Added 'Administration status'column for scheduled tasks view and status color indicat...
authorzev <zev@netxms.org>
Mon, 23 Oct 2017 16:14:28 +0000 (19:14 +0300)
committerzev <zev@netxms.org>
Mon, 23 Oct 2017 16:14:40 +0000 (19:14 +0300)
ChangeLog
src/java/netxms-eclipse/ServerConfig/icons/active.gif [new file with mode: 0644]
src/java/netxms-eclipse/ServerConfig/icons/disabled.gif [new file with mode: 0644]
src/java/netxms-eclipse/ServerConfig/icons/pending.gif [new file with mode: 0644]
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/ScheduledTaskView.java
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ScheduleTableEntryLabelProvider.java
webui/webapp/ServerConfig/icons/active.gif [new file with mode: 0644]
webui/webapp/ServerConfig/icons/disabled.gif [new file with mode: 0644]
webui/webapp/ServerConfig/icons/pending.gif [new file with mode: 0644]
webui/webapp/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/ScheduledTaskView.java
webui/webapp/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ScheduleTableEntryLabelProvider.java

index 48888da..2ef270c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,7 @@
 * 2.1.3
 *
 
-- Fixed issues: NX-1342, NX-1343
+- Fixed issues: NX-1341, NX-1342, NX-1343
 
 
 *
diff --git a/src/java/netxms-eclipse/ServerConfig/icons/active.gif b/src/java/netxms-eclipse/ServerConfig/icons/active.gif
new file mode 100644 (file)
index 0000000..c7394b3
Binary files /dev/null and b/src/java/netxms-eclipse/ServerConfig/icons/active.gif differ
diff --git a/src/java/netxms-eclipse/ServerConfig/icons/disabled.gif b/src/java/netxms-eclipse/ServerConfig/icons/disabled.gif
new file mode 100644 (file)
index 0000000..1453e5b
Binary files /dev/null and b/src/java/netxms-eclipse/ServerConfig/icons/disabled.gif differ
diff --git a/src/java/netxms-eclipse/ServerConfig/icons/pending.gif b/src/java/netxms-eclipse/ServerConfig/icons/pending.gif
new file mode 100644 (file)
index 0000000..af04f54
Binary files /dev/null and b/src/java/netxms-eclipse/ServerConfig/icons/pending.gif differ
index bd9e711..ca33553 100644 (file)
@@ -77,8 +77,9 @@ public class ScheduledTaskView extends ViewPart
    public static final int EXECUTION_TIME = 4;
    public static final int LAST_EXECUTION_TIME = 5;
    public static final int STATUS = 6;   
-   public static final int OWNER = 7;
-   public static final int COMMENTS = 8;
+   public static final int MANAGMENT_STATE = 7;   
+   public static final int OWNER = 8;
+   public static final int COMMENTS = 9;
    
    private NXCSession session;
    private SessionListener listener;
