Author: [log in to unmask]
Date: Wed Mar 4 15:42:55 2015
New Revision: 2247
Log:
Checkpoint work on monitoring app now that it is mostly working again.
Added:
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationActionListener.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java
Removed:
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/enums/
Modified:
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/Commands.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MenuBar.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/PlotPanel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/RunPanel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/SettingsPanel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/AbstractModel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/DialogUtil.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java
java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/Commands.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/Commands.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/Commands.java Wed Mar 4 15:42:55 2015
@@ -41,13 +41,13 @@
static final String NEXT = "next";
static final String PAUSE = "pause";
static final String PROCESSING_STAGE_CHANGED = "processingStageChanged";
- static final String RESET_PLOTS = "resetPlots";
+ static final String PLOTS_CLEAR = "resetPlots";
static final String RESTORE_DEFAULT_GUI_LAYOUT = "restoreDefaultGuiLayout";
static final String RESUME = "resume";
static final String SAVE_LAYOUT = "saveLayout";
static final String SAVE_LOG_TABLE = "saveLogTable";
- static final String SAVE_PLOTS = "savePlots";
+ static final String PLOTS_SAVE = "savePlots";
static final String SCREENSHOT = "screenshot";
static final String SELECT_LOG_FILE = "logToFile";
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java Wed Mar 4 15:42:55 2015
@@ -19,7 +19,6 @@
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -127,41 +126,37 @@
*/
public class ConnectionSettingsChangeListener implements PropertyChangeListener {
@Override
- public void propertyChange(PropertyChangeEvent evt) {
-
- System.out.println("ConnectionSettingsChangeListener.propertyChange");
- System.out.println(" src: " + evt.getSource());
- System.out.println(" propName: " + evt.getPropertyName());
- System.out.println(" oldValue: " + evt.getOldValue());
- System.out.println(" newValue: " + evt.getNewValue());
- System.out.println(" newValue: " + evt.getPropagationId());
-
- //if (evt.getSource() instanceof ConfigurationModel) {
- Object value = evt.getNewValue();
- if (evt.getPropertyName().equals(ET_NAME_PROPERTY)) {
- etNameField.setText((String) value);
- } else if (evt.getPropertyName().equals(HOST_PROPERTY)) {
- hostField.setText((String) value);
- } else if (evt.getPropertyName().equals(PORT_PROPERTY)) {
- portField.setText(value.toString());
- } else if (evt.getPropertyName().equals(BLOCKING_PROPERTY)) {
- blockingCheckBox.setSelected((Boolean) value);
- } else if (evt.getPropertyName().equals(VERBOSE_PROPERTY)) {
- verboseCheckBox.setSelected((Boolean) value);
- } else if (evt.getPropertyName().equals(STATION_NAME_PROPERTY)) {
- stationNameField.setText((String) value);
- } else if (evt.getPropertyName().equals(CHUNK_SIZE_PROPERTY)) {
- chunkSizeField.setText(value.toString());
- } else if (evt.getPropertyName().equals(QUEUE_SIZE_PROPERTY)) {
- queueSizeField.setText(value.toString());
- } else if (evt.getPropertyName().equals(STATION_POSITION_PROPERTY)) {
- stationPositionField.setText(value.toString());
- } else if (evt.getPropertyName().equals(WAIT_MODE_PROPERTY)) {
- waitModeComboBox.setSelectedItem(((Mode) value).name());
- } else if (evt.getPropertyName().equals(WAIT_TIME_PROPERTY)) {
- waitTimeField.setText(value.toString());
- } else if (evt.getPropertyName().equals(PRESCALE_PROPERTY)) {
- prescaleField.setText(value.toString());
+ public void propertyChange(PropertyChangeEvent evt) {
+ configurationModel.removePropertyChangeListener(this);
+ try {
+ Object value = evt.getNewValue();
+ if (evt.getPropertyName().equals(ET_NAME_PROPERTY)) {
+ etNameField.setText((String) value);
+ } else if (evt.getPropertyName().equals(HOST_PROPERTY)) {
+ hostField.setText((String) value);
+ } else if (evt.getPropertyName().equals(PORT_PROPERTY)) {
+ portField.setText(value.toString());
+ } else if (evt.getPropertyName().equals(BLOCKING_PROPERTY)) {
+ blockingCheckBox.setSelected((Boolean) value);
+ } else if (evt.getPropertyName().equals(VERBOSE_PROPERTY)) {
+ verboseCheckBox.setSelected((Boolean) value);
+ } else if (evt.getPropertyName().equals(STATION_NAME_PROPERTY)) {
+ stationNameField.setText((String) value);
+ } else if (evt.getPropertyName().equals(CHUNK_SIZE_PROPERTY)) {
+ chunkSizeField.setText(value.toString());
+ } else if (evt.getPropertyName().equals(QUEUE_SIZE_PROPERTY)) {
+ queueSizeField.setText(value.toString());
+ } else if (evt.getPropertyName().equals(STATION_POSITION_PROPERTY)) {
+ stationPositionField.setText(value.toString());
+ } else if (evt.getPropertyName().equals(WAIT_MODE_PROPERTY)) {
+ waitModeComboBox.setSelectedItem(((Mode) value).name());
+ } else if (evt.getPropertyName().equals(WAIT_TIME_PROPERTY)) {
+ waitTimeField.setText(value.toString());
+ } else if (evt.getPropertyName().equals(PRESCALE_PROPERTY)) {
+ prescaleField.setText(value.toString());
+ }
+ } finally {
+ configurationModel.addPropertyChangeListener(this);
}
}
}
@@ -176,12 +171,12 @@
return;
}
- System.out.println("ConnectionSettingsPanel.propertyChange");
- System.out.println(" src: " + evt.getSource());
- System.out.println(" propName: " + evt.getPropertyName());
- System.out.println(" oldValue: " + evt.getOldValue());
- System.out.println(" newValue: " + evt.getNewValue());
- System.out.println(" propValue: " + evt.getPropagationId());
+ //System.out.println("ConnectionSettingsPanel.propertyChange");
+ //System.out.println(" src: " + evt.getSource());
+ //System.out.println(" propName: " + evt.getPropertyName());
+ //System.out.println(" oldValue: " + evt.getOldValue());
+ //System.out.println(" newValue: " + evt.getNewValue());
+ //System.out.println(" propValue: " + evt.getPropagationId());
Object source = evt.getSource();
configurationModel.removePropertyChangeListener(this);
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java Wed Mar 4 15:42:55 2015
@@ -46,7 +46,6 @@
setLayout(new GridBagLayout());
// setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
- Font font = new Font("Arial", Font.PLAIN, 14);
GridBagConstraints c = new GridBagConstraints();
c.weightx = c.weighty = 1.0;
@@ -71,8 +70,10 @@
statusField.setHorizontalAlignment(JTextField.LEFT);
statusField.setEditable(false);
statusField.setBackground(Color.WHITE);
- statusField.setFont(font);
+ statusField.setFont(new Font("Arial", Font.BOLD, 16));
statusField.setMinimumSize(new Dimension(300, 50));
+ statusField.setForeground(model.getConnectionStatus().getColor());
+ statusField.setText(model.getConnectionStatus().name());
add(statusField, c);
// The "@" label.
@@ -93,30 +94,18 @@
dateField.setEditable(false);
dateField.setBackground(Color.WHITE);
dateField.setHorizontalAlignment(JTextField.LEFT);
- dateField.setFont(font);
+ dateField.setFont(new Font("Arial", Font.PLAIN, 14));
dateField.setMinimumSize(new Dimension(200, 50));
- add(dateField, c);
- }
-
- void setConnectionStatus(final ConnectionStatus status) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- statusField.setText(status.name());
- dateField.setText(dateFormat.format(new Date()));
- }
- });
+ add(dateField, c);
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(ConnectionStatusModel.CONNECTION_STATUS_PROPERTY)) {
final ConnectionStatus status = (ConnectionStatus) evt.getNewValue();
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- statusField.setText(status.name());
- dateField.setText(dateFormat.format(new Date()));
- }
- });
+ statusField.setForeground(status.getColor());
+ statusField.setText(status.name());
+ dateField.setText(dateFormat.format(new Date()));
}
}
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/DataSourceComboBox.java Wed Mar 4 15:42:55 2015
@@ -2,11 +2,14 @@
import java.awt.Dimension;
import java.awt.event.ActionListener;
-import java.io.File;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import org.hps.monitoring.application.DataSourceComboBox.DataSourceItem;
+import org.hps.monitoring.application.model.ConnectionStatusModel;
import org.hps.record.enums.DataSourceType;
/**
@@ -14,16 +17,26 @@
* @author Jeremy McCormick <[log in to unmask]>
*
*/
-public class DataSourceComboBox extends JComboBox<DataSourceItem> {
+public class DataSourceComboBox extends JComboBox<DataSourceItem> implements PropertyChangeListener {
- DataSourceComboBox(ActionListener listener) {
+ ConnectionStatusModel connectionModel;
+
+ DataSourceComboBox(ConnectionStatusModel connectionModel, ActionListener listener) {
addActionListener(listener);
setPreferredSize(new Dimension(400, this.getPreferredSize().height));
+ this.connectionModel = connectionModel;
+ connectionModel.addPropertyChangeListener(this);
+ }
+
+ public void addItem(DataSourceItem item) {
+ // Do not add duplicates.
+ if (((DefaultComboBoxModel<DataSourceItem>)getModel()).getIndexOf(item) == -1) {
+ super.addItem(item);
+ }
}
static class DataSourceItem {
- File file;
String name;
DataSourceType type;
@@ -31,14 +44,32 @@
this.type = type;
}
- DataSourceItem(File file, DataSourceType type) {
- this.file = file;
- this.name = file.getName();
- this.file = file;
- }
-
public String toString() {
return name;
- }
+ }
+
+ public boolean equals(Object object) {
+ if (!(object instanceof DataSourceItem)) {
+ return false;
+ }
+ DataSourceItem otherItem = (DataSourceItem) object;
+ if (this.name == otherItem.name && this.type == otherItem.type) return true;
+ return false;
+ }
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ConnectionStatusModel.CONNECTION_STATUS_PROPERTY)) {
+ ConnectionStatus status = (ConnectionStatus) evt.getNewValue();
+ if (status.equals(ConnectionStatus.DISCONNECTED)) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+ }
}
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java Wed Mar 4 15:42:55 2015
@@ -11,13 +11,12 @@
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
import org.hps.monitoring.application.model.ConnectionStatusModel;
/**
- * This is the panel with buttons for connecting or disconnecting and controlling the app from pause
- * mode.
+ * This is the panel with buttons for connecting or disconnecting from the session
+ * and controlling the application from pause mode.
*/
class EventButtonsPanel extends JPanel implements PropertyChangeListener {
@@ -66,46 +65,32 @@
@Override
public void propertyChange(final PropertyChangeEvent evt) {
+ System.out.println("EventButtonsPanel.propertyChange - " + evt.getPropertyName());
if (evt.getPropertyName().equals(ConnectionStatusModel.CONNECTION_STATUS_PROPERTY)) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- setConnectionStatus((ConnectionStatus) evt.getNewValue());
- }
- });
+ setConnectionStatus((ConnectionStatus) evt.getNewValue());
} else if (evt.getPropertyName().equals(ConnectionStatusModel.PAUSED_PROPERTY)) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- setPaused((boolean) evt.getNewValue());
- }
- });
+ System.out.println(" setPaused: " + (boolean) evt.getNewValue());
+ setPaused((boolean) evt.getNewValue());
}
}
void setConnectionStatus(final ConnectionStatus status) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- if (status.equals(ConnectionStatus.DISCONNECTED)) {
- nextButton.setEnabled(false);
- pauseButton.setEnabled(false);
- resumeButton.setEnabled(false);
- connectButton.setActionCommand(Commands.CONNECT);
- connectButton.setIcon(disconnectedIcon);
- } else {
- pauseButton.setEnabled(true);
- connectButton.setActionCommand(Commands.DISCONNECT);
- connectButton.setIcon(connectedIcon);
- }
- }
- });
+ if (status.equals(ConnectionStatus.DISCONNECTED)) {
+ nextButton.setEnabled(false);
+ pauseButton.setEnabled(false);
+ resumeButton.setEnabled(false);
+ connectButton.setActionCommand(Commands.CONNECT);
+ connectButton.setIcon(disconnectedIcon);
+ } else {
+ pauseButton.setEnabled(true);
+ connectButton.setActionCommand(Commands.DISCONNECT);
+ connectButton.setIcon(connectedIcon);
+ }
}
void setPaused(final boolean paused) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- resumeButton.setEnabled(paused);
- pauseButton.setEnabled(!paused);
- nextButton.setEnabled(paused);
- }
- });
+ resumeButton.setEnabled(paused);
+ pauseButton.setEnabled(!paused);
+ nextButton.setEnabled(paused);
}
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/EventProcessing.java Wed Mar 4 15:42:55 2015
@@ -1,8 +1,10 @@
package org.hps.monitoring.application;
+import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
import java.util.logging.Logger;
import org.freehep.record.loop.RecordLoop.Command;
@@ -15,6 +17,7 @@
import org.hps.record.LCSimEventBuilder;
import org.hps.record.composite.CompositeLoop;
import org.hps.record.composite.CompositeLoopConfiguration;
+import org.hps.record.composite.CompositeRecordProcessor;
import org.hps.record.composite.EventProcessingThread;
import org.hps.record.enums.DataSourceType;
import org.hps.record.evio.EvioDetectorConditionsProcessor;
@@ -29,14 +32,20 @@
*/
public class EventProcessing {
+ MonitoringApplication application;
SessionState state;
ErrorHandler errorHandler;
Logger logger;
-
- EventProcessing(SessionState state, Logger logger, ErrorHandler errorHandler) {
- this.state = state;
- this.logger = logger;
- this.errorHandler = errorHandler;
+ List<CompositeRecordProcessor> processors;
+
+ EventProcessing(
+ MonitoringApplication application,
+ List<CompositeRecordProcessor> processors) {
+ this.application = application;
+ this.state = application.sessionState;
+ this.logger = MonitoringApplication.logger;
+ this.errorHandler = application.errorHandler;
+ this.processors = processors;
}
void setup(ConfigurationModel configurationModel) {
@@ -165,18 +174,17 @@
loopConfig.add(new EtSystemStripCharts());
}
- // FIXME: Do this externally?
- // RunPanel updater.
- //loopConfig.add(frame.runPanel.new RunModelUpdater());
+ // Add extra CompositeRecordProcessors to the loop config.
+ for (CompositeRecordProcessor processor : processors) {
+ loopConfig.add(processor);
+ }
- // Setup for conditions activation via EVIO events.
+ // Enable conditions system activation from EVIO event information.
loopConfig.add(new EvioDetectorConditionsProcessor(configurationModel.getDetectorName()));
// Create the CompositeLoop with the configuration.
state.loop = new CompositeLoop(loopConfig);
}
-
-
/**
* Stop the event processing by executing a <code>STOP</code> command on the record loop and
@@ -233,13 +241,89 @@
void start() {
- // Create the processing thread.
+ // Start the event processing thread.
state.processingThread = new EventProcessingThread(state.loop);
-
- // Start the processing thread.
state.processingThread.start();
- }
-
-
-
-}
+
+ // Start the watchdog thread which will auto-disconnect when event processing is done.
+ state.sessionWatchdogThread = new SessionWatchdogThread(state.processingThread);
+ state.sessionWatchdogThread.start();
+ }
+
+ /**
+ * Notify the event processor to pause.
+ */
+ void pause() {
+ if (!application.connectionModel.getPaused()) {
+ state.loop.pause();
+ application.connectionModel.setPaused(true);
+ }
+ }
+
+ /**
+ *
+ */
+ void next() {
+ if (application.connectionModel.getPaused()) {
+ application.connectionModel.setPaused(false);
+ state.loop.execute(Command.GO_N, 1L, true);
+ application.connectionModel.setPaused(true);
+ }
+ }
+
+ /**
+ * Notify the event processor to resume processing events, if paused.
+ */
+ void resume() {
+ if (application.connectionModel.getPaused()) {
+ // Notify event processor to continue.
+ state.loop.resume();
+ application.connectionModel.setPaused(false);
+ }
+ }
+
+ void killWatchdogThread() {
+ // Is the session watchdog thread not null?
+ if (state.sessionWatchdogThread != null) {
+ // Is the thread still alive?
+ if (state.sessionWatchdogThread.isAlive()) {
+ // Interrupt the thread which should cause it to stop.
+ state.sessionWatchdogThread.interrupt();
+ try {
+ // This should always work once the thread is interrupted.
+ state.sessionWatchdogThread.join();
+ } catch (InterruptedException e) {
+ // This should never happen.
+ e.printStackTrace();
+ }
+ }
+ // Set the thread object to null.
+ state.sessionWatchdogThread = null;
+ }
+ }
+
+ class SessionWatchdogThread extends Thread {
+
+ Thread processingThread;
+
+ SessionWatchdogThread(Thread processingThread) {
+ this.processingThread = processingThread;
+ }
+
+ public void run() {
+ try {
+ // When the event processing thread finishes, the session should be stopped and a
+ // disconnect should occur.
+ processingThread.join();
+
+ // Activate a disconnect using the ActionEvent which is used by the disconnect button.
+ application.actionListener.actionPerformed(new ActionEvent(Thread.currentThread(), 0, Commands.DISCONNECT));
+
+ } catch (InterruptedException e) {
+ // This probably just means that the disconnect button was pushed, and this thread
+ // should no longer monitor the event processing.
+ e.printStackTrace();
+ }
+ }
+ }
+}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java Wed Mar 4 15:42:55 2015
@@ -1,33 +1,7 @@
package org.hps.monitoring.application;
-import static org.hps.monitoring.application.Commands.AIDA_AUTO_SAVE_CHANGED;
-import static org.hps.monitoring.application.Commands.DETECTOR_ALIAS_CHANGED;
-import static org.hps.monitoring.application.Commands.DETECTOR_NAME_CHANGED;
-import static org.hps.monitoring.application.Commands.DISCONNECT_ON_END_RUN_CHANGED;
-import static org.hps.monitoring.application.Commands.DISCONNECT_ON_ERROR_CHANGED;
-import static org.hps.monitoring.application.Commands.EVENT_BUILDER_CHANGED;
-import static org.hps.monitoring.application.Commands.FREEZE_CONDITIONS_CHANGED;
-import static org.hps.monitoring.application.Commands.LOG_LEVEL_CHANGED;
-import static org.hps.monitoring.application.Commands.LOG_TO_FILE_CHANGED;
-import static org.hps.monitoring.application.Commands.STEERING_RESOURCE_CHANGED;
-import static org.hps.monitoring.application.Commands.STEERING_TYPE_CHANGED;
-import static org.hps.monitoring.application.Commands.USER_RUN_NUMBER_CHANGED;
-import static org.hps.monitoring.application.model.ConfigurationModel.AIDA_AUTO_SAVE_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.AIDA_FILE_NAME_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.DETECTOR_ALIAS_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.DETECTOR_NAME_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.DISCONNECT_ON_END_RUN_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.DISCONNECT_ON_ERROR_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.EVENT_BUILDER_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.FREEZE_CONDITIONS_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.LOG_FILE_NAME_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.LOG_LEVEL_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.LOG_TO_FILE_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.MAX_EVENTS_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.STEERING_FILE_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.STEERING_RESOURCE_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.STEERING_TYPE_PROPERTY;
-import static org.hps.monitoring.application.model.ConfigurationModel.USER_RUN_NUMBER_PROPERTY;
+import static org.hps.monitoring.application.Commands.*;
+import static org.hps.monitoring.application.model.ConfigurationModel.*;
import java.awt.GridBagLayout;
import java.awt.Insets;
@@ -70,8 +44,6 @@
private JTextField maxEventsField;
private JCheckBox disconnectOnErrorCheckBox;
private JCheckBox disconnectOnEndRunCheckBox;
- private JTextField aidaSaveFileNameField;
- private JCheckBox aidaAutoSaveCheckbox;
private JTextField logFileNameField;
private JComboBox<?> logLevelComboBox;
private JCheckBox logToFileCheckbox;
@@ -168,13 +140,6 @@
logFileNameField = addField("Log File", "", "Full path to log file.", 30, false);
logFileNameField.addPropertyChangeListener("value", this);
-
- aidaAutoSaveCheckbox = addCheckBox("Save AIDA at End of Job", false, false);
- aidaAutoSaveCheckbox.addActionListener(this);
- aidaAutoSaveCheckbox.setActionCommand(AIDA_AUTO_SAVE_CHANGED);
-
- aidaSaveFileNameField = addField("AIDA Auto Save File Name", "", 30, false);
- aidaSaveFileNameField.addPropertyChangeListener("value", this);
}
@Override
@@ -190,26 +155,6 @@
logToFileCheckbox.addActionListener(listener);
steeringResourcesComboBox.addActionListener(listener);
freezeConditionsCheckBox.addActionListener(listener);
- }
-
- /**
- * Choose a file name for the automatic AIDA save file.
- */
- void chooseAidaAutoSaveFile() {
- JFileChooser fc = new JFileChooser();
- fc.setDialogTitle("Choose AIDA Auto Save File");
- int r = fc.showSaveDialog(this);
- if (r == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- String fileName = file.getPath();
- int extIndex = fileName.lastIndexOf(".");
- if ((extIndex == -1) || !(fileName.substring(extIndex + 1, fileName.length())).toLowerCase().equals("aida")) {
- fileName = fileName + ".aida";
- }
- final String finalFileName = fileName;
- configurationModel.setAidaAutoSave(true);
- configurationModel.setAidaFileName(finalFileName);
- }
}
/**
@@ -310,8 +255,6 @@
configurationModel.setLogToFile(logToFileCheckbox.isSelected());
} else if (LOG_LEVEL_CHANGED.equals(event.getActionCommand())) {
configurationModel.setLogLevel(Level.parse((String) logLevelComboBox.getSelectedItem()));
- } else if (AIDA_AUTO_SAVE_CHANGED.equals(event.getActionCommand())) {
- configurationModel.setAidaAutoSave(aidaAutoSaveCheckbox.isSelected());
} else if (EVENT_BUILDER_CHANGED.equals(event.getActionCommand())) {
configurationModel.setEventBuilderClassName((String) eventBuilderComboBox.getSelectedItem());
} else if (DETECTOR_NAME_CHANGED.equals(event.getActionCommand())) {
@@ -347,10 +290,6 @@
configurationModel.setSteeringFile(steeringFileField.getText());
} else if (source == logFileNameField) {
configurationModel.setLogFileName(logFileNameField.getText());
- } else if (source == aidaSaveFileNameField) {
- configurationModel.setAidaFileName(aidaSaveFileNameField.getText());
- } else if (source == aidaAutoSaveCheckbox) {
- configurationModel.setAidaAutoSave(aidaAutoSaveCheckbox.isSelected());
} else if (source == userRunNumberField) {
// Is run number being reset to null or empty?
if (userRunNumberField.getText() == null || userRunNumberField.getText().isEmpty()) {
@@ -388,12 +327,12 @@
private class JobSettingsChangeListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
- System.out.println("JobSettingsChangeListener.propertyChange");
- System.out.println(" src: " + evt.getSource());
- System.out.println(" propName: " + evt.getPropertyName());
- System.out.println(" oldValue: " + evt.getOldValue());
- System.out.println(" newValue: " + evt.getNewValue());
- System.out.println(" propId: " + evt.getPropagationId());
+ //System.out.println("JobSettingsChangeListener.propertyChange");
+ //System.out.println(" src: " + evt.getSource());
+ //System.out.println(" propName: " + evt.getPropertyName());
+ //System.out.println(" oldValue: " + evt.getOldValue());
+ //System.out.println(" newValue: " + evt.getNewValue());
+ //System.out.println(" propId: " + evt.getPropagationId());
if (evt.getSource() instanceof ConfigurationModel) {
Object value = evt.getNewValue();
configurationModel.removePropertyChangeListener(this);
@@ -402,10 +341,6 @@
detectorNameComboBox.setSelectedItem((String) value);
} else if (evt.getPropertyName().equals(DETECTOR_ALIAS_PROPERTY)) {
detectorAliasField.setText((String) value);
- } else if (evt.getPropertyName().equals(AIDA_AUTO_SAVE_PROPERTY)) {
- aidaAutoSaveCheckbox.setSelected((Boolean) value);
- } else if (evt.getPropertyName().equals(AIDA_FILE_NAME_PROPERTY)) {
- aidaSaveFileNameField.setText((String) value);
} else if (evt.getPropertyName().equals(DISCONNECT_ON_ERROR_PROPERTY)) {
disconnectOnErrorCheckBox.setSelected((Boolean) value);
} else if (evt.getPropertyName().equals(DISCONNECT_ON_END_RUN_PROPERTY)) {
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MenuBar.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MenuBar.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MenuBar.java Wed Mar 4 15:42:55 2015
@@ -1,6 +1,13 @@
package org.hps.monitoring.application;
-import static org.hps.monitoring.application.Commands.*;
+import static org.hps.monitoring.application.Commands.EXIT;
+import static org.hps.monitoring.application.Commands.OPEN_FILE;
+import static org.hps.monitoring.application.Commands.PLOTS_SAVE;
+import static org.hps.monitoring.application.Commands.PLOTS_CLEAR;
+import static org.hps.monitoring.application.Commands.SETTINGS_LOAD;
+import static org.hps.monitoring.application.Commands.SETTINGS_LOAD_DEFAULT;
+import static org.hps.monitoring.application.Commands.SETTINGS_SAVE;
+import static org.hps.monitoring.application.Commands.SETTINGS_SHOW;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
@@ -10,12 +17,7 @@
import javax.swing.JMenuItem;
public class MenuBar extends JMenuBar {
-
- //private JMenuItem savePlotsItem;
- //private JMenuItem logItem;
- //private JMenuItem terminalItem;
- //private JMenuItem saveLayoutItem;
-
+
MenuBar(ActionListener listener) {
JMenu fileMenu = new JMenu("File");
@@ -40,8 +42,8 @@
settingsMenu.setMnemonic(KeyEvent.VK_S);
add(settingsMenu);
- JMenuItem settingsItem = new JMenuItem("Show Settings ...");
- settingsItem.setMnemonic(KeyEvent.VK_P);
+ JMenuItem settingsItem = new JMenuItem("Open Settings Dialog ...");
+ settingsItem.setMnemonic(KeyEvent.VK_O);
settingsItem.setActionCommand(SETTINGS_SHOW);
settingsItem.addActionListener(listener);
settingsItem.setToolTipText("Show settings dialog");
@@ -49,7 +51,7 @@
JMenuItem loadConfigItem = new JMenuItem("Load Settings ...");
loadConfigItem.addActionListener(listener);
- loadConfigItem.setMnemonic(KeyEvent.VK_C);
+ loadConfigItem.setMnemonic(KeyEvent.VK_L);
loadConfigItem.setActionCommand(SETTINGS_LOAD);
loadConfigItem.setToolTipText("Load settings from a properties file");
settingsMenu.add(loadConfigItem);
@@ -67,34 +69,28 @@
defaultSettingsItem.setActionCommand(SETTINGS_LOAD_DEFAULT);
defaultSettingsItem.setToolTipText("Load the default settings");
settingsMenu.add(defaultSettingsItem);
-
- /*
+
JMenu plotsMenu = new JMenu("Plots");
- plotsMenu.setMnemonic(KeyEvent.VK_O);
+ plotsMenu.setMnemonic(KeyEvent.VK_P);
add(plotsMenu);
+
+ JMenuItem savePlotsItem = new JMenuItem("Save Plots ...");
+ savePlotsItem.setMnemonic(KeyEvent.VK_S);
+ savePlotsItem.setActionCommand(PLOTS_SAVE);
+ savePlotsItem.addActionListener(listener);
+ savePlotsItem.setEnabled(true);
+ savePlotsItem.setToolTipText("Save plots to AIDA file");
+ plotsMenu.add(savePlotsItem);
- JMenuItem aidaAutoSaveItem = new JMenuItem("Set AIDA Auto Save File ...");
- aidaAutoSaveItem.setMnemonic(KeyEvent.VK_A);
- aidaAutoSaveItem.setActionCommand(AIDA_AUTO_SAVE);
- //aidaAutoSaveItem.addActionListener(listener);
- aidaAutoSaveItem.setToolTipText("Select name of file to auto save AIDA plots at end of job.");
- plotsMenu.add(aidaAutoSaveItem);
-
- savePlotsItem = new JMenuItem("Save Plots to AIDA File...");
- savePlotsItem.setMnemonic(KeyEvent.VK_P);
- savePlotsItem.setActionCommand(SAVE_PLOTS);
- //savePlotsItem.addActionListener(listener);
- savePlotsItem.setEnabled(false);
- savePlotsItem.setToolTipText("Save plots from default AIDA tree to an output file.");
- plotsMenu.add(savePlotsItem);
+ JMenuItem clearPlotsItem = new JMenuItem("Clear plots");
+ clearPlotsItem.setMnemonic(KeyEvent.VK_C);
+ clearPlotsItem.setActionCommand(PLOTS_CLEAR);
+ clearPlotsItem.addActionListener(listener);
+ clearPlotsItem.setEnabled(true);
+ clearPlotsItem.setToolTipText("Clear the AIDA plots");
+ plotsMenu.add(clearPlotsItem);
- JMenuItem resetPlotsItem = new JMenuItem("Reset Plots");
- resetPlotsItem.setMnemonic(KeyEvent.VK_R);
- resetPlotsItem.setActionCommand(RESET_PLOTS);
- //resetPlotsItem.addActionListener(listener);
- resetPlotsItem.setEnabled(true);
- resetPlotsItem.setToolTipText("Reset all AIDA plots in the default tree.");
- plotsMenu.add(resetPlotsItem);
+ /*
JMenu logMenu = new JMenu("Log");
logMenu.setMnemonic(KeyEvent.VK_L);
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplication.java Wed Mar 4 15:42:55 2015
@@ -1,6 +1,5 @@
package org.hps.monitoring.application;
-import static org.hps.monitoring.application.Commands.*;
import hep.aida.jfree.AnalysisFactory;
import hep.aida.jfree.plotter.PlotterRegion;
import hep.aida.jfree.plotter.PlotterRegionListener;
@@ -9,22 +8,19 @@
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-import javax.swing.filechooser.FileNameExtensionFilter;
-
+import org.hps.monitoring.application.RunPanel.RunPanelUpdater;
import org.hps.monitoring.application.model.Configuration;
import org.hps.monitoring.application.model.ConfigurationModel;
import org.hps.monitoring.application.model.ConnectionStatusModel;
import org.hps.monitoring.application.model.RunModel;
-import org.hps.monitoring.application.util.DialogUtil;
import org.hps.monitoring.application.util.ErrorHandler;
import org.hps.monitoring.application.util.EtSystemUtil;
import org.hps.monitoring.plotting.MonitoringAnalysisFactory;
@@ -33,10 +29,16 @@
import org.hps.monitoring.subsys.SystemStatus;
import org.hps.monitoring.subsys.SystemStatusListener;
import org.hps.monitoring.subsys.SystemStatusRegistry;
+import org.hps.record.composite.CompositeRecordProcessor;
import org.hps.record.enums.DataSourceType;
import org.lcsim.util.aida.AIDA;
-public class MonitoringApplication implements PropertyChangeListener, ActionListener, SystemStatusListener {
+/**
+ *
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
+public class MonitoringApplication implements PropertyChangeListener, SystemStatusListener {
static Logger logger;
static {
@@ -47,6 +49,7 @@
ErrorHandler errorHandler;
MonitoringApplicationFrame frame;
+ ActionListener actionListener = new MonitoringApplicationActionListener(this);
RunModel runModel = new RunModel();
ConfigurationModel configurationModel = new ConfigurationModel();
@@ -56,10 +59,10 @@
EventProcessing processing;
// The default configuration resource.
- private static final String DEFAULT_CONFIGURATION = "/org/hps/monitoring/config/default_config.prop";
+ static final String DEFAULT_CONFIGURATION = "/org/hps/monitoring/config/default_config.prop";
// The application's global Configuration settings.
- private Configuration configuration;
+ Configuration configuration;
class LogHandler extends Handler {
@@ -80,10 +83,10 @@
MonitoringApplication(Configuration configuration) {
// Setup the error handler.
- this.errorHandler = new ErrorHandler(frame, logger);
-
- // Setup the main GUI component, passing it the data models and this object as the primary ActionListener.
- frame = new MonitoringApplicationFrame(configurationModel, runModel, connectionModel, this);
+ errorHandler = new ErrorHandler(frame, logger);
+
+ // Setup the main GUI component.
+ frame = new MonitoringApplicationFrame(this);
// Add this class as a listener on the configuration model.
configurationModel.addPropertyChangeListener(this);
@@ -91,7 +94,7 @@
// Setup the logger.
setupLogger();
- // Setup plotting backend and connect to the GUI.
+ // Setup AIDA plotting and connect it to the GUI.
setupAida();
// Set the configuration.
@@ -103,8 +106,8 @@
this.configuration = new Configuration(DEFAULT_CONFIGURATION);
}
- // Load the current configuration.
- loadConfiguration();
+ // Load the configuration.
+ loadConfiguration(this.configuration);
}
void setupAida() {
@@ -115,7 +118,6 @@
public void regionSelected(PlotterRegion region) {
if (region == null)
throw new RuntimeException("The region arg is null!!!");
- // System.out.println("MonitoringApplication - regionSelected - " + region.title());
frame.plotInfoPanel.setCurrentRegion(region);
}
});
@@ -142,7 +144,7 @@
// TODO Auto-generated method stub
}
- void loadConfiguration() {
+ void loadConfiguration(Configuration configuration) {
// Set the Configuration on the ConfigurationModel which will trigger all the PropertyChangelListeners.
configurationModel.setConfiguration(configuration);
@@ -153,67 +155,7 @@
//else
//logger.config("Loaded configuration from resource: " + configuration.getResourcePath());
}
-
- /**
- * Start a new monitoring session. This method is executed in a separate thread from the EDT
- * within {@link #actionPerformed(ActionEvent)} so GUI updates are not blocked while the session
- * is being setup.
- */
- void startSession() {
-
- //logger.fine("Starting a new monitoring session.");
-
- // Show a modal window that will block the GUI until connected or an error occurs.
- //JDialog dialog = DialogUtil.showStatusDialog(this, "Info", "Starting new session ...");
-
- try {
-
- // Reset the plot panel and global AIDA state.
- resetPlots();
-
- // The system status registry is cleared here before any event processors
- // which might create a SystemStatus are added to the event processing chain
- // e.g. an LCSim Driver, etc.
- SystemStatusRegistry.getSystemStatusRegistery().clear();
-
- // Setup event processing.
- sessionState = new SessionState();
- processing = new EventProcessing(sessionState, logger, errorHandler);
- processing.setup(configurationModel);
-
- // Add the dashboard updater.
- sessionState.loop.getCompositeLoopAdapters().get(0).addProcessor(frame.runPanel.new RunModelUpdater());
-
- // Setup the system status monitor table.
- setupSystemStatusMonitor();
-
- // Connect to the ET system.
- connect();
-
- // Start event processing.
- processing.start();
-
- // Start thread which will trigger a disconnect if the event processing finishes.
- //startSessionWatchdogThread();
-
- //logger.info("successfully started the monitoring session");
-
- } catch (Exception e) {
-
- //logger.severe("error occurred while setting up the session");
-
- // Log the error that occurred.
- errorHandler.setError(e).log().printStackTrace();
-
- // Disconnect from the session.
- // FIXME: This should never be needed as connected should only be set at end w/o errors.
- disconnect();
-
- } finally {
- // Close modal window.
- //dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
- }
- }
+
/**
* Connect to the ET system using the current connection settings.
@@ -275,80 +217,7 @@
// Reset plots.
frame.plotPanel.reset();
}
-
- /**
- * The action handler method for the application.
- * @param e The event to handle.
- */
- public void actionPerformed(ActionEvent e) {
-
- System.out.println("MonitoringApplication.actionPerformed - " + e.getActionCommand());
-
- String cmd = e.getActionCommand();
- if (CONNECT.equals(cmd)) {
- // Run the start session method on a separate thread.
- new Thread() {
- public void run() {
- startSession();
- }
- }.start();
- } else if (DISCONNECT.equals(cmd)) {
- // Run the stop session method on a separate thread.
- new Thread() {
- public void run() {
- stopSession();
- }
- }.start();
- } else if (SAVE_PLOTS.equals(cmd)) {
- //savePlots();
- } else if (CHOOSE_LOG_FILE.equals(cmd)) {
- //chooseLogFile();
- } else if (LOG_TO_TERMINAL.equals(cmd)) {
- //logToTerminal();
- } else if (SCREENSHOT.equals(cmd)) {
- //chooseScreenshot();
- } else if (EXIT.equals(cmd)) {
- //exit();
- } else if (SAVE_LOG_TABLE.equals(cmd)) {
- //saveLogTableToFile();
- } else if (CLEAR_LOG_TABLE.equals(cmd)) {
- //clearLogTable();
- } else if (PAUSE.equals(cmd)) {
- //pauseEventProcessing();
- } else if (NEXT.equals(cmd)) {
- //nextEvent();
- } else if (RESUME.equals(cmd)) {
- //resumeEventProcessing();
- } else if (LOG_LEVEL_CHANGED.equals(cmd)) {
- //setLogLevel();
- } else if (AIDA_AUTO_SAVE.equals(cmd)) {
- //getJobSettingsPanel().chooseAidaAutoSaveFile();
- } else if (SETTINGS_SHOW.equals(cmd)) {
- showConfigurationDialog();
- } else if (SETTINGS_LOAD.equals(cmd)) {
- //chooseConfigurationFile();
- } else if (SETTINGS_SAVE.equals(cmd)) {
- //updateLayoutConfiguration(); /* Save current GUI layout settings first, if needed. */
- //saveConfigurationFile();
- } else if (SAVE_LAYOUT.equals(cmd)) {
- //setSaveLayout();
- } else if (RESTORE_DEFAULT_GUI_LAYOUT.equals(cmd)) {
- //restoreDefaultLayout();
- } else if (VALIDATE_DATA_FILE.equals(cmd)) {
- //if (fileValidationThread == null) {
- // new FileValidationThread().start();
- //}
- } else if (RESET_PLOTS.equals(cmd)) {
- //resetAidaTree();
- } else if (SETTINGS_LOAD_DEFAULT.equals(cmd)) {
- loadDefaultSettings();
- DialogUtil.showInfoDialog(frame,
- "Default Configuration Loaded",
- "The default configuration was loaded from resource " + '\n' + DEFAULT_CONFIGURATION);
- } else if (OPEN_FILE.equals(cmd)) {
- openFile();
- }
- }
+
/**
* Disconnect from the current ET session with a particular status.
@@ -361,9 +230,6 @@
// Cleanup the ET connection.
cleanupEtConnection();
- // Update state of GUI to disconnected.
- //setDisconnectedGuiState();
-
// Change application state to disconnected.
connectionModel.setConnectionStatus(ConnectionStatus.DISCONNECTED);
@@ -374,13 +240,13 @@
* Cleanup the ET connection.
*/
void cleanupEtConnection() {
- if (sessionState.connection != null) {
- if (sessionState.connection.getEtSystem().alive()) {
- //logger.fine("cleaning up ET connection");
- sessionState.connection.cleanup();
- //logger.fine("done cleaning up tET connection");
+ if (sessionState != null) {
+ if (sessionState.connection != null) {
+ if (sessionState.connection.getEtSystem().alive()) {
+ sessionState.connection.cleanup();
+ }
+ sessionState.connection = null;
}
- sessionState.connection = null;
}
}
@@ -426,6 +292,63 @@
}
/**
+ * Start a new monitoring session. This method is executed in a separate thread from the EDT
+ * within {@link #actionPerformed(ActionEvent)} so GUI updates are not blocked while the session
+ * is being setup.
+ */
+ void startSession() {
+
+ //logger.fine("Starting a new monitoring session.");
+
+ // Show a modal window that will block the GUI until connected or an error occurs.
+ //JDialog dialog = DialogUtil.showStatusDialog(this, "Info", "Starting new session ...");
+
+ try {
+
+ // Reset the plot panel and global AIDA state.
+ resetPlots();
+
+ // The system status registry is cleared here before any event processors
+ // which might create a SystemStatus are added to the event processing chain
+ // e.g. an LCSim Driver, etc.
+ SystemStatusRegistry.getSystemStatusRegistery().clear();
+
+ // Setup event processing.
+ sessionState = new SessionState();
+ List<CompositeRecordProcessor> processors = new ArrayList<CompositeRecordProcessor>();
+ processors.add(frame.runPanel.new RunPanelUpdater());
+ processing = new EventProcessing(this, processors);
+ processing.setup(configurationModel);
+
+ // Setup the system status monitor table.
+ setupSystemStatusMonitor();
+
+ // Connect to the ET system.
+ connect();
+
+ // Start event processing.
+ processing.start();
+
+ //logger.info("successfully started the monitoring session");
+
+ } catch (Exception e) {
+
+ //logger.severe("error occurred while setting up the session");
+
+ // Log the error that occurred.
+ errorHandler.setError(e).log().printStackTrace();
+
+ // Disconnect from the session.
+ // FIXME: This should never be needed as connected should only be set at end w/o errors.
+ disconnect();
+
+ } finally {
+ // Close modal window.
+ //dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
+ }
+ }
+
+ /**
* Stop the session by killing the event processing thread, ending the job, and disconnecting
* from the ET system.
*/
@@ -438,11 +361,8 @@
//logger.log(Level.FINER, "stopping the session");
// Kill the watchdog thread which looks for disconnects, if it is active.
- //killSessionWatchdogThread();
-
- // Automatically write AIDA file from job settings.
- //saveAidaFile();
-
+ processing.killWatchdogThread();
+
// Disconnect from ET system, if using the ET server, and set the proper disconnected
// GUI state.
disconnect();
@@ -457,79 +377,14 @@
// Close modal message window.
//dialog.dispatchEvent(new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING));
}
- }
-
- void loadDefaultSettings() {
- configuration = new Configuration(DEFAULT_CONFIGURATION);
- configurationModel.setConfiguration(configuration);
- }
-
- void showConfigurationDialog() {
- frame.settingsDialog.setVisible(true);
- }
-
- /**
- * This is a simple file filter that will accept files with ".evio" anywhere in their name.
- */
- static class EvioFileFilter extends FileFilter {
-
- public EvioFileFilter() {
- }
-
- @Override
- public boolean accept(File pathname) {
- if (pathname.getName().contains(".evio") || pathname.isDirectory()) {
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public String getDescription() {
- return "EVIO files";
- }
- }
-
- /**
- * Open a file data source using a <code>JFileChooser</code>.
- */
- static FileFilter lcioFilter = new FileNameExtensionFilter("LCIO files", "slcio");
- static EvioFileFilter evioFilter = new EvioFileFilter();
- void openFile() {
- JFileChooser fc = new JFileChooser(System.getProperty("user.dir"));
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(lcioFilter);
- fc.addChoosableFileFilter(evioFilter);
- fc.setDialogTitle("Select Data File");
- int r = fc.showDialog(frame, "Select ...");
- if (r == JFileChooser.APPROVE_OPTION) {
-
- // Set data source path.
- final String filePath = fc.getSelectedFile().getPath();
- configurationModel.setDataSourcePath(filePath);
-
- // Set data source type.
- FileFilter filter = fc.getFileFilter();
- if (filter == lcioFilter) {
- configurationModel.setDataSourceType(DataSourceType.LCIO_FILE);
- } else if (filter == evioFilter) {
- configurationModel.setDataSourceType(DataSourceType.EVIO_FILE);
- }
- }
- }
-
- void saveSettings() {
- JFileChooser fc = new JFileChooser();
- fc.setDialogTitle("Save Configuration");
- fc.setCurrentDirectory(new File("."));
- int r = fc.showSaveDialog(frame);
- if (r == JFileChooser.APPROVE_OPTION) {
- File f = fc.getSelectedFile();
- //log(Level.CONFIG, "Saving configuration to file <" + f.getPath() + ">");
- configuration.writeToFile(f);
- }
- }
-
-
-}
+ }
+
+ /**
+ * Exit from the application.
+ */
+ void exit() {
+ cleanupEtConnection();
+ frame.setVisible(false);
+ System.exit(0);
+ }
+}
Added: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationActionListener.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationActionListener.java (added)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationActionListener.java Wed Mar 4 15:42:55 2015
@@ -0,0 +1,218 @@
+/**
+ *
+ */
+package org.hps.monitoring.application;
+
+import static org.hps.monitoring.application.Commands.CHOOSE_LOG_FILE;
+import static org.hps.monitoring.application.Commands.CLEAR_LOG_TABLE;
+import static org.hps.monitoring.application.Commands.CONNECT;
+import static org.hps.monitoring.application.Commands.DISCONNECT;
+import static org.hps.monitoring.application.Commands.EXIT;
+import static org.hps.monitoring.application.Commands.LOG_LEVEL_CHANGED;
+import static org.hps.monitoring.application.Commands.LOG_TO_TERMINAL;
+import static org.hps.monitoring.application.Commands.NEXT;
+import static org.hps.monitoring.application.Commands.OPEN_FILE;
+import static org.hps.monitoring.application.Commands.PAUSE;
+import static org.hps.monitoring.application.Commands.PLOTS_CLEAR;
+import static org.hps.monitoring.application.Commands.PLOTS_SAVE;
+import static org.hps.monitoring.application.Commands.RESUME;
+import static org.hps.monitoring.application.Commands.SAVE_LOG_TABLE;
+import static org.hps.monitoring.application.Commands.SCREENSHOT;
+import static org.hps.monitoring.application.Commands.SETTINGS_LOAD;
+import static org.hps.monitoring.application.Commands.SETTINGS_LOAD_DEFAULT;
+import static org.hps.monitoring.application.Commands.SETTINGS_SAVE;
+import static org.hps.monitoring.application.Commands.SETTINGS_SHOW;
+import static org.hps.monitoring.application.Commands.VALIDATE_DATA_FILE;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileNameExtensionFilter;
+
+import org.hps.monitoring.application.model.Configuration;
+import org.hps.monitoring.application.util.DialogUtil;
+import org.hps.monitoring.application.util.EvioFileFilter;
+import org.hps.record.enums.DataSourceType;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class MonitoringApplicationActionListener implements ActionListener {
+
+ MonitoringApplication application;
+
+ MonitoringApplicationActionListener(MonitoringApplication application) {
+ this.application = application;
+ }
+
+ /**
+ * The action handler method for the application.
+ * @param e The event to handle.
+ */
+ public void actionPerformed(ActionEvent e) {
+
+ String cmd = e.getActionCommand();
+ if (CONNECT.equals(cmd)) {
+ // Run the start session method on a separate thread.
+ new Thread() {
+ public void run() {
+ application.startSession();
+ }
+ }.start();
+ } else if (DISCONNECT.equals(cmd)) {
+ // Run the stop session method on a separate thread.
+ new Thread() {
+ public void run() {
+ application.stopSession();
+ }
+ }.start();
+ } else if (PLOTS_SAVE.equals(cmd)) {
+ savePlots();
+ } else if (CHOOSE_LOG_FILE.equals(cmd)) {
+ //chooseLogFile();
+ } else if (LOG_TO_TERMINAL.equals(cmd)) {
+ //logToTerminal();
+ } else if (SCREENSHOT.equals(cmd)) {
+ //chooseScreenshot();
+ } else if (EXIT.equals(cmd)) {
+ application.exit();
+ } else if (SAVE_LOG_TABLE.equals(cmd)) {
+ //saveLogTableToFile();
+ } else if (CLEAR_LOG_TABLE.equals(cmd)) {
+ //clearLogTable();
+ } else if (PAUSE.equals(cmd)) {
+ application.processing.pause();
+ } else if (NEXT.equals(cmd)) {
+ application.processing.next();
+ } else if (RESUME.equals(cmd)) {
+ application.processing.resume();
+ } else if (LOG_LEVEL_CHANGED.equals(cmd)) {
+ //setLogLevel();
+ } else if (SETTINGS_SHOW.equals(cmd)) {
+ showSettingsDialog();
+ } else if (SETTINGS_LOAD.equals(cmd)) {
+ loadSettings();
+ } else if (SETTINGS_SAVE.equals(cmd)) {
+ saveSettings();
+ } else if (VALIDATE_DATA_FILE.equals(cmd)) {
+ //if (fileValidationThread == null) {
+ // new FileValidationThread().start();
+ //}
+ } else if (PLOTS_CLEAR.equals(cmd)) {
+ clearPlots();
+ } else if (SETTINGS_LOAD_DEFAULT.equals(cmd)) {
+ loadDefaultSettings();
+ } else if (OPEN_FILE.equals(cmd)) {
+ openFile();
+ }
+ }
+
+ /**
+ *
+ */
+ void savePlots() {
+ JFileChooser fc = new JFileChooser();
+ int r = fc.showSaveDialog(application.frame);
+ if (r == JFileChooser.APPROVE_OPTION) {
+ File fileName = fc.getSelectedFile();
+ try {
+ AIDA.defaultInstance().saveAs(fileName);
+ DialogUtil.showInfoDialog(application.frame,
+ "Plots Saved",
+ "Plots were successfully saved to AIDA file.");
+ } catch (IOException e) {
+ application.errorHandler.setError(e).setMessage("Error Saving Plots").printStackTrace().log().showErrorDialog();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ void clearPlots() {
+ int confirmation = DialogUtil.showConfirmationDialog(application.frame,
+ "Are you sure you want to clear the plots", "Clear Plots Confirmation");
+ if (confirmation == JOptionPane.YES_OPTION) {
+ AIDA.defaultInstance().clearAll();
+ DialogUtil.showInfoDialog(application.frame,
+ "Plots Clear",
+ "The AIDA plots were cleared.");
+ }
+ }
+
+ void loadDefaultSettings() {
+ application.configuration = new Configuration(MonitoringApplication.DEFAULT_CONFIGURATION);
+ application.configurationModel.setConfiguration(application.configuration);
+ DialogUtil.showInfoDialog(application.frame,
+ "Default Configuration Loaded",
+ "The default configuration was loaded.");
+ }
+
+ void showSettingsDialog() {
+ application.frame.settingsDialog.setVisible(true);
+ }
+
+ /**
+ * Open a file data source using a <code>JFileChooser</code>.
+ */
+ static FileFilter lcioFilter = new FileNameExtensionFilter("LCIO files", "slcio");
+ static EvioFileFilter evioFilter = new EvioFileFilter();
+ void openFile() {
+ JFileChooser fc = new JFileChooser(System.getProperty("user.dir"));
+ fc.setAcceptAllFileFilterUsed(false);
+ fc.addChoosableFileFilter(lcioFilter);
+ fc.addChoosableFileFilter(evioFilter);
+ fc.setDialogTitle("Select Data File");
+ int r = fc.showDialog(application.frame, "Select ...");
+ if (r == JFileChooser.APPROVE_OPTION) {
+
+ // Set data source path.
+ final String filePath = fc.getSelectedFile().getPath();
+ application.configurationModel.setDataSourcePath(filePath);
+
+ // Set data source type.
+ FileFilter filter = fc.getFileFilter();
+ if (filter == lcioFilter) {
+ application.configurationModel.setDataSourceType(DataSourceType.LCIO_FILE);
+ } else if (filter == evioFilter) {
+ application.configurationModel.setDataSourceType(DataSourceType.EVIO_FILE);
+ }
+ }
+ }
+
+ void saveSettings() {
+ JFileChooser fc = new JFileChooser();
+ fc.setDialogTitle("Save Configuration");
+ fc.setCurrentDirectory(new File("."));
+ int r = fc.showSaveDialog(application.frame);
+ if (r == JFileChooser.APPROVE_OPTION) {
+ File f = fc.getSelectedFile();
+ application.configuration.writeToFile(f);
+ DialogUtil.showInfoDialog(application.frame,
+ "Settings Saved",
+ "Settings were saved successfully.");
+ }
+ }
+
+ void loadSettings() {
+ JFileChooser fc = new JFileChooser();
+ fc.setDialogTitle("Load Settings");
+ fc.setCurrentDirectory(new File("."));
+ int r = fc.showDialog(application.frame, "Load ...");
+ if (r == JFileChooser.APPROVE_OPTION) {
+ File f = fc.getSelectedFile();
+ application.configuration = new Configuration(f);
+ application.loadConfiguration(application.configuration);
+ DialogUtil.showInfoDialog(application.frame,
+ "Settings Loaded",
+ "Settings were loaded successfully.");
+ }
+ }
+
+}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/MonitoringApplicationFrame.java Wed Mar 4 15:42:55 2015
@@ -5,7 +5,6 @@
import java.awt.FlowLayout;
import java.awt.GraphicsConfiguration;
import java.awt.Rectangle;
-import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
@@ -19,9 +18,6 @@
import javax.swing.SwingConstants;
import org.hps.monitoring.application.DataSourceComboBox.DataSourceItem;
-import org.hps.monitoring.application.model.ConfigurationModel;
-import org.hps.monitoring.application.model.ConnectionStatusModel;
-import org.hps.monitoring.application.model.RunModel;
/**
*
@@ -51,10 +47,7 @@
* @param listener
*/
public MonitoringApplicationFrame(
- ConfigurationModel configurationModel,
- RunModel runModel,
- ConnectionStatusModel connectionModel,
- ActionListener listener) {
+ MonitoringApplication application) {
// Create the content panel.
JPanel contentPanel = new JPanel();
@@ -70,7 +63,7 @@
contentPanel.add(topPanel);
// Create the connection status panel.
- JPanel connectionPanel = new ConnectionStatusPanel(connectionModel);
+ JPanel connectionPanel = new ConnectionStatusPanel(application.connectionModel);
topPanel.add(connectionPanel);
// Add vertical separator.
@@ -79,7 +72,7 @@
topPanel.add(sep);
// Create the buttons panel.
- buttonsPanel = new EventButtonsPanel(connectionModel, listener);
+ buttonsPanel = new EventButtonsPanel(application.connectionModel, application.actionListener);
topPanel.add(buttonsPanel);
// Add vertical separator.
@@ -88,7 +81,7 @@
topPanel.add(sep);
// Add the data source combo box.
- JComboBox<DataSourceItem> dataSourceComboBox = new DataSourceComboBox(listener);
+ JComboBox<DataSourceItem> dataSourceComboBox = new DataSourceComboBox(application.connectionModel, application.actionListener);
topPanel.add(dataSourceComboBox);
// Create the bottom panel.
@@ -103,7 +96,7 @@
setProportionalSize(leftPanel, LEFT_PANEL_WIDTH, FULL_SIZE);
// Create the run dashboard.
- runPanel = new RunPanel(runModel);
+ runPanel = new RunPanel(application.runModel);
// Create the tabbed pane for content in bottom of left panel such as log table and system monitor.
JTabbedPane tableTabbedPane = new JTabbedPane();
@@ -129,6 +122,7 @@
// Create the plot panel.
plotPanel = new PlotPanel();
+ plotPanel.setVisible(true); // DEBUG
setProportionalSize(plotPanel, RIGHT_PANEL_WIDTH, PLOT_PANEL_HEIGHT);
// Create the right panel vertical split pane for displaying plots and their information and statistics.
@@ -142,7 +136,7 @@
bottomPanel.add(mainSplitPane, BorderLayout.CENTER);
// Create the menu bar.
- setJMenuBar(new MenuBar(listener));
+ setJMenuBar(new MenuBar(application.actionListener));
// Setup the frame now that all components have been added.
pack();
@@ -150,7 +144,7 @@
setVisible(true);
// Setup the settings dialog box.
- settingsDialog = new SettingsDialog(configurationModel, listener);
+ settingsDialog = new SettingsDialog(application.configurationModel, application.actionListener);
}
/**
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/PlotPanel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/PlotPanel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/PlotPanel.java Wed Mar 4 15:42:55 2015
@@ -1,4 +1,6 @@
package org.hps.monitoring.application;
+
+import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
@@ -8,10 +10,14 @@
* @author Jeremy McCormick <[log in to unmask]>
*/
public class PlotPanel extends JPanel {
+
private JTabbedPane plotPane;
public PlotPanel() {
+ setLayout(new BorderLayout());
plotPane = new JTabbedPane();
+ plotPane.setPreferredSize(getPreferredSize());
+ add(plotPane, BorderLayout.CENTER);
}
JTabbedPane getPlotPane() {
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/RunPanel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/RunPanel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/RunPanel.java Wed Mar 4 15:42:55 2015
@@ -101,7 +101,7 @@
this.runModel = runModel;
}
- class RunModelUpdater extends CompositeRecordProcessor {
+ class RunPanelUpdater extends CompositeRecordProcessor {
Timer timer;
@@ -117,7 +117,7 @@
class RunTimerTask extends TimerTask {
public void run() {
-
+
double tickLengthSeconds = (System.currentTimeMillis() - lastTickMillis) / (double)millis;
int elapsedTime = (int) ((System.currentTimeMillis() - jobStartMillis) / (double)millis);
double megaBytesReceived = bytesReceived / 1000000;
@@ -163,7 +163,8 @@
}
@Override
- public void process(CompositeRecord event) {
+ public void process(CompositeRecord event) {
+ // FIXME: CompositeRecord number is always -1 here.
if (event.getEvioEvent() != null) {
EvioEvent evioEvent = event.getEvioEvent();
bytesReceived += evioEvent.getTotalBytes();
@@ -259,6 +260,7 @@
*/
@Override
public void propertyChange(PropertyChangeEvent evt) {
+ //System.out.println("RunPanel.propertyChange - " + evt.getPropertyName());
Object value = evt.getNewValue();
if (RUN_NUMBER_PROPERTY.equals(evt.getPropertyName())) {
runNumberField.setValue((Integer) value);
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/SettingsPanel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/SettingsPanel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/SettingsPanel.java Wed Mar 4 15:42:55 2015
@@ -24,8 +24,6 @@
ConnectionSettingsPanel connectionPanel;
DataSourcePanel dataSourcePanel;
static final String OKAY_COMMAND = "settingsOkay";
-
- //JButton defaultsButton;
JDialog parent;
@@ -89,14 +87,5 @@
if (e.getActionCommand().equals(OKAY_COMMAND)) {
parent.setVisible(false);
}
- }
-
- /**
- * This method is used to register a listener so that the Monitoring Application can reset to
- * the default configuration when the "Defaults" button is pushed from the settings panel.
- * @param listener
- */
- //void addActionListener(ActionListener listener) {
- // defaultsButton.addActionListener(listener);
- //}
+ }
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/AbstractModel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/AbstractModel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/AbstractModel.java Wed Mar 4 15:42:55 2015
@@ -18,14 +18,9 @@
public abstract class AbstractModel {
protected PropertyChangeSupport propertyChangeSupport;
- protected boolean listenersEnabled = true;
public AbstractModel() {
propertyChangeSupport = new PropertyChangeSupport(this);
- }
-
- public void setListenersEnabled(boolean listenersEnabled) {
- this.listenersEnabled = listenersEnabled;
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
@@ -37,29 +32,17 @@
}
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
- System.out.println("AbstractModel.firePropertyChange");
- System.out.println(" propName: " + propertyName);
- System.out.println(" oldValue: " + oldValue);
- System.out.println(" newValue: " + newValue);
- if (listenersEnabled) {
- propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue);
- }
+ propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
protected void firePropertyChange(PropertyChangeEvent evt) {
- if (listenersEnabled) {
- propertyChangeSupport.firePropertyChange(evt);
- }
+ propertyChangeSupport.firePropertyChange(evt);
}
abstract public String[] getPropertyNames();
public void fireModelChanged() {
- //System.out.println("AbstractModel.fireModelChanged");
- if (!listenersEnabled)
- return;
propertyLoop: for (String property : getPropertyNames()) {
- //System.out.println(" prop = " + property);
Method getMethod = null;
for (Method method : getClass().getMethods()) {
if (method.getName().equals("get" + property)) {
@@ -77,7 +60,6 @@
throw new RuntimeException("Property " + property + " is missing a get method.", e);
} catch (InvocationTargetException e) {
// Is the cause of the problem an illegal argument to the method?
- //System.out.println("cause: " + e.getCause().getMessage());
if (e.getCause() instanceof IllegalArgumentException) {
// For this error, assume that the key itself is missing from the configuration which is a warning.
System.err.println("The key " + property + " is not set in the configuration.");
@@ -96,7 +78,6 @@
} catch (IllegalAccessException | IllegalArgumentException e) {
throw new RuntimeException(e);
}
- System.out.println();
}
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java Wed Mar 4 15:42:55 2015
@@ -17,8 +17,6 @@
Configuration configuration;
// Job setting properties.
- public static final String AIDA_AUTO_SAVE_PROPERTY = "AidaAutoSave";
- public static final String AIDA_FILE_NAME_PROPERTY = "AidaFileName";
public static final String DETECTOR_NAME_PROPERTY = "DetectorName";
public static final String DETECTOR_ALIAS_PROPERTY = "DetectorAlias";
public static final String DISCONNECT_ON_ERROR_PROPERTY = "DisconnectOnError";
@@ -52,9 +50,9 @@
public static final String WAIT_MODE_PROPERTY = "WaitMode";
public static final String WAIT_TIME_PROPERTY = "WaitTime";
public static final String PRESCALE_PROPERTY = "Prescale";
-
+
static final String[] CONFIG_PROPERTIES = AbstractModel.getPropertyNames(ConfigurationModel.class);
-
+
public ConfigurationModel() {
this.configuration = new Configuration();
}
@@ -79,10 +77,8 @@
public void setLogLevel(Level level) {
Level oldValue = getLogLevel();
- if (!oldValue.equals(level)) {
- configuration.set(LOG_LEVEL_PROPERTY, level.getName());
- firePropertyChange(LOG_LEVEL_PROPERTY, oldValue, getLogLevel());
- }
+ configuration.set(LOG_LEVEL_PROPERTY, level.getName());
+ firePropertyChange(LOG_LEVEL_PROPERTY, oldValue, getLogLevel());
}
public SteeringType getSteeringType() {
@@ -91,10 +87,8 @@
public void setSteeringType(SteeringType steeringType) {
SteeringType oldValue = getSteeringType();
- if (!steeringType.equals(oldValue)) {
- configuration.set(STEERING_TYPE_PROPERTY, steeringType.name());
- firePropertyChange(STEERING_TYPE_PROPERTY, oldValue, getSteeringType());
- }
+ configuration.set(STEERING_TYPE_PROPERTY, steeringType.name());
+ firePropertyChange(STEERING_TYPE_PROPERTY, oldValue, getSteeringType());
}
public File getSteeringFile() {
@@ -107,10 +101,8 @@
public void setSteeringFile(String steeringFile) {
File oldValue = getSteeringFile();
- if (!steeringFile.equals(oldValue)) {
- configuration.set(STEERING_FILE_PROPERTY, steeringFile);
- firePropertyChange(STEERING_FILE_PROPERTY, oldValue, getSteeringFile().getPath());
- }
+ configuration.set(STEERING_FILE_PROPERTY, steeringFile);
+ firePropertyChange(STEERING_FILE_PROPERTY, oldValue, getSteeringFile().getPath());
}
public String getSteeringResource() {
@@ -119,10 +111,8 @@
public void setSteeringResource(String steeringResource) {
String oldValue = getSteeringResource();
- if (!steeringResource.equals(oldValue)) {
- configuration.set(STEERING_RESOURCE_PROPERTY, steeringResource);
- firePropertyChange(STEERING_RESOURCE_PROPERTY, oldValue, steeringResource);
- }
+ configuration.set(STEERING_RESOURCE_PROPERTY, steeringResource);
+ firePropertyChange(STEERING_RESOURCE_PROPERTY, oldValue, steeringResource);
}
public String getDetectorName() {
@@ -131,27 +121,22 @@
public void setDetectorName(String detectorName) {
String oldValue = getDetectorName();
- if (!detectorName.equals(oldValue)) {
- configuration.set(DETECTOR_NAME_PROPERTY, detectorName);
- firePropertyChange(DETECTOR_NAME_PROPERTY, oldValue, getDetectorName());
- }
- }
-
+ configuration.set(DETECTOR_NAME_PROPERTY, detectorName);
+ firePropertyChange(DETECTOR_NAME_PROPERTY, oldValue, getDetectorName());
+ }
+
public String getDetectorAlias() {
return configuration.get(DETECTOR_ALIAS_PROPERTY);
}
-
+
public void setDetectorAlias(String detectorAlias) {
String oldValue = null;
if (hasPropertyKey(DETECTOR_ALIAS_PROPERTY)) {
oldValue = getDetectorAlias();
}
- if (!detectorAlias.equals(oldValue)) {
- configuration.set(DETECTOR_ALIAS_PROPERTY, detectorAlias);
- firePropertyChange(DETECTOR_ALIAS_PROPERTY, oldValue, getDetectorAlias());
- }
- }
-
+ configuration.set(DETECTOR_ALIAS_PROPERTY, detectorAlias);
+ firePropertyChange(DETECTOR_ALIAS_PROPERTY, oldValue, getDetectorAlias());
+ }
public String getEventBuilderClassName() {
return configuration.get(EVENT_BUILDER_PROPERTY);
@@ -159,10 +144,8 @@
public void setEventBuilderClassName(String eventBuilderClassName) {
String oldValue = getEventBuilderClassName();
- if (!eventBuilderClassName.equals(oldValue)) {
- configuration.set(EVENT_BUILDER_PROPERTY, eventBuilderClassName);
- firePropertyChange(EVENT_BUILDER_PROPERTY, oldValue, getEventBuilderClassName());
- }
+ configuration.set(EVENT_BUILDER_PROPERTY, eventBuilderClassName);
+ firePropertyChange(EVENT_BUILDER_PROPERTY, oldValue, getEventBuilderClassName());
}
public Boolean getLogToFile() {
@@ -171,10 +154,8 @@
public void setLogToFile(Boolean logToFile) {
Boolean oldValue = getLogToFile();
- if (!oldValue.equals(logToFile)) {
- configuration.set(LOG_TO_FILE_PROPERTY, logToFile);
- firePropertyChange(LOG_TO_FILE_PROPERTY, oldValue, getLogToFile());
- }
+ configuration.set(LOG_TO_FILE_PROPERTY, logToFile);
+ firePropertyChange(LOG_TO_FILE_PROPERTY, oldValue, getLogToFile());
}
public String getLogFileName() {
@@ -183,34 +164,8 @@
public void setLogFileName(String logFileName) {
String oldValue = getLogFileName();
- if (!logFileName.equals(oldValue)) {
- configuration.set(LOG_FILE_NAME_PROPERTY, logFileName);
- firePropertyChange(LOG_FILE_NAME_PROPERTY, oldValue, getLogFileName());
- }
- }
-
- public Boolean getAidaAutoSave() {
- return configuration.equals(AIDA_AUTO_SAVE_PROPERTY);
- }
-
- public void setAidaAutoSave(Boolean aidaAutoSave) {
- Boolean oldValue = getAidaAutoSave();
- if (!aidaAutoSave.equals(oldValue)) {
- configuration.set(AIDA_AUTO_SAVE_PROPERTY, aidaAutoSave);
- firePropertyChange(AIDA_AUTO_SAVE_PROPERTY, oldValue, aidaAutoSave);
- }
- }
-
- public String getAidaFileName() {
- return configuration.get(AIDA_FILE_NAME_PROPERTY);
- }
-
- public void setAidaFileName(String aidaFileName) {
- String oldValue = getAidaFileName();
- if (!aidaFileName.equals(oldValue)) {
- configuration.set(AIDA_FILE_NAME_PROPERTY, aidaFileName);
- firePropertyChange(AIDA_FILE_NAME_PROPERTY, oldValue, aidaFileName);
- }
+ configuration.set(LOG_FILE_NAME_PROPERTY, logFileName);
+ firePropertyChange(LOG_FILE_NAME_PROPERTY, oldValue, getLogFileName());
}
public Boolean getDisconnectOnError() {
@@ -219,10 +174,8 @@
public void setDisconnectOnError(Boolean disconnectOnError) {
Boolean oldValue = getDisconnectOnError();
- if (!disconnectOnError.equals(oldValue)) {
- configuration.set(DISCONNECT_ON_ERROR_PROPERTY, disconnectOnError);
- firePropertyChange(DISCONNECT_ON_ERROR_PROPERTY, oldValue, getDisconnectOnError());
- }
+ configuration.set(DISCONNECT_ON_ERROR_PROPERTY, disconnectOnError);
+ firePropertyChange(DISCONNECT_ON_ERROR_PROPERTY, oldValue, getDisconnectOnError());
}
public Boolean getDisconnectOnEndRun() {
@@ -231,10 +184,8 @@
public void setDisconnectOnEndRun(Boolean disconnectOnEndRun) {
Boolean oldValue = getDisconnectOnEndRun();
- if (!disconnectOnEndRun.equals(oldValue)) {
- configuration.set(DISCONNECT_ON_END_RUN_PROPERTY, disconnectOnEndRun);
- firePropertyChange(DISCONNECT_ON_END_RUN_PROPERTY, oldValue, getDisconnectOnEndRun());
- }
+ configuration.set(DISCONNECT_ON_END_RUN_PROPERTY, disconnectOnEndRun);
+ firePropertyChange(DISCONNECT_ON_END_RUN_PROPERTY, oldValue, getDisconnectOnEndRun());
}
public DataSourceType getDataSourceType() {
@@ -243,10 +194,8 @@
public void setDataSourceType(DataSourceType dataSourceType) {
DataSourceType oldValue = getDataSourceType();
- if (!dataSourceType.equals(oldValue)) {
- configuration.set(DATA_SOURCE_TYPE_PROPERTY, dataSourceType);
- firePropertyChange(DATA_SOURCE_TYPE_PROPERTY, oldValue, getDataSourceType());
- }
+ configuration.set(DATA_SOURCE_TYPE_PROPERTY, dataSourceType);
+ firePropertyChange(DATA_SOURCE_TYPE_PROPERTY, oldValue, getDataSourceType());
}
public String getDataSourcePath() {
@@ -255,10 +204,8 @@
public void setDataSourcePath(String dataSourcePath) {
String oldValue = getDataSourcePath();
- if (!dataSourcePath.equals(oldValue)) {
- configuration.set(DATA_SOURCE_PATH_PROPERTY, dataSourcePath);
- firePropertyChange(DATA_SOURCE_PATH_PROPERTY, oldValue, getDataSourcePath());
- }
+ configuration.set(DATA_SOURCE_PATH_PROPERTY, dataSourcePath);
+ firePropertyChange(DATA_SOURCE_PATH_PROPERTY, oldValue, getDataSourcePath());
}
public ProcessingStage getProcessingStage() {
@@ -269,10 +216,8 @@
public void setProcessingStage(ProcessingStage processingStage) {
ProcessingStage oldValue = getProcessingStage();
- if (!processingStage.equals(oldValue)) {
- configuration.set(PROCESSING_STAGE_PROPERTY, processingStage);
- firePropertyChange(PROCESSING_STAGE_PROPERTY, oldValue, getProcessingStage());
- }
+ configuration.set(PROCESSING_STAGE_PROPERTY, processingStage);
+ firePropertyChange(PROCESSING_STAGE_PROPERTY, oldValue, getProcessingStage());
}
public String getEtName() {
@@ -281,10 +226,8 @@
public void setEtName(String etName) {
String oldValue = getEtName();
- if (!etName.equals(oldValue)) {
- configuration.set(ET_NAME_PROPERTY, etName);
- firePropertyChange(ET_NAME_PROPERTY, oldValue, getEtName());
- }
+ configuration.set(ET_NAME_PROPERTY, etName);
+ firePropertyChange(ET_NAME_PROPERTY, oldValue, getEtName());
}
public String getHost() {
@@ -293,10 +236,8 @@
public void setHost(String host) {
String oldValue = getHost();
- if (!host.equals(oldValue)) {
- configuration.set(HOST_PROPERTY, host);
- firePropertyChange(HOST_PROPERTY, oldValue, getHost());
- }
+ configuration.set(HOST_PROPERTY, host);
+ firePropertyChange(HOST_PROPERTY, oldValue, getHost());
}
public Integer getPort() {
@@ -305,10 +246,8 @@
public void setPort(Integer port) {
Integer oldValue = getPort();
- if (!port.equals(oldValue)) {
- configuration.set(PORT_PROPERTY, port);
- firePropertyChange(PORT_PROPERTY, oldValue, getPort());
- }
+ configuration.set(PORT_PROPERTY, port);
+ firePropertyChange(PORT_PROPERTY, oldValue, getPort());
}
public Boolean getBlocking() {
@@ -317,10 +256,8 @@
public void setBlocking(Boolean blocking) {
Boolean oldValue = getBlocking();
- if (!blocking.equals(oldValue)) {
- configuration.set(BLOCKING_PROPERTY, blocking);
- firePropertyChange(BLOCKING_PROPERTY, oldValue, getBlocking());
- }
+ configuration.set(BLOCKING_PROPERTY, blocking);
+ firePropertyChange(BLOCKING_PROPERTY, oldValue, getBlocking());
}
public Boolean getVerbose() {
@@ -329,10 +266,8 @@
public void setVerbose(Boolean verbose) {
Boolean oldValue = getVerbose();
- if (!verbose.equals(oldValue)) {
- configuration.set(VERBOSE_PROPERTY, verbose);
- firePropertyChange(VERBOSE_PROPERTY, oldValue, getVerbose());
- }
+ configuration.set(VERBOSE_PROPERTY, verbose);
+ firePropertyChange(VERBOSE_PROPERTY, oldValue, getVerbose());
}
public String getStationName() {
@@ -341,10 +276,8 @@
public void setStationName(String stationName) {
String oldValue = getStationName();
- if (!stationName.equals(oldValue)) {
- configuration.set(STATION_NAME_PROPERTY, stationName);
- firePropertyChange(STATION_NAME_PROPERTY, oldValue, getStationName());
- }
+ configuration.set(STATION_NAME_PROPERTY, stationName);
+ firePropertyChange(STATION_NAME_PROPERTY, oldValue, getStationName());
}
public Integer getChunkSize() {
@@ -353,10 +286,8 @@
public void setChunkSize(Integer chunkSize) {
Integer oldValue = getChunkSize();
- if (!chunkSize.equals(oldValue)) {
- configuration.set(CHUNK_SIZE_PROPERTY, chunkSize);
- firePropertyChange(CHUNK_SIZE_PROPERTY, oldValue, getChunkSize());
- }
+ configuration.set(CHUNK_SIZE_PROPERTY, chunkSize);
+ firePropertyChange(CHUNK_SIZE_PROPERTY, oldValue, getChunkSize());
}
public Integer getQueueSize() {
@@ -365,10 +296,8 @@
public void setQueueSize(Integer queueSize) {
Integer oldValue = getQueueSize();
- if (!queueSize.equals(oldValue)) {
- configuration.set(QUEUE_SIZE_PROPERTY, queueSize);
- firePropertyChange(QUEUE_SIZE_PROPERTY, oldValue, getQueueSize());
- }
+ configuration.set(QUEUE_SIZE_PROPERTY, queueSize);
+ firePropertyChange(QUEUE_SIZE_PROPERTY, oldValue, getQueueSize());
}
public Integer getStationPosition() {
@@ -377,10 +306,8 @@
public void setStationPosition(Integer stationPosition) {
Integer oldValue = getStationPosition();
- if (!stationPosition.equals(oldValue)) {
- configuration.set(STATION_POSITION_PROPERTY, stationPosition);
- firePropertyChange(STATION_POSITION_PROPERTY, oldValue, getStationPosition());
- }
+ configuration.set(STATION_POSITION_PROPERTY, stationPosition);
+ firePropertyChange(STATION_POSITION_PROPERTY, oldValue, getStationPosition());
}
public Mode getWaitMode() {
@@ -389,10 +316,8 @@
public void setWaitMode(Mode waitMode) {
Mode oldValue = getWaitMode();
- if (!waitMode.equals(oldValue)) {
- configuration.set(WAIT_MODE_PROPERTY, waitMode.name());
- firePropertyChange(WAIT_MODE_PROPERTY, oldValue, getWaitMode());
- }
+ configuration.set(WAIT_MODE_PROPERTY, waitMode.name());
+ firePropertyChange(WAIT_MODE_PROPERTY, oldValue, getWaitMode());
}
public Integer getWaitTime() {
@@ -401,10 +326,8 @@
public void setWaitTime(Integer waitTime) {
Integer oldValue = getWaitTime();
- if (!waitTime.equals(oldValue)) {
- configuration.set(WAIT_TIME_PROPERTY, waitTime);
- firePropertyChange(WAIT_TIME_PROPERTY, oldValue, getWaitTime());
- }
+ configuration.set(WAIT_TIME_PROPERTY, waitTime);
+ firePropertyChange(WAIT_TIME_PROPERTY, oldValue, getWaitTime());
}
public Integer getPrescale() {
@@ -413,50 +336,42 @@
public void setPrescale(Integer prescale) {
Integer oldValue = getPrescale();
- if (!prescale.equals(oldValue)) {
- configuration.set(PRESCALE_PROPERTY, prescale);
- firePropertyChange(PRESCALE_PROPERTY, oldValue, getPrescale());
- }
- }
-
+ configuration.set(PRESCALE_PROPERTY, prescale);
+ firePropertyChange(PRESCALE_PROPERTY, oldValue, getPrescale());
+ }
+
public void setUserRunNumber(Integer userRunNumber) {
Integer oldValue = null;
if (hasPropertyKey(USER_RUN_NUMBER_PROPERTY)) {
oldValue = getUserRunNumber();
}
- if (!userRunNumber.equals(oldValue)) {
- configuration.set(USER_RUN_NUMBER_PROPERTY, userRunNumber);
- firePropertyChange(USER_RUN_NUMBER_PROPERTY, oldValue, getUserRunNumber());
- }
- }
-
+ configuration.set(USER_RUN_NUMBER_PROPERTY, userRunNumber);
+ firePropertyChange(USER_RUN_NUMBER_PROPERTY, oldValue, getUserRunNumber());
+ }
+
public Integer getUserRunNumber() {
return configuration.getInteger(USER_RUN_NUMBER_PROPERTY);
}
-
+
public void setFreezeConditions(Boolean freezeConditions) {
Boolean oldValue = null;
if (hasPropertyKey(FREEZE_CONDITIONS_PROPERTY)) {
oldValue = getFreezeConditions();
}
- if (!freezeConditions.equals(oldValue)) {
- configuration.set(FREEZE_CONDITIONS_PROPERTY, freezeConditions);
- firePropertyChange(FREEZE_CONDITIONS_PROPERTY, oldValue, freezeConditions);
- }
- }
-
+ configuration.set(FREEZE_CONDITIONS_PROPERTY, freezeConditions);
+ firePropertyChange(FREEZE_CONDITIONS_PROPERTY, oldValue, freezeConditions);
+ }
+
public Boolean getFreezeConditions() {
return configuration.getBoolean(FREEZE_CONDITIONS_PROPERTY);
}
-
+
public void setMaxEvents(Long maxEvents) {
Long oldValue = getMaxEvents();
- if (!maxEvents.equals(oldValue)) {
- configuration.set(MAX_EVENTS_PROPERTY, maxEvents);
- firePropertyChange(MAX_EVENTS_PROPERTY, oldValue, getMaxEvents());
- }
- }
-
+ configuration.set(MAX_EVENTS_PROPERTY, maxEvents);
+ firePropertyChange(MAX_EVENTS_PROPERTY, oldValue, getMaxEvents());
+ }
+
public Long getMaxEvents() {
return configuration.getLong(MAX_EVENTS_PROPERTY);
}
@@ -470,18 +385,17 @@
}
}
}
-
+
public boolean hasPropertyKey(String key) {
return configuration.hasKey(key);
}
-
+
public boolean hasValidProperty(String key) {
return configuration.hasKey(key) && configuration.get(key) != null;
}
-
+
@Override
public String[] getPropertyNames() {
return CONFIG_PROPERTIES;
}
}
-
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java Wed Mar 4 15:42:55 2015
@@ -1,16 +1,21 @@
package org.hps.monitoring.application.model;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import org.hps.monitoring.application.ConnectionStatus;
/**
+ * This model updates listeners when the connection status changes from disconnected
+ * to connected or vice versa. It will also notify when the event processing is
+ * paused.
*
* @author Jeremy McCormick <[log in to unmask]>
- *
*/
public class ConnectionStatusModel extends AbstractModel {
public static final String CONNECTION_STATUS_PROPERTY = "ConnectionStatus";
- public static final String PAUSED_PROPERTY = "ConnectionStatus";
+ public static final String PAUSED_PROPERTY = "Paused";
static final String[] propertyNames = new String[] {
CONNECTION_STATUS_PROPERTY,
@@ -29,10 +34,10 @@
}
public void setConnectionStatus(ConnectionStatus connectionStatus) {
- if (connectionStatus != this.connectionStatus) {
- ConnectionStatus oldValue = connectionStatus;
- this.connectionStatus = connectionStatus;
- firePropertyChange(CONNECTION_STATUS_PROPERTY, oldValue, this.connectionStatus);
+ ConnectionStatus oldValue = connectionStatus;
+ this.connectionStatus = connectionStatus;
+ for (PropertyChangeListener listener : propertyChangeSupport.getPropertyChangeListeners()) {
+ listener.propertyChange(new PropertyChangeEvent(this, CONNECTION_STATUS_PROPERTY, oldValue, this.connectionStatus));
}
}
@@ -41,10 +46,11 @@
}
public void setPaused(boolean paused) {
- if (paused != this.paused) {
- boolean oldValue = this.paused;
- this.paused = paused;
- firePropertyChange(PAUSED_PROPERTY, oldValue, paused);
+ System.out.println("ConnectionStatusModel.setPause - " + paused);
+ boolean oldValue = this.paused;
+ this.paused = paused;
+ for (PropertyChangeListener listener : propertyChangeSupport.getPropertyChangeListeners()) {
+ listener.propertyChange(new PropertyChangeEvent(this, PAUSED_PROPERTY, oldValue, this.paused));
}
}
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/DialogUtil.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/DialogUtil.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/DialogUtil.java Wed Mar 4 15:42:55 2015
@@ -8,8 +8,15 @@
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
-public class DialogUtil {
+public final class DialogUtil {
+ /**
+ *
+ * @param parentComponent
+ * @param title
+ * @param message
+ * @return
+ */
public static JDialog showStatusDialog(final Component parentComponent, String title, String message) {
final JOptionPane optionPane = new JOptionPane(message, JOptionPane.INFORMATION_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {}, null);
final JDialog dialog = new JDialog();
@@ -32,6 +39,12 @@
return dialog;
}
+ /**
+ *
+ * @param component
+ * @param error
+ * @param title
+ */
public static void showErrorDialog(final Component component, final Throwable error, final String title) {
final Runnable runnable = new Runnable() {
public void run() {
@@ -41,6 +54,12 @@
SwingUtilities.invokeLater(runnable);
}
+ /**
+ *
+ * @param component
+ * @param title
+ * @param message
+ */
public static void showInfoDialog(final Component component, final String title, final String message) {
final Runnable runnable = new Runnable() {
public void run() {
@@ -49,4 +68,24 @@
};
SwingUtilities.invokeLater(runnable);
}
+
+ /**
+ *
+ * @param parent
+ * @param message
+ * @param title
+ * @return
+ */
+ public static int showConfirmationDialog(final Component parent, String message, String title) {
+ Object[] options = { "Yes", "No", "Cancel" };
+ int result = JOptionPane.showOptionDialog(
+ parent,
+ message, title,
+ JOptionPane.YES_NO_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ options,
+ options[2]);
+ return result;
+ }
}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java Wed Mar 4 15:42:55 2015
@@ -24,7 +24,7 @@
* chained, where appropriate. Some methods are not available for chaining when it doesn't make
* sense. </p>
*/
-public class ErrorHandler {
+public final class ErrorHandler {
Logger logger;
Component component;
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java Wed Mar 4 15:42:55 2015
@@ -3,7 +3,7 @@
import org.hps.monitoring.application.model.ConfigurationModel;
import org.hps.record.et.EtConnection;
-public class EtSystemUtil {
+public final class EtSystemUtil {
private EtSystemUtil() {
}
Added: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java (added)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java Wed Mar 4 15:42:55 2015
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.hps.monitoring.application.util;
+
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
+/**
+ * This is a simple file filter that will accept files with ".evio" anywhere in their name.
+ */
+public final class EvioFileFilter extends FileFilter {
+
+ public EvioFileFilter() {
+ }
+
+ @Override
+ public boolean accept(File pathname) {
+ if (pathname.getName().contains(".evio") || pathname.isDirectory()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ return "EVIO files";
+ }
+}
Modified: java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java
=============================================================================
--- java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java (original)
+++ java/branches/monitoring-app-HPSJAVA-442/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java Wed Mar 4 15:42:55 2015
@@ -22,7 +22,7 @@
* @author Jeremy McCormick <[log in to unmask]>
*
*/
-public class ResourceUtil {
+public final class ResourceUtil {
private ResourceUtil() {
}
|