fixed date/time display in scheduled task list
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 28 Sep 2016 08:39:25 +0000 (11:39 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 28 Sep 2016 08:39:25 +0000 (11:39 +0300)
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ScheduleTableEntryLabelProvider.java
webui/webapp/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ScheduleTableEntryLabelProvider.java

index dd3aa80..fded4b8 100644 (file)
@@ -8,6 +8,7 @@ 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.views.ScheduledTaskView;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 
@@ -25,6 +26,9 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
       wbLabelProvider = new WorkbenchLabelProvider();
    }
 
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+    */
    @Override
    public Image getColumnImage(Object element, int columnIndex)
    {
@@ -39,6 +43,9 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
       return null;
    }
    
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+    */
    @Override
    public String getColumnText(Object element, int columnIndex)
    {
@@ -51,25 +58,24 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
          case ScheduledTaskView.CALLBACK_ID:
             return task.getScheduledTaskId();
          case ScheduledTaskView.OBJECT:
-            if(task.getObjectId() == 0)
+            if (task.getObjectId() == 0)
                return "";
             AbstractObject object = session.findObjectById(task.getObjectId());
             return (object != null) ? object.getObjectName() : ("[" + Long.toString(task.getObjectId()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
          case ScheduledTaskView.PARAMETERS:
             return task.getParameters();
          case ScheduledTaskView.EXECUTION_TIME:
-            return task.getSchedule().isEmpty() ? task.getExecutionTime().toString() : task.getSchedule();
+            return task.getSchedule().isEmpty() ? RegionalSettings.getDateTimeFormat().format(task.getExecutionTime()) : task.getSchedule();
          case ScheduledTaskView.LAST_EXECUTION_TIME:
-            return task.getLastExecutionTime().getTime() == 0 ? "" : task.getLastExecutionTime().toString();
+            return (task.getLastExecutionTime().getTime() == 0) ? "" : RegionalSettings.getDateTimeFormat().format(task.getLastExecutionTime());
          case ScheduledTaskView.STATUS:
             return task.getStatus();
          case ScheduledTaskView.OWNER:
-            if((task.getFlags() & ScheduledTask.INTERNAL)>0)
-               return "Internal";
+            if ((task.getFlags() & ScheduledTask.INTERNAL) != 0)
+               return "system";
             AbstractUserObject user = session.findUserDBObjectById(task.getOwner());
             return (user != null) ? user.getName() : ("[" + Long.toString(task.getOwner()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
       }
       return null;
    }
-
 }
index dd3aa80..fded4b8 100644 (file)
@@ -8,6 +8,7 @@ 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.views.ScheduledTaskView;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 
@@ -25,6 +26,9 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
       wbLabelProvider = new WorkbenchLabelProvider();
    }
 
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+    */
    @Override
    public Image getColumnImage(Object element, int columnIndex)
    {
@@ -39,6 +43,9 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
       return null;
    }
    
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+    */
    @Override
    public String getColumnText(Object element, int columnIndex)
    {
@@ -51,25 +58,24 @@ public class ScheduleTableEntryLabelProvider extends LabelProvider implements IT
          case ScheduledTaskView.CALLBACK_ID:
             return task.getScheduledTaskId();
          case ScheduledTaskView.OBJECT:
-            if(task.getObjectId() == 0)
+            if (task.getObjectId() == 0)
                return "";
             AbstractObject object = session.findObjectById(task.getObjectId());
             return (object != null) ? object.getObjectName() : ("[" + Long.toString(task.getObjectId()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
          case ScheduledTaskView.PARAMETERS:
             return task.getParameters();
          case ScheduledTaskView.EXECUTION_TIME:
-            return task.getSchedule().isEmpty() ? task.getExecutionTime().toString() : task.getSchedule();
+            return task.getSchedule().isEmpty() ? RegionalSettings.getDateTimeFormat().format(task.getExecutionTime()) : task.getSchedule();
          case ScheduledTaskView.LAST_EXECUTION_TIME:
-            return task.getLastExecutionTime().getTime() == 0 ? "" : task.getLastExecutionTime().toString();
+            return (task.getLastExecutionTime().getTime() == 0) ? "" : RegionalSettings.getDateTimeFormat().format(task.getLastExecutionTime());
          case ScheduledTaskView.STATUS:
             return task.getStatus();
          case ScheduledTaskView.OWNER:
-            if((task.getFlags() & ScheduledTask.INTERNAL)>0)
-               return "Internal";
+            if ((task.getFlags() & ScheduledTask.INTERNAL) != 0)
+               return "system";
             AbstractUserObject user = session.findUserDBObjectById(task.getOwner());
             return (user != null) ? user.getName() : ("[" + Long.toString(task.getOwner()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$
       }
       return null;
    }
-
 }