dashboard editor improved; added "refresh" menu to dashboard view; added "comments...
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 28 Sep 2011 12:02:59 +0000 (12:02 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 28 Sep 2011 12:02:59 +0000 (12:02 +0000)
13 files changed:
.gitattributes
doc/manuals/netxms_user_manual.odt
sql/setup.in
src/install/windows/common.iss
src/java/netxms-eclipse/Dashboard/plugin.xml
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/DataSources.java
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/ObjectStatusChart.java [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/StatusIndicator.java [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/DashboardDynamicView.java
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/DashboardView.java
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/widgets/DashboardControl.java
src/server/core/nxsl_classes.cpp
src/server/include/nms_objects.h

index f00b417..5a03689 100644 (file)
@@ -681,6 +681,8 @@ src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/perspectiv
 src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/AvailabilityChart.java -text
 src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/DashboardElements.java -text
 src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/Layout.java -text
+src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/ObjectStatusChart.java -text
+src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/StatusIndicator.java -text
 src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/helpers/DashboardElementsLabelProvider.java -text
 src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/DashboardDynamicView.java -text
 src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/DashboardNavigator.java -text
index 4bd8e1d..9b41bed 100644 (file)
Binary files a/doc/manuals/netxms_user_manual.odt and b/doc/manuals/netxms_user_manual.odt differ
index 58aa82c..f9bd353 100644 (file)
@@ -268,6 +268,12 @@ INSERT INTO user_groups (id,name,system_access,flags,description,guid)
 INSERT INTO acl (object_id,user_id,access_rights) VALUES (1,-2147483647,2047);
 INSERT INTO acl (object_id,user_id,access_rights) VALUES (2,-2147483647,2047);
 INSERT INTO acl (object_id,user_id,access_rights) VALUES (3,-2147483647,2047);
+INSERT INTO acl (object_id,user_id,access_rights) VALUES (4,-2147483647,2047);
+INSERT INTO acl (object_id,user_id,access_rights) VALUES (5,-2147483647,2047);
+INSERT INTO acl (object_id,user_id,access_rights) VALUES (6,-2147483647,2047);
+INSERT INTO acl (object_id,user_id,access_rights) VALUES (7,-2147483647,2047);
+INSERT INTO acl (object_id,user_id,access_rights) VALUES (8,-2147483647,2047);
+INSERT INTO acl (object_id,user_id,access_rights) VALUES (9,-2147483647,2047);
 
 
 /*
index 75bd94d..0bfe1b3 100644 (file)
@@ -3,12 +3,13 @@
 Name: "{group}\Alarm Notifier"; Filename: "{app}\bin\nxnotify.exe"; Components: console\r
 Name: "{group}\Alarm Viewer"; Filename: "{app}\bin\nxav.exe"; Components: console\r
 Name: "{group}\NetXMS Console"; Filename: "{app}\bin\nxmc.exe"; Components: console\r
+Name: "{group}\Legacy NetXMS Console"; Filename: "{app}\bin\nxcon.exe"; Components: console\r
 Name: "{group}\Recompile MIB Files"; Filename: "{app}\bin\nxmibc.exe"; Parameters: "-P -z -d ""{app}\var\mibs"" -o ""{app}\var\mibs\netxms.mib"""; Components: console\r
 Name: "{group}\Server Configuration Wizard"; Filename: "{app}\bin\nxconfig.exe"; Components: server\r
 Name: "{group}\Server Console"; Filename: "{app}\bin\nxadm.exe"; Parameters: "-i"; Components: server\r
 Name: "{group}\{cm:UninstallProgram,NetXMS}"; Filename: "{uninstallexe}"\r
-Name: "{userdesktop}\NetXMS Console"; Filename: "{app}\bin\nxcon.exe"; Tasks: desktopicon; Components: console\r
-Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\NetXMS Console"; Filename: "{app}\bin\nxcon.exe"; Tasks: quicklaunchicon; Components: console\r
+Name: "{userdesktop}\NetXMS Console"; Filename: "{app}\bin\nxmc.exe"; Tasks: desktopicon; Components: console\r
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\NetXMS Console"; Filename: "{app}\bin\nxmc.exe"; Tasks: quicklaunchicon; Components: console\r
 \r
 [Dirs]\r
 Name: "{app}\etc"\r
index a70fc66..01e5299 100644 (file)
@@ -85,7 +85,7 @@
       </page>\r
       <page\r
             class="org.netxms.ui.eclipse.dashboard.propertypages.Layout"\r
-            id="org.netxms.ui.eclipse.dashboard.propertypages.Layout#0"\r
+            id="org.netxms.ui.eclipse.dashboard.propertypages.Layout#100"\r
             name="Layout">\r
          <enabledWhen>\r
             <instanceof\r
             </instanceof>\r
          </enabledWhen>\r
       </page>\r
+      <page\r
+            class="org.netxms.ui.eclipse.dashboard.propertypages.StatusIndicator"\r
+            id="org.netxms.ui.eclipse.dashboard.propertypages.StatusIndicator#0"\r
+            name="Status Indicator">\r
+         <enabledWhen>\r
+            <instanceof\r
+                  value="org.netxms.ui.eclipse.dashboard.widgets.internal.StatusIndicatorConfig">\r
+            </instanceof>\r
+         </enabledWhen>\r
+      </page>\r
+      <page\r
+            class="org.netxms.ui.eclipse.dashboard.propertypages.ObjectStatusChart"\r
+            id="org.netxms.ui.eclipse.dashboard.propertypages.ObjectStatusChart#0"\r
+            name="Object Status Chart">\r
+         <enabledWhen>\r
+            <instanceof\r
+                  value="org.netxms.ui.eclipse.dashboard.widgets.internal.ObjectStatusChartConfig">\r
+            </instanceof>\r
+         </enabledWhen>\r
+      </page>\r
    </extension>\r
    <extension\r
          point="org.eclipse.core.runtime.adapters">\r
index e61f25a..df88f07 100644 (file)
@@ -1,5 +1,20 @@
 /**
- * 
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2011 Victor Kirhenshtein
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 package org.netxms.ui.eclipse.dashboard.propertypages;
 
@@ -37,8 +52,7 @@ import org.netxms.ui.eclipse.tools.WidgetHelper;
 import org.netxms.ui.eclipse.widgets.SortableTableViewer;
 
 /**
- * @author victor
- *
+ * DCI list editor for dashboard element
  */
 public class DataSources extends PropertyPage
 {
@@ -271,7 +285,7 @@ public class DataSources extends PropertyPage
        private void editItem()
        {
                IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
-               ConditionDciInfo dci = (ConditionDciInfo)selection.getFirstElement();
+               DashboardDciInfo dci = (DashboardDciInfo)selection.getFirstElement();
                if (dci == null)
                        return;
                
diff --git a/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/ObjectStatusChart.java b/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/ObjectStatusChart.java
new file mode 100644 (file)
index 0000000..01ec0c0
--- /dev/null
@@ -0,0 +1,109 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2011 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.dashboard.propertypages;\r
+\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Button;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.ui.dialogs.PropertyPage;\r
+import org.netxms.client.objects.GenericObject;\r
+import org.netxms.ui.eclipse.dashboard.widgets.internal.ObjectStatusChartConfig;\r
+import org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector;\r
+import org.netxms.ui.eclipse.widgets.LabeledText;\r
+\r
+/**\r
+ * Availability chart element properties\r
+ */\r
+public class ObjectStatusChart extends PropertyPage\r
+{\r
+       private ObjectStatusChartConfig config;\r
+       private ObjectSelector objectSelector;\r
+       private LabeledText title;\r
+       private Button checkShowLegend;\r
+       private Button checkShow3D;\r
+       private Button checkTransposed;\r
+       private Button checkTranslucent;\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)\r
+        */\r
+       @Override\r
+       protected Control createContents(Composite parent)\r
+       {\r
+               config = (ObjectStatusChartConfig)getElement().getAdapter(ObjectStatusChartConfig.class);\r
+               \r
+               Composite dialogArea = new Composite(parent, SWT.NONE);\r
+               \r
+               GridLayout layout = new GridLayout();\r
+               dialogArea.setLayout(layout);\r
+               \r
+               objectSelector = new ObjectSelector(dialogArea, SWT.NONE);\r
+               objectSelector.setLabel("Root Object");\r
+               objectSelector.setObjectClass(GenericObject.class);\r
+               objectSelector.setObjectId(config.getRootObject());\r
+               GridData gd = new GridData();\r
+               gd.horizontalAlignment = SWT.FILL;\r
+               gd.grabExcessHorizontalSpace = true;\r
+               objectSelector.setLayoutData(gd);\r
+               \r
+               title = new LabeledText(dialogArea, SWT.NONE);\r
+               title.setLabel("Title");\r
+               title.setText(config.getTitle());\r
+               gd = new GridData();\r
+               gd.horizontalAlignment = SWT.FILL;\r
+               gd.grabExcessHorizontalSpace = true;\r
+               title.setLayoutData(gd);\r
+               \r
+               checkShowLegend = new Button(dialogArea, SWT.CHECK);\r
+               checkShowLegend.setText("Show &legend");\r
+               checkShowLegend.setSelection(config.isShowLegend());\r
+               \r
+               checkShow3D = new Button(dialogArea, SWT.CHECK);\r
+               checkShow3D.setText("&3D view");\r
+               checkShow3D.setSelection(config.isShowIn3D());\r
+               \r
+               checkTransposed = new Button(dialogArea, SWT.CHECK);\r
+               checkTransposed.setText("Trans&posed");\r
+               checkTransposed.setSelection(config.isTransposed());\r
+\r
+               checkTranslucent = new Button(dialogArea, SWT.CHECK);\r
+               checkTranslucent.setText("&Translucent");\r
+               checkTranslucent.setSelection(config.isTranslucent());\r
+\r
+               return dialogArea;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.preference.PreferencePage#performOk()\r
+        */\r
+       @Override\r
+       public boolean performOk()\r
+       {\r
+               config.setRootObject(objectSelector.getObjectId());\r
+               config.setTitle(title.getText());\r
+               config.setShowLegend(checkShowLegend.getSelection());\r
+               config.setShowIn3D(checkShow3D.getSelection());\r
+               config.setTransposed(checkTransposed.getSelection());\r
+               config.setTranslucent(checkTranslucent.getSelection());\r
+               return true;\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/StatusIndicator.java b/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/propertypages/StatusIndicator.java
new file mode 100644 (file)
index 0000000..a386dfd
--- /dev/null
@@ -0,0 +1,84 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2011 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.dashboard.propertypages;\r
+\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.ui.dialogs.PropertyPage;\r
+import org.netxms.client.objects.GenericObject;\r
+import org.netxms.ui.eclipse.dashboard.widgets.internal.StatusIndicatorConfig;\r
+import org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector;\r
+import org.netxms.ui.eclipse.widgets.LabeledText;\r
+\r
+/**\r
+ * Availability chart element properties\r
+ */\r
+public class StatusIndicator extends PropertyPage\r
+{\r
+       private StatusIndicatorConfig config;\r
+       private ObjectSelector objectSelector;\r
+       private LabeledText title;\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)\r
+        */\r
+       @Override\r
+       protected Control createContents(Composite parent)\r
+       {\r
+               config = (StatusIndicatorConfig)getElement().getAdapter(StatusIndicatorConfig.class);\r
+               \r
+               Composite dialogArea = new Composite(parent, SWT.NONE);\r
+               \r
+               GridLayout layout = new GridLayout();\r
+               dialogArea.setLayout(layout);\r
+               \r
+               objectSelector = new ObjectSelector(dialogArea, SWT.NONE);\r
+               objectSelector.setLabel("NetXMS Object");\r
+               objectSelector.setObjectClass(GenericObject.class);\r
+               objectSelector.setObjectId(config.getObjectId());\r
+               GridData gd = new GridData();\r
+               gd.horizontalAlignment = SWT.FILL;\r
+               gd.grabExcessHorizontalSpace = true;\r
+               objectSelector.setLayoutData(gd);\r
+               \r
+               title = new LabeledText(dialogArea, SWT.NONE);\r
+               title.setLabel("Title");\r
+               title.setText(config.getTitle());\r
+               gd = new GridData();\r
+               gd.horizontalAlignment = SWT.FILL;\r
+               gd.grabExcessHorizontalSpace = true;\r
+               title.setLayoutData(gd);\r
+               \r
+               return dialogArea;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.preference.PreferencePage#performOk()\r
+        */\r
+       @Override\r
+       public boolean performOk()\r
+       {\r
+               config.setObjectId(objectSelector.getObjectId());\r
+               config.setTitle(title.getText());\r
+               return true;\r
+       }\r
+}\r
index 2c851c8..54fedac 100644 (file)
@@ -29,8 +29,11 @@ import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.ISelectionService;\r
 import org.eclipse.ui.IWorkbenchPart;\r
 import org.eclipse.ui.part.ViewPart;\r
+import org.netxms.client.NXCSession;\r
 import org.netxms.client.objects.Dashboard;\r
+import org.netxms.ui.eclipse.actions.RefreshAction;\r
 import org.netxms.ui.eclipse.dashboard.widgets.DashboardControl;\r
+import org.netxms.ui.eclipse.shared.ConsoleSharedData;\r
 \r
 /**\r
  * Dynamic dashboard view - change dashboard when selection in dashboard\r
@@ -45,6 +48,7 @@ public class DashboardDynamicView extends ViewPart
        private ISelectionService selectionService;\r
        private ISelectionListener selectionListener;\r
        private Composite parentComposite;\r
+       private RefreshAction actionRefresh;\r
 \r
        /*\r
         * (non-Javadoc)\r
@@ -87,6 +91,13 @@ public class DashboardDynamicView extends ViewPart
         */\r
        private void createActions()\r
        {\r
+               actionRefresh = new RefreshAction() {\r
+                       @Override\r
+                       public void run()\r
+                       {\r
+                               rebuildDashboard();\r
+                       }\r
+               };\r
        }\r
 \r
        /**\r
@@ -107,6 +118,7 @@ public class DashboardDynamicView extends ViewPart
         */\r
        private void fillLocalPullDown(IMenuManager manager)\r
        {\r
+               manager.add(actionRefresh);\r
        }\r
 \r
        /**\r
@@ -117,6 +129,7 @@ public class DashboardDynamicView extends ViewPart
         */\r
        private void fillLocalToolBar(IToolBarManager manager)\r
        {\r
+               manager.add(actionRefresh);\r
        }\r
 \r
        /*\r
@@ -145,4 +158,27 @@ public class DashboardDynamicView extends ViewPart
                parentComposite.layout();\r
                setPartName("Dashboard: " + dashboard.getObjectName());\r
        }\r
+       \r
+       /**\r
+        * Rebuild current dashboard\r
+        */\r
+       private void rebuildDashboard()\r
+       {\r
+               if (dashboard == null)\r
+                       return;\r
+               \r
+               if (dbc != null)\r
+                       dbc.dispose();\r
+               dashboard = (Dashboard)((NXCSession)ConsoleSharedData.getSession()).findObjectById(dashboard.getObjectId(), Dashboard.class);\r
+               if (dashboard != null)\r
+               {\r
+                       dbc = new DashboardControl(parentComposite, SWT.NONE, dashboard, false);\r
+                       parentComposite.layout();\r
+                       setPartName("Dashboard: " + dashboard.getObjectName());\r
+               }\r
+               else\r
+               {\r
+                       dbc = null;\r
+               }\r
+       }\r
 }\r
index 736271d..04f9369 100644 (file)
@@ -23,6 +23,7 @@ import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuManager;\r
 import org.eclipse.jface.action.IToolBarManager;\r
 import org.eclipse.jface.action.Separator;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.ui.IActionBars;\r
@@ -32,6 +33,7 @@ import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.part.ViewPart;\r
 import org.netxms.client.NXCSession;\r
 import org.netxms.client.objects.Dashboard;\r
+import org.netxms.ui.eclipse.actions.RefreshAction;\r
 import org.netxms.ui.eclipse.dashboard.widgets.DashboardControl;\r
 import org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardModifyListener;\r
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;\r
@@ -47,6 +49,9 @@ public class DashboardView extends ViewPart implements ISaveablePart
        private NXCSession session;\r
        private Dashboard dashboard;\r
        private DashboardControl dbc;\r
+       private Composite parentComposite;\r
+       private DashboardModifyListener dbcModifyListener;\r
+       private RefreshAction actionRefresh;\r
        private Action actionEditMode;\r
        private Action actionSave;\r
        private Action actionAddAlarmBrowser;\r
@@ -79,8 +84,9 @@ public class DashboardView extends ViewPart implements ISaveablePart
        @Override\r
        public void createPartControl(Composite parent)\r
        {\r
+               parentComposite = parent;\r
                dbc = new DashboardControl(parent, SWT.NONE, dashboard, false);\r
-               dbc.setModifyListener(new DashboardModifyListener() {\r
+               dbcModifyListener = new DashboardModifyListener() {\r
                        @Override\r
                        public void save()\r
                        {\r
@@ -94,7 +100,8 @@ public class DashboardView extends ViewPart implements ISaveablePart
                                actionSave.setEnabled(true);\r
                                firePropertyChange(PROP_DIRTY);\r
                        }\r
-               });\r
+               };\r
+               dbc.setModifyListener(dbcModifyListener);\r
 \r
                createActions();\r
                contributeToActionBars();\r
@@ -105,6 +112,20 @@ public class DashboardView extends ViewPart implements ISaveablePart
         */\r
        private void createActions()\r
        {\r
+               actionRefresh = new RefreshAction() {\r
+                       @Override\r
+                       public void run()\r
+                       {\r
+                               if (dbc.isModified())\r
+                               {\r
+                                       if (!MessageDialog.openConfirm(getSite().getShell(), "Refresh Dashboard", \r
+                                                       "This will destroy all unsaved changes. Are you sure?"))\r
+                                               return;\r
+                               }\r
+                               rebuildDashboard(true);\r
+                       }\r
+               };\r
+               \r
                actionSave = new Action("&Save") {\r
                        @Override\r
                        public void run()\r
@@ -121,6 +142,8 @@ public class DashboardView extends ViewPart implements ISaveablePart
                        {\r
                                dbc.setEditMode(!dbc.isEditMode());\r
                                actionEditMode.setChecked(dbc.isEditMode());\r
+                               if (!dbc.isEditMode())\r
+                                       rebuildDashboard(false);\r
                        }\r
                };\r
                actionEditMode.setImageDescriptor(SharedIcons.EDIT);\r
@@ -229,6 +252,8 @@ public class DashboardView extends ViewPart implements ISaveablePart
                manager.add(actionAddStatusIndicator);\r
                manager.add(actionAddAvailabilityChart);\r
                manager.add(actionAddDashboard);\r
+               manager.add(new Separator());\r
+               manager.add(actionRefresh);\r
        }\r
 \r
        /**\r
@@ -241,6 +266,7 @@ public class DashboardView extends ViewPart implements ISaveablePart
        {\r
                manager.add(actionEditMode);\r
                manager.add(actionSave);\r
+               manager.add(actionRefresh);\r
        }\r
        \r
        /* (non-Javadoc)\r
@@ -293,6 +319,47 @@ public class DashboardView extends ViewPart implements ISaveablePart
        @Override\r
        public boolean isSaveOnCloseNeeded()\r
        {\r
-               return true;\r
+               return dbc.isModified();\r
+       }\r
+\r
+       /**\r
+        * Rebuild current dashboard\r
+        * \r
+        * @param reload if true, dashboard object will be reloaded and all unsaved changes\r
+        * will be lost\r
+        */\r
+       private void rebuildDashboard(boolean reload)\r
+       {\r
+               if (dashboard == null)\r
+                       return;\r
+               \r
+               if (dbc != null)\r
+                       dbc.dispose();\r
+               \r
+               if (reload)\r
+               {\r
+                       dashboard = (Dashboard)((NXCSession)ConsoleSharedData.getSession()).findObjectById(dashboard.getObjectId(), Dashboard.class);\r
+\r
+                       if (dashboard != null)\r
+                       {\r
+                               dbc = new DashboardControl(parentComposite, SWT.NONE, dashboard, false);\r
+                               parentComposite.layout(true, true);\r
+                               setPartName("Dashboard: " + dashboard.getObjectName());\r
+                               dbc.setModifyListener(dbcModifyListener);\r
+                       }\r
+                       else\r
+                       {\r
+                               dbc = null;\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       dbc = new DashboardControl(parentComposite, SWT.NONE, dashboard, dbc.getElements(), dbc.isModified());\r
+                       parentComposite.layout(true, true);\r
+                       dbc.setModifyListener(dbcModifyListener);\r
+               }\r
+\r
+               actionSave.setEnabled(dbc.isModified());\r
+               firePropertyChange(PROP_DIRTY);\r
        }\r
 }\r
index 19f0f85..3140e84 100644 (file)
@@ -77,8 +77,21 @@ public class DashboardControl extends Composite
                super(parent, style);\r
                this.dashboard = dashboard;\r
                this.embedded = embedded;\r
-               elements = new ArrayList<DashboardElement>(dashboard.getElements());\r
-               setBackground(new Color(getDisplay(), 255, 255, 255));\r
+               this.elements = new ArrayList<DashboardElement>(dashboard.getElements());\r
+               createContent();\r
+       }\r
+\r
+       /**\r
+        * @param parent\r
+        * @param style\r
+        */\r
+       public DashboardControl(Composite parent, int style, Dashboard dashboard, List<DashboardElement> elements, boolean modified)\r
+       {\r
+               super(parent, style);\r
+               this.dashboard = dashboard;\r
+               this.embedded = false;\r
+               this.modified = modified;\r
+               this.elements = new ArrayList<DashboardElement>(elements);\r
                createContent();\r
        }\r
 \r
@@ -87,6 +100,8 @@ public class DashboardControl extends Composite
         */\r
        private void createContent()\r
        {\r
+               setBackground(new Color(getDisplay(), 255, 255, 255));\r
+               \r
                GridLayout layout = new GridLayout();\r
                layout.numColumns = dashboard.getNumColumns();\r
                layout.marginWidth = embedded ? 0 : 15;\r
@@ -95,7 +110,7 @@ public class DashboardControl extends Composite
                layout.verticalSpacing = 10;\r
                setLayout(layout);\r
                \r
-               for(final DashboardElement e : dashboard.getElements())\r
+               for(final DashboardElement e : elements)\r
                {\r
                        createElementWidget(e);\r
                }\r
@@ -251,6 +266,7 @@ public class DashboardControl extends Composite
                        w.dispose();\r
                        layout(true, true);\r
                }\r
+               setModified();\r
        }\r
        \r
        /**\r
@@ -488,4 +504,12 @@ public class DashboardControl extends Composite
        {\r
                return modified;\r
        }\r
+\r
+       /**\r
+        * @return the elements\r
+        */\r
+       public List<DashboardElement> getElements()\r
+       {\r
+               return elements;\r
+       }\r
 }\r
index e8b3f22..54f21a1 100644 (file)
@@ -61,6 +61,10 @@ NXSL_Value *NXSL_NetObjClass::getAttr(NXSL_Object *pObject, const TCHAR *pszAttr
    {
       pValue = new NXSL_Value((LONG)object->Type());
    }
+   else if (!_tcscmp(pszAttr, _T("comments")))
+   {
+      pValue = new NXSL_Value(object->getComments());
+   }
        else
        {
                const TCHAR *attrValue = object->GetCustomAttribute(pszAttr);
@@ -167,6 +171,10 @@ NXSL_Value *NXSL_NodeClass::getAttr(NXSL_Object *pObject, const TCHAR *pszAttr)
    {
       pValue = new NXSL_Value(pNode->getSysDescription());
    }
+   else if (!_tcscmp(pszAttr, _T("comments")))
+   {
+      pValue = new NXSL_Value(pNode->getComments());
+   }
        else
        {
                const TCHAR *attrValue = pNode->GetCustomAttribute(pszAttr);
index f3b524f..c024f3d 100644 (file)
@@ -305,6 +305,7 @@ public:
    int getPropagatedStatus();
    DWORD TimeStamp() { return m_dwTimeStamp; }
        void getGuid(uuid_t out) { memcpy(out, m_guid, UUID_LENGTH); }
+       const TCHAR *getComments() { return CHECK_NULL_EX(m_pszComments); }
 
    BOOL isModified() { return m_bIsModified; }
    BOOL isDeleted() { return m_bIsDeleted; }