use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartSettingDlg in project cubrid-manager by CUBRID.
the class HostDashboardHistoryViewPart method fireChartSetting.
/**
* This method is responsible for preparing data for ChartSettingDlg and
* dealing with the results of chartSettingDlg
*
*/
private void fireChartSetting() {
ChartSettingDlg chartSettingDlg = new ChartSettingDlg(composite.getShell());
chartSettingDlg.setHasTitlSetting(false);
chartSettingDlg.setHasHistoryPath(true);
chartSettingDlg.setHasAxisSetting(false);
chartSettingDlg.setHasChartSelection(true);
// plot appearance
XYPlot cpuSeriesPlot = cpuChart.getSeriesChart().getXYPlot();
String plotBgColor = trimPaintColor(cpuSeriesPlot.getBackgroundPaint().toString());
String plotDomainGridColor = trimPaintColor(cpuSeriesPlot.getDomainGridlinePaint().toString());
String plotRangGridColor = trimPaintColor(cpuSeriesPlot.getRangeGridlinePaint().toString());
chartSettingDlg.setPlotBgColor(plotBgColor);
chartSettingDlg.setPlotDomainGridColor(plotDomainGridColor);
chartSettingDlg.setPlotRangGridColor(plotRangGridColor);
// series
if (brokerChartPart == null) {
chartSettingDlg.setHasSeriesItemSetting(false);
} else {
chartSettingDlg.setHasSeriesItemSetting(true);
chartSettingDlg.setSettingMap(brokerChartPart.getSettingMap());
}
// history path
chartSettingDlg.setHistoryPath(historyPath);
chartSettingDlg.setHistoryFileName(historyFileName);
// chart selection
chartSettingDlg.setChartSelectionLst(getSelectedCharts());
if (chartSettingDlg.open() == Dialog.OK) {
// plot appearance
plotBgColor = chartSettingDlg.getPlotBgColor();
plotDomainGridColor = chartSettingDlg.getPlotDomainGridColor();
plotRangGridColor = chartSettingDlg.getPlotRangGridColor();
XYPlot memorySeriesPlot = (XYPlot) memoryChart.getSeriesChart().getPlot();
XYPlot iowaitSeriesPlot = (XYPlot) iowaitChart.getSeriesChart().getPlot();
// history path
String newHistoryPath = chartSettingDlg.getHistoryPath();
isChangedHistoryPath = historyPath.equals(newHistoryPath) ? false : true;
if (isChangedHistoryPath) {
historyPath = newHistoryPath;
historyFileHelp.setHistoryPath(historyPath);
}
int red = 0;
int green = 0;
int blue = 0;
//background
red = getColorElem(plotBgColor, 0);
green = getColorElem(plotBgColor, 1);
blue = getColorElem(plotBgColor, 2);
Color bgColor = new Color(red, green, blue);
//cpu chart
cpuSeriesPlot.setBackgroundPaint(bgColor);
//memoryChart
memorySeriesPlot.setBackgroundPaint(bgColor);
//iowaitChart
iowaitSeriesPlot.setBackgroundPaint(bgColor);
//DomainGridColor
//broker Chart
red = getColorElem(plotDomainGridColor, 0);
green = getColorElem(plotDomainGridColor, 1);
blue = getColorElem(plotDomainGridColor, 2);
Color domainGridlineColor = new Color(red, green, blue);
//cpu chart
cpuSeriesPlot.setDomainGridlinePaint(domainGridlineColor);
//memoryChart
memorySeriesPlot.setDomainGridlinePaint(domainGridlineColor);
//delayChart
iowaitSeriesPlot.setDomainGridlinePaint(domainGridlineColor);
//RangeGridColor
red = getColorElem(plotRangGridColor, 0);
green = getColorElem(plotRangGridColor, 1);
blue = getColorElem(plotRangGridColor, 2);
Color rangeGridColor = new Color(red, green, blue);
//cpu chart
cpuSeriesPlot.setRangeGridlinePaint(rangeGridColor);
//memoryChart
memorySeriesPlot.setRangeGridlinePaint(rangeGridColor);
//delayChart
iowaitSeriesPlot.setRangeGridlinePaint(rangeGridColor);
//broker Chart;
if (brokerChartPart != null) {
XYPlot brokerPlot = brokerChartPart.getChart().getXYPlot();
brokerPlot.setBackgroundPaint(bgColor);
brokerPlot.setDomainGridlinePaint(domainGridlineColor);
brokerPlot.setRangeGridlinePaint(rangeGridColor);
brokerChartPart.setSettingMap(chartSettingDlg.getSettingMap());
brokerChartPart.updateSettingSeries();
}
//chart Selection
fireChartSelection(chartSettingDlg.getChartSelectionLst());
}
}
use of com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartSettingDlg 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;
}
Aggregations