Search in sources :

Example 26 with BrokerNode

use of com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode 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 27 with BrokerNode

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

the class BrokerMonitorPart method performRequest.

/**
	 * @see org.eclipse.gef.editparts.AbstractEditPart#performRequest(org.eclipse.gef.Request)
	 * @param req Request
	 */
public void performRequest(Request req) {
    if (req.getType() == RequestConstants.REQ_OPEN) {
        BrokerNode bn = (BrokerNode) getModel();
        String brokerName = bn.getBrokerName();
        HostNode hn = bn.getParent();
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (window == null) {
            return;
        }
        IWorkbenchPage page = window.getActivePage();
        if (page == null) {
            return;
        }
        String secondaryId = new StringBuffer(brokerName + "@" + hn.getUserName()).append("&").append(hn.getIp()).append("&").append(hn.getPort()).toString();
        IViewReference viewReference = page.findViewReference(BrokerDashboardViewPart.ID, secondaryId);
        if (viewReference == null) {
            try {
                IViewPart viewPart = page.showView(BrokerDashboardViewPart.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
                ((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
            } catch (PartInitException ex) {
                viewReference = null;
            }
        } else {
            IViewPart viewPart = viewReference.getView(false);
            window.getActivePage().bringToTop(viewPart);
            ((BrokerDashboardViewPart) viewPart).init((BrokerNode) getModel());
        }
    }
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) BrokerDashboardViewPart(com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerDashboardViewPart) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

Example 28 with BrokerNode

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

the class BrokerMonitorPart method createFigure.

/**
	 * get a database monitor figure.
	 * 
	 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
	 * @return a database figure
	 */
protected IFigure createFigure() {
    BrokerMonitorFigure figure = new BrokerMonitorFigure();
    BrokerNode broker = (BrokerNode) getModel();
    setMode2View(figure, broker);
    HostNode hostNode = broker.getParent();
    figure.setHint(new StringBuffer(" ").append(broker.getBrokerName()).append("@").append(hostNode.getIp()).append(":").append(hostNode.getPort()).append(" ").toString());
    return figure;
}
Also used : BrokerNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode) BrokerMonitorFigure(com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerMonitorFigure) HostNode(com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)

Aggregations

BrokerNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerNode)28 DatabaseNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.DatabaseNode)14 HostNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.HostNode)12 BrokerMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.BrokerMonitorPart)8 Dashboard (com.cubrid.cubridmanager.ui.mondashboard.editor.model.Dashboard)7 BrokerDBListNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.BrokerDBListNode)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 ClientNode (com.cubrid.cubridmanager.ui.mondashboard.editor.model.ClientNode)5 DashboardPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DashboardPart)4 Point (org.eclipse.draw2d.geometry.Point)4 DatabaseMonitorPart (com.cubrid.cubridmanager.ui.mondashboard.editor.parts.DatabaseMonitorPart)3 ArrayList (java.util.ArrayList)3 BrokerInfo (com.cubrid.cubridmanager.core.broker.model.BrokerInfo)2 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)2 BrokerDashboardViewPart (com.cubrid.cubridmanager.ui.mondashboard.editor.BrokerDashboardViewPart)2 BrokerMonitorFigure (com.cubrid.cubridmanager.ui.mondashboard.editor.figure.BrokerMonitorFigure)2 HashMap (java.util.HashMap)2 CMWizardDialog (com.cubrid.common.ui.spi.dialog.CMWizardDialog)1 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1