aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/settings
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-24 10:34:30 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-24 10:34:30 +0100
commit9ac2848be66c39acdc291dc3b48b91178acc1a05 (patch)
treeec4c1805bbd45e3d59e2aa4a89605756c28914aa /src/jcgp/gui/settings
parent6769419bea279935c4a3a84616d45ee7d4a6345c (diff)
Refactored parsers and parameters, had to install e(fx)clipse to deploy application.
Diffstat (limited to 'src/jcgp/gui/settings')
-rw-r--r--src/jcgp/gui/settings/parameters/GUIDoubleParameter.java10
-rw-r--r--src/jcgp/gui/settings/parameters/GUIIntegerParameter.java4
-rw-r--r--src/jcgp/gui/settings/parameters/GUIParameter.java2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
index 5331364..f177ffa 100644
--- a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
@@ -32,13 +32,13 @@ public class GUIDoubleParameter extends GUIParameter<Number> {
*/
GUIDoubleParameter(Parameter<Number> parameter, SettingsPane sp) {
super(parameter, sp);
- decimalFormat = new DecimalFormat();
- decimalFormat.setMaximumFractionDigits(10);
}
@Override
protected Control makeControl() {
- textField = new TextField(String.valueOf(parameter.get()));
+ decimalFormat = new DecimalFormat();
+ decimalFormat.setMaximumFractionDigits(10);
+ textField = new TextField(decimalFormat.format(parameter.get().doubleValue()));
textField.setStyle(VALID_PARAMETER_STYLE);
textField.setAlignment(Pos.CENTER_RIGHT);
textField.prefWidthProperty().bind(widthProperty().divide(2));
@@ -100,6 +100,8 @@ public class GUIDoubleParameter extends GUIParameter<Number> {
@Override
public void refreshValue() {
- textField.setText(decimalFormat.format(parameter.get().doubleValue()));
+ if (!textField.isFocused()) {
+ textField.setText(decimalFormat.format(parameter.get().doubleValue()));
+ }
}
}
diff --git a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
index ee266f3..e1b0b75 100644
--- a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
@@ -97,6 +97,8 @@ public class GUIIntegerParameter extends GUIParameter<Number> {
@Override
public void refreshValue() {
- textField.setText(String.valueOf(parameter.get()));
+ if (!textField.isFocused()) {
+ textField.setText(String.valueOf(parameter.get()));
+ }
}
}
diff --git a/src/jcgp/gui/settings/parameters/GUIParameter.java b/src/jcgp/gui/settings/parameters/GUIParameter.java
index c6ac2e6..79762ff 100644
--- a/src/jcgp/gui/settings/parameters/GUIParameter.java
+++ b/src/jcgp/gui/settings/parameters/GUIParameter.java
@@ -141,7 +141,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 (settingsPane.isExperimentRunning()) {
+ if (settingsPane.isExperimentRunning() || !isFocused()) {
/* 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