Search in sources :

Example 16 with DashboardElement

use of org.netxms.client.dashboards.DashboardElement in project netxms by netxms.

the class DashboardControl method saveDashboard.

/**
 * Save dashboard layout
 *
 * @param viewPart
 */
public void saveDashboard(IViewPart viewPart) {
    final NXCObjectModificationData md = new NXCObjectModificationData(dashboard.getObjectId());
    md.setDashboardElements(new ArrayList<DashboardElement>(elements));
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    new ConsoleJob(Messages.get().DashboardControl_SaveLayout, viewPart, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            session.modifyObject(md);
            runInUIThread(new Runnable() {

                @Override
                public void run() {
                    if (isDisposed())
                        return;
                    modified = false;
                    if (modifyListener != null)
                        modifyListener.save();
                }
            });
        }

        @Override
        protected String getErrorMessage() {
            return Messages.get().DashboardControl_SaveError + dashboard.getObjectName();
        }
    }.start();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) NXCSession(org.netxms.client.NXCSession) NXCObjectModificationData(org.netxms.client.NXCObjectModificationData) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) DashboardElement(org.netxms.client.dashboards.DashboardElement)

Example 17 with DashboardElement

use of org.netxms.client.dashboards.DashboardElement in project netxms by netxms.

the class DashboardControl method addTubeChart.

/**
 * Add tube chart widget to dashboard
 */
public void addTubeChart() {
    DashboardElement e = new DashboardElement(DashboardElement.TUBE_CHART, DEFAULT_CHART_CONFIG);
    addElement(e);
}
Also used : DashboardElement(org.netxms.client.dashboards.DashboardElement)

Example 18 with DashboardElement

use of org.netxms.client.dashboards.DashboardElement in project netxms by netxms.

the class DashboardControl method createContent.

/**
 * Create dashboard's content
 */
private void createContent() {
    setBackground(SharedColors.getColor(SharedColors.DASHBOARD_BACKGROUND, getDisplay()));
    DashboardLayout layout = new DashboardLayout();
    layout.numColumns = dashboard.getNumColumns();
    layout.marginWidth = embedded ? 0 : 15;
    layout.marginHeight = embedded ? 0 : 15;
    layout.horizontalSpacing = 10;
    layout.verticalSpacing = 10;
    setLayout(layout);
    for (final DashboardElement e : elements) {
        createElementWidget(e);
    }
}
Also used : DashboardLayout(org.netxms.ui.eclipse.dashboard.layout.DashboardLayout) DashboardElement(org.netxms.client.dashboards.DashboardElement)

Example 19 with DashboardElement

use of org.netxms.client.dashboards.DashboardElement in project netxms by netxms.

the class DashboardControl method addEmbeddedDashboard.

/**
 * Add embedded dashboard widget to dashboard
 */
public void addEmbeddedDashboard() {
    DashboardElement e = new DashboardElement(DashboardElement.DASHBOARD, DEFAULT_OBJECT_REFERENCE_CONFIG);
    addElement(e);
}
Also used : DashboardElement(org.netxms.client.dashboards.DashboardElement)

Example 20 with DashboardElement

use of org.netxms.client.dashboards.DashboardElement in project netxms by netxms.

the class DashboardControl method addSnmpTrapMonitor.

public void addSnmpTrapMonitor() {
    DashboardElement e = new DashboardElement(DashboardElement.SNMP_TRAP_MONITOR, DEFAULT_OBJECT_REFERENCE_CONFIG);
    addElement(e);
}
Also used : DashboardElement(org.netxms.client.dashboards.DashboardElement)

Aggregations

DashboardElement (org.netxms.client.dashboards.DashboardElement)23 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 NXCSession (org.netxms.client.NXCSession)3 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)3 NXCObjectModificationData (org.netxms.client.NXCObjectModificationData)2 AbstractObject (org.netxms.client.objects.AbstractObject)2 DashboardElementConfig (org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Entry (java.util.Map.Entry)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1