use of com.cubrid.cubridmanager.ui.monstatistic.editor.internal.MonitorStatisticChart 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.ui.monstatistic.editor.internal.MonitorStatisticChart 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.ui.monstatistic.editor.internal.MonitorStatisticChart 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));
}
use of com.cubrid.cubridmanager.ui.monstatistic.editor.internal.MonitorStatisticChart in project cubrid-manager by CUBRID.
the class MonitorStatisticDetailViewPart method reloadChart.
public void reloadChart() {
if (statisticDataList == null || statisticDataList.size() == 0) {
return;
}
if (rootComp.getChildren() != null) {
for (Control ctrl : rootComp.getChildren()) {
ctrl.dispose();
}
}
chart = new MonitorStatisticChart(rootComp, true, isMultiHost);
chart.setStatisticDataList(statisticDataList);
chart.loadChart();
createInfoGroup(rootComp);
rootComp.layout();
}
use of com.cubrid.cubridmanager.ui.monstatistic.editor.internal.MonitorStatisticChart in project cubrid-manager by CUBRID.
the class MonitorStatisticEditor method updateStatisticItem.
public void updateStatisticItem(StatisticChartItem item) {
if (item == null || item.getSeries() == -1) {
return;
}
StatisticChartItem oldItem = statisticItemList.get(item.getSeries());
MonitorStatisticChart chart = chartList.get(oldItem.getSeries());
statisticDataMap.remove(oldItem);
chartList.remove(oldItem);
statisticItemList.set(item.getSeries(), item);
chartList.set(oldItem.getSeries(), chart);
Map<StatisticChartItem, List<StatisticData>> dataMap = refreshData(item);
chart.refreshChart(dataMap.get(item));
chart.updateGroupName(item.getName());
statisticDataMap.put(item, dataMap.get(item));
monitorStatisticPersistManager.saveStatistic();
}
Aggregations