aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/population
diff options
context:
space:
mode:
Diffstat (limited to 'src/jcgp/gui/population')
-rw-r--r--src/jcgp/gui/population/GUIGene.java6
-rw-r--r--src/jcgp/gui/population/GUIInput.java10
-rw-r--r--src/jcgp/gui/population/GUINode.java10
-rw-r--r--src/jcgp/gui/population/GUIOutput.java27
4 files changed, 34 insertions, 19 deletions
diff --git a/src/jcgp/gui/population/GUIGene.java b/src/jcgp/gui/population/GUIGene.java
index a37eb19..26be2a5 100644
--- a/src/jcgp/gui/population/GUIGene.java
+++ b/src/jcgp/gui/population/GUIGene.java
@@ -4,9 +4,9 @@ import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Group;
import javafx.scene.shape.Circle;
import javafx.scene.text.Text;
+import jcgp.backend.population.Connection;
+import jcgp.backend.population.Gene;
import jcgp.gui.ChromosomePane;
-import jcgp.population.Connection;
-import jcgp.population.Gene;
enum GUIGeneState {
NEUTRAL,
@@ -59,7 +59,7 @@ public abstract class GUIGene extends Group {
return locked;
}
- public abstract void setLocked(boolean value);
+ abstract void setLocked(boolean value);
public abstract void addLocks(int value);
diff --git a/src/jcgp/gui/population/GUIInput.java b/src/jcgp/gui/population/GUIInput.java
index 30ce4ac..f47186c 100644
--- a/src/jcgp/gui/population/GUIInput.java
+++ b/src/jcgp/gui/population/GUIInput.java
@@ -11,11 +11,11 @@ import javafx.scene.shape.Circle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
-import jcgp.GUI;
+import jcgp.backend.population.Connection;
+import jcgp.backend.population.Input;
+import jcgp.backend.population.Output;
import jcgp.gui.ChromosomePane;
-import jcgp.population.Connection;
-import jcgp.population.Input;
-import jcgp.population.Output;
+import jcgp.gui.GUI;
public class GUIInput extends GUIGene {
@@ -212,7 +212,7 @@ public class GUIInput extends GUIGene {
}
@Override
- public void setLocked(boolean value) {
+ void setLocked(boolean value) {
locked += value ? 1 : -1;
stateProperty.set(locked > 0 ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER);
}
diff --git a/src/jcgp/gui/population/GUINode.java b/src/jcgp/gui/population/GUINode.java
index 6fc84da..450647f 100644
--- a/src/jcgp/gui/population/GUINode.java
+++ b/src/jcgp/gui/population/GUINode.java
@@ -13,11 +13,11 @@ import javafx.scene.shape.Line;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
-import jcgp.GUI;
+import jcgp.backend.population.Connection;
+import jcgp.backend.population.Input;
+import jcgp.backend.population.Node;
import jcgp.gui.ChromosomePane;
-import jcgp.population.Connection;
-import jcgp.population.Input;
-import jcgp.population.Node;
+import jcgp.gui.GUI;
public class GUINode extends GUIGene {
@@ -429,7 +429,7 @@ public class GUINode extends GUIGene {
}
@Override
- public void setLocked(boolean value) {
+ void setLocked(boolean value) {
locked += value ? 1 : -1;
stateProperty.set(locked > 0 ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER);
diff --git a/src/jcgp/gui/population/GUIOutput.java b/src/jcgp/gui/population/GUIOutput.java
index 16d95f0..9c5dfa5 100644
--- a/src/jcgp/gui/population/GUIOutput.java
+++ b/src/jcgp/gui/population/GUIOutput.java
@@ -13,12 +13,12 @@ import javafx.scene.shape.Line;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
-import jcgp.GUI;
+import jcgp.backend.population.Connection;
+import jcgp.backend.population.Input;
+import jcgp.backend.population.Node;
+import jcgp.backend.population.Output;
import jcgp.gui.ChromosomePane;
-import jcgp.population.Connection;
-import jcgp.population.Input;
-import jcgp.population.Node;
-import jcgp.population.Output;
+import jcgp.gui.GUI;
public class GUIOutput extends GUIGene {
@@ -281,7 +281,7 @@ public class GUIOutput extends GUIGene {
}
@Override
- public void setLocked(boolean value) {
+ void setLocked(boolean value) {
locked += value ? 1 : -1;
setConnections(value ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER);
@@ -314,5 +314,20 @@ public class GUIOutput extends GUIGene {
sourceLine.setEndX(gene.getLayoutX() + NODE_RADIUS);
sourceLine.setEndY(gene.getLayoutY());
}
+
+ public void unlock() {
+ if (isLocked()) {
+ setLocked(false);
+ stateProperty.set(GUIGeneState.NEUTRAL);
+ setConnections(GUIGeneState.NEUTRAL);
+ }
+ }
+
+ public void lock() {
+ if (!isLocked()) {
+ stateProperty.set(GUIGeneState.HOVER);
+ setLocked(true);
+ }
+ }
}