Search in sources :

Example 1 with StatisticChartItem

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();
        }
    }
}
Also used : EditSingleHostStatisticItemDialog(com.cubrid.cubridmanager.ui.monstatistic.dialog.EditSingleHostStatisticItemDialog) EditMultiHostStatisticItemDialog(com.cubrid.cubridmanager.ui.monstatistic.dialog.EditMultiHostStatisticItemDialog) StatisticChartItem(com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem)

Example 2 with StatisticChartItem

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;
}
Also used : LoadMonitorStatisticDataProgress(com.cubrid.cubridmanager.ui.monstatistic.progress.LoadMonitorStatisticDataProgress) List(java.util.List) ArrayList(java.util.ArrayList) StatisticChartItem(com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem)

Example 3 with StatisticChartItem

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();
}
Also used : Control(org.eclipse.swt.widgets.Control) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) List(java.util.List) ArrayList(java.util.ArrayList) StatisticChartItem(com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem) MonitorStatisticChart(com.cubrid.cubridmanager.ui.monstatistic.editor.internal.MonitorStatisticChart)

Example 4 with StatisticChartItem

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);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) StatisticChartItem(com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem) MonitorStatisticChart(com.cubrid.cubridmanager.ui.monstatistic.editor.internal.MonitorStatisticChart)

Example 5 with StatisticChartItem

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));
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) StatisticChartItem(com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem) MonitorStatisticChart(com.cubrid.cubridmanager.ui.monstatistic.editor.internal.MonitorStatisticChart)

Aggregations

StatisticChartItem (com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartItem)11 ArrayList (java.util.ArrayList)7 MonitorStatisticChart (com.cubrid.cubridmanager.ui.monstatistic.editor.internal.MonitorStatisticChart)5 List (java.util.List)5 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)4 Composite (org.eclipse.swt.widgets.Composite)4 GridData (org.eclipse.swt.layout.GridData)3 MultiHostChartItem (com.cubrid.cubridmanager.core.monstatistic.model.MultiHostChartItem)2 SingleHostChartItem (com.cubrid.cubridmanager.core.monstatistic.model.SingleHostChartItem)2 StatisticChartHost (com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartHost)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 MonitorStatistic (com.cubrid.common.ui.spi.model.MonitorStatistic)1 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 MonitoringTask (com.cubrid.cubridmanager.core.common.task.MonitoringTask)1 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)1 XMLMemento (com.cubrid.cubridmanager.core.common.xml.XMLMemento)1 StatisticData (com.cubrid.cubridmanager.core.monstatistic.model.StatisticData)1 GetMonitorStatisticDataTask (com.cubrid.cubridmanager.core.monstatistic.task.GetMonitorStatisticDataTask)1 EditMultiHostStatisticItemDialog (com.cubrid.cubridmanager.ui.monstatistic.dialog.EditMultiHostStatisticItemDialog)1 EditSingleHostStatisticItemDialog (com.cubrid.cubridmanager.ui.monstatistic.dialog.EditSingleHostStatisticItemDialog)1