Author: [log in to unmask]
Date: Sun May 3 00:57:26 2015
New Revision: 2887
Log:
Added JavaDocs to files and fixed a minor font color issue.
Modified:
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java Sun May 3 00:57:26 2015
@@ -22,6 +22,10 @@
private JLabel[] fieldTitle;
private JLabel[] fieldValue;
+ /**
+ * Instantiates a new <code>ShifterTrigPanel</code> with the
+ * indicated name.
+ */
public ShifterTrigPanel(String name) {
// Instantiate a layout for the fields.
SpringLayout layout = new SpringLayout();
@@ -172,6 +176,12 @@
}
}
+ /**
+ * Updates the panel statistical display with data from the
+ * argument snapshot.
+ * @param stat - The snapshot from which to derive statistical
+ * data.
+ */
public void updatePanel(DiagnosticSnapshot stat) {
// If the snapshot is null, insert "null" values in the
// field panels,
@@ -234,6 +244,23 @@
processEfficiency(seenPairTriggers[SSP][TRIGGER_1], matchedPairTriggers[SSP][TRIGGER_1], 8, spaces, 0.99, 0.95);
}
+ /**
+ * Updates the indicated field value using the indicated number
+ * seen and matched elements. Automatically handles the special
+ * case of zero seen elements and also updates the colors of the
+ * field labels to the appropriate color based on the efficiency
+ * and the thresholds for warnings.
+ * @param seen - The number of elements seen.
+ * @param matched - The number of elements matched.
+ * @param fieldIndex - The index for the field that should display
+ * the statistical data.
+ * @param spaces - The number of spaces to giveto each displayed
+ * value.
+ * @param threshWarning - The threshold at which the "warning
+ * color should be used.
+ * @param threshCritical - The threshold at which the "critical"
+ * color should be used.
+ */
private void processEfficiency(int seen, int matched, int fieldIndex, int spaces, double threshWarning, double threshCritical) {
// Calculate the efficiency.
double efficiency = 100.0 * matched / seen;
@@ -267,6 +294,9 @@
}
// Otherwise, use the default component background.
- else { fieldValue[fieldIndex].setBackground(getBackground()); }
+ else {
+ fieldValue[fieldIndex].setBackground(getBackground());
+ fieldValue[fieldIndex].setForeground(getForeground());
+ }
}
}
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java Sun May 3 00:57:26 2015
@@ -5,16 +5,26 @@
import java.awt.GridLayout;
import javax.swing.JPanel;
-
+/**
+ * Class <code>ShifterTrigWindow</code> displays basic efficiency data
+ * for clustering and each of the four data triggers for both the entire
+ * run and for a local time window. The data displays will change color
+ * to either yellow or red if the efficiencies drop too low.
+ */
public class ShifterTrigWindow extends JPanel implements DiagnosticUpdatable {
private static final long serialVersionUID = 1L;
private ShifterTrigPanel localPanel = new ShifterTrigPanel("Instantaneous");
private ShifterTrigPanel globalPanel = new ShifterTrigPanel("Run-Integrated");
+ /**
+ * Instantiates a new panel for displaying basic information
+ * pertaining to trigger diagnostics.
+ */
public ShifterTrigWindow() {
setLayout(new GridLayout(1, 2));
add(localPanel);
add(globalPanel);
+ updatePanel(null, null);
}
@Override
|