Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/monitoring on MAIN
ConnectionPanel.java+1-121.14 -> 1.15
MonitoringApplication.java+32-71.20 -> 1.21
+33-19
2 modified files
add user@hostname to title of monitoring app; disallow close on X so that user must use exit menu item to trigger connection cleanup

hps-java/src/main/java/org/lcsim/hps/monitoring
ConnectionPanel.java 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- ConnectionPanel.java	18 Apr 2012 21:06:54 -0000	1.14
+++ ConnectionPanel.java	19 Apr 2012 01:34:27 -0000	1.15
@@ -39,9 +39,6 @@
     
     private ConnectionParameters connectionParameters;
 
-    //private boolean connectRequested = false;    
-    //private boolean disconnectRequested = false;
-
     static final String[] waitModes = { 
         Mode.SLEEP.toString(), 
         Mode.TIMED.toString(), 
@@ -298,10 +295,7 @@
             mode = Mode.ASYNC;
         } else if (Mode.SLEEP.toString().equalsIgnoreCase(sel)) {
             mode = Mode.SLEEP;
-            // Values are constrained by combo box so shouldn't happen but check anyways.
-        } else {
-            throw new RuntimeException("Invalid wait mode.");
-        }
+        } 
         return mode;
     }
 
@@ -348,11 +342,6 @@
         prescaleField.setEnabled(e);
     }
 
-    // FIXME: Move the event handling to MonitoringApplication.
-    public void actionPerformed(ActionEvent e) {
-        
-    }
-
     void save() {
         JFileChooser fc = new JFileChooser();
         int r = fc.showSaveDialog(ConnectionPanel.this);

hps-java/src/main/java/org/lcsim/hps/monitoring
MonitoringApplication.java 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- MonitoringApplication.java	18 Apr 2012 21:06:54 -0000	1.20
+++ MonitoringApplication.java	19 Apr 2012 01:34:27 -0000	1.21
@@ -31,6 +31,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.net.InetAddress;
 import java.nio.ByteBuffer;
 
 import javax.imageio.ImageIO;
@@ -67,10 +68,8 @@
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  */
-// TODO: Move the parts of this class having to do with EtEvent/EvioEvent/LCSimEvent to separate classes.
+// TODO: Move the parts of this class having to do with processing Et/Evio/LCSim events to a separate class.
 // TODO: Move the Swing parts of this class to MonitoringGui class.
-// TODO: Should have Timer to update elapsed time field independent of event processing.
-//       http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Timer.html
 public class MonitoringApplication {
     
     private JPanel mainPanel;
@@ -360,12 +359,13 @@
 	 */
 	private void createApplicationFrame() {
 	    mainPanel.setOpaque(true);
-        JFrame frame = new JFrame("HPS Monitoring");
+	    
+        JFrame frame = new JFrame(getApplicationTitle());
         frame.setContentPane(mainPanel);
         frame.setJMenuBar(menuBar);
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        //frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); 
-        frame.setResizable(false);                       
+        //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+        frame.setResizable(false);
         frame.pack();
         frame.setVisible(true);
     }
@@ -382,6 +382,28 @@
             }
         }
     }
+	
+	private static String getApplicationTitle() {
+	    return "HPS Monitoring - " + getUserName() + "@"+ getHostname();
+	}
+	
+	private static String getHostname() {
+	    try {
+	        return InetAddress.getLocalHost().getHostName();
+	    }
+	    catch (Exception e) {
+	        return "UNKNOWN_HOST";
+	    }
+	}
+	
+	private static String getUserName() {
+	    if (System.getProperty("user.name") == null) {
+	        return "NO_ONE";
+	    } 
+	    else {
+	        return System.getProperty("user.name");
+	    }
+	}
 
     // FIXME: Put this in JobManager???
 	private synchronized void resetDrivers() {
@@ -887,5 +909,8 @@
     private void resetJob() {
         jobStartTime = System.currentTimeMillis();
         eventPanel.reset();
+        if (getConnectionStatus() == ConnectionStatus.DISCONNECTED) {
+            eventPanel.resetSessionSupplied();
+        }
     }
 }
\ No newline at end of file
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1