Search in sources :

Example 1 with AddDashboardElementDlg

use of org.netxms.ui.eclipse.dashboard.dialogs.AddDashboardElementDlg in project netxms by netxms.

the class DashboardElements method addNewElement.

/**
 * Add new dashboard element
 */
private void addNewElement() {
    AddDashboardElementDlg dlg = new AddDashboardElementDlg(getShell());
    if (dlg.open() == Window.OK) {
        String config;
        switch(dlg.getElementType()) {
            case DashboardElement.BAR_CHART:
            case DashboardElement.PIE_CHART:
            case DashboardElement.TUBE_CHART:
                config = DashboardControl.DEFAULT_CHART_CONFIG;
                break;
            case DashboardElement.LINE_CHART:
                config = DashboardControl.DEFAULT_LINE_CHART_CONFIG;
                break;
            case DashboardElement.DIAL_CHART:
                config = DashboardControl.DEFAULT_DIAL_CHART_CONFIG;
                break;
            case DashboardElement.AVAILABLITY_CHART:
                config = DashboardControl.DEFAULT_AVAILABILITY_CHART_CONFIG;
                break;
            case DashboardElement.TABLE_BAR_CHART:
            case DashboardElement.TABLE_PIE_CHART:
            case DashboardElement.TABLE_TUBE_CHART:
                config = DashboardControl.DEFAULT_TABLE_CHART_CONFIG;
                break;
            case DashboardElement.LABEL:
                config = DashboardControl.DEFAULT_LABEL_CONFIG;
                break;
            case DashboardElement.ALARM_VIEWER:
            case DashboardElement.EVENT_MONITOR:
            case DashboardElement.SYSLOG_MONITOR:
            case DashboardElement.SNMP_TRAP_MONITOR:
            case DashboardElement.STATUS_INDICATOR:
            case DashboardElement.STATUS_MAP:
            case DashboardElement.DASHBOARD:
            case DashboardElement.RACK_DIAGRAM:
                config = DashboardControl.DEFAULT_OBJECT_REFERENCE_CONFIG;
                break;
            case DashboardElement.NETWORK_MAP:
            case DashboardElement.SERVICE_COMPONENTS:
                config = DashboardControl.DEFAULT_NETWORK_MAP_CONFIG;
                break;
            case DashboardElement.GEO_MAP:
                config = DashboardControl.DEFAULT_GEO_MAP_CONFIG;
                break;
            case DashboardElement.WEB_PAGE:
                config = DashboardControl.DEFAULT_WEB_PAGE_CONFIG;
                break;
            case DashboardElement.TABLE_VALUE:
                config = DashboardControl.DEFAULT_TABLE_VALUE_CONFIG;
                break;
            case DashboardElement.DCI_SUMMARY_TABLE:
                config = DashboardControl.DEFAULT_SUMMARY_TABLE_CONFIG;
                break;
            default:
                // $NON-NLS-1$
                config = "<element>\n</element>";
                break;
        }
        DashboardElement element = new DashboardElement(dlg.getElementType(), config);
        elements.add(element);
        viewer.setInput(elements.toArray());
        viewer.setSelection(new StructuredSelection(element));
    }
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) AddDashboardElementDlg(org.netxms.ui.eclipse.dashboard.dialogs.AddDashboardElementDlg) DashboardElement(org.netxms.client.dashboards.DashboardElement)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 DashboardElement (org.netxms.client.dashboards.DashboardElement)1 AddDashboardElementDlg (org.netxms.ui.eclipse.dashboard.dialogs.AddDashboardElementDlg)1