Author: [log in to unmask]
Date: Tue May 12 03:13:41 2015
New Revision: 2958
Log:
use clear/replot to update plot ranges
Modified:
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java
java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java
java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java
Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java
=============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java (original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java Tue May 12 03:13:41 2015
@@ -4,17 +4,24 @@
package org.hps.monitoring.application;
import java.awt.BorderLayout;
+import java.awt.Toolkit;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import org.hps.monitoring.application.SystemStatusEventsTable.SystemStatusEventsTableModel;
+import org.hps.monitoring.subsys.StatusCode;
import org.hps.monitoring.subsys.SystemStatus;
/**
- * This is a panel showing the two tables for viewing the system statuses, one showing the current state of all system
- * status monitors and the other with all system status change events.
+ * This is a panel showing the two tables for viewing the system statuses, one
+ * showing the current state of all system status monitors and the other with
+ * all system status change events.
*
* @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
*/
@@ -32,6 +39,13 @@
private final SystemStatusTable statusTable = new SystemStatusTable();
/**
+ * The list of statuses to check.
+ */
+ private final List<SystemStatus> statuses = new ArrayList<SystemStatus>();
+
+ private final Timer timer = new Timer("System Status Beeper");
+
+ /**
* Class constructor.
*/
SystemStatusPanel() {
@@ -40,6 +54,7 @@
new JScrollPane(this.eventsTable));
splitPane.setDividerLocation(150);
this.add(splitPane, BorderLayout.CENTER);
+ timer.scheduleAtFixedRate(new SystemStatusBeeper(), 0, 1000);
}
/**
@@ -51,6 +66,7 @@
// Register listeners of table models on this status.
this.statusTable.getTableModel().addSystemStatus(status);
this.eventsTable.getSystemStatusEventsTableModel().addSystemStatus(status);
+ this.statuses.add(status);
}
/**
@@ -63,4 +79,20 @@
// Clear the system status events table.
((SystemStatusEventsTableModel) this.eventsTable.getModel()).clear();
}
+
+ private class SystemStatusBeeper extends TimerTask {
+
+ @Override
+ public void run() {
+ boolean isAlarming = false;
+ for (SystemStatus status : statuses) {
+ if (status.getStatusCode() == StatusCode.ALARM) {
+ isAlarming = true;
+ }
+ }
+ if (isAlarming) {
+ System.out.println("beep\007");
+ }
+ }
+ }
}
Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java
=============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java (original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java Tue May 12 03:13:41 2015
@@ -528,17 +528,17 @@
maxSampleStatus.setStatus(StatusCode.ALARM, "Sensor " + sensor.getName() + " looks out of time.");
}
IPlotterStyle plotterStyle = createOccupancyPlotStyle("Max Sample Number", sensor, true);
-// region.clear();
-// region.plot(maxSamplePlot, plotterStyle);
- region.applyStyle(plotterStyle);
+ region.clear();
+ region.plot(maxSamplePlot, plotterStyle);
+// region.applyStyle(plotterStyle);
// region.style().regionBoxStyle().backgroundStyle().setColor("246, 34, 34, 1");
// setBackgroundColor(region.style(),sensor.isAxial(),true);
} else {
IPlotterStyle plotterStyle = createOccupancyPlotStyle("Max Sample Number", sensor, false);
-// region.clear();
-// region.plot(maxSamplePlot, plotterStyle);
- region.applyStyle(plotterStyle);
+ region.clear();
+ region.plot(maxSamplePlot, plotterStyle);
+// region.applyStyle(plotterStyle);
// setBackgroundColor(region.style(),sensor.isAxial(),false);
}
}
@@ -572,11 +572,15 @@
occupancyStatus.setStatus(StatusCode.ALARM, "Sensor " + sensor.getName() + " occupancy abnormal.");
}
IPlotterStyle plotterStyle = createOccupancyPlotStyle("Max Sample Number", sensor, true);
- region.applyStyle(plotterStyle);
+ region.clear();
+ region.plot(occupancyPlot, plotterStyle);
+// region.applyStyle(plotterStyle);
} else {
IPlotterStyle plotterStyle = createOccupancyPlotStyle("Max Sample Number", sensor, false);
- region.applyStyle(plotterStyle);
+ region.clear();
+ region.plot(occupancyPlot, plotterStyle);
+// region.applyStyle(plotterStyle);
}
}
if (isSystemOK) {
Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java
=============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java (original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalMonitoringPlots.java Tue May 12 03:13:41 2015
@@ -166,10 +166,10 @@
//System.out.println("Event: "+thisEventN+" "+prevEventN);
//System.out.println("Time: "+thisEventTime+" "+prevEventTime);
// System.out.println("Monitor: "+thisTime+" "+prevTime+" "+NoccupancyFill);
-
+if (scale>0) {
hitCountFillPlot.scale(scale);
clusterCountFillPlot.scale(scale);
- redraw();
+ redraw();}
prevTime=thisTime;
prevEventN=thisEventN;
prevEventTime=thisEventTime;
@@ -186,15 +186,15 @@
void redraw() {
hitCountDrawPlot.reset();
hitCountDrawPlot.add(hitCountFillPlot);
-// plotter.region(0).clear();
-// plotter.region(0).plot(hitCountDrawPlot);
+ plotter.region(0).clear();
+ plotter.region(0).plot(hitCountDrawPlot);
// plotter.region(0).refresh();
hitCountFillPlot.reset();
clusterCountDrawPlot.reset();
clusterCountDrawPlot.add(clusterCountFillPlot);
-// plotter.region(1).clear();
-// plotter.region(1).plot(clusterCountDrawPlot);
+ plotter.region(1).clear();
+ plotter.region(1).plot(clusterCountDrawPlot);
// plotter.region(1).refresh();
clusterCountFillPlot.reset();
@@ -208,8 +208,8 @@
if ((row != 0) && (column != 0) && (!EcalMonitoringUtilities.isInHole(row, column)))
occupancyDrawPlot.fill(column, row, mean);
}
-// plotter.region(2).clear();
-// if (occupancyDrawPlot.sumAllBinHeights()> 0) plotter.region(2).plot(occupancyDrawPlot);
+ plotter.region(2).clear();
+ if (occupancyDrawPlot.sumAllBinHeights()> 0) plotter.region(2).plot(occupancyDrawPlot);
// plotter.region(2).refresh();
}
|