diff options
Diffstat (limited to 'src/jcgp/gui/settings')
-rw-r--r-- | src/jcgp/gui/settings/SettingsPane.java | 64 | ||||
-rw-r--r-- | src/jcgp/gui/settings/parameters/GUIDoubleParameter.java | 2 | ||||
-rw-r--r-- | src/jcgp/gui/settings/parameters/GUIIntegerParameter.java | 2 |
3 files changed, 42 insertions, 26 deletions
diff --git a/src/jcgp/gui/settings/SettingsPane.java b/src/jcgp/gui/settings/SettingsPane.java index 5b23bdd..d7ffd79 100644 --- a/src/jcgp/gui/settings/SettingsPane.java +++ b/src/jcgp/gui/settings/SettingsPane.java @@ -17,7 +17,7 @@ import javafx.scene.text.Font; import javafx.scene.text.Text; import jcgp.JCGP; import jcgp.backend.function.FunctionSet; -import jcgp.backend.modules.ea.EvolutionaryAlgorithm; +import jcgp.backend.modules.es.EvolutionaryStrategy; import jcgp.backend.modules.fitness.Problem; import jcgp.backend.modules.mutator.Mutator; import jcgp.backend.resources.parameters.Parameter; @@ -103,26 +103,26 @@ public class SettingsPane extends AnchorPane { private void initialiseEAParameters(final JCGP cgp) { eaPane = new VBox(2); - Text header = new Text("Evolutionary Algorithm"); + Text header = new Text("Evolutionary Strategy"); header.setFont(Font.font("Arial", 14)); header.setUnderline(true); - final ComboBox<EvolutionaryAlgorithm> eaCBox = new ComboBox<EvolutionaryAlgorithm>(); - eaCBox.getItems().addAll(cgp.getEvolutionaryAlgorithms()); - eaCBox.getSelectionModel().select(cgp.getEvolutionaryAlgorithm()); + final ComboBox<EvolutionaryStrategy> eaCBox = new ComboBox<EvolutionaryStrategy>(); + eaCBox.getItems().addAll(cgp.getEvolutionaryStrategies()); + eaCBox.getSelectionModel().select(cgp.getEvolutionaryStrategy()); eaCBox.prefWidthProperty().bind(mainContainer.widthProperty()); final VBox eaParameters = new VBox(); eaParameters.setSpacing(2); - if (cgp.getEvolutionaryAlgorithm().getLocalParameters() != null) { - refreshParameters(cgp.getEvolutionaryAlgorithm().getLocalParameters(), eaParameters); + if (cgp.getEvolutionaryStrategy().getLocalParameters() != null) { + refreshParameters(cgp.getEvolutionaryStrategy().getLocalParameters(), eaParameters); } eaCBox.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { - cgp.setEvolutionaryAlgorithm(eaCBox.getSelectionModel().getSelectedIndex()); + cgp.setEvolutionaryStrategy(eaCBox.getSelectionModel().getSelectedIndex()); if (eaCBox.getSelectionModel().getSelectedItem().getLocalParameters() != null) { refreshParameters(eaCBox.getSelectionModel().getSelectedItem().getLocalParameters(), eaParameters); } @@ -147,7 +147,7 @@ public class SettingsPane extends AnchorPane { final VBox mutatorParameters = new VBox(); mutatorParameters.setSpacing(2); - if (cgp.getEvolutionaryAlgorithm().getLocalParameters() != null) { + if (cgp.getEvolutionaryStrategy().getLocalParameters() != null) { refreshParameters(cgp.getMutator().getLocalParameters(), mutatorParameters); } @@ -168,7 +168,7 @@ public class SettingsPane extends AnchorPane { private void initialiseProblemTypeParameters(final JCGP cgp, final GUI gui) { problemPane= new VBox(2); - Text header = new Text("Problem type"); + Text header = new Text("Problem Type"); header.setFont(Font.font("Arial", 14)); header.setUnderline(true); @@ -205,6 +205,10 @@ public class SettingsPane extends AnchorPane { } private void createControls(final JCGP cgp, final GUI gui) { + Text header = new Text("Experiment controls"); + header.setFont(Font.font("Arial", 14)); + header.setUnderline(true); + final VBox controls = new VBox(2); controls.setFillWidth(true); @@ -241,7 +245,7 @@ public class SettingsPane extends AnchorPane { HBox.setHgrow(reset, Priority.ALWAYS); reset.setMaxWidth(Double.MAX_VALUE); - controls.getChildren().add(flowButtons); + controls.getChildren().addAll(header, flowButtons); mainContainer.getChildren().add(controls); } @@ -255,7 +259,6 @@ public class SettingsPane extends AnchorPane { vb.getChildren().clear(); for (int i = 0; i < newParameters.length; i++) { GUIParameter gp = GUIParameter.create(newParameters[i], this); - parameters.add(gp); vb.getChildren().add(gp); } @@ -289,17 +292,17 @@ public class SettingsPane extends AnchorPane { - public void runningMode(boolean value) { - baseParameterPane.setDisable(value); - eaPane.setDisable(value); - mutatorPane.setDisable(value); - problemPane.setDisable(value); - step.setDisable(value); - reset.setDisable(value); - - runPause.setText(value ? "Pause" : "Run"); - } - +// public void runningMode(boolean value) { +// baseParameterPane.setDisable(value); +// eaPane.setDisable(value); +// mutatorPane.setDisable(value); +// problemPane.setDisable(value); +// step.setDisable(value); +// reset.setDisable(value); +// +// runPause.setText(value ? "Pause" : "Run"); +// } +// /** * * @return true if the experiment needs to be reset, false otherwise. @@ -335,6 +338,19 @@ public class SettingsPane extends AnchorPane { public void applyParameters() { for (GUIParameter parameter : parameters) { parameter.applyValue(); - } + } + } + + public void updateControls(boolean running, boolean finished) { + baseParameterPane.setDisable(running); + eaPane.setDisable(running); + mutatorPane.setDisable(running); + problemPane.setDisable(running); + + runPause.setText(running ? "Pause" : "Run"); + runPause.setDisable(finished); + step.setDisable(running || finished); + reset.setDisable(running); + } } diff --git a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java index eecff2d..4a8e0e1 100644 --- a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java +++ b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java @@ -34,7 +34,7 @@ public class GUIDoubleParameter extends GUIParameter { name.wrappingWidthProperty().bind(widthProperty().divide(2)); - ((TextField) valueControl).setEditable(!parameter.isMonitor()); + ((TextField) valueControl).setDisable(parameter.isMonitor()); // bind if monitor, else set changelistener if (parameter.isMonitor()) { diff --git a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java index 9c84c6a..204e7a2 100644 --- a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java +++ b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java @@ -34,7 +34,7 @@ public class GUIIntegerParameter extends GUIParameter { name.wrappingWidthProperty().bind(widthProperty().divide(2)); - ((TextField) valueControl).setEditable(!parameter.isMonitor()); + ((TextField) valueControl).setDisable(parameter.isMonitor()); // bind if monitor, else set listeners if (parameter.isMonitor()) { |