use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method openEditStatisticItemDialog.
public void openEditStatisticItemDialog() {
if (isMultiHost) {
EditMultiHostStatisticItemDialog dialog = new EditMultiHostStatisticItemDialog(getSite().getShell(), this);
if (dialog.open() == Dialog.OK) {
StatisticChartItem item = dialog.getStatisticChartItem();
item.setSeries(statisticItemList.size());
addNewDataChart(item);
monitorStatisticPersistManager.saveStatistic();
}
} else {
EditSingleHostStatisticItemDialog dialog = new EditSingleHostStatisticItemDialog(getSite().getShell(), this, serverInfo);
if (dialog.open() == Dialog.OK) {
StatisticChartItem item = dialog.getStatisticChartItem();
item.setSeries(statisticItemList.size());
addNewDataChart(item);
monitorStatisticPersistManager.saveStatistic();
}
}
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method refreshData.
private Map<StatisticChartItem, List<StatisticData>> refreshData(List<StatisticChartItem> itemList) {
if (itemList == null) {
return null;
}
LoadMonitorStatisticDataProgress progress;
if (isMultiHost) {
progress = new LoadMonitorStatisticDataProgress();
} else {
progress = new LoadMonitorStatisticDataProgress(serverInfo);
}
progress.setStatisticItemList(itemList);
progress.loadMonitorStatisticData();
/*[TOOLS-3742] when invalid token or connect server failure, give out error message*/
if (!isMultiHost && progress.getErrorMsg() != null) {
CommonUITool.openErrorBox(progress.getErrorMsg());
}
Map<StatisticChartItem, List<StatisticData>> dataMap = progress.getStatisticDataMap();
return dataMap;
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method addNewDataChart.
private void addNewDataChart(StatisticChartItem item) {
if (item == null) {
return;
}
statisticItemList.add(item);
Composite compNewChart;
Composite compAddItem = compList.get(addItemCompIndex);
if (addItemCompIndex < CHART_PER_LINE - 1) {
compNewChart = compList.get(addItemCompIndex + 1);
for (Control ctrl : compNewChart.getChildren()) {
ctrl.dispose();
}
} else {
compNewChart = new Composite(chartAreaRootComp, SWT.NONE);
compList.add(compNewChart);
}
//initial layout data of composite
{
compNewChart.setLayout(new GridLayout(1, false));
GridData gdCompNewChart = new GridData(GridData.FILL_HORIZONTAL);
gdCompNewChart.widthHint = SIZE_WIDTH;
gdCompNewChart.heightHint = SIZE_HEIGHT;
compNewChart.setLayoutData(gdCompNewChart);
compNewChart.setBackground(COLOR_CHART_AREA_BACKGROUND);
}
//change the position of add item
compList.set(addItemCompIndex, compNewChart);
compList.set(addItemCompIndex + 1, compAddItem);
compNewChart.moveAbove(compAddItem);
addItemCompIndex++;
//draw the chart
Map<StatisticChartItem, List<StatisticData>> dataMap = refreshData(item);
MonitorStatisticChart chart = new MonitorStatisticChart(compNewChart, false, isMultiHost);
chart.setEditor(this);
chart.setGroupName(item.getName());
chart.setStatisticDataList(dataMap.get(item));
chart.setEditMode(true);
chart.loadChart();
chart.setStatisticChartItem(item);
chartList.add(chart);
//update the scroll bar size
updateScrolledCompositeHeight();
compAddItem.layout();
compNewChart.layout();
chartAreaRootComp.layout();
scrolledComp.layout();
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method createDataChart.
private void createDataChart(Composite parent) {
if (statisticItemList == null) {
return;
}
for (StatisticChartItem item : statisticItemList) {
final Composite comp = new Composite(parent, SWT.NONE);
{
comp.setLayout(new GridLayout(1, false));
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.widthHint = SIZE_WIDTH;
gridData.heightHint = SIZE_HEIGHT;
comp.setLayoutData(gridData);
comp.setBackground(COLOR_CHART_AREA_BACKGROUND);
}
if (item == null) {
//TODO: deal with no chart item
continue;
}
MonitorStatisticChart chart = new MonitorStatisticChart(comp, false, isMultiHost);
chart.setEditor(this);
chart.setStatisticChartItem(item);
chart.setGroupName(item.getName());
chart.setStatisticDataList(statisticDataMap.get(item));
chart.setEditMode(false);
chart.loadChart();
chartList.add(chart);
compList.add(comp);
}
}
use of com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method refreshChartBySeries.
public void refreshChartBySeries(int series) {
StatisticChartItem chartItem = statisticItemList.get(series);
MonitorStatisticChart chart = chartList.get(series);
if (chartItem == null || chart == null) {
return;
}
Map<StatisticChartItem, List<StatisticData>> dataMap = refreshData(chartItem);
chart.refreshChart(dataMap.get(chartItem));
statisticDataMap.put(chartItem, dataMap.get(chartItem));
}
Aggregations