[Swift-commit] r7963 - trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Fri Jul 4 01:51:56 CDT 2014


Author: hategan
Date: 2014-07-04 01:51:55 -0500 (Fri, 04 Jul 2014)
New Revision: 7963

Modified:
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GanttChart.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GraphPanel.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SeriesWrapper.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SummaryPanel.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java
Log:
swing monitor updates

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GanttChart.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GanttChart.java	2014-07-04 06:49:06 UTC (rev 7962)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GanttChart.java	2014-07-04 06:51:55 UTC (rev 7963)
@@ -36,6 +36,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.TimerTask;
 
 import javax.swing.BoundedRangeModel;
 import javax.swing.JComponent;
@@ -47,7 +48,6 @@
 import javax.swing.JTable;
 import javax.swing.SpinnerNumberModel;
 import javax.swing.SwingConstants;
-import javax.swing.Timer;
 import javax.swing.UIManager;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -56,6 +56,7 @@
 
 import org.globus.cog.abstraction.interfaces.Status;
 import org.globus.cog.abstraction.interfaces.Task;
+import org.griphyn.vdl.karajan.monitor.SystemState;
 import org.griphyn.vdl.karajan.monitor.SystemStateListener;
 import org.griphyn.vdl.karajan.monitor.items.ApplicationItem;
 import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
@@ -80,13 +81,14 @@
 	private JScrollBar hsb;
 	private JSpinner scalesp;
 	private long firstEvent;
-	private Timer timer;
 	private double scale;
 	private int offset, maxX;
 	private JLabel ctime;
 	private boolean scrollVerticallyOnNextUpdate;
+	private SystemState state;
 
-	public GanttChart() {
+	public GanttChart(SystemState state) {
+	    this.state = state;
 		scale = INITIAL_SCALE;
 		jobs = new ArrayList<Job>();
 		jobmap = new HashMap<String, Job>();
@@ -127,8 +129,12 @@
 		add(createTools(), BorderLayout.NORTH);
 		add(hsb, BorderLayout.SOUTH);
 		
-		timer = new Timer(1000, this);
-		timer.start();
+		state.schedule(new TimerTask() {
+            @Override
+            public void run() {
+                GanttChart.this.actionPerformed(null);
+            }
+		}, 1000, 1000);
 	}
 	
 	private JComponent createTools() {
@@ -166,7 +172,7 @@
 
 	public void itemUpdated(SystemStateListener.UpdateType updateType, StatefulItem item) {
 		if (firstEvent == 0) {
-			firstEvent = System.currentTimeMillis();
+			firstEvent = state.getCurrentTime();
 		}
 		if (item.getItemClass().equals(StatefulItemClass.APPLICATION)) {
 			ApplicationItem ai = (ApplicationItem) item;
@@ -248,7 +254,7 @@
 
 	public void actionPerformed(ActionEvent e) {
 		if (firstEvent != 0) {
-			ctime.setText("Current time: " + (System.currentTimeMillis() - firstEvent) / 1000 + "s");
+			ctime.setText("Current time: " + (state.getCurrentTime() - firstEvent) / 1000 + "s");
 		}
 		cmodel.fireTableDataChanged();
 	}
@@ -428,7 +434,7 @@
 		public int time;
 
 		public Event(int type) {
-			this.time = (int) (System.currentTimeMillis() - firstEvent);
+			this.time = (int) (state.getCurrentTime() - firstEvent);
 			this.type = type;
 		}
 	}
@@ -541,7 +547,7 @@
 			}
 
 			if (!endcap) {
-				ex = (int) (System.currentTimeMillis() - firstEvent);
+				ex = (int) (state.getCurrentTime() - firstEvent);
 			}
 
 			g.setColor(LINE_COLOR);

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GraphPanel.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GraphPanel.java	2014-07-04 06:49:06 UTC (rev 7962)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/GraphPanel.java	2014-07-04 06:51:55 UTC (rev 7963)
@@ -58,8 +58,6 @@
 import org.jfree.chart.event.ChartChangeEvent;
 import org.jfree.chart.event.ChartChangeEventType;
 import org.jfree.chart.event.ChartChangeListener;
-import org.jfree.chart.event.PlotChangeEvent;
-import org.jfree.chart.event.PlotChangeListener;
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.data.Range;
@@ -199,7 +197,12 @@
                 enableTooltip(x);
             }
         };
-        GlobalTimer.getTimer().schedule(tooltipTimerTask, TOOLTIP_DISPLAY_DELAY);
+        try {
+            GlobalTimer.getTimer().schedule(tooltipTimerTask, TOOLTIP_DISPLAY_DELAY);
+        }
+        catch (IllegalStateException e) {
+            System.err.println(this + ": " + e.getMessage());
+        }
     }
 
     protected synchronized void disableToolTip() {

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SeriesWrapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SeriesWrapper.java	2014-07-04 06:49:06 UTC (rev 7962)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SeriesWrapper.java	2014-07-04 06:51:55 UTC (rev 7963)
@@ -221,7 +221,6 @@
         return new Second(new Date(time));
     }
 
-
     @Override
     public Class getTimePeriodClass() {
         return Second.class;

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SummaryPanel.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SummaryPanel.java	2014-07-04 06:49:06 UTC (rev 7962)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SummaryPanel.java	2014-07-04 06:51:55 UTC (rev 7963)
@@ -38,7 +38,7 @@
 
     public SummaryPanel(SystemState state) {
         this.state = state;
-        this.start = System.currentTimeMillis();
+        this.start = state.getCurrentTime();
         SpringLayout l = new SpringLayout();
         setLayout(l);
         
@@ -161,7 +161,7 @@
             }
         }
         long heapMax = state.getMaxHeap();
-        long heapCrt = state.getCurrentHeap();
+        long heapCrt = state.getUsedHeap();
         memory.setMaximum((int) (heapMax / 1000000));
         memory.setValue((int) (heapCrt / 1000000));
         memory.setString(state.getCurrentHeapFormatted() + " / " + state.getMaxHeapFormatted());

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java	2014-07-04 06:49:06 UTC (rev 7962)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java	2014-07-04 06:51:55 UTC (rev 7963)
@@ -156,7 +156,7 @@
 		tablemap.put(StatefulItemClass.TASK, tasks);
 		tabs.add("Tasks", (Component) tasks);
 		
-		gantt = new GanttChart();
+		gantt = new GanttChart(getState());
 		tabs.add("Gantt Chart", gantt);
 		
 	}




More information about the Swift-commit mailing list