From 9ac2848be66c39acdc291dc3b48b91178acc1a05 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Thu, 24 Apr 2014 10:34:30 +0100 Subject: Refactored parsers and parameters, had to install e(fx)clipse to deploy application. --- src/jcgp/gui/settings/parameters/GUIDoubleParameter.java | 10 ++++++---- src/jcgp/gui/settings/parameters/GUIIntegerParameter.java | 4 +++- src/jcgp/gui/settings/parameters/GUIParameter.java | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/jcgp/gui/settings/parameters') 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 { */ GUIDoubleParameter(Parameter 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 { @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 { @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 extends HBox { ObservableValue 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 -- cgit v1.2.3