Search in sources :

Example 1 with MonitorType

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

the class AddMonitorInstanceDlg method createDialogArea.

/**
	 * Creates and returns the contents of the upper part of this dialog (above
	 * the button bar).
	 * 
	 * @param parent The parent composite to contain the dialog area
	 * @return the dialog area control
	 */
protected Control createDialogArea(Composite parent) {
    initial();
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite comp = new Composite(parentComp, SWT.NO_FOCUS);
    GridLayout layout = new GridLayout();
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    Composite typeComp = new Composite(comp, SWT.NONE);
    typeComp.setLayout(new GridLayout(4, false));
    typeComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Label typeLbl = new Label(typeComp, SWT.NONE);
    typeLbl.setText(Messages.addMonInsDlgTypeLbl);
    typeCombo = new Combo(typeComp, SWT.READ_ONLY);
    final GridData gdContentTxt = new GridData(SWT.FILL, SWT.CENTER, true, false);
    typeCombo.setLayoutData(gdContentTxt);
    typeCombo.setItems(monitorTypes);
    Label nodeLbl = new Label(typeComp, SWT.NONE);
    nodeLbl.setText(Messages.addMonInsDlgNodeName);
    nodeTxt = new Text(typeComp, SWT.BORDER);
    nodeTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (monData == null) {
        typeCombo.select(0);
    } else {
        MonitorType monitorType = monData.getMonitorType();
        typeCombo.setText(monitorType.toString());
        nodeTxt.setEnabled(false);
        String noteLabel = selection.getLabel();
        nodeTxt.setText(noteLabel);
    }
    nodeTxt.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent ex) {
            if (ValidateUtil.isValidDBName(nodeTxt.getText())) {
                //using db name rule
                isOkenable[0] = true;
            } else {
                isOkenable[0] = false;
            }
            enableOk();
        }
    });
    typeCombo.addSelectionListener(new TypeSelectionAdapter());
    final CTabFolder folder = new CTabFolder(comp, SWT.BORDER);
    folder.setLayout(new GridLayout());
    GridData gdTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
    folder.setLayoutData(gdTabFolder);
    folder.setSimple(false);
    TreeMap<String, ShowSetting> settingMap = new TreeMap<String, ShowSetting>();
    chartSettingDlg = new ChartSettingDlg(null);
    chartSettingDlg.setFolder(folder);
    chartSettingDlg.setShowTitlteContent(true);
    String historyFileName = hostAddress + "_" + monPort + HistoryComposite.HISTORY_SUFFIX;
    if (typeCombo.getSelectionIndex() == 0) {
        historyFileName = HistoryComposite.BROKER_HISTORY_FILE_PREFIX + historyFileName;
    } else if (typeCombo.getSelectionIndex() == 1) {
        historyFileName = HistoryComposite.DB_HISTORY_FILE_PREFIX + historyFileName;
    }
    chartSettingDlg.setHistoryFileName(historyFileName);
    if (monData == null) {
        BrokerDiagData brokerDiagData = new BrokerDiagData();
        TreeMap<String, String> map = convertMapKey(brokerDiagData.getDiagStatusResultMap());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            ShowSetting showSetting = new ShowSetting();
            ShowSettingMatching.match(key, showSetting, MonitorType.BROKER, isNewBrokerDiag);
            settingMap.put(key, showSetting);
        }
        IPath historyPath = CubridManagerCorePlugin.getDefault().getStateLocation();
        chartSettingDlg.setTitleName(defaultMonitorTtl[0]);
        String sHistoryPath = historyPath.toOSString() + File.separator + historyFileName;
        chartSettingDlg.setHistoryPath(sHistoryPath);
    } else {
        //title
        String titleName = monData.getTitleName();
        String titleBgColor = monData.getTitleBgColor();
        String titleFontName = monData.getTitleFontName();
        int titleFontSize = monData.getTitleFontSize();
        String titleFontColor = monData.getTitleFontColor();
        chartSettingDlg.setTitleName(titleName);
        chartSettingDlg.setTtlBgColor(titleBgColor);
        chartSettingDlg.setTtlFontName(titleFontName);
        chartSettingDlg.setTtlFontSize(titleFontSize);
        chartSettingDlg.setTtlFontColor(titleFontColor);
        //plot
        String plotBgColor = monData.getPlotBgColor();
        String plotDateAxisColor = monData.getPlotDateAxisColor();
        String plotDomainGridColor = monData.getPlotDomainGridColor();
        String plotNumberAxisColor = monData.getPlotNumberAxisColor();
        String plotRangGridColor = monData.getPlotRangGridColor();
        chartSettingDlg.setPlotBgColor(plotBgColor);
        chartSettingDlg.setPlotDateAxisColor(plotDateAxisColor);
        chartSettingDlg.setPlotDomainGridColor(plotDomainGridColor);
        chartSettingDlg.setPlotNumberAxisColor(plotNumberAxisColor);
        chartSettingDlg.setPlotRangGridColor(plotRangGridColor);
        //series
        settingMap = monData.getSettingMap();
        //history path 
        String historyPath = monData.getHistoryPath();
        chartSettingDlg.setHistoryPath(historyPath);
    }
    chartSettingDlg.setSettingMap(settingMap);
    chartSettingDlg.createTtlTab();
    chartSettingDlg.createPlotItem();
    chartSettingDlg.createSeriesItemByDefault();
    chartSettingDlg.createHistoryPathItem();
    folder.setSelection(0);
    saveBtn = new Button(comp, SWT.CHECK);
    saveBtn.setText(Messages.btnSaveMonitorSetting);
    setTitle(Messages.addMonInsDlgTtl);
    setMessage(Messages.addMonInsDlgMsg);
    return comp;
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) MonitorType(com.cubrid.cubridmanager.ui.monitoring.editor.internal.MonitorType) ModifyListener(org.eclipse.swt.events.ModifyListener) IPath(org.eclipse.core.runtime.IPath) Label(org.eclipse.swt.widgets.Label) BrokerDiagData(com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) TreeMap(java.util.TreeMap) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ChartSettingDlg(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartSettingDlg) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) Map(java.util.Map) TreeMap(java.util.TreeMap)

Aggregations

BrokerDiagData (com.cubrid.cubridmanager.core.monitoring.model.BrokerDiagData)1 ChartSettingDlg (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartSettingDlg)1 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)1 MonitorType (com.cubrid.cubridmanager.ui.monitoring.editor.internal.MonitorType)1 ShowSetting (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 IPath (org.eclipse.core.runtime.IPath)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1