Search in sources :

Example 1 with ClientNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.

the class ClientMonitorPart method refreshVisuals.

/**
	 * Refreshes this EditPart's <i>visuals</i>. This method is called by
	 * {@link #refresh()}, and may also be called in response to notifications
	 * from the model.
	 */
protected void refreshVisuals() {
    ClientFigure figure = (ClientFigure) this.getFigure();
    ClientNode clientNode = (ClientNode) this.getModel();
    figure.setName(clientNode.getName());
    figure.setClients(clientNode.getClientList());
    BrokerNode broker = clientNode.getBrokerNode();
    if (broker != null) {
        figure.setHostConnected(broker.getParent().isConnected());
    }
    super.refreshVisuals();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) ClientFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.ClientFigure) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)

Example 2 with ClientNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.

the class ClientMonitorPart method createFigure.

/**
	 * get a database monitor figure.
	 * 
	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
	 * @return a database figure
	 */
protected IFigure createFigure() {
    ClientFigure figure = new ClientFigure();
    ClientNode modelNode = (ClientNode) getModel();
    figure.setName(modelNode.getName());
    return figure;
}
Also used : ClientFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.ClientFigure) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)

Example 3 with ClientNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.

the class ShowBrokerClientAction method run.

/**
	 * Create a new figure in dashboard.
	 * 
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    ClientNode clientNode = db.getClientNodeByBroker(model);
    if (this.isChecked()) {
        if (null == clientNode) {
            clientNode = new ClientNode();
            clientNode.setBrokerNode(model);
            db.addClientNode(clientNode);
        }
        clientNode.setVisible(true);
    } else {
        clientNode.setVisible(false);
    }
    db.refresh();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 4 with ClientNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.

the class ShowBrokerClientAction method isSupported.

/**
	 * Always support
	 * 
	 * @see com.cubrid.common.ui.spi.action.ISelectionAction#isSupported(java.lang.Object)
	 * @param obj Object
	 * @return boolean support:true;not support:false;
	 */
