aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-03-31 20:32:59 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-03-31 20:32:59 +0100
commita757deacded0d7357a9f68462d3f2051e16004ee (patch)
tree4706e867ed7686a155f0c8ee16ffb3eeb74daac4 /src/jcgp/gui
parent04b35ccdad6e18701ede823e333118b0b22907c2 (diff)
Need to do a few tests on windows
Diffstat (limited to 'src/jcgp/gui')
-rw-r--r--src/jcgp/gui/ChromosomePane.java122
-rw-r--r--src/jcgp/gui/Messenger.java7
-rw-r--r--src/jcgp/gui/console/GUIConsole.java (renamed from src/jcgp/gui/GUIConsole.java)16
-rw-r--r--src/jcgp/gui/settings/SettingsPane.java400
-rw-r--r--src/jcgp/gui/settings/parameters/GUIBooleanParameter.java40
-rw-r--r--src/jcgp/gui/settings/parameters/GUIDoubleParameter.java48
-rw-r--r--src/jcgp/gui/settings/parameters/GUIIntegerParameter.java49
-rw-r--r--src/jcgp/gui/settings/parameters/GUIParameter.java30
8 files changed, 698 insertions, 14 deletions
diff --git a/src/jcgp/gui/ChromosomePane.java b/src/jcgp/gui/ChromosomePane.java
new file mode 100644
index 0000000..b4a628f
--- /dev/null
+++ b/src/jcgp/gui/ChromosomePane.java
@@ -0,0 +1,122 @@
+package jcgp.gui;
+
+import java.util.ArrayList;
+
+import javafx.scene.control.ScrollPane;
+import javafx.scene.layout.Pane;
+import javafx.scene.shape.Line;
+import jcgp.JCGP.Resources;
+import jcgp.gui.population.GUIGene;
+import jcgp.gui.population.GUIInput;
+import jcgp.gui.population.GUINode;
+import jcgp.gui.population.GUIOutput;
+import jcgp.population.Chromosome;
+import jcgp.population.Connection;
+import jcgp.population.Input;
+import jcgp.population.Node;
+
+
+public class ChromosomePane extends ScrollPane {
+
+ private GUINode[][] guiNodes;
+ private GUIInput[] guiInputs;
+ private GUIOutput[] guiOutputs;
+
+ private Pane content;
+
+ private ArrayList<Line> connectionLines;
+
+ private boolean target = false;
+
+ public ChromosomePane(Chromosome chromosome, Resources resources) {
+ super();
+ connectionLines = new ArrayList<Line>();
+
+ //setMouseTransparent(true);
+
+ content = new Pane();
+ content.setId("content pane for genes");
+
+ // generate the GUIGenes
+ // inputs
+ guiInputs = new GUIInput[resources.getInt("inputs")];
+ for (int i = 0; i < guiInputs.length; i++) {
+ // make the GUI elements
+ guiInputs[i] = new GUIInput(this, chromosome.getInput(i));
+ content.getChildren().addAll(guiInputs[i]);
+ }
+ // nodes
+ guiNodes = new GUINode[resources.getInt("rows")][resources.getInt("columns")];
+ double angle, xPos, yPos;
+ for (int r = 0; r < guiNodes.length; r++) {
+ for (int c = 0; c < guiNodes[r].length; c++) {
+ // make the connection lines
+ Line lines[] = new Line[resources.getInt("arity")];
+ for (int l = 0; l < lines.length; l++) {
+ angle = ((((double) (l + 1)) / ((double) (lines.length + 1))) * GUIGene.THETA) - (GUIGene.THETA / 2);
+ xPos = (-Math.cos(angle) * GUIGene.NODE_RADIUS) + (((c + 1) * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING)) + GUIGene.NODE_RADIUS);
+ yPos = (Math.sin(angle) * GUIGene.NODE_RADIUS) + ((r * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING)) + GUIGene.NODE_RADIUS);
+
+ lines[l] = new Line(xPos, yPos, xPos, yPos);
+ lines[l].setMouseTransparent(true);
+ lines[l].setVisible(false);
+ connectionLines.add(lines[l]);
+ }
+ // make the GUI elements
+ guiNodes[r][c] = new GUINode(this, chromosome.getNode(r, c), lines);
+ }
+ content.getChildren().addAll(guiNodes[r]);
+ }
+
+ // outputs
+ guiOutputs = new GUIOutput[resources.getInt("outputs")];
+ for (int i = 0; i < guiOutputs.length; i++) {
+ xPos = ((resources.getInt("columns") + 1) * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING));
+ yPos = (chromosome.getOutput(i).getIndex() * (2 * GUIGene.NODE_RADIUS + GUIGene.SPACING)) + GUIGene.NODE_RADIUS;
+ // make the line
+ Line line = new Line(xPos, yPos, xPos, yPos);
+ line.setMouseTransparent(true);
+ line.setVisible(false);
+ connectionLines.add(line);
+ // make the GUI elements
+ guiOutputs[i] = new GUIOutput(this, chromosome.getOutput(i), line);
+ content.getChildren().addAll(guiOutputs[i]);
+ }
+
+ content.getChildren().addAll(connectionLines);
+ setPrefWidth(620);
+ setContent(content);
+ }
+
+ public GUIGene getGuiGene(Connection gene) {
+ if (gene instanceof Input) {
+ return guiInputs[((Input) gene).getIndex()];
+ } else if (gene instanceof Node) {
+ return guiNodes[((Node) gene).getRow()][((Node) gene).getColumn()];
+ } else {
+ // something bad happened!
+ throw new ClassCastException();
+ }
+
+ }
+
+ public boolean isTarget() {
+ return target;
+ }
+
+ public void setTarget(boolean newValue) {
+ target = newValue;
+ }
+
+ public void update() {
+ for (int r = 0; r < guiNodes.length; r++) {
+ for (int c = 0; c < guiNodes[r].length; c++) {
+ guiNodes[r][c].updateLines();
+ guiNodes[r][c].updateFunction();
+ }
+ }
+ for (int i = 0; i < guiOutputs.length; i++) {
+ guiOutputs[i].updateLines();
+ }
+ }
+}
diff --git a/src/jcgp/gui/Messenger.java b/src/jcgp/gui/Messenger.java
new file mode 100644
index 0000000..becf47c
--- /dev/null
+++ b/src/jcgp/gui/Messenger.java
@@ -0,0 +1,7 @@
+package jcgp.gui;
+
+public class Messenger {
+
+
+
+}
diff --git a/src/jcgp/gui/GUIConsole.java b/src/jcgp/gui/console/GUIConsole.java
index 15ef2f6..0ef2be3 100644
--- a/src/jcgp/gui/GUIConsole.java
+++ b/src/jcgp/gui/console/GUIConsole.java
@@ -1,10 +1,5 @@
-package jcgp.gui;
+package jcgp.gui.console;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.control.TextArea;
@@ -21,14 +16,7 @@ public class GUIConsole extends AnchorPane {
super();
textArea.setEditable(false);
textArea.setWrapText(true);
-
-// System.setOut(new PrintStream(new OutputStream() {
-// @Override
-// public void write(final int b) throws IOException {
-// textArea.appendText(String.valueOf((char) b));
-// }
-// }));
-
+
setResizeListeners();
AnchorPane.setTopAnchor(textArea, GUI.RESIZE_MARGIN);
diff --git a/src/jcgp/gui/settings/SettingsPane.java b/src/jcgp/gui/settings/SettingsPane.java
new file mode 100644
index 0000000..9edcbdb
--- /dev/null
+++ b/src/jcgp/gui/settings/SettingsPane.java
@@ -0,0 +1,400 @@
+package jcgp.gui.settings;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javafx.beans.property.SimpleIntegerProperty;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.geometry.Insets;
+import javafx.scene.Cursor;
+import javafx.scene.control.Button;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.input.MouseEvent;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.VBox;
+import javafx.scene.text.Font;
+import javafx.scene.text.FontSmoothingType;
+import javafx.scene.text.Text;
+import jcgp.GUI;
+import jcgp.JCGP;
+import jcgp.function.FunctionSet;
+import jcgp.gui.settings.parameters.*;
+import jcgp.modules.ea.EvolutionaryAlgorithm;
+import jcgp.modules.fitness.FitnessFunction;
+import jcgp.modules.mutator.Mutator;
+import jcgp.parameters.*;
+
+public class SettingsPane extends AnchorPane {
+
+ private VBox mainContainer;
+ private VBox bpPane, eaPane, mutatorPane, ffPane, nfPane;
+ private ArrayList<GUIParameter> parameters = new ArrayList<GUIParameter>();
+
+ private boolean dragging = false;
+
+ public SettingsPane(JCGP cgp, GUI gui) {
+ super();
+
+ setResizeListeners();
+
+ mainContainer = new VBox(8);
+ mainContainer.setPadding(new Insets(5, GUI.RESIZE_MARGIN, 0, 2));
+
+ setMinWidth(GUI.SETTINGS_WIDTH);
+ setPrefWidth(GUI.SETTINGS_WIDTH);
+
+ initialiseBaseParameters(cgp, gui);
+
+ initialiseEAParameters(cgp);
+
+ initialiseMutatorParameters(cgp);
+
+ initialiseFitnessFunctionParameters(cgp);
+
+ initialiseNodeFunctionParameters(cgp);
+
+ createControls(cgp, gui);
+
+ ScrollPane scroll = new ScrollPane();
+ scroll.setFitToWidth(true);
+ scroll.setContent(mainContainer);
+ scroll.setStyle("-fx-background-color: #FFFFFF");
+
+ AnchorPane.setTopAnchor(scroll, 0.0);
+ AnchorPane.setBottomAnchor(scroll, 0.0);
+ AnchorPane.setRightAnchor(scroll, 0.0);
+ AnchorPane.setLeftAnchor(scroll, GUI.RESIZE_MARGIN);
+
+ getChildren().add(scroll);
+ }
+
+ private void initialiseBaseParameters(JCGP cgp, GUI gui) {
+ bpPane = new VBox(2);
+
+ Text header = new Text("Base Parameters");
+ header.setFont(Font.font("Arial", 14));
+ header.setUnderline(true);
+
+ bpPane.getChildren().add(header);
+
+ final GUIIntegerParameter generation = new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("currentGen"));
+ final GUIIntegerParameter run = new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("currentRun"));
+
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("rows")));
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("columns")));
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("inputs")));
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("outputs")));
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("levelsBack")));
+
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("popSize")));
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("generations")));
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("runs")));
+
+ parameters.add(generation);
+ parameters.add(run);
+
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("seed")));
+ parameters.add(new GUIIntegerParameter((IntegerParameter) cgp.getResources().getParameter("report")));
+ parameters.add(new GUIBooleanParameter((BooleanParameter) cgp.getResources().getParameter("verbose")));
+
+ bpPane.getChildren().addAll(parameters);
+
+ mainContainer.getChildren().add(bpPane);
+
+ generation.getTextField().textProperty().bind(((SimpleIntegerProperty) cgp.getResources().getParameter("currentGen").valueProperty()).asString());
+ }
+
+ private void initialiseEAParameters(final JCGP cgp) {
+ eaPane = new VBox(2);
+
+ Text header = new Text("Evolutionary Algorithm");
+ 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());
+ eaCBox.prefWidthProperty().bind(mainContainer.widthProperty());
+
+ final VBox eaParameters = new VBox();
+ eaParameters.setSpacing(2);
+ if (cgp.getEvolutionaryAlgorithm().getLocalParameters() != null) {
+ refreshParameters(cgp.getEvolutionaryAlgorithm().getLocalParameters().entrySet().iterator(), eaParameters);
+ }
+
+ eaCBox.setOnAction(new EventHandler<ActionEvent>() {
+ @Override
+ public void handle(ActionEvent event) {
+ cgp.setEvolutionaryAlgorithm(eaCBox.getSelectionModel().getSelectedIndex());
+ if (eaCBox.getSelectionModel().getSelectedItem().getLocalParameters() != null) {
+ refreshParameters(eaCBox.getSelectionModel().getSelectedItem().getLocalParameters().entrySet().iterator(), eaParameters);
+ }
+ }
+ });
+
+ eaPane.getChildren().addAll(header, eaCBox, eaParameters);
+ mainContainer.getChildren().add(eaPane);
+ }
+
+ private void initialiseMutatorParameters(final JCGP cgp) {
+ mutatorPane = new VBox(2);
+
+ Text header = new Text("Mutator");
+ header.setFontSmoothingType(FontSmoothingType.LCD);
+ header.setFont(Font.font("Arial", 14));
+ header.setUnderline(true);
+
+ final ComboBox<Mutator> mutatorCBox = new ComboBox<Mutator>();
+ mutatorCBox.getItems().addAll(cgp.getMutators());
+ mutatorCBox.getSelectionModel().select(cgp.getMutator());
+ mutatorCBox.prefWidthProperty().bind(mainContainer.widthProperty());
+
+ final VBox mutatorParameters = new VBox();
+ mutatorParameters.setSpacing(2);
+ if (cgp.getEvolutionaryAlgorithm().getLocalParameters() != null) {
+ refreshParameters(cgp.getMutator().getLocalParameters().entrySet().iterator(), mutatorParameters);
+ }
+
+ mutatorCBox.setOnAction(new EventHandler<ActionEvent>() {
+ @Override
+ public void handle(ActionEvent event) {
+ cgp.setEvolutionaryAlgorithm(mutatorCBox.getSelectionModel().getSelectedIndex());
+ if (mutatorCBox.getSelectionModel().getSelectedItem().getLocalParameters() != null) {
+ refreshParameters(mutatorCBox.getSelectionModel().getSelectedItem().getLocalParameters().entrySet().iterator(), mutatorParameters);
+ }
+ }
+ });
+
+ mutatorPane.getChildren().addAll(header, mutatorCBox, mutatorParameters);
+ mainContainer.getChildren().add(mutatorPane);
+ }
+
+ private void initialiseFitnessFunctionParameters(final JCGP cgp) {
+ ffPane= new VBox(2);
+
+ Text header = new Text("Fitness Function");
+ header.setFont(Font.font("Arial", 14));
+ header.setUnderline(true);
+
+ final ComboBox<FitnessFunction> ffCBox = new ComboBox<FitnessFunction>();
+ ffCBox.getItems().addAll(cgp.getFitnessFunctions());
+ ffCBox.getSelectionModel().select(cgp.getFitnessFunction());
+ ffCBox.prefWidthProperty().bind(mainContainer.widthProperty());
+
+ final VBox ffParameters = new VBox();
+ ffParameters.setSpacing(2);
+ if (cgp.getFitnessFunction().getLocalParameters() != null) {
+ refreshParameters(cgp.getFitnessFunction().getLocalParameters().entrySet().iterator(), ffParameters);
+ }
+
+ ffCBox.setOnAction(new EventHandler<ActionEvent>() {
+ @Override
+ public void handle(ActionEvent event) {
+ cgp.setEvolutionaryAlgorithm(ffCBox.getSelectionModel().getSelectedIndex());
+ if (ffCBox.getSelectionModel().getSelectedItem().getLocalParameters() != null) {
+ refreshParameters(ffCBox.getSelectionModel().getSelectedItem().getLocalParameters().entrySet().iterator(), ffParameters);
+ }
+ }
+ });
+
+ ffPane.getChildren().addAll(header, ffCBox, ffParameters);
+ mainContainer.getChildren().add(ffPane);
+
+ }
+
+ private void initialiseNodeFunctionParameters(JCGP cgp) {
+ nfPane = new VBox(2);
+
+ Text header = new Text("Node Functions");
+ header.setFont(Font.font("Arial", 14));
+ header.setUnderline(true);
+
+ final ComboBox<FunctionSet> nfCBox = new ComboBox<FunctionSet>();
+ nfCBox.getItems().addAll(cgp.getResources().getFunctionSets());
+ nfCBox.getSelectionModel().select(cgp.getResources().getFunctionSet());
+ nfCBox.prefWidthProperty().bind(mainContainer.widthProperty());
+
+ final VBox nfParameters = new VBox();
+ nfParameters.setSpacing(2);
+ refreshFunctions(cgp.getResources().getFunctionSet(), nfParameters);
+
+ nfCBox.setOnAction(new EventHandler<ActionEvent>() {
+ @Override
+ public void handle(ActionEvent event) {
+ refreshFunctions(nfCBox.getSelectionModel().getSelectedItem(), nfParameters);
+ }
+ });
+
+ nfPane.getChildren().addAll(header, nfCBox, nfParameters);
+ mainContainer.getChildren().add(nfPane);
+ }
+
+ private void createControls(final JCGP cgp, final GUI gui) {
+ final VBox controls = new VBox(2);
+ controls.setFillWidth(true);
+
+ final HBox flowButtons = new HBox(2);
+ final Button play = new Button("Run");
+
+ play.setOnAction(new EventHandler<ActionEvent>() {
+ @Override
+ public void handle(ActionEvent event) {
+ gui.playPause();
+ if (gui.isEvolving()) {
+ play.setText("Pause");
+ } else {
+ play.setText("Run");
+ }
+ }
+ });
+
+ Button step = new Button("Step");
+
+ step.setOnAction(new EventHandler<ActionEvent>() {
+ @Override
+ public void handle(ActionEvent event) {
+ gui.step();
+ }
+ });
+
+ flowButtons.getChildren().addAll(play, step);
+
+ HBox.setHgrow(play, Priority.ALWAYS);
+ play.setMaxWidth(Double.MAX_VALUE);
+
+ HBox.setHgrow(step, Priority.ALWAYS);
+ step.setMaxWidth(Double.MAX_VALUE);
+
+ controls.getChildren().add(flowButtons);
+
+ mainContainer.getChildren().add(controls);
+
+ }
+
+ /**
+ * @param cgp
+ * @param vb
+ */
+ private void refreshParameters(Iterator<Entry<String, Parameter>> it, VBox vb) {
+ parameters.removeAll(vb.getChildren());
+ vb.getChildren().clear();
+ while (it.hasNext()) {
+ Parameter parameter = ((Map.Entry<String, Parameter>) it.next()).getValue();
+ if (parameter instanceof IntegerParameter) {
+ GUIIntegerParameter gip = new GUIIntegerParameter((IntegerParameter) parameter);
+ parameters.add(gip);
+ vb.getChildren().add(gip);
+ } else if (parameter instanceof DoubleParameter) {
+ GUIDoubleParameter gdp = new GUIDoubleParameter((DoubleParameter) parameter);
+ parameters.add(gdp);
+ vb.getChildren().add(gdp);
+ } else if (parameter instanceof BooleanParameter) {
+ GUIBooleanParameter gbp = new GUIBooleanParameter((BooleanParameter) parameter);
+ parameters.add(gbp);
+ vb.getChildren().add(gbp);
+ }
+ }
+ }
+
+ private void refreshFunctions(final FunctionSet fs, VBox vb) {
+ vb.getChildren().clear();
+ CheckBox cb;
+ for (int i = 0; i < fs.getTotalFunctionCount(); i++) {
+ cb = new CheckBox(fs.getFunction(i).getName());
+ cb.setId(String.valueOf(i));
+ cb.setSelected(fs.isEnabled(fs.getFunction(i)));
+ final int index = i;
+ cb.setOnAction(new EventHandler<ActionEvent>() {
+ @Override
+ public void handle(ActionEvent event) {
+ if (((CheckBox) event.getSource()).isSelected()) {
+ fs.enableFunction(index);
+ } else {
+ fs.disableFunction(index);
+ }
+ }
+ });
+ vb.getChildren().add(cb);
+ }
+ }
+
+ private void setResizeListeners() {
+ setOnMousePressed(new EventHandler<MouseEvent>() {
+ @Override
+ public void handle(MouseEvent event) {
+ if(isInDraggableZone(event)) {
+ dragging = true;
+ }
+ }
+ });
+ setOnMouseDragged(new EventHandler<MouseEvent>() {
+ @Override
+ public void handle(MouseEvent event) {
+ if(dragging) {
+ double newWidth = getWidth() - event.getX();
+ if (newWidth >= getMinWidth()) {
+ setPrefWidth(newWidth);
+ } else {
+ setPrefWidth(getMinWidth());
+ }
+ }
+ }
+ });
+ setOnMouseMoved(new EventHandler<MouseEvent>() {
+ @Override
+ public void handle(MouseEvent event) {
+ if(isInDraggableZone(event) || dragging) {
+ setCursor(Cursor.H_RESIZE);
+ }
+ else {
+ setCursor(Cursor.DEFAULT);
+ }
+ }
+ });
+ setOnMouseReleased(new EventHandler<MouseEvent>() {
+ @Override
+ public void handle(MouseEvent event) {
+ dragging = false;
+ setCursor(Cursor.DEFAULT);
+ }
+ });
+ }
+
+ private boolean isInDraggableZone(MouseEvent event) {
+ return event.getX() < (GUI.RESIZE_MARGIN);
+ }
+
+ public void refreshValues() {
+ for (GUIParameter parameter : parameters) {
+ parameter.refreshValue();
+ }
+ //parent.updateNodeGrids();
+ }
+
+// public void bindParameters() {
+// for (GUIParameter parameter : parameters) {
+// parameter.doBindings();
+// }
+// }
+//
+// public void unbindParameters() {
+// for (GUIParameter parameter : parameters) {
+// parameter.undoBindings();
+// }
+// }
+
+ public void toggleSettings(boolean value) {
+ bpPane.setDisable(value);
+ eaPane.setDisable(value);
+ mutatorPane.setDisable(value);
+ ffPane.setDisable(value);
+ nfPane.setDisable(value);
+ }
+}
diff --git a/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
new file mode 100644
index 0000000..a9f6753
--- /dev/null
+++ b/src/jcgp/gui/settings/parameters/GUIBooleanParameter.java
@@ -0,0 +1,40 @@
+package jcgp.gui.settings.parameters;
+
+import javafx.scene.control.CheckBox;
+import jcgp.parameters.BooleanParameter;
+
+public class GUIBooleanParameter extends GUIParameter {
+
+ public GUIBooleanParameter(BooleanParameter parameter) {
+ super();
+
+ this.parameter = parameter;
+
+ value = new CheckBox(parameter.getName());
+ ((CheckBox) value).setSelected(parameter.get());
+
+ value.setDisable(!parameter.isEditable());
+
+ getChildren().add(value);
+
+ }
+
+// @Override
+// public void doBindings() {
+// ((CheckBox) value).selectedProperty().bind(((BooleanParameter) parameter).valueProperty());
+// }
+//
+// @Override
+// public void undoBindings() {
+// ((CheckBox) value).selectedProperty().unbind();
+// }
+
+ @Override
+ public void refreshValue() {
+ if (!((CheckBox) value).selectedProperty().isBound()) {
+ ((CheckBox) value).setSelected(((BooleanParameter) parameter).get());
+ }
+
+ }
+
+}
diff --git a/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
new file mode 100644
index 0000000..25d5b9f
--- /dev/null
+++ b/src/jcgp/gui/settings/parameters/GUIDoubleParameter.java
@@ -0,0 +1,48 @@
+package jcgp.gui.settings.parameters;
+
+import javafx.geometry.Pos;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.Priority;
+import javafx.scene.text.Text;
+import jcgp.GUI;
+import jcgp.parameters.DoubleParameter;
+
+public class GUIDoubleParameter extends GUIParameter {
+
+ public GUIDoubleParameter(DoubleParameter parameter) {
+ super();
+
+ this.parameter = parameter;
+
+ name = new Text(parameter.getName());
+ value = new TextField(String.valueOf(parameter.get()));
+
+ ((TextField) value).setAlignment(Pos.CENTER_RIGHT);
+
+ setHgrow(value, Priority.ALWAYS);
+
+ name.setWrappingWidth(GUI.WRAP_WIDTH);
+
+ ((TextField) value).setEditable(parameter.isEditable());
+
+ getChildren().addAll(name, value);
+ }
+
+// @Override
+// public void doBindings() {
+// ((TextField) value).textProperty().bind(((DoubleParameter) parameter).valueProperty().asString());
+// }
+//
+// @Override
+// public void undoBindings() {
+// ((TextField) value).textProperty().unbind();
+// }
+
+ @Override
+ public void refreshValue() {
+ if (!((TextField) value).textProperty().isBound()) {
+ ((TextField) value).setText(String.valueOf(((DoubleParameter) parameter).get()));
+ }
+ }
+
+}
diff --git a/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
new file mode 100644
index 0000000..6bcfd55
--- /dev/null
+++ b/src/jcgp/gui/settings/parameters/GUIIntegerParameter.java
@@ -0,0 +1,49 @@
+package jcgp.gui.settings.parameters;
+
+import javafx.geometry.Pos;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.Priority;
+import javafx.scene.text.Text;
+import jcgp.GUI;
+import jcgp.parameters.IntegerParameter;
+
+public class GUIIntegerParameter extends GUIParameter {
+
+ public GUIIntegerParameter(IntegerParameter parameter) {
+ super();
+
+ this.parameter = parameter;
+
+ name = new Text(parameter.getName());
+ value = new TextField(String.valueOf(parameter.get()));
+
+ ((TextField) value).setAlignment(Pos.CENTER_RIGHT);
+
+ setHgrow(value, Priority.ALWAYS);
+
+ name.setWrappingWidth(GUI.WRAP_WIDTH);
+
+ ((TextField) value).setEditable(parameter.isEditable());
+
+ getChildren().addAll(name, value);
+ }
+
+// @Override
+// public void doBindings() {
+// ((TextField) value).textProperty().bind(((IntegerParameter) parameter).valueProperty().asString());
+// }
+//
+// @Override
+// public void undoBindings() {
+// ((TextField) value).textProperty().unbind();
+// }
+
+ public TextField getTextField() {
+ return (TextField) value;
+ }
+
+ @Override
+ public void refreshValue() {
+ ((TextField) value).setText(String.valueOf(((IntegerParameter) parameter).get()));
+ }
+}
diff --git a/src/jcgp/gui/settings/parameters/GUIParameter.java b/src/jcgp/gui/settings/parameters/GUIParameter.java
new file mode 100644
index 0000000..a2f2f9c
--- /dev/null
+++ b/src/jcgp/gui/settings/parameters/GUIParameter.java
@@ -0,0 +1,30 @@
+package jcgp.gui.settings.parameters;
+
+import javafx.geometry.Pos;
+import javafx.scene.control.Control;
+import javafx.scene.layout.HBox;
+import javafx.scene.text.Text;
+import jcgp.parameters.Parameter;
+
+public abstract class GUIParameter extends HBox {
+
+ protected Parameter parameter;
+ protected Text name;
+ protected Control value;
+
+ public GUIParameter() {
+ setAlignment(Pos.CENTER_LEFT);
+ setSpacing(5);
+ }
+
+ public Parameter getParameter() {
+ return parameter;
+ }
+
+// public abstract void doBindings();
+//
+// public abstract void undoBindings();
+
+ public abstract void refreshValue();
+
+}