+ /**
+ * Answers true if the SliderPanel is for Conservation, false if it is for PID
+ * threshold
+ *
+ * @return
+ */
+ public boolean isForConservation()
+ {
+ return forConservation;
+ }
+
+ /**
+ * Answers the title for the slider panel; this may include 'Background' if
+ * for the alignment, or the group id if for a group
+ *
+ * @return
+ */
+ public String getTitle()
+ {
+ String title = null;
+ JInternalFrame conservationSlider = getConservationSlider();
+ JInternalFrame PIDSlider = getPIDSlider();
+
+ if (isForConservation())
+ {
+ if (conservationSlider != null)
+ {
+ title = conservationSlider.getTitle();
+ }
+ }
+ else if (PIDSlider != null)
+ {
+ title = PIDSlider.getTitle();
+ }
+ return title;
+ }
+
+ /**
+ * Returns the singleton instance of the Conservation slider within current
+ * application scope, or null if there is none
+ *
+ * @return
+ */
+ private static JInternalFrame getConservationSlider()
+ {
+ return Desktop.getInstance().conservationSlider;
+ }
+
+ /**
+ * Returns the singleton instance of the PID slider within current application
+ * scope, or null if there is none
+ *
+ * @return
+ */
+ private static JInternalFrame getPIDSlider()
+ {
+ return Desktop.getInstance().PIDSlider;
+ }
+
+ /**
+ * Returns the current value of the Conservation slider, or zero if there is
+ * no such slider
+ *
+ * @param slider
+ * @return
+ */
+ public static int getConservationValue()
+ {
+ return getValue(getConservationSlider());
+ }
+
+ /**
+ * Returns the current value of the PID slider, or zero if there is no such
+ * slider
+ *
+ * @param slider
+ * @return
+ */
+ public static int getPIDValue()
+ {
+ return getValue(getPIDSlider());
+ }
+
+ /**
+ * Returns the current value of the given slider, or zero if {@code slider} is
+ * null
+ *
+ * @param slider
+ * @return
+ */
+ static int getValue(JInternalFrame slider)
+ {
+ return slider == null ? 0
+ : ((SliderPanel) slider.getContentPane()).getValue();
+ }