public boolean isSupported(Object obj) {
    IStructuredSelection selection = (IStructuredSelection) getSelection();
    if (!(selection.getFirstElement() instanceof BrokerMonitorPart)) {
        return false;
    }
    BrokerMonitorPart cmp = (BrokerMonitorPart) selection.getFirstElement();
    DashboardPart dp = (DashboardPart) cmp.getParent();
    Dashboard db = (Dashboard) dp.getModel();
    BrokerNode model = (BrokerNode) cmp.getModel();
    ClientNode clientNode = db.getClientNodeByBroker(model);
    setChecked(null != clientNode && clientNode.isVisible());
    return true;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart) DashboardPart(com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 5 with ClientNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode in project cubrid-manager by CUBRID.

the class MonitorDashboardPersistManager method saveDashboard.

/**
	 * 
	 * Save dash boards
	 * 
	 */
public void saveDashboard() {
    synchronized (this) {
        XMLMemento memento = XMLMemento.createWriteRoot("dashboards");
        Iterator<ICubridNode> iterator = monitorDashboardList.iterator();
        while (iterator.hasNext()) {
            ICubridNode node = (ICubridNode) iterator.next();
            if (node instanceof MonitorStatistic) {
                continue;
            }
            Dashboard dashboard = (Dashboard) node.getAdapter(Dashboard.class);
            IXMLMemento dashboardChild = memento.createChild("dashboard");
            dashboardChild.putString("name", node.getName());
            Iterator<HostNode> nodeIte = dashboard.getHostNodeList().iterator();
            while (nodeIte.hasNext()) {
                //save host node
                HostNode hostNode = nodeIte.next();
                IXMLMemento hostNodeChild = dashboardChild.createChild("host");
                hostNodeChild.putString("aliasname", hostNode.getName());
                hostNodeChild.putString("ip", hostNode.getIp());
                hostNodeChild.putString("port", hostNode.getPort());
                hostNodeChild.putString("username", hostNode.getUserName());
                hostNodeChild.putString("password", CipherUtils.encrypt(hostNode.getPassword()));
                hostNodeChild.putString("location", hostNode.getLocation().x + "," + hostNode.getLocation().y);
                hostNodeChild.putString("visible", hostNode.isVisible() ? "true" : "false");
                //save the database node list
                List<DatabaseNode> dbNodeList = hostNode.getDbNodeList();
                Iterator<DatabaseNode> dbNodeIte = dbNodeList.iterator();
                while (dbNodeIte.hasNext()) {
                    DatabaseNode dbNode = (DatabaseNode) dbNodeIte.next();
                    IXMLMemento databaseNodeChild = hostNodeChild.createChild("database");
                    databaseNodeChild.putString("aliasname", dbNode.getName());
                    databaseNodeChild.putString("dbname", dbNode.getDbName());
                    databaseNodeChild.putString("username", dbNode.getDbUser());
                    databaseNodeChild.putString("password", CipherUtils.encrypt(dbNode.getDbPassword()));
                    databaseNodeChild.putString("location", dbNode.getLocation().x + "," + dbNode.getLocation().y);
                }
                //save broker node list
                List<BrokerNode> brokerNodeList = hostNode.getBrokerNodeList();
                Iterator<BrokerNode> brokerNodeIte = brokerNodeList.iterator();
                while (brokerNodeIte.hasNext()) {
                    BrokerNode brokerNode = (BrokerNode) brokerNodeIte.next();
                    IXMLMemento brokerNodeChild = hostNodeChild.createChild("broker");
                    brokerNodeChild.putString("aliasname", brokerNode.getName());
                    brokerNodeChild.putString("brokername", brokerNode.getBrokerName());
                    brokerNodeChild.putString("location", brokerNode.getLocation().x + "," + brokerNode.getLocation().y);
                    //save the client IP list
                    ClientNode ipListNode = dashboard.getClientNodeByBroker(brokerNode);
                    Point point = null;
                    String clientIpName = null;
                    if (ipListNode == null) {
                        brokerNodeChild.putString("show_ip_list", "false");
                        point = brokerNode.getClientsLocation();
                    } else {
                        brokerNodeChild.putString("show_ip_list", ipListNode.isVisible() ? "true" : "false");
                        point = ipListNode.getLocation();
                        clientIpName = ipListNode.getName();
                    }
                    if (point != null) {
                        brokerNodeChild.putString("client_ip_location", point.x + "," + point.y);
                    }
                    if (clientIpName != null) {
                        brokerNodeChild.putString("client_ip_name", clientIpName);
                    }
                    //save the database list
                    BrokerDBListNode dbListNode = dashboard.getBrokerDBListNodeByBroker(brokerNode);
                    String clientDbName = null;
                    if (dbListNode == null) {
                        brokerNodeChild.putString("show_db_list", "false");
                        point = brokerNode.getDatabasesLocation();
                    } else {
                        brokerNodeChild.putString("show_db_list", dbListNode.isVisible() ? "true" : "false");
                        point = dbListNode.getLocation();
                        clientDbName = dbListNode.getName();
                    }
                    if (point != null) {
                        brokerNodeChild.putString("client_db_location", point.x + "," + point.y);
                    }
                    if (clientDbName != null) {
                        brokerNodeChild.putString("client_db_name", clientDbName);
                    }
                }
            }
        }
        PersistUtils.saveXMLMemento(CubridManagerUIPlugin.PLUGIN_ID, MONITOR_DASHBOARD_XML_CONTENT, memento);
    }
}
Also used : IXMLMemento(com.cubrid.cubridmanager.core.common.xml.IXMLMemento) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) ClientNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) Point(org.eclipse.draw2d.geometry.Point) BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) XMLMemento(com.cubrid.cubridmanager.core.common.xml.XMLMemento) IXMLMemento(com.cubrid.cubridmanager.core.common.xml.IXMLMemento) MonitorStatistic(com.cubrid.common.ui.spi.model.MonitorStatistic)

Aggregations

ClientNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)6 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)5 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)4 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)2 ClientFigure (com.cubrid.cubridmanager.ui.mondashboard.editor.figure.ClientFigure)2 BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)2 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)2 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)2 BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)2 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)2 Point (org.eclipse.draw2d.geometry.Point)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 MonitorStatistic (com.cubrid.common.ui.spi.model.MonitorStatistic)1 XMLMemento (com.cubrid.cubridmanager.core.common.xml.XMLMemento)1