5 modified files
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/DataSourcePanel.java 2014-08-18 19:29:35 UTC (rev 865)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/DataSourcePanel.java 2014-08-18 19:55:31 UTC (rev 866)
@@ -1,7 +1,8 @@
package org.hps.monitoring.gui;
-import static org.hps.monitoring.gui.Commands.*;
-import static org.hps.monitoring.gui.model.ConfigurationModel.*;
+import static org.hps.monitoring.gui.Commands.DATA_SOURCE_TYPE_CHANGED;
+import static org.hps.monitoring.gui.model.ConfigurationModel.DATA_SOURCE_PATH_PROPERTY;
+import static org.hps.monitoring.gui.model.ConfigurationModel.DATA_SOURCE_TYPE_PROPERTY;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
@@ -36,27 +37,30 @@
DataSourcePanel() {
setLayout(new GridBagLayout());
+
dataSourceTypeComboBox = addComboBox("Data Source", dataSourceTypes);
dataSourceTypeComboBox.setSelectedIndex(0);
dataSourceTypeComboBox.setActionCommand(DATA_SOURCE_TYPE_CHANGED);
dataSourceTypeComboBox.addActionListener(this);
dataSourcePathField = addField("Data Source Path", 40);
- dataSourcePathField.setEditable(false);
- dataSourcePathField.addPropertyChangeListener("value", this);
+ //dataSourcePathField.setEditable(false);
+ //dataSourcePathField.addPropertyChangeListener("value", this);
+ dataSourcePathField.addPropertyChangeListener(this);
+ //dataSourcePathField.addPropertyChangeListener(new DummyPropertyChangeListener());
+ //dataSourcePathField.addPropertyChangeListener("value", new DummyPropertyChangeListener());
}
+
+ /*
+ class DummyPropertyChangeListener implements PropertyChangeListener {
- /*
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals(DATA_SOURCE_COMMAND)) {
- int selectedIndex = dataSourceCombo.getSelectedIndex();
- DataSourceType dataSourceType = DataSourceType.values()[selectedIndex];
- if (dataSourceType.isFile()) {
- chooseFile();
- } else {
- setFilePath("");
- }
- }
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ System.out.println("DummyPropertyChangeListener.propertyChange");
+ System.out.println(" source: " + evt.getSource());
+ System.out.println(" name: " + evt.getPropertyName());
+ System.out.println(" value: " + evt.getNewValue());
+ }
}
*/
@@ -68,38 +72,21 @@
if (r == JFileChooser.APPROVE_OPTION) {
file = fc.getSelectedFile();
final String filePath = file.getPath();
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- dataSourcePathField.setText(filePath);
- }
- });
+
+ // This will cause the GUI to be updated via a PropertyChangeListener.
+ configurationModel.setDataSourcePath(filePath);
}
}
-
- /*
- void checkFile() throws IOException {
- DataSourceType dataSourceType = DataSourceType.values()[this.dataSourceTypeComboBox.getSelectedIndex()];
- if (!dataSourceType.isFile())
- return;
- File file = new File(dataSourcePathField.getText());
- if (!file.exists()) {
- throw new IOException("File " + file + " does not exist!");
- }
- if (dataSourceType.equals(DataSourceType.EVIO_FILE)) {
- try {
- new EvioReader(file, false, false);
- } catch (EvioException e) {
- throw new IOException("Error with EVIO file.", e);
- }
- } else if (dataSourceType.equals(DataSourceType.LCIO_FILE)) {
- new LCIOReader(file);
- }
- }
- */
-
+
@Override
public void setConfigurationModel(ConfigurationModel configurationModel) {
this.configurationModel = configurationModel;
+
+ // This listener pushes GUI values into the configuration.
+ this.configurationModel.addPropertyChangeListener(this);
+
+ // This listener updates the GUI from changes in the configuration.
+ this.configurationModel.addPropertyChangeListener(new DataSourceChangeListener());
}
@Override
@@ -118,16 +105,8 @@
}
}
- /**
- * Updates the configuration with changes from the GUI component values.
- * The changes from the GUI are distinguishable by their component object.
- */
- @Override
public void propertyChange(PropertyChangeEvent evt) {
- if (dataSourcePathField.equals(evt.getSource())) {
- configurationModel.setDataSourcePath(dataSourcePathField.getText());
- }
- }
+ }
/**
* Update the GUI from changes in the underlying configuration.
@@ -137,6 +116,15 @@
public class DataSourceChangeListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
+
+ // FIXME: Anyway to make sure this is not needed?
+ if (evt.getPropertyName().equals("ancestor"))
+ return;
+
+ //System.out.println("DataSourceChangeListener.propertyChange");
+ //System.out.println(" source: " + evt.getSource());
+ //System.out.println(" name: " + evt.getPropertyName());
+ //System.out.println(" value: " + evt.getNewValue());
Object value = evt.getNewValue();
if (DATA_SOURCE_TYPE_PROPERTY.equals(evt.getPropertyName())) {
dataSourceTypeComboBox.setSelectedItem(value.toString());
@@ -144,5 +132,26 @@
dataSourcePathField.setText((String) value);
}
}
- }
+ }
+
+ /*
+ void checkFile() throws IOException {
+ DataSourceType dataSourceType = DataSourceType.values()[this.dataSourceTypeComboBox.getSelectedIndex()];
+ if (!dataSourceType.isFile())
+ return;
+ File file = new File(dataSourcePathField.getText());
+ if (!file.exists()) {
+ throw new IOException("File " + file + " does not exist!");
+ }
+ if (dataSourceType.equals(DataSourceType.EVIO_FILE)) {
+ try {
+ new EvioReader(file, false, false);
+ } catch (EvioException e) {
+ throw new IOException("Error with EVIO file.", e);
+ }
+ } else if (dataSourceType.equals(DataSourceType.LCIO_FILE)) {
+ new LCIOReader(file);
+ }
+ }
+ */
}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java 2014-08-18 19:29:35 UTC (rev 865)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java 2014-08-18 19:55:31 UTC (rev 866)
@@ -1142,8 +1142,9 @@
configuration.setStopOnErrors(true);
configuration.setDataSourceType(configurationModel.getDataSourceType());
- configuration.setEtConnection(connection);
+ configuration.setEtConnection(connection);
configuration.setFilePath(configurationModel.getDataSourcePath());
+ System.out.println("dataSourcePath: " + configurationModel.getDataSourcePath());
configuration.setLCSimEventBuild(eventBuilder);
configuration.setDetectorName(configurationModel.getDetectorName());
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/RunPanel.java 2014-08-18 19:29:35 UTC (rev 865)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/RunPanel.java 2014-08-18 19:55:31 UTC (rev 866)
@@ -25,8 +25,7 @@
* Dashboard for displaying information about the current run.
* @author Jeremy McCormick <[log in to unmask]>
*/
-// FIXME: Add current EVIO event number, current event sequence number, job start date,
-// and job end date fields.
+// FIXME: Add current event sequence number, job start date, and job end date fields.
public class RunPanel extends JPanel implements PropertyChangeListener {
FieldPanel runNumberField = new FieldPanel("Run Number", "", 10, false);
@@ -37,6 +36,7 @@
FieldPanel elapsedTimeField = new FieldPanel("Elapsed Time [sec]", "", 14, false);
FieldPanel eventsReceivedField = new FieldPanel("Events Received", "", 14, false);
FieldPanel dataReceivedField = new FieldPanel("Data Received [bytes]", "", 14, false);
+ FieldPanel eventNumberField = new FieldPanel("Event Number", "", 14, false);
Timer timer;
long jobStartMillis;
@@ -61,6 +61,7 @@
add(elapsedTimeField);
add(eventsReceivedField);
add(dataReceivedField);
+ add(eventNumberField);
this.setMinimumSize(new Dimension(0, 190));
}
@@ -92,16 +93,19 @@
@Override
public void processEvent(CompositeRecord event) {
- model.incrementEventsReceived();
+ model.incrementEventsReceived();
EvioEvent evioEvent = event.getEvioEvent();
if (evioEvent != null) {
model.addDataReceived((long)evioEvent.getTotalBytes());
+ model.setEventNumber(evioEvent.getEventNumber());
if (EventConstants.isPreStartEvent(evioEvent)) {
startRun(evioEvent);
} else if (EventConstants.isEndEvent(evioEvent)) {
endRun(evioEvent);
}
- }
+ } else if (event.getLcioEvent() != null) {
+ model.setEventNumber(event.getLcioEvent().getEventNumber());
+ }
}
private void endRun(EvioEvent evioEvent) {
@@ -163,6 +167,8 @@
this.elapsedTimeField.setValue((Integer) value);
} else if (DATA_RECEIVED_PROPERTY.equals(evt.getPropertyName())) {
this.dataReceivedField.setValue((Long) value);
- }
+ } else if (EVENT_NUMBER_PROPERTY.equals(evt.getPropertyName())) {
+ this.eventNumberField.setValue((Integer) value);
+ }
}
}
\ No newline at end of file
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/RunModel.java 2014-08-18 19:29:35 UTC (rev 865)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/RunModel.java 2014-08-18 19:55:31 UTC (rev 866)
@@ -15,6 +15,7 @@
public final static String EVENTS_RECEIVED_PROPERTY = "EventsReceived"; // events received so far
public final static String ELAPSED_TIME_PROPERTY = "ElapsedTime"; // updated on the fly, in seconds
public final static String DATA_RECEIVED_PROPERTY = "DataReceived"; // updated on the fly, in bytes
+ public final static String EVENT_NUMBER_PROPERTY = "EventNumber"; // current event number
static final String[] properties = new String[] {
RUN_NUMBER_PROPERTY,
@@ -23,7 +24,8 @@
RUN_LENGTH_PROPERTY,
TOTAL_EVENTS_PROPERTY,
ELAPSED_TIME_PROPERTY,
- DATA_RECEIVED_PROPERTY
+ DATA_RECEIVED_PROPERTY,
+ EVENT_NUMBER_PROPERTY
};
int runNumber;
@@ -34,6 +36,7 @@
int eventsReceived;
int elapsedTime;
long dataReceived;
+ int eventNumber;
public String[] getPropertyNames() {
return properties;
@@ -135,6 +138,12 @@
this.setDataReceived(dataReceived + addDataReceived);
}
+ public void setEventNumber(int eventNumber) {
+ int oldValue = this.eventNumber;
+ this.eventNumber = eventNumber;
+ this.firePropertyChange(EVENT_NUMBER_PROPERTY, oldValue, this.eventNumber);
+ }
+
public void reset() {
setDataReceived(0);
setElapsedTime(0);
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/record
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/record/EventProcessingChain.java 2014-08-18 19:29:35 UTC (rev 865)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/record/EventProcessingChain.java 2014-08-18 19:55:31 UTC (rev 866)
@@ -88,7 +88,7 @@
try {
lcioStep.getLoop().setLCIORecordSource(new LCIOEventSource(new File(configuration.filePath)));
} catch (IOException e) {
- throw new RuntimeException("Error configurating LCIOEventSource.", e);
+ throw new RuntimeException("Error configuring LCIOEventSource.", e);
}
else
throw new IllegalArgumentException("Configuration is missing a file path.");
@@ -120,9 +120,9 @@
// Building EVIO events?
if (configuration.processingStage.ordinal() >= ProcessingStage.EVIO.ordinal()) {
- // Using EVIO event source.
+ // Using EVIO event source?
if (configuration.sourceType.ordinal() <= DataSourceType.EVIO_FILE.ordinal()) {
- // Using ET event source.
+ // Using ET event source?
if (configuration.sourceType == DataSourceType.ET_SERVER) {
// Use dynamic event queue.
evioStep.setEvioEventQueue(new EvioEventQueue());
SVNspam 0.1