Search in sources :

Example 6 with DashboardControl

use of org.netxms.ui.eclipse.dashboard.widgets.DashboardControl in project netxms by netxms.

the class DashboardView method rebuildDashboard.

/**
 * Rebuild current dashboard
 *
 * @param reload if true, dashboard object will be reloaded and all unsaved changes
 * will be lost
 */
private void rebuildDashboard(boolean reload) {
    if (dashboard == null)
        return;
    if (dbc != null)
        dbc.dispose();
    if (reload) {
        dashboard = (Dashboard) ((NXCSession) ConsoleSharedData.getSession()).findObjectById(dashboard.getObjectId(), Dashboard.class);
        if (dashboard != null) {
            dbc = new DashboardControl(parentComposite, SWT.NONE, dashboard, this, selectionProvider, false);
            parentComposite.layout(true, true);
            setPartName(Messages.get().DashboardView_PartNamePrefix + dashboard.getObjectName());
            if (!readOnly) {
                dbc.setModifyListener(dbcModifyListener);
            }
        } else {
            dbc = null;
        }
    } else {
        dbc = new DashboardControl(parentComposite, SWT.NONE, dashboard, dbc.getElements(), this, selectionProvider, dbc.isModified());
        parentComposite.layout(true, true);
        if (!readOnly) {
            dbc.setModifyListener(dbcModifyListener);
        }
    }
    actionSave.setEnabled((dbc != null) ? dbc.isModified() : false);
    firePropertyChange(PROP_DIRTY);
}
Also used : NXCSession(org.netxms.client.NXCSession) DashboardControl(org.netxms.ui.eclipse.dashboard.widgets.DashboardControl)

Aggregations

DashboardControl (org.netxms.ui.eclipse.dashboard.widgets.DashboardControl)6 NXCSession (org.netxms.client.NXCSession)3 Dashboard (org.netxms.client.objects.Dashboard)2 IntermediateSelectionProvider (org.netxms.ui.eclipse.tools.IntermediateSelectionProvider)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Composite (org.eclipse.swt.widgets.Composite)1 ISelectionListener (org.eclipse.ui.ISelectionListener)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 SessionListener (org.netxms.client.SessionListener)1 SessionNotification (org.netxms.client.SessionNotification)1 DashboardModifyListener (org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardModifyListener)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1