diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-01 13:09:07 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-05-01 13:09:07 +0100 |
commit | c4fc7e307caf03c93c4203aff8960ffcb3ca8737 (patch) | |
tree | 10a84adee6a9b422ad5d28597d2a85fd3b6b50dd /src/jcgp/gui/settings | |
parent | 36f4393bcc9e55afa2334baa33e603ce839741a1 (diff) | |
parent | e354311547a5a5f4d817e6af5b7df99813d66ecb (diff) |
Merged with repo, there were unsynced changes
Diffstat (limited to 'src/jcgp/gui/settings')
-rw-r--r-- | src/jcgp/gui/settings/SettingsPane.java | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/jcgp/gui/settings/SettingsPane.java b/src/jcgp/gui/settings/SettingsPane.java index b1322e4..e3d2096 100644 --- a/src/jcgp/gui/settings/SettingsPane.java +++ b/src/jcgp/gui/settings/SettingsPane.java @@ -43,6 +43,8 @@ public class SettingsPane extends AnchorPane { private TestCaseTable testCaseTable; private GUI gui; + + private int currentArity; public SettingsPane(GUI gui) { super(); @@ -168,6 +170,8 @@ public class SettingsPane extends AnchorPane { } private void initialiseProblemTypeParameters(final JCGP jcgp, final GUI gui) { + updateArity(); + problemPane= new VBox(2); Text header = new Text("Problem Type"); @@ -207,6 +211,7 @@ public class SettingsPane extends AnchorPane { @Override public void handle(ActionEvent event) { jcgp.setProblem(problemCBox.getSelectionModel().getSelectedIndex()); + updateArity(); refreshParameters(jcgp.getProblem().getLocalParameters(), problemParameters); if (testCaseTable != null) { testCaseTable.close(); @@ -313,6 +318,7 @@ public class SettingsPane extends AnchorPane { gui.reDraw(); refreshFunctions(); } + gui.flushConsole(); } }); @@ -328,6 +334,7 @@ public class SettingsPane extends AnchorPane { gui.getExperiment().loadChromosome(chrFile, 0); gui.reDraw(); } + gui.flushConsole(); } }); saveChromosome.setOnAction(new EventHandler<ActionEvent>() { @@ -341,6 +348,7 @@ public class SettingsPane extends AnchorPane { if (chrFile != null) { gui.getExperiment().saveChromosome(chrFile, 0); } + gui.flushConsole(); } }); @@ -395,6 +403,7 @@ public class SettingsPane extends AnchorPane { fs.disableFunction(index); } gui.updateFunctionSelector(); + revalidateParameters(); } }); nodeFunctions.getChildren().add(cb); @@ -408,7 +417,8 @@ public class SettingsPane extends AnchorPane { } /** - * @return true if the experiment needs to be reset, false otherwise. + * + * @return true if the experiment needs to be reset, false if otherwise. */ public boolean isResetRequired() { for (GUIParameter<?> parameter : parameters) { @@ -416,6 +426,9 @@ public class SettingsPane extends AnchorPane { return true; } } + if (arityChanged()) { + return true; + } return false; } @@ -437,15 +450,19 @@ public class SettingsPane extends AnchorPane { * changed parameter. */ public void revalidateParameters() { - runPause.setDisable(false); - step.setDisable(false); + boolean disableControls = false; for (GUIParameter<?> parameter : parameters) { parameter.validate(); if (parameter.requiresReset()) { - runPause.setDisable(true); - step.setDisable(true); + disableControls = true; } } + if (arityChanged()) { + disableControls = true; + } + + runPause.setDisable(disableControls); + step.setDisable(disableControls); } /** @@ -456,6 +473,7 @@ public class SettingsPane extends AnchorPane { for (GUIParameter<?> parameter : parameters) { parameter.applyValue(); } + updateArity(); } /** @@ -499,4 +517,12 @@ public class SettingsPane extends AnchorPane { public TestCaseTable getTestCaseTable() { return testCaseTable; } + + private void updateArity() { + currentArity = gui.getExperiment().getProblem().getFunctionSet().getMaxArity(); + } + + private boolean arityChanged() { + return currentArity != gui.getExperiment().getProblem().getFunctionSet().getMaxArity(); + } } |