Author: [log in to unmask] Date: Mon Apr 13 13:17:35 2015 New Revision: 2679 Log: Code cleanup in monitoring-app module. Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AddActionListener.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/Commands.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DatePanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventDashboard.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/LogPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SettingsDialog.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusTable.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ToolbarPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/AbstractModel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatus.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/HasConfigurationModel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/RunModel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SteeringType.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SystemStatusTableModel.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/package-info.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/AIDAServer.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/DialogUtil.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/SyncEventProcessor.java java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/TableExporter.java Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java Mon Apr 13 13:17:35 2015 @@ -344,7 +344,7 @@ } /** - * Get the {@link org.hps.monitoring.application.model.ConfigurationModel} for this component + * Get the {@link org.hps.monitoring.application.model.ConfigurationModel} for this component. * * @return the {@link org.hps.monitoring.application.model.ConfigurationModel} for this component */ Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AddActionListener.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AddActionListener.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AddActionListener.java Mon Apr 13 13:17:35 2015 @@ -3,14 +3,15 @@ import java.awt.event.ActionListener; /** - * Mixin interface for components which can be assigned an external <code>ActionListener</code>. + * Mix-in interface for components which can be assigned an <code>ActionListener</code>. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ interface AddActionListener { /** - * Assign an <code>ActionListener</code> to this component which will assign to appropriate child components. + * Set an <code>ActionListener</code> for this component, which should assign it to appropriate child components + * that emit <code>ActionEvent</code> objects. * * @param listener the <code>ActionListener</code> to assign to this component */ Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/Commands.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/Commands.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/Commands.java Mon Apr 13 13:17:35 2015 @@ -1,8 +1,7 @@ package org.hps.monitoring.application; /** - * These strings are used to identify ActionEvents in the MonitoringApplication. A few commands handled only by - * sub-components are not listed here. + * These strings are used to identify <code>ActionEvent</code> commands in the MonitoringApplication. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsCollectionTableModel.java Mon Apr 13 13:17:35 2015 @@ -68,11 +68,11 @@ @Override public Class<?> getColumnClass(final int columnIndex) { final Class<?> columnClass = this.columnTypes[columnIndex]; - if (columnClass.equals(int.class)) { + if (int.class.equals(columnClass)) { return Integer.class; - } else if (columnClass.equals(float.class)) { + } else if (float.class.equals(columnClass)) { return Float.class; - } else if (columnClass.equals(double.class)) { + } else if (double.class.equals(columnClass)) { return Double.class; } else { return columnClass; @@ -92,6 +92,7 @@ /** * Get the name of the column. * + * @param columnIndex the column index * @return the name of the column */ @Override @@ -110,10 +111,11 @@ } /** - * Get a cell value. + * Get a table cell value. * * @param rowIndex the row index * @param columnIndex the column index + * @return the value of the cell */ @Override public Object getValueAt(final int rowIndex, final int columnIndex) { @@ -128,7 +130,7 @@ /** * Setup the columns from table meta data. * - * @param tableInfo the {@link org.hps.conditions.database.TableMetaData} with table info + * @param tableInfo the {@link org.hps.conditions.database.TableMetaData} with the table info */ private void setupColumns(final TableMetaData tableInfo) { Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConditionsPanel.java Mon Apr 13 13:17:35 2015 @@ -26,12 +26,12 @@ import org.lcsim.conditions.ConditionsListener; /** - * The component for showing conditions tables in the monitoring app. + * The component for showing conditions table records in the monitoring application tabs. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ @SuppressWarnings("serial") -public final class ConditionsPanel extends JPanel { +final class ConditionsPanel extends JPanel { /** * The listener for updating the panel when conditions are changed. @@ -66,7 +66,7 @@ final ConditionsObjectCollection<?> collection = manager.getCachedConditions( manager.findTableMetaData(tableName).getCollectionClass(), tableName).getCachedData(); ConditionsPanel.this.tableModels - .put(tableName, new ConditionsCollectionTableModel(manager, collection)); + .put(tableName, new ConditionsCollectionTableModel(manager, collection)); } } } @@ -94,6 +94,12 @@ this.conditionsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.conditionsList.addListSelectionListener(new ListSelectionListener() { + + /** + * The selection listener method implementation which will activate a new table in the conditions panel. + * + * @param e the list selection event + */ @Override public void valueChanged(final ListSelectionEvent e) { final String tableName = ConditionsPanel.this.conditionsList.getSelectedValue(); @@ -104,11 +110,11 @@ } }); + // Initialize with default table model. this.conditionsTable.setModel(new DefaultTableModel()); final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.conditionsList, new JScrollPane( this.conditionsTable)); - // splitPane.setResizeWeight(0.6); this.add(splitPane); } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java Mon Apr 13 13:17:35 2015 @@ -22,9 +22,15 @@ final class ConnectionSettingsPanel extends AbstractFieldsPanel { /** - * Updates the GUI from changes in the ConfigurationModel. + * Update the GUI from changes in the {@link org.hps.monitoring.application.model.ConfigurationModel}. */ public class ConnectionSettingsChangeListener implements PropertyChangeListener { + + /** + * Handle a property change from the model. + * + * @param the <code>PropertyChangeEvent</code> to handle + */ @Override public void propertyChange(final PropertyChangeEvent evt) { ConnectionSettingsPanel.this.getConfigurationModel().removePropertyChangeListener(this); @@ -64,7 +70,7 @@ /** * The available wait mode settings (sleep, timed and asynchronous). */ - private static final String[] WAIT_MODES = { Mode.SLEEP.name(), Mode.TIMED.name(), Mode.ASYNC.name() }; + private static final String[] WAIT_MODES = {Mode.SLEEP.name(), Mode.TIMED.name(), Mode.ASYNC.name()}; /** * Check box for blocking setting. Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionStatusPanel.java Mon Apr 13 13:17:35 2015 @@ -21,6 +21,7 @@ * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ +@SuppressWarnings("serial") final class ConnectionStatusPanel extends JPanel implements PropertyChangeListener { /** Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DatePanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DatePanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/DatePanel.java Mon Apr 13 13:17:35 2015 @@ -5,7 +5,7 @@ import java.util.Date; /** - * A small JPanel with a date field and a label on its border. + * A small <code>JPanel</code> with a date field and a label on its border. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventButtonsPanel.java Mon Apr 13 13:17:35 2015 @@ -116,7 +116,7 @@ * Add a button to the panel. * * @param resource the resource for the image icon - * @param command the command for the action event + * @param actionCommand the command for the action event * @param listener the action listener which handles action events * @param enabled <code>true</code> if button should be enabled initially * @return the new button object @@ -128,6 +128,8 @@ /** * Handle property change events to set status from changes to the connection status model. + * + * @param evt the <code>PropertyChangeEvent</code> to handle */ @Override public void propertyChange(final PropertyChangeEvent evt) { Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventDashboard.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventDashboard.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventDashboard.java Mon Apr 13 13:17:35 2015 @@ -20,7 +20,7 @@ import org.lcsim.event.EventHeader; /** - * This class implements a "dashboard" for displaying information about the current run. + * This class implements a dashboard for displaying information about the current run. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ @@ -37,6 +37,9 @@ */ class RunTimerTask extends TimerTask { + /** + * Run the timer task to update the GUI from the current values in the model. + */ @Override public void run() { @@ -270,69 +273,62 @@ /** * Field for showing the data rate in MB per second. */ - FieldPanel dataRateField = new FieldPanel("Data Rate [MB/s]", "", 12, false); + private final FieldPanel dataRateField = new FieldPanel("Data Rate [MB/s]", "", 12, false); /** * Field for showing the total data received in MB. */ - FieldPanel dataReceivedField = new FieldPanel("Data Received [MB]", "", 14, false); + private final FieldPanel dataReceivedField = new FieldPanel("Data Received [MB]", "", 14, false); /** * Field for showing the elapsed job time in seconds. */ - FieldPanel elapsedTimeField = new FieldPanel("Elapsed Time [sec]", "", 14, false); + private final FieldPanel elapsedTimeField = new FieldPanel("Elapsed Time [sec]", "", 14, false); /** * Field for showing the end date. */ - DatePanel endDateField = new DatePanel("Run End", "", 14, false); + private final DatePanel endDateField = new DatePanel("Run End", "", 14, false); /** * Field for showing the current event number. */ - FieldPanel eventNumberField = new FieldPanel("Event Number", "", 14, false); + private final FieldPanel eventNumberField = new FieldPanel("Event Number", "", 14, false); /** * Field showing the event rate in Hertz. */ - FieldPanel eventRateField = new FieldPanel("Event Rate [Hz]", "", 14, false); + private final FieldPanel eventRateField = new FieldPanel("Event Rate [Hz]", "", 14, false); /** * Field for showing the total number of events received. */ - FieldPanel eventsReceivedField = new FieldPanel("Events Received", "", 14, false); + private final FieldPanel eventsReceivedField = new FieldPanel("Events Received", "", 14, false); /** * Field for showing the length of the run in seconds. */ - FieldPanel lengthField = new FieldPanel("Run Length [sec]", "", 12, false); + private final FieldPanel lengthField = new FieldPanel("Run Length [sec]", "", 12, false); /** * The backing model with run and event information. */ - RunModel runModel; + private final RunModel runModel; /** * Field for showing the run number. */ - FieldPanel runNumberField = new FieldPanel("Run Number", "", 10, false); + private final FieldPanel runNumberField = new FieldPanel("Run Number", "", 10, false); /** * Field for showing the start date. */ - DatePanel startDateField = new DatePanel("Run Start", "", 14, false); + private final DatePanel startDateField = new DatePanel("Run Start", "", 14, false); /** * Field for showing the total events in the run. */ - FieldPanel totalEventsField = new FieldPanel("Total Events in Run", "", 14, false); - - /** - * Class constructor which will build the GUI components. - */ - public EventDashboard() { - build(); - } + private final FieldPanel totalEventsField = new FieldPanel("Total Events in Run", "", 14, false); /** * Class constructor which takes reference to backing model. @@ -407,13 +403,4 @@ this.eventRateField.setValue(DECIMAL_FORMAT.format(value)); } } - - /** - * Set the backing {@link org.hps.monitoring.application.model.RunModel} of the component. - * - * @param runModel the backing {@link org.hps.monitoring.application.model.RunModel} of the component - */ - public void setModel(final RunModel runModel) { - this.runModel = runModel; - } } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/EventProcessing.java Mon Apr 13 13:17:35 2015 @@ -46,7 +46,7 @@ final class EventProcessing { /** - * This class is used internally to organize the objects used by an event processing session. + * This class organizes and encapsulates most of the objects used by an event processing session. */ private final class SessionState { @@ -56,7 +56,7 @@ private List<ConditionsListener> conditionsListeners; /** - * An {@link org.hps.record.et.EtConnection} with ET configuration (can be null if using file source). + * An {@link org.hps.record.et.EtConnection} with ET configuration (can be null if using a file source). */ private EtConnection connection; @@ -195,9 +195,10 @@ /** * Class constructor, which will initialize with reference to the current monitoring application and lists of extra - * processors to add to the loop as well as supplemental conditions listeners that activate when conditions change. - * - * @param application the current monitoring application + * processors to add to the loop, as well as supplemental conditions listeners that activate when the conditions + * change. + * + * @param application the current monitoring application object * @param processors a list of processors to add after configuration is performed * @param drivers a list of extra {@link org.lcsim.util.Driver} objects to add to the loop * @param conditionsListeners a list of extra {@link org.lcsim.conditions.ConditionsListener} to add to the loop @@ -367,9 +368,9 @@ } /** - * Interrupt and join to the processing watchdog thread. + * Interrupt and join the processing watchdog thread. * <p> - * This will happen if there is a user requested disconnect from pushing the disconnect button in the GUI. + * This will happen if there is a user requested disconnect from pushing the button in the GUI. */ synchronized void killWatchdogThread() { // Is the session watchdog thread not null? @@ -405,7 +406,7 @@ } /** - * Notify the loop to pause event processing. + * Notify the loop to pause the event processing. */ synchronized void pause() { this.logger.finest("pausing"); @@ -493,7 +494,7 @@ setupSteeringFile(steering); } - // Set conditions tag. + // Set conditions tag if applicable. if (configurationModel.hasValidProperty(ConfigurationModel.CONDITIONS_TAG_PROPERTY) && !configurationModel.getConditionsTag().equals("")) { this.logger.config("conditions tag is set to " + configurationModel.getConditionsTag()); @@ -535,7 +536,7 @@ this.logger.config("setting up record loop ..."); - // Initialize the loop from configuration model. + // Initialize the loop from the ConfigurationModel. final CompositeLoopConfiguration loopConfig = new CompositeLoopConfiguration() .setStopOnEndRun(configurationModel.getDisconnectOnEndRun()) .setStopOnErrors(configurationModel.getDisconnectOnError()) @@ -547,6 +548,7 @@ this.logger.config("data source path is " + configurationModel.getDataSourcePath()); this.logger.config("data source type is " + configurationModel.getDataSourceType()); + // Set the max events. if (configurationModel.hasValidProperty(ConfigurationModel.MAX_EVENTS_PROPERTY)) { final long maxEvents = configurationModel.getMaxEvents(); if (maxEvents > 0L) { @@ -650,12 +652,12 @@ // Kill session watchdog thread. killWatchdogThread(); - // Wake up all ET stations to unblock the system and make sure secondary stations are detached. + // Wake up all ET stations to unblock the system and make sure stations are detached properly. if (usingEtServer()) { wakeUpEtStations(); } - // Stop the event processing now that ET system is unblocked. + // Stop the event processing now that ET system should be unblocked. this.logger.fine("sending STOP command to loop ..."); this.sessionState.loop.execute(Command.STOP); this.logger.fine("loop got command STOP"); Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java Mon Apr 13 13:17:35 2015 @@ -33,7 +33,6 @@ * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ -// FIXME: Combo boxes should use explicit types. @SuppressWarnings("serial") final class JobSettingsPanel extends AbstractFieldsPanel { @@ -76,6 +75,8 @@ /** * Handle {@link java.beans.PropertyChangeEvent} by updating the GUI from changes to the model. + * + * @param evt the {@link java.beans.PropertyChangeEvent} to handle */ @Override public void propertyChange(final PropertyChangeEvent evt) { @@ -140,9 +141,9 @@ /** * The available LogLevel settings as an array of strings. */ - static final String[] LOG_LEVELS = new String[] { Level.ALL.toString(), Level.FINEST.toString(), + static final String[] LOG_LEVELS = new String[] {Level.ALL.toString(), Level.FINEST.toString(), Level.FINER.toString(), Level.FINE.toString(), Level.CONFIG.toString(), Level.INFO.toString(), - Level.WARNING.toString(), Level.SEVERE.toString(), Level.OFF.toString() }; + Level.WARNING.toString(), Level.SEVERE.toString(), Level.OFF.toString()}; /** * The package where steering resources must be located. @@ -264,8 +265,8 @@ steeringFileButton.setActionCommand(Commands.CHOOSE_STEERING_FILE); steeringFileButton.addActionListener(this); - this.steeringTypeComboBox = this.addComboBox("Steering Type", new String[] { SteeringType.RESOURCE.name(), - SteeringType.FILE.name() }); + this.steeringTypeComboBox = this.addComboBox("Steering Type", new String[] {SteeringType.RESOURCE.name(), + SteeringType.FILE.name()}); this.steeringTypeComboBox.setActionCommand(Commands.STEERING_TYPE_CHANGED); this.steeringTypeComboBox.addActionListener(this); Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/LogPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/LogPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/LogPanel.java Mon Apr 13 13:17:35 2015 @@ -18,6 +18,7 @@ * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ +@SuppressWarnings("serial") final class LogPanel extends JPanel { /** Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/MonitoringApplication.java Mon Apr 13 13:17:35 2015 @@ -250,11 +250,6 @@ // Add window listener to perform clean shutdown. this.frame.addWindowListener(new WindowListener() { - /** - * Not used. - * - * @param e - */ @Override public void windowActivated(final WindowEvent e) { } @@ -269,47 +264,22 @@ exit(); } - /** - * Not used. - * - * @param e - */ @Override public void windowClosing(final WindowEvent e) { } - /** - * Not used. - * - * @param e - */ @Override public void windowDeactivated(final WindowEvent e) { } - /** - * Not used. - * - * @param e - */ @Override public void windowDeiconified(final WindowEvent e) { } - /** - * Not used. - * - * @param e - */ @Override public void windowIconified(final WindowEvent e) { } - /** - * Not used. - * - * @param e - */ @Override public void windowOpened(final WindowEvent e) { } @@ -414,7 +384,7 @@ } /** - * Redirect <code>System.out</code> and <code>System.err</code> to file chosen by a file chooser. + * Redirect <code>System.out</code> and <code>System.err</code> to a file chosen by a file chooser. */ private void chooseLogFile() { final JFileChooser fc = new JFileChooser(); @@ -556,8 +526,8 @@ /** * This method sets the configuration on the model, which fires a change for every property. * - * @param configuration The new configuration. - * @param merge True to merge the configuration into the current one rather than replace it. + * @param configuration the new configuration + * @param merge <code>true</code> to merge the configuration into the current one rather than replace it */ private void loadConfiguration(final Configuration configuration, final boolean merge) { @@ -607,8 +577,8 @@ /** * Redirect <code>System.out</code> and <code>System.err</code> to a file. * - * @param file The output log file. - * @throws FileNotFoundException if the file does not exist. + * @param file the output log file + * @throws FileNotFoundException if the file does not exist */ private void logToFile(final File file) { try { @@ -721,7 +691,7 @@ /** * Handle property changes. * - * @param evt The property change event. + * @param evt the <code>PropertyChangeEvent</code> to handle */ @Override public void propertyChange(final PropertyChangeEvent evt) { Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/PlotPanel.java Mon Apr 13 13:17:35 2015 @@ -103,7 +103,7 @@ /** * Save the plotter from a tab to a graphics file. - * + * * @param plotter the plotter to save */ private void savePlotter(final IPlotter plotter) { Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SettingsDialog.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SettingsDialog.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SettingsDialog.java Mon Apr 13 13:17:35 2015 @@ -9,7 +9,9 @@ import org.hps.monitoring.application.model.ConfigurationModel; /** - * The modal dialog for entering settings. It contains a <code>JPanel</code> with the different settings sub-tabs. + * The modal dialog for entering application settings. + * <p> + * It contains a <code>JPanel</code> with the different settings sub-tabs. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusEventsTable.java Mon Apr 13 13:17:35 2015 @@ -1,6 +1,3 @@ -/** - * - */ package org.hps.monitoring.application; import java.awt.Component; @@ -127,18 +124,18 @@ public Object getValueAt(final int rowIndex, final int columnIndex) { final SystemStatus status = this.statuses.get(rowIndex); switch (columnIndex) { - case 0: - return new Date(status.getLastChangedMillis()); - case 1: - return status.getSubsystem(); - case 2: - return status.getStatusCode(); - case 3: - return status.getDescription(); - case 4: - return status.getMessage(); - default: - return null; + case 0: + return new Date(status.getLastChangedMillis()); + case 1: + return status.getSubsystem(); + case 2: + return status.getStatusCode(); + case 3: + return status.getDescription(); + case 4: + return status.getMessage(); + default: + return null; } } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusPanel.java Mon Apr 13 13:17:35 2015 @@ -14,10 +14,11 @@ /** * This is a panel showing the two tables for viewing the system statuses, one showing the current state of all system - * status monitors and the other all system status change events. + * status monitors and the other with all system status change events. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ +@SuppressWarnings("serial") final class SystemStatusPanel extends JPanel { /** Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusTable.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusTable.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/SystemStatusTable.java Mon Apr 13 13:17:35 2015 @@ -24,7 +24,7 @@ final class SystemStatusTable extends JTable { /** - * Renders a button if the status is clearable. + * Renders a button if the status is clear-able. */ private class ButtonRenderer extends JButton implements TableCellRenderer { @@ -51,7 +51,7 @@ public Component getTableCellRendererComponent(final JTable table, final Object value, final boolean isSelected, final boolean hasFocus, final int rowIndex, final int columnIndex) { final boolean clearable = (Boolean) table.getModel().getValueAt(rowIndex, - SystemStatusTableModel.CLEARABLE_COL); + SystemStatusTableModel.CLEARABLE_COLUMN_INDEX); if (clearable) { return this; } else { @@ -106,51 +106,52 @@ this.setModel(new SystemStatusTableModel()); // Rendering of system status cells using different background colors. - this.getColumnModel().getColumn(SystemStatusTableModel.STATUS_COL) - .setCellRenderer(new DefaultTableCellRenderer() { + this.getColumnModel().getColumn(SystemStatusTableModel.STATUS_COLUMN_INDEX) + .setCellRenderer(new DefaultTableCellRenderer() { - @Override - public Component getTableCellRendererComponent(final JTable table, final Object value, - final boolean isSelected, final boolean hasFocus, final int row, final int col) { + @Override + public Component getTableCellRendererComponent(final JTable table, final Object value, + final boolean isSelected, final boolean hasFocus, final int row, final int col) { - // Cells are by default rendered as a JLabel. - final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, - hasFocus, row, col); + // Cells are by default rendered as a JLabel. + final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, + hasFocus, row, col); - // Color code the cell by its status. - final StatusCode statusCode = StatusCode.valueOf((String) value); - label.setBackground(statusCode.getColor()); - return label; - } - }); + // Color code the cell by its status. + final StatusCode statusCode = StatusCode.valueOf((String) value); + label.setBackground(statusCode.getColor()); + return label; + } + }); // Date formatting for last changed. - this.getColumnModel().getColumn(SystemStatusTableModel.LAST_CHANGED_COL) - .setCellRenderer(new DefaultTableCellRenderer() { + this.getColumnModel().getColumn(SystemStatusTableModel.LAST_CHANGED_COLUMN_INDEX) + .setCellRenderer(new DefaultTableCellRenderer() { - final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss.SSS"); + final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss.SSS"); - @Override - public Component getTableCellRendererComponent(final JTable table, Object value, - final boolean isSelected, final boolean hasFocus, final int row, final int column) { - if (value instanceof Date) { - value = this.dateFormat.format(value); - } - return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - } - }); + @Override + public Component getTableCellRendererComponent(final JTable table, Object value, + final boolean isSelected, final boolean hasFocus, final int row, final int column) { + if (value instanceof Date) { + value = this.dateFormat.format(value); + } + return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + } + }); // Button for clearing system statuses. - this.getColumnModel().getColumn(SystemStatusTableModel.RESET_COL).setCellRenderer(new ButtonRenderer("Clear")); + this.getColumnModel().getColumn(SystemStatusTableModel.RESET_COLUMN_INDEX) + .setCellRenderer(new ButtonRenderer("Clear")); this.addMouseListener(new JTableButtonMouseListener(this)); this.getColumn("Clearable").setWidth(0); this.getColumn("Clearable").setMinWidth(0); this.getColumn("Clearable").setMaxWidth(0); // Column widths. - this.getColumnModel().getColumn(SystemStatusTableModel.ACTIVE_COL).setPreferredWidth(8); - this.getColumnModel().getColumn(SystemStatusTableModel.STATUS_COL).setPreferredWidth(10); - this.getColumnModel().getColumn(SystemStatusTableModel.SYSTEM_COL).setPreferredWidth(10); + this.getColumnModel().getColumn(SystemStatusTableModel.ACTIVE_COLUMN_INDEX).setPreferredWidth(8); + this.getColumnModel().getColumn(SystemStatusTableModel.STATUS_COLUMN_INDEX).setPreferredWidth(10); + this.getColumnModel().getColumn(SystemStatusTableModel.SYSTEM_COLUMN_INDEX).setPreferredWidth(10); // TODO: Add default width setting for every column. this.setAutoCreateRowSorter(true); @@ -158,10 +159,10 @@ /** * Get the tqble model. - * + * * @return the table model */ public SystemStatusTableModel getTableModel() { return (SystemStatusTableModel) this.getModel(); } -} +} Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ToolbarPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ToolbarPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ToolbarPanel.java Mon Apr 13 13:17:35 2015 @@ -16,6 +16,7 @@ * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ +@SuppressWarnings("serial") final class ToolbarPanel extends JPanel { /** @@ -79,7 +80,7 @@ /** * Get the combo box with the data sources - * + * * @return the combo box with the data sources */ DataSourceComboBox getDataSourceComboBox() { Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/TriggerDiagnosticsPanel.java Mon Apr 13 13:17:35 2015 @@ -76,7 +76,7 @@ private final PairTablePanel pairsPanel = new PairTablePanel(); /** - * The panel for singles statistics. + * The panel with singles statistics. */ private final SinglesTablePanel singlesPanel = new SinglesTablePanel(); Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/AbstractModel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/AbstractModel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/AbstractModel.java Mon Apr 13 13:17:35 2015 @@ -21,10 +21,10 @@ public abstract class AbstractModel { /** - * This method will statically extract property names from a class, which in this package's conventions are - * statically declared, public strings that end with "_PROPERTY". + * This method will extract property names from a class, which in this package's conventions are statically + * declared, public strings that end with the sub-string "_PROPERTY". * - * @param type the class with the properties + * @param type the class with the properties settings * @return the list of property names */ protected static String[] getPropertyNames(final Class<? extends AbstractModel> type) { Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java Mon Apr 13 13:17:35 2015 @@ -273,7 +273,7 @@ } /** - * Get the ET chunk size + * Get the ET chunk size, which is the number of events that will be retrieved at once from the server. * * @return the ET chunk size */ @@ -656,11 +656,11 @@ /** * Set the name of the AIDA server. * - * @param AIDAServerName the name of the AIDA server - */ - public void setAIDAServerName(final String AIDAServerName) { + * @param aidaServerName the name of the AIDA server + */ + public void setAIDAServerName(final String aidaServerName) { final String oldValue = this.getAIDAServerName(); - this.configuration.set(AIDA_SERVER_NAME_PROPERTY, AIDAServerName); + this.configuration.set(AIDA_SERVER_NAME_PROPERTY, aidaServerName); this.firePropertyChange(AIDA_SERVER_NAME_PROPERTY, oldValue, this.getAIDAServerName()); } @@ -719,10 +719,9 @@ } /** - * Set the data source type - * - * @see - * @param dataSourceType + * Set the data source type (EVIO, LCIO or ET). + * + * @param dataSourceType the data source type */ public void setDataSourceType(final DataSourceType dataSourceType) { final DataSourceType oldValue = this.getDataSourceType(); @@ -747,11 +746,13 @@ /** * Set the detector to load from the detector model resources in the jar. * <p> - * These are present in the jar accordin to the LCSim convension like: + * These are present in the jar according to the LCSim convention: * * <pre> * ${DETECTOR_NAME}/detector.properties * </pre> + * <p> + * where <code>detector.properties</code> has the name of the detector matching the directory name. * * @param detectorName the name of the detector name */ @@ -773,7 +774,7 @@ } /** - * Set to <code>true<code> to disconnect if event processing errors occur + * Set to <code>true<code> to disconnect if event processing errors occur. * * @param disconnectOnError set to <code>true</code> to disconnect if event processing errors occur */ @@ -801,7 +802,7 @@ * Set the fully qualified class name of the {@link org.hps.record.LCSimEventBuilder} that should be used to build * LCIO events from EVIO. * - * @param eventBuilderClassName + * @param eventBuilderClassName the fully qualified class name of the event builder */ public void setEventBuilderClassName(final String eventBuilderClassName) { final String oldValue = this.getEventBuilderClassName(); @@ -810,8 +811,8 @@ } /** - * Set to <code>true</code> to freeze the conditions system after initialization if there is a valid detector name - * and run number setting + * Set to <code>true</code> to freeze the conditions system after initialization if there is also a valid detector + * name and run number setting. * * @param freezeConditions <code>true</code> to freeze the conditions */ @@ -880,8 +881,9 @@ } /** - * - * @param maxEvents + * Set the maximum number of events to process before the session will automatically end. + * + * @param maxEvents the maximum number of events */ public void setMaxEvents(final Long maxEvents) { final Long oldValue = this.getMaxEvents(); @@ -889,30 +891,57 @@ this.firePropertyChange(MAX_EVENTS_PROPERTY, oldValue, this.getMaxEvents()); } + /** + * Set the TCP/IP port number of the ET server for the client connection. + * + * @param port the ET port number + */ public void setPort(final Integer port) { final Integer oldValue = this.getPort(); this.configuration.set(PORT_PROPERTY, port); this.firePropertyChange(PORT_PROPERTY, oldValue, this.getPort()); } + /** + * Set a prescale value for the ET station which will decrease the event rate. + * <p> + * A prescale of 2 would mean every 2nd event is processed, etc. + * + * @param prescale the ET station prescale value + */ public void setPrescale(final Integer prescale) { final Integer oldValue = this.getPrescale(); this.configuration.set(PRESCALE_PROPERTY, prescale); this.firePropertyChange(PRESCALE_PROPERTY, oldValue, this.getPrescale()); } + /** + * Set the processing stage which determines which event processing stages are executed. + * + * @param processingStage the processing stage to execute + */ public void setProcessingStage(final ProcessingStage processingStage) { final ProcessingStage oldValue = this.getProcessingStage(); this.configuration.set(PROCESSING_STAGE_PROPERTY, processingStage); this.firePropertyChange(PROCESSING_STAGE_PROPERTY, oldValue, this.getProcessingStage()); } + /** + * Set the ET queue size. + * + * @param queueSize the ET queue size + */ public void setQueueSize(final Integer queueSize) { final Integer oldValue = this.getQueueSize(); this.configuration.set(QUEUE_SIZE_PROPERTY, queueSize); this.firePropertyChange(QUEUE_SIZE_PROPERTY, oldValue, this.getQueueSize()); } + /** + * Set the recent files list, which is a list of "\n" delimited file paths. + * + * @param recentFiles the recent files list as a string + */ public void setRecentFiles(final String recentFiles) { String oldValue = null; if (this.configuration.checkKey(RECENT_FILES_PROPERTY)) { @@ -922,6 +951,13 @@ this.firePropertyChange(RECENT_FILES_PROPERTY, oldValue, this.configuration.get(RECENT_FILES_PROPERTY)); } + /** + * Set the recent files list. + * <p> + * This method is not part of the public API and is only used internally. + * + * @param recentFilesList the recent files list + */ private void setRecentFilesList(final List<String> recentFilesList) { final StringBuffer sb = new StringBuffer(); for (final String recentFile : recentFilesList) { @@ -931,36 +967,70 @@ this.configuration.set(RECENT_FILES_PROPERTY, sb.toString()); } + /** + * Set the ET station name. + * + * @param stationName the ET station name + */ public void setStationName(final String stationName) { final String oldValue = this.getStationName(); this.configuration.set(STATION_NAME_PROPERTY, stationName); this.firePropertyChange(STATION_NAME_PROPERTY, oldValue, this.getStationName()); } + /** + * Set the ET station position. + * + * @param stationPosition the ET station position + */ public void setStationPosition(final Integer stationPosition) { final Integer oldValue = this.getStationPosition(); this.configuration.set(STATION_POSITION_PROPERTY, stationPosition); this.firePropertyChange(STATION_POSITION_PROPERTY, oldValue, this.getStationPosition()); } + /** + * Set the steering file path. + * + * @param steeringFile the steering file path + */ public void setSteeringFile(final String steeringFile) { final String oldValue = this.getSteeringFile(); this.configuration.set(STEERING_FILE_PROPERTY, steeringFile); this.firePropertyChange(STEERING_FILE_PROPERTY, oldValue, this.getSteeringFile()); } + /** + * Set the steering file resource. + * + * @param steeringResource the steering file resource + */ public void setSteeringResource(final String steeringResource) { final String oldValue = this.getSteeringResource(); this.configuration.set(STEERING_RESOURCE_PROPERTY, steeringResource); this.firePropertyChange(STEERING_RESOURCE_PROPERTY, oldValue, steeringResource); } + /** + * Set the steering type (file or resource). + * + * @param steeringType the steering type + * @see SteeringType + */ public void setSteeringType(final SteeringType steeringType) { final SteeringType oldValue = this.getSteeringType(); this.configuration.set(STEERING_TYPE_PROPERTY, steeringType.name()); this.firePropertyChange(STEERING_TYPE_PROPERTY, oldValue, this.getSteeringType()); } + /** + * Set a user run number which will be used to initialize the conditions system. + * <p> + * This should most likely be used with {@link #setFreezeConditions(Boolean)} or it is likely to be later overridden + * by run numbers from the data. + * + * @param userRunNumber the user run number + */ public void setUserRunNumber(final Integer userRunNumber) { Integer oldValue = null; if (this.hasPropertyKey(USER_RUN_NUMBER_PROPERTY)) { @@ -970,18 +1040,33 @@ this.firePropertyChange(USER_RUN_NUMBER_PROPERTY, oldValue, this.getUserRunNumber()); } + /** + * Set verbose mode for the ET system. + * + * @param verbose the ET verbose flag + */ public void setVerbose(final Boolean verbose) { final Boolean oldValue = this.getVerbose(); this.configuration.set(VERBOSE_PROPERTY, verbose); this.firePropertyChange(VERBOSE_PROPERTY, oldValue, this.getVerbose()); } + /** + * Set the ET wait mode (timed, asynchronous or wait). + * + * @param waitMode the ET wait mode + */ public void setWaitMode(final Mode waitMode) { final Mode oldValue = this.getWaitMode(); this.configuration.set(WAIT_MODE_PROPERTY, waitMode.name()); this.firePropertyChange(WAIT_MODE_PROPERTY, oldValue, this.getWaitMode()); } + /** + * Set the ET wait time, which is ignored if wait mode is not timed. + * + * @param waitTime the ET wait time + */ public void setWaitTime(final Integer waitTime) { final Integer oldValue = this.getWaitTime(); this.configuration.set(WAIT_TIME_PROPERTY, waitTime); Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatus.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatus.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatus.java Mon Apr 13 13:17:35 2015 @@ -10,14 +10,38 @@ */ public enum ConnectionStatus { - CONNECTED(Color.GREEN), DISCONNECTED(Color.RED), DISCONNECTING(Color.YELLOW); + /** + * This is the state when the session is connected to event processing. + */ + CONNECTED(Color.GREEN), + /** + * This is the disconnected state when event processing is not occurring. + */ + DISCONNECTED(Color.RED), + /** + * This is the state when the session is being torn down. + */ + DISCONNECTING(Color.YELLOW); - Color color; + /** + * The color that should be displayed in the GUI component for this state. + */ + private Color color; - ConnectionStatus(final Color color) { + /** + * Class constructor. + * + * @param color the color to display for this state + */ + private ConnectionStatus(final Color color) { this.color = color; } + /** + * Get the color to display for this state. + * + * @return the color to display for this state + */ public Color getColor() { return this.color; } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConnectionStatusModel.java Mon Apr 13 13:17:35 2015 @@ -5,45 +5,97 @@ /** * 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. + * also notify listeners when the event processing has been paused. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ public final class ConnectionStatusModel extends AbstractModel { + /** + * The connection status property. + */ public static final String CONNECTION_STATUS_PROPERTY = "ConnectionStatus"; + + /** + * The paused property. + */ public static final String PAUSED_PROPERTY = "Paused"; - static final String[] propertyNames = new String[] {CONNECTION_STATUS_PROPERTY, PAUSED_PROPERTY}; + /** + * The property names of this class. + */ + private static final String[] PROPERTY_NAMES = new String[] {CONNECTION_STATUS_PROPERTY, PAUSED_PROPERTY}; - ConnectionStatus connectionStatus = ConnectionStatus.DISCONNECTED; - boolean paused = false; + /** + * The current connection status. + */ + private ConnectionStatus connectionStatus = ConnectionStatus.DISCONNECTED; + /** + * Flag which is <code>true</code> when event processing is in the paused state. + */ + private boolean paused = false; + + /** + * Get the current connection status. + * + * @return the current connection status + */ public ConnectionStatus getConnectionStatus() { return this.connectionStatus; } + /** + * Return <code>true</code> if the event processing is currently paused. + * + * @return <code>true</code> if event processing is currently paused + */ public boolean getPaused() { return this.paused; } + /** + * Get the property names for this class. + * + * @return the property names for this class + */ @Override public String[] getPropertyNames() { - return propertyNames; + return PROPERTY_NAMES; } + /** + * Return <code>true</code> if the status is <code>CONNECTED</code>. + * + * @return <code>true</code> if status is <code>CONNECTED</code> + */ public boolean isConnected() { return this.connectionStatus == ConnectionStatus.CONNECTED; } + /** + * Return <code>true</code> if the status is <code>DISCONNECTED</code>. + * + * @return <code>true</code> if the status is <code>DISCONNECTED</code> + */ public boolean isDisconnected() { return this.connectionStatus == ConnectionStatus.DISCONNECTED; } + /** + * Return <code>true</code> if the status is <code>DISCONNECTING</code>. + * + * @return <code>true</code> if the status is <code>DISCONNECTING</code> + */ public boolean isDisconnecting() { return this.connectionStatus == ConnectionStatus.DISCONNECTING; } + /** + * Set the connection status. + * + * @param connectionStatus the new connection status + */ public void setConnectionStatus(final ConnectionStatus connectionStatus) { final ConnectionStatus oldValue = connectionStatus; this.connectionStatus = connectionStatus; @@ -53,6 +105,11 @@ } } + /** + * Set to <code>true</code> if status is paused. + * + * @param paused <code>true</code> if status is paused + */ public void setPaused(final boolean paused) { final boolean oldValue = this.paused; this.paused = paused; Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/HasConfigurationModel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/HasConfigurationModel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/HasConfigurationModel.java Mon Apr 13 13:17:35 2015 @@ -8,16 +8,16 @@ public interface HasConfigurationModel { /** - * Get the current ConfigurationModel of the object. + * Get the current {@link ConfigurationModel} of the object. * - * @return The ConfigurationModel. + * @return the associated {@link ConfigurationModel} */ ConfigurationModel getConfigurationModel(); /** - * Set the ConfigurationModel of the object. + * Set the {@link ConfigurationModel} of the object. * - * @param configurationModel The ConfigurationModel. + * @param configurationModel the new {@link ConfigurationModel} */ void setConfigurationModel(ConfigurationModel configurationModel); } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/RunModel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/RunModel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/RunModel.java Mon Apr 13 13:17:35 2015 @@ -9,36 +9,133 @@ */ public final class RunModel extends AbstractModel { - public final static String DATA_RATE_PROPERTY = "DataRate"; // data rate in megabytes per second - public final static String DATA_RECEIVED_PROPERTY = "DataReceived"; // updated on the fly, in bytes - public final static String ELAPSED_TIME_PROPERTY = "ElapsedTime"; // updated on the fly, in seconds - public final static String END_DATE_PROPERTY = "EndDate"; - public final static String EVENT_NUMBER_PROPERTY = "EventNumber"; // current event number - public final static String EVENT_RATE_PROPERTY = "EventRate"; // event rate per second - public final static String EVENTS_RECEIVED_PROPERTY = "EventsReceived"; // events received so far - public final static String RUN_LENGTH_PROPERTY = "RunLength"; // set at end, in seconds - public final static String RUN_NUMBER_PROPERTY = "RunNumber"; - static final String[] RUN_PROPERTIES = AbstractModel.getPropertyNames(RunModel.class); - public final static String START_DATE_PROPERTY = "StartDate"; - - public final static String TOTAL_EVENTS_PROPERTY = "TotalEvents"; // only set at end - - Double dataRate; - Double dataReceived; - Integer elapsedTime; - Date endDate; - Integer eventNumber; - Double eventRate; - Integer eventsReceived; - Integer runLength; - Integer runNumber; - Date startDate; - Integer totalEvents; - + /** + * The data rate in megabytes per second. + */ + public static final String DATA_RATE_PROPERTY = "DataRate"; + + /** + * The amount of data received in bytes since the last timer tick. + */ + public static final String DATA_RECEIVED_PROPERTY = "DataReceived"; + + /** + * The total elapsed time in the session. + */ + public static final String ELAPSED_TIME_PROPERTY = "ElapsedTime"; + + /** + * The end date of the run which comes from the EVIO END record. + */ + public static final String END_DATE_PROPERTY = "EndDate"; + + /** + * The event number currently being processed which usually comes from the EVIO or LCIO records. + */ + public static final String EVENT_NUMBER_PROPERTY = "EventNumber"; + + /** + * The event rate in Hertz. + */ + public static final String EVENT_RATE_PROPERTY = "EventRate"; + + /** + * The total number of events received in the session. + */ + public static final String EVENTS_RECEIVED_PROPERTY = "EventsReceived"; + + /** + * The total length of the run which is set from the EVIO END record. + */ + public static final String RUN_LENGTH_PROPERTY = "RunLength"; + + /** + * The run number which comes from the EVIO control data. + */ + public static final String RUN_NUMBER_PROPERTY = "RunNumber"; + + /** + * The properties of this model. + */ + private static final String[] RUN_PROPERTIES = AbstractModel.getPropertyNames(RunModel.class); + + /** + * The start date of the run which comes from the EVIO PRESTART event. + */ + public static final String START_DATE_PROPERTY = "StartDate"; + + /** + * The total events in the run which comes from the EVIO END event. + */ + public static final String TOTAL_EVENTS_PROPERTY = "TotalEvents"; + + /** + * The data rate in MB/s. + */ + private Double dataRate; + + /** + * The data received in bytes. + */ + private Double dataReceived; + + /** + * The elapsed time in seconds. + */ + private Integer elapsedTime; + + /** + * The end date of the run. + */ + private Date endDate; + + /** + * The current event number. + */ + private Integer eventNumber; + + /** + * The event rate in Hertz. + */ + private Double eventRate; + + /** + * The number of events received. + */ + private Integer eventsReceived; + + /** + * The length of the run. + */ + private Integer runLength; + + /** + * The run number. + */ + private Integer runNumber; + + /** + * The run start date. + */ + private Date startDate; + + /** + * The total events received in the run. + */ + private Integer totalEvents; + + /** + * Add data received in bytes. + * + * @param addDataReceived the amount of data received in bytes + */ public void addDataReceived(final double addDataReceived) { this.setDataReceived(this.dataReceived + addDataReceived); } + /** + * Compute the run length from the start and end date and set its value in the GUI. + */ public void computeRunLength() { if (this.startDate != null && this.endDate != null) { final long elapsedMillis = this.endDate.getTime() - this.startDate.getTime(); @@ -47,55 +144,118 @@ } } + /** + * Get the data rate in MB/s. + * + * @return the data rate in MB/s + */ public double getDataRate() { return this.dataRate; } + /** + * Get the data received in bytes. + * + * @return the data received in bytes + */ public double getDataReceived() { return this.dataReceived; } + /** + * Get the elapsed time in seconds. + * + * @return the elapsed time in seconds + */ public int getElapsedTime() { return this.elapsedTime; } + /** + * Get the run end date. + * + * @return the run end date + */ public Date getEndDate() { return this.endDate; } + /** + * Get the current event number. + * + * @return the current event number + */ public int getEventNumber() { return this.eventNumber; } + /** + * Get the event rate in Hertz. + * + * @return the event rate in Hertz + */ public double getEventRate() { return this.eventRate; } + /** + * Get the number of events received in the session. + * + * @return the number of events received + */ public int getEventsReceived() { return this.eventsReceived; } + /** + * Get the property names for this model. + * + * @return the property names for this model + */ @Override public String[] getPropertyNames() { return RUN_PROPERTIES; } + /** + * Get the run length in seconds. + * + * @return the run length in seconds + */ public int getRunLength() { return this.runLength; } + /** + * Get the run number. + * + * @return the run number + */ public int getRunNumber() { return this.runNumber; } + /** + * Get the start date. + * + * @return the start date + */ public Date getStartDate() { return this.startDate; } + /** + * Get the total events in the run. + * + * @return the total events in the run + */ public int getTotalEvents() { return this.totalEvents; } + /** + * Reset the model for new run. + */ public void reset() { setDataReceived(0); setElapsedTime(0); @@ -107,69 +267,124 @@ setTotalEvents(0); } + /** + * Set the data rate in MB/s. + * + * @param dataRate the data rate in MB/s + */ public void setDataRate(final double dataRate) { final Double oldValue = this.dataRate; this.dataRate = dataRate; this.firePropertyChange(DATA_RATE_PROPERTY, oldValue, this.dataRate); } + /** + * Set the data received in bytes. + * + * @param dataReceived the data received in bytes + */ public void setDataReceived(final double dataReceived) { final Double oldValue = this.dataReceived; this.dataReceived = dataReceived; this.firePropertyChange(DATA_RECEIVED_PROPERTY, oldValue, this.dataReceived); } + /** + * Set the elapsed time in seconds. + * + * @param elapsedTime the elapsed time in seconds + */ public void setElapsedTime(final int elapsedTime) { final Integer oldValue = this.elapsedTime; this.elapsedTime = elapsedTime; this.firePropertyChange(ELAPSED_TIME_PROPERTY, oldValue, this.elapsedTime); } + /** + * Set the run end date. + * + * @param endDate the run end date + */ public void setEndDate(final Date endDate) { final Date oldValue = this.endDate; this.endDate = endDate; this.firePropertyChange(END_DATE_PROPERTY, oldValue, this.endDate); } + /** + * Set the current event number. + * + * @param eventNumber the current event number + */ public void setEventNumber(final int eventNumber) { final Integer oldValue = this.eventNumber; this.eventNumber = eventNumber; this.firePropertyChange(EVENT_NUMBER_PROPERTY, oldValue, this.eventNumber); } + /** + * Set the event rate in Hertz. + * + * @param eventRate the event rate in Hertz + */ public void setEventRate(final double eventRate) { final Double oldValue = this.eventRate; this.eventRate = eventRate; this.firePropertyChange(EVENT_RATE_PROPERTY, oldValue, this.eventRate); } + /** + * Set the number of events received. + * + * @param eventsReceived the number of events received + */ public void setEventsReceived(final int eventsReceived) { final Integer oldValue = this.eventsReceived; this.eventsReceived = eventsReceived; this.firePropertyChange(EVENTS_RECEIVED_PROPERTY, oldValue, this.eventsReceived); } + /** + * Set the length of the run in seconds. + * + * @param runLength the length of the run in seconds + */ public void setRunLength(final int runLength) { final Integer oldValue = this.runLength; this.runLength = runLength; this.firePropertyChange(RUN_LENGTH_PROPERTY, oldValue, this.runLength); } + /** + * Set the run number. + * + * @param runNumber the run number + */ public void setRunNumber(final int runNumber) { final Integer oldValue = this.runNumber; this.runNumber = runNumber; this.firePropertyChange(RUN_NUMBER_PROPERTY, oldValue, this.runNumber); } + /** + * Set the start date. + * + * @param startDate the start date + */ public void setStartDate(final Date startDate) { final Date oldValue = this.startDate; this.startDate = startDate; this.firePropertyChange(START_DATE_PROPERTY, oldValue, this.startDate); } + /** + * Set the total number of events in the run. + * + * @param totalEvents the total number of events in the run + */ public void setTotalEvents(final int totalEvents) { final Integer oldValue = this.totalEvents; this.totalEvents = totalEvents; this.firePropertyChange(TOTAL_EVENTS_PROPERTY, oldValue, this.totalEvents); } -} +} Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SteeringType.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SteeringType.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SteeringType.java Mon Apr 13 13:17:35 2015 @@ -6,5 +6,12 @@ * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ public enum SteeringType { - FILE, RESOURCE; + /** + * Steering from local file on disk. + */ + FILE, + /** + * Steering from resource in jar file. + */ + RESOURCE; } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SystemStatusTableModel.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SystemStatusTableModel.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/SystemStatusTableModel.java Mon Apr 13 13:17:35 2015 @@ -2,7 +2,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -19,80 +18,152 @@ * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ +@SuppressWarnings("serial") public final class SystemStatusTableModel extends AbstractTableModel implements SystemStatusListener { - public static final int ACTIVE_COL = 1; - public static final int CLEARABLE_COL = 7; - static final String[] columnNames = { "Reset", "Active", "Status", "System", "Description", "Message", - "Last Changed", "Clearable" }; - public static final int DESCRIPTION_COL = 4; - public static final int LAST_CHANGED_COL = 6; - public static final int MESSAGE_COL = 5; - public static final int RESET_COL = 0; - public static final int STATUS_COL = 2; - - public static final int SYSTEM_COL = 3; - - final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss.SSS"); - List<SystemStatus> statuses = new ArrayList<SystemStatus>(); - + /** + * Active field column index. + */ + public static final int ACTIVE_COLUMN_INDEX = 1; + + /** + * Clearable field column index. + */ + public static final int CLEARABLE_COLUMN_INDEX = 7; + + /** + * The names of the columns. + */ + private static final String[] COLUMN_NAMES = {"Reset", "Active", "Status", "System", "Description", "Message", + "Last Changed", "Clearable"}; + + /** + * Description column index. + */ + public static final int DESCRIPTION_COLUMN_INDEX = 4; + + /** + * Last changed field column index. + */ + public static final int LAST_CHANGED_COLUMN_INDEX = 6; + + /** + * Message field column index. + */ + public static final int MESSAGE_COLUMN_INDEX = 5; + + /** + * Reset field column index. + */ + public static final int RESET_COLUMN_INDEX = 0; + + /** + * Status field column index. + */ + public static final int STATUS_COLUMN_INDEX = 2; + + /** + * System field column index. + */ + public static final int SYSTEM_COLUMN_INDEX = 3; + + /** + * The list of system status objects that back the model. + */ + private final List<SystemStatus> statuses = new ArrayList<SystemStatus>(); + + /** + * Add a system status to the model. + * + * @param status the system status to add to the model + */ public void addSystemStatus(final SystemStatus status) { this.statuses.add(status); status.addListener(this); fireTableDataChanged(); } + /** + * Clear all the data in the model. + */ public void clear() { this.statuses.clear(); fireTableDataChanged(); } - @Override - public Class getColumnClass(final int column) { - switch (column) { - case ACTIVE_COL: + /** + * Get the class of the column. + * + * @param columnIndex the index of the column + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + @Override + public Class getColumnClass(final int columnIndex) { + switch (columnIndex) { + case ACTIVE_COLUMN_INDEX: return Boolean.class; - case LAST_CHANGED_COL: + case LAST_CHANGED_COLUMN_INDEX: return Date.class; default: return String.class; } } + /** + * Get the column count. + * + * @return the column count + */ @Override public int getColumnCount() { - return columnNames.length; - } - - @Override - public String getColumnName(final int col) { - return columnNames[col]; - } - + return COLUMN_NAMES.length; + } + + /** + * Get the column name. + * + * @param columnIndex the column index + */ + @Override + public String getColumnName(final int columnIndex) { + return COLUMN_NAMES[columnIndex]; + } + + /** + * Get the row count. + * + * @return the row count + */ @Override public int getRowCount() { return this.statuses.size(); } + /** + * Get a table cell value. + * + * @param rowIndex the row index + * @param columnIndex the column index + */ @Override public Object getValueAt(final int rowIndex, final int columnIndex) { final SystemStatus status = this.statuses.get(rowIndex); switch (columnIndex) { - case ACTIVE_COL: + case ACTIVE_COLUMN_INDEX: return status.isActive(); - case STATUS_COL: + case STATUS_COLUMN_INDEX: return status.getStatusCode().name(); - case SYSTEM_COL: + case SYSTEM_COLUMN_INDEX: return status.getSubsystem().name(); - case DESCRIPTION_COL: + case DESCRIPTION_COLUMN_INDEX: return status.getDescription(); - case MESSAGE_COL: + case MESSAGE_COLUMN_INDEX: return status.getMessage(); - case LAST_CHANGED_COL: + case LAST_CHANGED_COLUMN_INDEX: return new Date(status.getLastChangedMillis()); - case RESET_COL: - // If the status is clearable, then it has a button that can be used to - // manually set the state to CLEARED. If the status is not clearable, + case RESET_COLUMN_INDEX: + // If the status is clear-able, then the cell has a button which can be used to + // manually set the state to CLEARED. If the status cannot be cleared, // then nothing is rendered in this cell. if (status.isClearable()) { final JButton button = new JButton(); @@ -100,9 +171,6 @@ @Override public void actionPerformed(final ActionEvent e) { final SystemStatus status = SystemStatusTableModel.this.statuses.get(rowIndex); - // Only clearable statuses can have this state set. Check for this - // just to be safe, even though no button is available for non-clearable - // statuses. if (status.isClearable()) { final StatusCode oldStatusCode = status.getStatusCode(); status.setStatus(StatusCode.CLEARED, "Cleared from " + oldStatusCode.name() + " state."); @@ -113,29 +181,42 @@ } else { return null; } - case CLEARABLE_COL: + case CLEARABLE_COLUMN_INDEX: return status.isClearable(); default: return null; } } - @Override - public boolean isCellEditable(final int row, final int col) { - if (col == ACTIVE_COL) { - return true; - } else { - return false; + /** + * Return <code>true</code> if cell is editable. + * + * @return <code>true</code> if cell is editable + */ + @Override + public boolean isCellEditable(final int rowIndex, final int columnIndex) { + return columnIndex == ACTIVE_COLUMN_INDEX; + } + + /** + * Set the table cell value. + * + * @param value the new value + * @param rowIndex the row index + * @param columnIndex the column index + */ + @Override + public void setValueAt(final Object value, final int rowIndex, final int columnIndex) { + if (columnIndex == ACTIVE_COLUMN_INDEX) { + this.statuses.get(rowIndex).setActive((Boolean) value); } } - @Override - public void setValueAt(final Object value, final int row, final int col) { - if (col == ACTIVE_COL) { - this.statuses.get(row).setActive((Boolean) value); - } - } - + /** + * Notify of system status changed. + * + * @param status the system status that changed + */ @Override public void statusChanged(final SystemStatus status) { final int rowNumber = this.statuses.indexOf(status); Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/package-info.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/package-info.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/package-info.java Mon Apr 13 13:17:35 2015 @@ -16,4 +16,5 @@ * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ -package org.hps.monitoring.application; +package org.hps.monitoring.application; + Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/AIDAServer.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/AIDAServer.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/AIDAServer.java Mon Apr 13 13:17:35 2015 @@ -14,25 +14,36 @@ * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ -public class AIDAServer { +public final class AIDAServer { - boolean connected = false; - String name; - RmiServerImpl server; + /** + * Connected flag. + */ + private boolean connected = false; + + /** + * The name of the server. + */ + private String name; + + /** + * The RMI server object. + */ + private RmiServerImpl server; /** * Class constructor. * - * @param name The name of the AIDA server. + * @param name the name of the AIDA server */ public AIDAServer(final String name) { this.name = name; } /** - * True if connected. + * Return <code>true</code> if connected. * - * @return True if connected to server. + * @return <code>true</code> if connected to server */ public boolean connected() { return this.connected; @@ -46,6 +57,11 @@ this.connected = false; } + /** + * Get the server name as a string. + * + * @return the server name + */ public String getName() { try { return InetAddress.getLocalHost().getCanonicalHostName() + this.server.getBindName() + ":" @@ -68,7 +84,7 @@ /** * Start the remote AIDA server. * - * @return True if server started successfully; false if an error occurred during initialization. + * @return <code>true</code> if server started successfully; false if an error occurred during initialization. */ public boolean start() { final RemoteServer treeServer = new RemoteServer((IDevTree) AIDA.defaultInstance().tree()); Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/DialogUtil.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/DialogUtil.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/DialogUtil.java Mon Apr 13 13:17:35 2015 @@ -10,15 +10,19 @@ import javax.swing.WindowConstants; /** + * This is a set of utility methods for creating Swing dialog windows. + * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ public final class DialogUtil { /** - * @param parent - * @param message - * @param title - * @return + * Show a confirmation dialog. + * + * @param parent the parent component + * @param message the message + * @param title the title of the dialog + * @return the result from the user's dialog selection */ public static int showConfirmationDialog(final Component parent, final String title, final String message) { final Object[] options = { "Yes", "No", "Cancel" }; @@ -28,9 +32,11 @@ } /** - * @param component - * @param error - * @param title + * Show an error dialog. + * + * @param component the parent component + * @param error the error message + * @param title the title of the dialog */ public static void showErrorDialog(final Component component, final String title, final String message) { final Runnable runnable = new Runnable() { @@ -43,9 +49,11 @@ } /** - * @param component - * @param error - * @param title + * Show an error dialog with an associated thrown object. + * + * @param component the parent component + * @param error the <code>Throwable</code> error + * @param title the title of the dialog */ public static void showErrorDialog(final Component component, final Throwable error, final String title) { final Runnable runnable = new Runnable() { @@ -58,9 +66,11 @@ } /** - * @param component - * @param title - * @param message + * Show an information dialog. + * + * @param component the parent component + * @param title the title of the dialog + * @param message the message */ public static void showInfoDialog(final Component component, final String title, final String message) { final Runnable runnable = new Runnable() { @@ -73,10 +83,12 @@ } /** - * @param parentComponent - * @param title - * @param message - * @return + * Show a status dialog which will block GUI interaction. + * + * @param parentComponent the parent component + * @param title the title of the dialog + * @param message the message + * @return the dialog window component */ public static JDialog showStatusDialog(final Component parentComponent, final String title, final String message) { final JOptionPane optionPane = new JOptionPane(message, JOptionPane.INFORMATION_MESSAGE, @@ -101,4 +113,11 @@ dialog.setVisible(true); return dialog; } + + /** + * Do not allow class instantiation. + */ + private DialogUtil() { + throw new UnsupportedOperationException("Do not instantiate this class."); + } } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ErrorHandler.java Mon Apr 13 13:17:35 2015 @@ -8,10 +8,9 @@ import javax.swing.SwingUtilities; /** - * <p> * An error handling class which is able to do any of the following, depending on how the users wants to handle the * error. - * </p> + * <p> * <ul> * <li>Print a message</li> * <li>Print the stack trace</li> @@ -20,20 +19,36 @@ * <li>Raise an exception</li> * <li>Exit the application</li> * </ul> - * </p> It mostly uses the "builder" pattern so that the various handling methods can be easily chained, where - * appropriate. Some methods are not available for chaining when it doesn't make sense. </p> + * <p> + * It mostly uses the "builder" pattern so that the various handling methods can be easily chained, where appropriate. + * Some methods are not available for chaining when it doesn't make sense. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ public final class ErrorHandler { - Component component; - Throwable error; - Logger logger; - String message; + /** + * The component used for showing dialog windows. + */ + private final Component component; /** - * Constructor. + * The thrown error. + */ + private Throwable error; + + /** + * A logger for reporting error messages. + */ + private final Logger logger; + + /** + * The error message. + */ + private String message; + + /** + * Class constructor. * * @param component The GUI component to which this object is assigned. * @param logger The logger to which messages will be written. @@ -44,7 +59,9 @@ } /** - * Exit the application. This is not chainable for obvious reasons. + * Exit the application. + * <p> + * This is not a chain-able method for obvious reasons. */ public void exit() { System.err.println("Fatal error. Application will exit."); @@ -54,7 +71,7 @@ /** * Log the error message to the <code>Logger</code>. * - * @return This object. + * @return this object */ public ErrorHandler log() { this.logger.log(Level.SEVERE, this.message, this.error); @@ -74,7 +91,7 @@ /** * Print the full stack trace of the error to System.err. * - * @return This object. + * @return this object */ public ErrorHandler printStackTrace() { this.error.printStackTrace(); @@ -82,18 +99,21 @@ } /** - * Rethrow the error as a <code>RuntimeException</code>. Additional methods cannot be chained to this as they would - * not be executed. + * Immediately re-throw the error as a <code>RuntimeException</code>. + * <p> + * Additional methods cannot be chained to this as they would not be executed. */ public void raiseException() { throw new RuntimeException(this.message, this.error); } /** - * Set the error that occurred. This should always be called first in a method chain. + * Set the error that occurred. + * <p> + * This should always be called first when method chaining. * - * @param error The error which is a <code>Throwable</code>. - * @return This object. + * @param error the error which is any type of <code>Throwable</code> + * @return this object */ public ErrorHandler setError(final Throwable error) { this.error = error; @@ -102,10 +122,10 @@ } /** - * Set the error message if it differs from the exception's message. + * Set the error message, if it differs from the exception's message. * - * @param message The erro message. - * @return This object. + * @param message the error message + * @return this object */ public ErrorHandler setMessage(final String message) { this.message = message; @@ -115,7 +135,7 @@ /** * Show an error dialog with the message. * - * @return This object. + * @return this object */ public ErrorHandler showErrorDialog() { final Runnable runnable = new Runnable() { @@ -132,7 +152,9 @@ /** * Show an error dialog with a custom message and title. * - * @return This object. + * @param message the error message + * @param title the title of the dialog window + * @return this object */ public ErrorHandler showErrorDialog(final String message, final String title) { final Runnable runnable = new Runnable() { Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EtSystemUtil.java Mon Apr 13 13:17:35 2015 @@ -11,18 +11,34 @@ */ public final class EtSystemUtil { + /** + * Create an {@link org.hps.record.et.EtConnection} from the settings in a + * {@link org.hps.monitoring.application.model.ConfigurationModel}. + * + * @param config the {@link org.hps.monitoring.application.model.ConfigurationModel} with the connection settings + * @return the new {@link org.hps.record.et.EtConnection} + */ public static EtConnection createEtConnection(final ConfigurationModel config) { return EtConnection.createConnection(config.getEtName(), config.getHost(), config.getPort(), config.getBlocking(), config.getQueueSize(), config.getPrescale(), config.getStationName(), config.getStationPosition(), config.getWaitMode(), config.getWaitTime(), config.getChunkSize()); } + /** + * Create an event selection array (with size 6). + * + * @return the event selection array + */ public static int[] createSelectArray() { final int select[] = new int[EtConstants.stationSelectInts]; Arrays.fill(select, -1); return select; } + /** + * Do not allow class instantiation. + */ private EtSystemUtil() { + throw new UnsupportedOperationException("Do not instantiate this class."); } } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/EvioFileFilter.java Mon Apr 13 13:17:35 2015 @@ -5,24 +5,37 @@ import javax.swing.filechooser.FileFilter; /** - * This is a simple file filter that will accept files with ".evio" anywhere in their name. + * This is a file filter that will accept files with ".evio" anywhere in their name. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ public final class EvioFileFilter extends FileFilter { + /** + * Class constructor. + */ public EvioFileFilter() { } + /** + * Return <code>true</code> if path should be accepted. + * + * @return <code>true</code> to accept the path + */ @Override - public boolean accept(final File pathname) { - if (pathname.getName().contains(".evio") || pathname.isDirectory()) { + public boolean accept(final File path) { + if (path.getName().contains(".evio") || path.isDirectory()) { return true; } else { return false; } } + /** + * Get the description of the file filter. + * + * @return the description of the file filter + */ @Override public String getDescription() { return "EVIO files"; Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/ResourceUtil.java Mon Apr 13 13:17:35 2015 @@ -19,15 +19,19 @@ import org.reflections.Reflections; /** + * This is a set of utility methods for getting jar resources at runtime. + * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ public final class ResourceUtil { /** - * Find a list of available detector names. Only those detectors that have names starting with "HPS" in their - * detector.properties files will be returned. + * Find a list of available detector names. + * <p> + * Only those detectors that have names starting with "HPS" in their <code>detector.properties</code> files will be + * returned. * - * @return The list of available detector names. + * @return the list of available HPS detector names */ public static String[] findDetectorNames() { final ClassLoader classLoader = ResourceUtil.class.getClassLoader(); @@ -68,7 +72,7 @@ * Find all classes that implement {@link org.hps.record.LCSimEventBuilder} and return a list of their canonical * names. * - * @return The list of classes implementing LCSimEventBuilder. + * @return the list of fully qualified class names that implement LCSimEventBuilder */ public static String[] findEventBuilderClassNames() { final Reflections reflections = new Reflections("org.hps"); @@ -81,10 +85,10 @@ } /** - * Get the files with extension 'lcsim' from all loaded jar files. + * Get all of the files with the extension "lcsim" which are in a certain package. * - * @param packageName The package name for filtering the resources. - * @return A list of embedded steering file resources. + * @param packageName the package name for filtering the list of resources + * @return a list of embedded steering file resources */ public static String[] findSteeringResources(final String packageName) { final List<String> resources = new ArrayList<String>(); @@ -115,10 +119,20 @@ return arr; } + /** + * Get the list of available conditions tags from the conditions system. + * + * @return the list of available conditions tags + */ + // FIXME: This method probably does not belong in this class. public static String[] getConditionsTags() { return DatabaseConditionsManager.getInstance().getTags().toArray(new String[] {}); } + /** + * Do not allow class instantiation. + */ private ResourceUtil() { + throw new UnsupportedOperationException("Do not instantiate this class."); } } Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/SyncEventProcessor.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/SyncEventProcessor.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/SyncEventProcessor.java Mon Apr 13 13:17:35 2015 @@ -22,11 +22,23 @@ * @see org.hps.recon.ecal.daqconfig.ConfigurationManager * @see org.hps.recon.ecal.daqconfig.EvioDAQParser */ -public class SyncEventProcessor extends EtEventProcessor { +// FIXME: This class is currently unused. +public final class SyncEventProcessor extends EtEventProcessor { + /** + * The name of the trigger configuration collection. + */ private static final String TRIGGER_CONFIG = "TriggerConfig"; - TriggerConfigEvioReader configReader = new TriggerConfigEvioReader(); + /** + * The trigger configuration reader. + */ + private final TriggerConfigEvioReader configReader = new TriggerConfigEvioReader(); + + /** + * Process an ET event and if there is a trigger configuration present, parse it and update the configuration in the + * global manager. + */ @Override public void process(final EtEvent event) { EvioEvent evioEvent = null; Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/TableExporter.java ============================================================================= --- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/TableExporter.java (original) +++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/util/TableExporter.java Mon Apr 13 13:17:35 2015 @@ -8,8 +8,9 @@ import javax.swing.table.TableModel; /** - * This is a utility for exporting a JTable's model data to a text file. Non-numeric fields are all contained in double - * quotes. + * This is a utility for exporting a JTable's model data to a text file. + * <p> + * Non-numeric fields such as strings are delimited by double quotes. * * @author <a href="mailto:[log in to unmask]">Jeremy McCormick</a> */ @@ -18,10 +19,10 @@ /** * Export the given table to a text file. * - * @param table The JTable component. - * @param path The output file path. - * @param fieldDelimiter The field delimiter to use. - * @throws IOException if there are errors writing the file. + * @param table the JTable component + * @param path the output file path + * @param fieldDelimiter the field delimiter to use + * @throws IOException if there are errors writing the file */ public static void export(final JTable table, final String path, final char fieldDelimiter) throws IOException { @@ -58,6 +59,10 @@ out.close(); } + /** + * Do not allow class instantiation. + */ private TableExporter() { + throw new UnsupportedOperationException("Do not instantiate this class."); } }