Search in sources :

Example 1 with BrokerDBListNode

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

the class BrokerDBListMonitorPart method createFigure.

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

Example 2 with BrokerDBListNode

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

the class BrokerConnectionPart method refreshVisuals.

/**
	 * refresh Visuals
	 */
protected void refreshVisuals() {
    PolylineConnection conn = (PolylineConnection) getFigure();
    HANodeConnection model = (HANodeConnection) getModel();
    //BrokerDBListNode linewith should be 1.
    if (model.getTarget() instanceof BrokerDBListNode) {
        conn.setLineWidth(1);
    }
    BrokerNode broker = null;
    if (model.getSource() instanceof BrokerNode) {
        broker = (BrokerNode) model.getSource();
    } else if (model.getTarget() instanceof BrokerNode) {
        broker = (BrokerNode) model.getTarget();
    }
    if (broker != null) {
        if (broker.getParent().isConnected()) {
            conn.setForegroundColor(CONNECTION_DEFAULT_COLOR);
        } else {
            conn.setForegroundColor(AbstractMonitorFigure.DISABLED_COLOR);
        }
    }
    super.refreshVisuals();
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) HANodeConnection(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANodeConnection) PolylineConnection(org.eclipse.draw2d.PolylineConnection)

Example 3 with BrokerDBListNode

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

the class BrokerDBListMonitorPart 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() {
    BrokerDBListFigure figure = (BrokerDBListFigure) this.getFigure();
    BrokerDBListNode dn = (BrokerDBListNode) this.getModel();
    figure.setName(dn.getName());
    //Remove defined dabatases.
    List<String> dbList = new ArrayList<String>();
    dbList.addAll(dn.getDbList());
    Dashboard dashboard = (Dashboard) getParent().getModel();
    for (DatabaseNode dbNode : dashboard.getAllDatabaseNode()) {
        String dbName = dbNode.getDbName() + "@" + dbNode.getParent().getIp();
        if (dn.getDbList().contains(dbName)) {
            dbList.remove(dbName);
        }
    }
    figure.setDBList(dbList);
    BrokerNode broker = dn.getBrokerNode();
    figure.setHostConnected(broker.getParent().isConnected());
    super.refreshVisuals();
}
Also used : BrokerDBListFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerDBListFigure) BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) DatabaseNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) ArrayList(java.util.ArrayList) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)

Example 4 with BrokerDBListNode

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

the class ShowBrokerDabaseAction 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();
    BrokerDBListNode brokerDBListNode = db.getBrokerDBListNodeByBroker(model);
    if (isChecked()) {
        if (null == brokerDBListNode) {
            brokerDBListNode = new BrokerDBListNode();
            brokerDBListNode.setBrokerNode(model);
            db.addBrokerDBListNode(brokerDBListNode);
        }
        brokerDBListNode.setVisible(true);
    } else {
        brokerDBListNode.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) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 5 with BrokerDBListNode

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

the class ShowBrokerDabaseAction 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();
    BrokerDBListNode brokerDBListNode = db.getBrokerDBListNodeByBroker(model);
    setChecked(null != brokerDBListNode && brokerDBListNode.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) BrokerDBListNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode) Dashboard(com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)7 BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)6 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)5 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)3 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)2 BrokerDBListFigure (com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerDBListFigure)2 ClientNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)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 HANodeConnection (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HANodeConnection)1 ArrayList (java.util.ArrayList)1 PolylineConnection (org.eclipse.draw2d.PolylineConnection)1