Search in sources :

Example 1 with StatusMonInstanceData

use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.

the class EditMonitorInstanceAction method run.

/**
	 * Override the run method in order to open an instance of status monitor
	 * dialog
	 * 
	 */
public void run() {
    Object[] obj = this.getSelectedObj();
    ICubridNode selection = (ICubridNode) obj[0];
    String selectLbl = selection.getLabel();
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    String prefix = QueryOptions.getPrefix(serverInfo);
    String selectionKey = prefix + QueryOptions.MONITOR_FOLDER_NAME + selectLbl;
    CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
    StatusMonInstanceData monData = instance.getData(selectionKey);
    AddMonitorInstanceDlg addMonitorInstanceDlg = new AddMonitorInstanceDlg(getShell());
    addMonitorInstanceDlg.setSelection(selection);
    addMonitorInstanceDlg.setMonData(monData);
    addMonitorInstanceDlg.open();
}
Also used : CubridStatusMonitorInstance(com.cubrid.cubridmanager.ui.monitoring.editor.internal.CubridStatusMonitorInstance) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) StatusMonInstanceData(com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) AddMonitorInstanceDlg(com.cubrid.cubridmanager.ui.monitoring.dialog.AddMonitorInstanceDlg)

Example 2 with StatusMonInstanceData

use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.

the class CubridStatusMonitorFolderLoader method createTempStatusNode.

/**
	 * Create temp status node
	 * 
	 * @param parent the parent node
	 */
private void createTempStatusNode(ICubridNode parent) {
    CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
    ServerInfo serverInfo = parent.getServer().getServerInfo();
    String[] keys = QueryOptions.getAllStatusMonitorKey(serverInfo);
    for (String key : keys) {
        StatusMonInstanceData data = instance.loadSetting(key);
        instance.addData(key, data);
    }
    Map<String, StatusMonInstanceData> map = instance.getDataMap();
    for (Map.Entry<String, StatusMonInstanceData> entry : map.entrySet()) {
        String key = entry.getKey();
        String prefix = QueryOptions.getPrefix(serverInfo);
        if (!key.startsWith(prefix)) {
            continue;
        }
        String label = key.substring(key.lastIndexOf(".") + 1);
        StatusMonInstanceData monInstaceData = entry.getValue();
        String statusId = parent.getId() + NODE_SEPARATOR + label;
        ICubridNode stautsNode = new DefaultCubridNode(statusId, label, "icons/navigator/status_item.png");
        stautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
        stautsNode.setModelObj(monInstaceData);
        String viewId = "";
        switch(monInstaceData.getMonitorType()) {
            case BROKER:
                viewId = BrokerStatusMonitorViewPart.ID;
                break;
            case DATABASE:
                viewId = DbStatusDumpMonitorViewPart.ID;
                break;
            default:
        }
        if ("".equals(viewId)) {
            return;
        }
        stautsNode.setViewId(viewId);
        stautsNode.setContainer(false);
        parent.addChild(stautsNode);
    }
}
Also used : DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) CubridStatusMonitorInstance(com.cubrid.cubridmanager.ui.monitoring.editor.internal.CubridStatusMonitorInstance) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) StatusMonInstanceData(com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) Map(java.util.Map)

Example 3 with StatusMonInstanceData

use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.

the class CubridMonitorFolderLoader method createTempStatusNode.

/**
	 * Create temp status node
	 *
	 * @param parent the parent node
	 */
private void createTempStatusNode(ICubridNode parent) {
    CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
    ServerInfo serverInfo = parent.getServer().getServerInfo();
    String[] keys = QueryOptions.getAllStatusMonitorKey(serverInfo);
    for (String key : keys) {
        StatusMonInstanceData data = instance.loadSetting(key);
        instance.addData(key, data);
    }
    Map<String, StatusMonInstanceData> map = instance.getDataMap();
    for (Map.Entry<String, StatusMonInstanceData> entry : map.entrySet()) {
        String key = entry.getKey();
        String prefix = QueryOptions.getPrefix(serverInfo);
        if (!key.startsWith(prefix)) {
            continue;
        }
        String label = key.substring(key.lastIndexOf(".") + 1);
        StatusMonInstanceData monInstaceData = entry.getValue();
        String statusId = parent.getId() + NODE_SEPARATOR + label;
        ICubridNode stautsNode = new DefaultCubridNode(statusId, label, "icons/navigator/status_item.png");
        stautsNode.setType(CubridNodeType.STATUS_MONITOR_TEMPLATE);
        stautsNode.setModelObj(monInstaceData);
        String viewId = "";
        switch(monInstaceData.getMonitorType()) {
            case BROKER:
                viewId = BrokerStatusMonitorViewPart.ID;
                break;
            case DATABASE:
                viewId = DbStatusDumpMonitorViewPart.ID;
                break;
            default:
        }
        if ("".equals(viewId)) {
            return;
        }
        stautsNode.setViewId(viewId);
        stautsNode.setContainer(false);
        parent.addChild(stautsNode);
    }
}
Also used : DefaultCubridNode(com.cubrid.common.ui.spi.model.DefaultCubridNode) CubridStatusMonitorInstance(com.cubrid.cubridmanager.ui.monitoring.editor.internal.CubridStatusMonitorInstance) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) StatusMonInstanceData(com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) Map(java.util.Map)

