aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/settings/parameters/GUIParameter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/gui/settings/parameters/GUIParameter.java')
-rw-r--r--src/jcgp/gui/settings/parameters/GUIParameter.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/jcgp/gui/settings/parameters/GUIParameter.java b/src/jcgp/gui/settings/parameters/GUIParameter.java
index b7afb74..a8a8c4a 100644
--- a/src/jcgp/gui/settings/parameters/GUIParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIParameter.java
@@ -49,6 +49,7 @@ public abstract class GUIParameter<T> extends HBox {
private Text name;
private Control valueControl;
+ protected SettingsPane settingsPane;
protected Tooltip tooltip;
protected Parameter<T> parameter;
@@ -70,24 +71,24 @@ public abstract class GUIParameter<T> extends HBox {
* @param parameter a Parameter for which to generate a GUIParameter
* @param sp a reference to the SettingsPane
*/
- protected GUIParameter(Parameter<T> parameter, final SettingsPane sp) {
+ protected GUIParameter(Parameter<T> parameter, final SettingsPane settingsPane) {
this.parameter = parameter;
this.referenceValue = parameter.get();
+ this.settingsPane = settingsPane;
+
setAlignment(Pos.CENTER_LEFT);
setSpacing(5);
name = new Text(parameter.getName());
// set text width to half of the total width of the GUIParameter
name.wrappingWidthProperty().bind(widthProperty().divide(2));
- // allow the text to grow to always fill half of the GUIParameter
// the tooltip is the hover-over label containing status information, when appropriate
tooltip = new Tooltip();
tooltip.setStyle("-fx-background-color: white; -fx-border-color: black; .page-corner {-fx-background-color: transparent;}");
tooltip.setSkin(null);
-
valueControl = makeControl();
setHgrow(valueControl, Priority.ALWAYS);
@@ -99,7 +100,7 @@ public abstract class GUIParameter<T> extends HBox {
// if parameter is not a monitor, make sure the control is constrained appropriately
if (!parameter.isMonitor()) {
- setControlListeners(sp);
+ setControlListeners();
}
getChildren().addAll(name, valueControl);
@@ -143,7 +144,7 @@ public abstract class GUIParameter<T> extends HBox {
ObservableValue<? extends Object> observable,
Object oldValue, Object newValue) {
// only do this if the experiment is running
- if (GUI.isWorking()) {
+ if (settingsPane.isExperimentRunning()) {
/* here's the catch - atomically get the lock state and set it to true
* the lock will only be false again when the runnable is finished executing,
* preventing multiple runnables to concurrently update the same GUIParameter
@@ -221,11 +222,11 @@ public abstract class GUIParameter<T> extends HBox {
* presses to ensure no invalid characters are inserted, applying the new
* value to the underlying parameter and revalidating the parameters to
* reflect the changes made.
- *
- * @param settingsPane the parent Pane on which revalidateParameters() should
- * be called.
+ * <br><br>
+ * Note that changelisteners registered to the main content property of the
+ * control should always call handleChange() to update the
*/
- protected abstract void setControlListeners(SettingsPane settingsPane);
+ protected abstract void setControlListeners();
/**
* This method is called to style the GUIParameter according to the status of