aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/settings/parameters
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-05-04 19:23:52 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-05-04 19:23:52 +0100
commitaa9e74e7f67789f6353fc26e02ee8e68e40609a2 (patch)
tree3ad4ed8a0717a9983775a38b0cc8d9a10c01302a /src/jcgp/gui/settings/parameters
parentc4fc7e307caf03c93c4203aff8960ffcb3ca8737 (diff)
Added more comments, minor refactorings
Diffstat (limited to 'src/jcgp/gui/settings/parameters')
-rw-r--r--src/jcgp/gui/settings/parameters/GUIBooleanParameter.java6
-rw-r--r--src/jcgp/gui/settings/parameters/GUIDoubleParameter.java11
-rw-r--r--src/jcgp/gui/settings/parameters/GUIIntegerParameter.java10
-rw-r--r--src/jcgp/gui/settings/parameters/GUIParameter.java49
4 files changed, 37 insertions, 39 deletions
diff --git a/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
index eb669bb..29f8e1f 100644
--- a/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
@@ -9,9 +9,9 @@ import jcgp.backend.parameters.ParameterStatus;
import jcgp.gui.settings.SettingsPane;
/**
- * This extension of GUIParameter uses a CheckBox to display
- * the value of a BooleanParameter. It cannot be constructed
- * directly - instead, use GUIParameter.create().
+ * This extension of @code{GUIParameter} uses a @code{CheckBox} to display
+ * the value of a @code{BooleanParameter}. It cannot be constructed
+ * directly - instead, use @code{GUIParameter.create()}.
* <br><br>
* See {@link GUIParameter} for more information.
*
diff --git a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
index 16a4cd4..c3c1f59 100644
--- a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
@@ -12,9 +12,9 @@ import jcgp.backend.parameters.ParameterStatus;
import jcgp.gui.settings.SettingsPane;
/**
- * This extension of GUIParameter uses a TextField to display
- * the value of a DoubleParameter. It cannot be constructed
- * directly - instead, use GUIParameter.create().
+ * This extension of @code{GUIParameter} uses a @code{TextField} to display
+ * the value of a @code{DoubleParameter}. It cannot be constructed
+ * directly - instead, use @code{GUIParameter.create()}.
* <br><br>
* See {@link GUIParameter} for more information.
*
@@ -26,11 +26,11 @@ public class GUIDoubleParameter extends GUIParameter<Number> {
private DecimalFormat decimalFormat;
/**
- * This default-visibility constructor is intended for use
+ * This protected constructor is intended for use
* by the factory method only.
*
*/
- GUIDoubleParameter(Parameter<Number> parameter, SettingsPane sp) {
+ protected GUIDoubleParameter(Parameter<Number> parameter, SettingsPane sp) {
super(parameter, sp);
}
@@ -57,7 +57,6 @@ public class GUIDoubleParameter extends GUIParameter<Number> {
ObservableValue<? extends String> observable,
String oldValue, String newValue) {
if (!settingsPane.isExperimentRunning()) {
- //if (newValue.matches("([0-9]*[.]?[0-9]*)")) {
if (newValue.matches("^[-+]?[0-9]*\\.?[0-9]+$")) {
if (!newValue.isEmpty()) {
double value = Double.parseDouble(newValue);
diff --git a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
index e8a9183..5bf6d9c 100644
--- a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
@@ -10,9 +10,9 @@ import jcgp.backend.parameters.ParameterStatus;
import jcgp.gui.settings.SettingsPane;
/**
- * This extension of GUIParameter uses a TextField to display
- * the value of a IntegerParameter. It cannot be constructed
- * directly - instead, use GUIParameter.create().
+ * This extension of @code{GUIParameter} uses a @code{TextField} to display
+ * the value of a @code{IntegerParameter}. It cannot be constructed
+ * directly - instead, use @code{GUIParameter.create()}.
* <br><br>
* See {@link GUIParameter} for more information.
*
@@ -23,11 +23,11 @@ public class GUIIntegerParameter extends GUIParameter<Number> {
private TextField textField;
/**
- * This default-visibility constructor is intended for use
+ * This protected constructor is intended for use
* by the factory method only.
*
*/
- GUIIntegerParameter(Parameter<Number> parameter, SettingsPane sp) {
+ protected GUIIntegerParameter(Parameter<Number> parameter, SettingsPane sp) {
super(parameter, sp);
}
diff --git a/src/jcgp/gui/settings/parameters/GUIParameter.java b/src/jcgp/gui/settings/parameters/GUIParameter.java
index 0a9149f..3009340 100644
--- a/src/jcgp/gui/settings/parameters/GUIParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIParameter.java
@@ -20,14 +20,16 @@ import jcgp.gui.settings.SettingsPane;
/**
*
- * This is the base class for all GUIParameters. Using the factory method GUIParameter.create()
+ * This is the base class for all @code{GUIParameter}s. Using the factory method @code{GUIParameter.create()}
* generates an appropriate instance of this class for the specified parameter.
* <br><br>
- * GUIParameter is an HBox containing a Text for the parameter name and a Control for interaction.
- * It stores an instance of its associated Parameter object and also contains a Tooltip for
+ * @code{GUIParameter} is an @code{HBox} containing a @code{Text} for the parameter name
+ * and a @code{Control} for interaction.
+ * It stores an instance of its associated @code{Parameter} object and also contains a @code{Tooltip} for
* displaying status information.
* <br><br>
- * Monitor parameters have their Control disabled so that no changed can be made via the GUI.
+ * Monitor parameters are updated automatically and have their @code{Control} disabled so
+ * that no changes can be made via the GUI.
* Non-monitor parameters are updated automatically as well, but may be changed by the user
* if the program is not evolving.
*
@@ -64,12 +66,12 @@ public abstract class GUIParameter<T> extends HBox {
/**
* This protected template constructor contains the common elements to all
- * GUIParameters and should be invoked by any subclasses using super(). It
+ * @code{GUIParameter}s and should be invoked by any subclasses using @code{super()}. It
* defers the creation of the parameter {@code Control} object to the subclass
* currently being built (which in turn is defined by the factory method).
*
- * @param parameter a Parameter for which to generate a GUIParameter.
- * @param sp a reference to the SettingsPane.
+ * @param parameter a @code{Parameter} for which to generate a @code{GUIParameter}.
+ * @param sp a reference to the @code{SettingsPane}.
*/
protected GUIParameter(Parameter<T> parameter, final SettingsPane settingsPane) {
this.parameter = parameter;
@@ -105,13 +107,13 @@ public abstract class GUIParameter<T> extends HBox {
}
/**
- * Factory method to create GUIParameters from Parameters.
- * Use this to create an appropriate GUIParameter from any instance of Parameter,
- * rather than manually downcasting the Parameter object every time.
+ * Factory method to create @code{GUIParameter}s from @code{Parameter}s.
+ * Use this to create an appropriate @code{GUIParameter} from any instance of @code{Parameter},
+ * rather than manually downcasting the @code{Parameter} object every time.
*
- * @param parameter a Parameter for which to generate a GUIParameter.
- * @param sp a reference to the SettingsPane.
- * @return an appropriate instance of GUIParameter.
+ * @param parameter a parameter for which to generate a @code{GUIParameter}.
+ * @param sp a reference to the @code{SettingsPane}.
+ * @return an appropriate instance of @code{GUIParameter}.
*/
public static GUIParameter<?> create(Parameter<?> parameter, SettingsPane sp) {
if (parameter instanceof IntegerParameter) {
@@ -171,7 +173,7 @@ public abstract class GUIParameter<T> extends HBox {
/**
* Force the parameter to validate its current value, and apply the associated
- * style to the GUIParameter.
+ * style to the @code{GUIParameter}.
*/
public void validate() {
parameter.validate(parameter.get());
@@ -190,7 +192,7 @@ public abstract class GUIParameter<T> extends HBox {
}
/**
- * Set the current parameter value as the reference value of the GUIParameter.
+ * Set the current parameter value as the reference value of the @code{GUIParameter}.
* The new reference value will be used to determine the validity of the parameter,
* should its value change.
*/
@@ -203,31 +205,28 @@ public abstract class GUIParameter<T> extends HBox {
* GUIParameter() as necessary.
*/
/**
- * This method returns the Control object used to control the parameter.
+ * This method returns the @code{Control} object used to control the parameter.
* <br><br>
- * Implementations of GUIParameter must override this method and return
- * a control appropriate to the type of parameter. This will typically be
- * done by referencing the protected field GUIParameter.parameter.
+ * Implementations of @code{GUIParameter} must override this method and return
+ * a @code{Control} appropriate to the type of parameter. This will typically be
+ * done by referencing the protected field @code{GUIParameter.parameter}.
*
* @return the Control object to be added to the GUIParameter.
*/
protected abstract Control makeControl();
/**
- * Adds the necessary handlers to the Control object in order to modify
+ * Adds the necessary handlers to the @code{Control} object in order to modify
* the underlying parameter. This will typically consist of filtering key
* 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.
- * <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();
/**
- * This method is called to style the GUIParameter according to the status of
- * the parameter, which can be obtained with parameter.getStatus(). While the
+ * This method is called to style the @code{GUIParameter} according to the status of
+ * the parameter, which can be obtained with @code{parameter.getStatus()}. While the
* subclass is free to style itself in any way, the CSS strings defined here
* (INVALID_PARAMETER_STYLE, WARNING_PARAMETER_STYLE, VALID_PARAMETER_STYLE)
* provide a way to keep the GUI consistent.