Example 4 with StatusMonInstanceData

use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData in project cubrid-manager by CUBRID.

the class AddMonitorInstanceDlg method okPressed.

/**
	 * When press "ok" button, call it.
	 */
public void okPressed() {
    chartSettingDlg.performGetData();
    StatusMonInstanceData data = new StatusMonInstanceData();
    //type
    String type = typeCombo.getText().trim();
    if (type.equals(MonitorType.BROKER.toString())) {
        data.setMonitorType(MonitorType.BROKER);
    } else if (type.equals(MonitorType.DATABASE.toString())) {
        data.setMonitorType(MonitorType.DATABASE);
    }
    //title
    data.setTitleName(chartSettingDlg.getTitleName());
    data.setTitleBgColor(chartSettingDlg.getTtlBgColor());
    data.setTitleFontName(chartSettingDlg.getTtlFontName());
    data.setTitleFontSize(chartSettingDlg.getTtlFontSize());
    data.setTitleFontColor(chartSettingDlg.getTtlFontColor());
    //plot
    data.setPlotBgColor(chartSettingDlg.getPlotBgColor());
    data.setPlotDomainGridColor(chartSettingDlg.getPlotDomainGridColor());
    data.setPlotRangGridColor(chartSettingDlg.getPlotRangGridColor());
    data.setPlotDateAxisColor(chartSettingDlg.getPlotDateAxisColor());
    data.setPlotNumberAxisColor(chartSettingDlg.getPlotNumberAxisColor());
    //series
    data.setSettingMap(chartSettingDlg.getSettingMap());
    //history path
    data.setHistoryPath(chartSettingDlg.getHistoryPath());
    //store the data
    CubridStatusMonitorInstance instance = CubridStatusMonitorInstance.getInstance();
    String nodeName = nodeTxt.getText().trim();
    String statusId = selection.getId();
    ServerInfo serverInfo = selection.getServer().getServerInfo();
    String prefix = QueryOptions.getPrefix(serverInfo);
    String selectionKey = prefix + QueryOptions.MONITOR_FOLDER_NAME + nodeName;
    if (statusId.endsWith(nodeName)) {
        instance.updateData(selectionKey, data);
        selection.setModelObj(data);
        String viewId = "";
        switch(data.getMonitorType()) {
            case BROKER:
                viewId = BrokerStatusMonitorViewPart.ID;
                break;
            case DATABASE:
                viewId = DbStatusDumpMonitorViewPart.ID;
                break;
            default:
        }
        selection.setViewId(viewId);
    } else {
        instance.addData(selectionKey, data);
    }
    //save button
    if (saveBtn.getSelection()) {
        instance.saveSetting(selectionKey);
    }
    super.okPressed();
}
Also used : CubridStatusMonitorInstance(com.cubrid.cubridmanager.ui.monitoring.editor.internal.CubridStatusMonitorInstance) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) StatusMonInstanceData(com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData)

Aggregations

ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)4 CubridStatusMonitorInstance (com.cubrid.cubridmanager.ui.monitoring.editor.internal.CubridStatusMonitorInstance)4 StatusMonInstanceData (com.cubrid.cubridmanager.ui.monitoring.editor.internal.StatusMonInstanceData)4 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)3 DefaultCubridNode (com.cubrid.common.ui.spi.model.DefaultCubridNode)2 Map (java.util.Map)2 AddMonitorInstanceDlg (com.cubrid.cubridmanager.ui.monitoring.dialog.AddMonitorInstanceDlg)1