Commit in hps-java/src/main/java/org/lcsim/hps/monitoring on MAIN | |||
JobPanel.java | +35 | -8 | 1.3 -> 1.4 |
MonitoringApplication.java | +27 | -8 | 1.13 -> 1.14 |
+62 | -16 |
add field to optionally pop up a dialog before disconnect so plots don't suddenly disappear
diff -u -r1.3 -r1.4 --- JobPanel.java 4 Apr 2012 23:26:07 -0000 1.3 +++ JobPanel.java 16 Apr 2012 23:13:37 -0000 1.4 @@ -1,5 +1,7 @@
package org.lcsim.hps.monitoring;
+import static org.lcsim.hps.monitoring.MonitoringCommands.warnOnDisconnectCmd; +
import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout;
@@ -7,7 +9,6 @@
import java.awt.event.ActionListener; import java.io.File; import java.io.InputStream;
-import java.io.PrintStream;
import javax.swing.JCheckBox; import javax.swing.JComboBox;
@@ -25,6 +26,7 @@
JTextField eventBuilderField; JCheckBox logCheckBox; JTextField logFileField;
+ JCheckBox disconnectWarningCheckBox;
String defaultEventBuilderClassName = "";
@@ -32,7 +34,7 @@
final static int RESOURCE = 0; final static int FILE = 1; final static int NONE = 2;
-
+
JobPanel() { setLayout(new GridBagLayout());
@@ -147,12 +149,32 @@
logFileField.setEditable(false); logFileField.setBackground(Color.WHITE); add(logFileField, c);
+ + c = new GridBagConstraints(); + c.gridx = 0; + c.gridy = 6; + c.anchor = GridBagConstraints.WEST; + JLabel disconnectWarningLabel = new JLabel("Warn before disconnect:"); + disconnectWarningLabel.setHorizontalAlignment(JLabel.LEFT); + disconnectWarningLabel.setToolTipText("Whether or not to warn with a dialog box before disconnect."); + add(disconnectWarningLabel, c); + + c = new GridBagConstraints(); + c.gridx = 1; + c.gridy = 6; + c.anchor = GridBagConstraints.EAST; + disconnectWarningCheckBox = new JCheckBox(); + disconnectWarningCheckBox.setSelected(false); + disconnectWarningCheckBox.addActionListener(this); + disconnectWarningCheckBox.setActionCommand(warnOnDisconnectCmd); + add(disconnectWarningCheckBox, c);
} public void actionPerformed(ActionEvent e) { if (MonitoringCommands.steeringCmd == e.getActionCommand()) { editSteering();
- } else if (MonitoringCommands.eventBuilderCmd == e.getActionCommand()) {
+ } + else if (MonitoringCommands.eventBuilderCmd == e.getActionCommand()) {
editEventBuilder(); } }
@@ -167,14 +189,16 @@
JOptionPane.showMessageDialog(this, "The LCSim steering resource does not exist."); disableSteering(); }
- } else if (FILE == steeringType) {
+ } + else if (FILE == steeringType) {
// Check that steering file exists. File f = new File(steering); if (!f.exists()) { JOptionPane.showMessageDialog(this, "The LCSim steering file does not exist."); disableSteering(); }
- } else if (NONE == steeringType) {
+ } + else if (NONE == steeringType) {
if (!("".equals(steeringField.getText().trim()))) { JOptionPane.showMessageDialog(this, "Select resource or file type in above combo box to enable LCSim."); }
@@ -192,13 +216,16 @@
// Test that the event builder class can be created successfully. Class eventBuilderClass = Class.forName(eventBuilderClassName); eventBuilderClass.newInstance();
- } catch (ClassNotFoundException e) {
+ } + catch (ClassNotFoundException e) {
JOptionPane.showMessageDialog(this, "Event builder class does not exist."); resetEventBuilder();
- } catch (InstantiationException e) {
+ } + catch (InstantiationException e) {
JOptionPane.showMessageDialog(this, "Failed to instantiate instance of event builder class."); resetEventBuilder();
- } catch (IllegalAccessException e) {
+ } + catch (IllegalAccessException e) {
JOptionPane.showMessageDialog(this, "Couldn't access event builder class."); resetEventBuilder(); }
diff -u -r1.13 -r1.14 --- MonitoringApplication.java 13 Apr 2012 00:56:42 -0000 1.13 +++ MonitoringApplication.java 16 Apr 2012 23:13:37 -0000 1.14 @@ -2,6 +2,7 @@
import static org.lcsim.hps.monitoring.MonitoringCommands.connectCmd; import static org.lcsim.hps.monitoring.MonitoringCommands.disconnectCmd;
+import static org.lcsim.hps.monitoring.MonitoringCommands.eventRefreshCmd;
import static org.lcsim.hps.monitoring.MonitoringCommands.exitCmd; import static org.lcsim.hps.monitoring.MonitoringCommands.loadConnectionCmd; import static org.lcsim.hps.monitoring.MonitoringCommands.logCmd;
@@ -12,7 +13,7 @@
import static org.lcsim.hps.monitoring.MonitoringCommands.savePlotsCmd; import static org.lcsim.hps.monitoring.MonitoringCommands.screenshotCmd; import static org.lcsim.hps.monitoring.MonitoringCommands.terminalCmd;
-import static org.lcsim.hps.monitoring.MonitoringCommands.eventRefreshCmd;
+//import static org.lcsim.hps.monitoring.MonitoringCommands.warnOnDisconnectCmd;
import java.awt.AWTException; import java.awt.Dimension;
@@ -437,7 +438,7 @@
showDialog("The value " + inputValue + " is not valid for this field."); } }
-
+
private void setDisconnectedGuiState() { // Enable or disable appropriate menu items.
@@ -601,16 +602,34 @@
private ConnectionParameters getConnectionParameters() { return connectionPanel.getConnectionParameters(); }
+ + private boolean warnOnDisconnect() { + return jobPanel.disconnectWarningCheckBox.isSelected(); + }
- // Method for disconnecting cleanly from the ET server and LCSim.
+ /* + * Disconnect cleanly from an ET session. + */
synchronized private void disconnect(int status) {
+ + System.out.println("disconnecting..."); + + // Show a warning dialog box before disconnecting, if this option is selected. + if (warnOnDisconnect()) { + showDialog("You are about to be disconnected."); + } + + // Set the application status from caller.
setConnectionStatus(status);
+ + // Stop the LCSim job.
try {
- // Stop the LCSim job.
stopJob(); } catch (Exception e) { e.printStackTrace(); }
+ + // Disconnect from the ET system.
if (connection != null) { // Disconnect from ET system.
@@ -621,7 +640,11 @@
sys = null; att = null; }
+ + // Update state of GUI to disconnected.
setDisconnectedGuiState();
+ + // Finally, change application state to fully disconnected.
setConnectionStatus(ConnectionStatus.DISCONNECTED); }
@@ -746,10 +769,6 @@
final String defaultSteering = "/org/lcsim/hps/steering/TestRunMonitoring.lcsim"; final String defaultEventBuilder = LCSimTestRunEventBuilder.class.getCanonicalName();
- // Settings for old MC format. - //final String defaultSteering = "/org/lcsim/hps/steering/MCMonitoring.lcsim"; - //final String defaultEventBuilder = MCEventBuilder.class.getCanonicalName(); -
// Push default settings to JobPanel. app.setJobParameters(new JobParameters(new String[] {defaultDetectorName, defaultSteering, defaultEventBuilder})); app.run();
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