@@ -107,8 +108,8 @@ public class ScheduledTaskView extends ViewPart
    @Override
    public void createPartControl(Composite parent)
    {      
-      final int[] widths = { 50, 100, 200, 400, 150, 150, 100, 100, 200 };
-      final String[] names = { "Id", "Schedule Type", "Object", "Parameters", "Execution time", "Last execution time", "Status", "Owner", "Comments" };
+      final int[] widths = { 50, 100, 200, 400, 150, 150, 100, 200, 250, 200 };
+      final String[] names = { "Id", "Schedule Type", "Object", "Parameters", "Execution time", "Last execution time", "Execution status", "Administrative status", "Owner", "Comments" };
       viewer = new SortableTableViewer(parent, names, widths, SCHEDULE_ID, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
       viewer.setContentProvider(new ArrayContentProvider());
       viewer.setLabelProvider(new ScheduleTableEntryLabelProvider());
index 04572c7..625ba5e 100644 (file)
@@ -1,21 +1,33 @@
 package org.netxms.ui.eclipse.serverconfig.views.helpers;
 
+import org.eclipse.jface.viewers.IColorProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.model.WorkbenchLabelProvider;
 import org.netxms.client.NXCSession;
 import org.netxms.client.ScheduledTask;
 import org.netxms.client.objects.AbstractObject;
 import org.netxms.client.users.AbstractUserObject;
 import org.netxms.ui.eclipse.console.resources.RegionalSettings;
+import org.netxms.ui.eclipse.serverconfig.Activator;
 import org.netxms.ui.eclipse.serverconfig.views.ScheduledTaskView;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 
-public class ScheduleTableEntryLabelProvider extends LabelProvider implements ITableLabelProvider
+public class ScheduleTableEntryLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider
 {
+   private static final Color FONT_COLOR = new Color(Display.getDefault(), new RGB(126, 137, 185));
+   private static final int EXECUTED = 0;
+   private static final int PENDING = 1;
+   private static final int DISBALED = 2;
+   
+   
    private NXCSession session;
    private WorkbenchLabelProvider wbLabelProvider;
+   private Image statusImages[];
    
    /**
     * Default constructor 
@@ -24,6 +36,11 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
    {
       session = (NXCSession)ConsoleSharedData.getSession();
       wbLabelProvider = new WorkbenchLabelProvider();
+            
+      statusImages = new Image[3];
+      statusImages[EXECUTED] = Activator.getImageDescriptor("icons/active.gif").createImage(); //$NON-NLS-1$
+      statusImages[PENDING] = Activator.getImageDescriptor("icons/pending.gif").createImage(); //$NON-NLS-1$
+      statusImages[DISBALED] = Activator.getImageDescriptor("icons/disabled.gif").createImage(); //$NON-NLS-1$
    }
 
    /* (non-Javadoc)
@@ -32,10 +49,18 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
    @Override
    public Image getColumnImage(Object element, int columnIndex)
    {
+      ScheduledTask task = (ScheduledTask)element;
+      
       switch(columnIndex)
       {
+         case ScheduledTaskView.SCHEDULE_ID:
+            if(task.isDisbaled())
+               return statusImages[DISBALED];
+            if((task.getFlags() & ScheduledTask.EXECUTED) != 0 || (task.getFlags() & ScheduledTask.RUNNING) != 0)
+               return statusImages[EXECUTED];
+            return statusImages[PENDING];
          case ScheduledTaskView.OBJECT:
-            if(((ScheduledTask)element).getObjectId() == 0)
+            if(task.getObjectId() == 0)
                return null;
             AbstractObject object = session.findObjectById(((ScheduledTask)element).getObjectId());
             return (object != null) ? wbLabelProvider.getImage(object) : null;
@@ -70,6 +95,8 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
             return (task.getLastExecutionTime().getTime() == 0) ? "" : RegionalSettings.getDateTimeFormat().format(task.getLastExecutionTime());
          case ScheduledTaskView.STATUS:
             return task.getStatus();
+         case ScheduledTaskView.MANAGMENT_STATE:
+            return task.isDisbaled() ? "Disabled" : "Enabled";
          case ScheduledTaskView.OWNER:
             if ((task.getFlags() & ScheduledTask.SYSTEM) != 0)
                return "system";
@@ -80,4 +107,25 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
       }
       return null;
    }
+
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+    */
+   @Override
+   public Color getForeground(Object element)
+   {
+      if (((ScheduledTask)element).isDisbaled())
+      {
+         return FONT_COLOR;
+      }
+      return null;
+   }
+
+   @Override
+   public Color getBackground(Object element)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
 }
diff --git a/webui/webapp/ServerConfig/icons/active.gif b/webui/webapp/ServerConfig/icons/active.gif
new file mode 100644 (file)
index 0000000..c7394b3
Binary files /dev/null and b/webui/webapp/ServerConfig/icons/active.gif differ
diff --git a/webui/webapp/ServerConfig/icons/disabled.gif b/webui/webapp/ServerConfig/icons/disabled.gif
new file mode 100644 (file)
index 0000000..1453e5b
Binary files /dev/null and b/webui/webapp/ServerConfig/icons/disabled.gif differ
diff --git a/webui/webapp/ServerConfig/icons/pending.gif b/webui/webapp/ServerConfig/icons/pending.gif
new file mode 100644 (file)
index 0000000..af04f54
Binary files /dev/null and b/webui/webapp/ServerConfig/icons/pending.gif differ
index bd9e711..ca33553 100644 (file)
@@ -77,8 +77,9 @@ public class ScheduledTaskView extends ViewPart
    public static final int EXECUTION_TIME = 4;
    public static final int LAST_EXECUTION_TIME = 5;
    public static final int STATUS = 6;   
-   public static final int OWNER = 7;
-   public static final int COMMENTS = 8;
+   public static final int MANAGMENT_STATE = 7;   
+   public static final int OWNER = 8;
+   public static final int COMMENTS = 9;
    
    private NXCSession session;
    private SessionListener listener;
@@ -107,8 +108,8 @@ public class ScheduledTaskView extends ViewPart
    @Override
    public void createPartControl(Composite parent)
    {      
-      final int[] widths = { 50, 100, 200, 400, 150, 150, 100, 100, 200 };
-      final String[] names = { "Id", "Schedule Type", "Object", "Parameters", "Execution time", "Last execution time", "Status", "Owner", "Comments" };
+      final int[] widths = { 50, 100, 200, 400, 150, 150, 100, 200, 250, 200 };
+      final String[] names = { "Id", "Schedule Type", "Object", "Parameters", "Execution time", "Last execution time", "Execution status", "Administrative status", "Owner", "Comments" };
       viewer = new SortableTableViewer(parent, names, widths, SCHEDULE_ID, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);
       viewer.setContentProvider(new ArrayContentProvider());
       viewer.setLabelProvider(new ScheduleTableEntryLabelProvider());
index 04572c7..625ba5e 100644 (file)
@@ -1,21 +1,33 @@
 package org.netxms.ui.eclipse.serverconfig.views.helpers;
 
+import org.eclipse.jface.viewers.IColorProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.model.WorkbenchLabelProvider;
 import org.netxms.client.NXCSession;
 import org.netxms.client.ScheduledTask;
 import org.netxms.client.objects.AbstractObject;
 import org.netxms.client.users.AbstractUserObject;
 import org.netxms.ui.eclipse.console.resources.RegionalSettings;
+import org.netxms.ui.eclipse.serverconfig.Activator;
 import org.netxms.ui.eclipse.serverconfig.views.ScheduledTaskView;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 
-public class ScheduleTableEntryLabelProvider extends LabelProvider implements ITableLabelProvider
+public class ScheduleTableEntryLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider
 {
+   private static final Color FONT_COLOR = new Color(Display.getDefault(), new RGB(126, 137, 185));
+   private static final int EXECUTED = 0;
+   private static final int PENDING = 1;
+   private static final int DISBALED = 2;
+   
+   
    private NXCSession session;
    private WorkbenchLabelProvider wbLabelProvider;
+   private Image statusImages[];
    
    /**
     * Default constructor 
@@ -24,6 +36,11 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
    {
       session = (NXCSession)ConsoleSharedData.getSession();
       wbLabelProvider = new WorkbenchLabelProvider();
+            
+      statusImages = new Image[3];
+      statusImages[EXECUTED] = Activator.getImageDescriptor("icons/active.gif").createImage(); //$NON-NLS-1$
+      statusImages[PENDING] = Activator.getImageDescriptor("icons/pending.gif").createImage(); //$NON-NLS-1$
+      statusImages[DISBALED] = Activator.getImageDescriptor("icons/disabled.gif").createImage(); //$NON-NLS-1$
    }
 
    /* (non-Javadoc)
@@ -32,10 +49,18 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
    @Override
    public Image getColumnImage(Object element, int columnIndex)
    {
+      ScheduledTask task = (ScheduledTask)element;
+      
       switch(columnIndex)
       {
+         case ScheduledTaskView.SCHEDULE_ID:
+            if(task.isDisbaled())
+               return statusImages[DISBALED];
+            if((task.getFlags() & ScheduledTask.EXECUTED) != 0 || (task.getFlags() & ScheduledTask.RUNNING) != 0)
+               return statusImages[EXECUTED];
+            return statusImages[PENDING];
          case ScheduledTaskView.OBJECT:
-            if(((ScheduledTask)element).getObjectId() == 0)
+            if(task.getObjectId() == 0)
                return null;
             AbstractObject object = session.findObjectById(((ScheduledTask)element).getObjectId());
             return (object != null) ? wbLabelProvider.getImage(object) : null;
@@ -70,6 +95,8 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
             return (task.getLastExecutionTime().getTime() == 0) ? "" : RegionalSettings.getDateTimeFormat().format(task.getLastExecutionTime());
          case ScheduledTaskView.STATUS:
             return task.getStatus();
+         case ScheduledTaskView.MANAGMENT_STATE:
+            return task.isDisbaled() ? "Disabled" : "Enabled";
          case ScheduledTaskView.OWNER:
             if ((task.getFlags() & ScheduledTask.SYSTEM) != 0)
                return "system";
@@ -80,4 +107,25 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
       }
       return null;
    }
+
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
+    */
+   @Override
+   public Color getForeground(Object element)
+   {
+      if (((ScheduledTask)element).isDisbaled())
+      {
+         return FONT_COLOR;
+      }
+      return null;
+   }
+
+   @Override
+   public Color getBackground(Object element)
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
 }