diff options
Diffstat (limited to 'src/jcgp/gui/population/GUIOutput.java')
-rw-r--r-- | src/jcgp/gui/population/GUIOutput.java | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/jcgp/gui/population/GUIOutput.java b/src/jcgp/gui/population/GUIOutput.java index 602a022..415d0fd 100644 --- a/src/jcgp/gui/population/GUIOutput.java +++ b/src/jcgp/gui/population/GUIOutput.java @@ -129,15 +129,6 @@ public class GUIOutput extends GUIGene { } }); - addEventFilter(MouseDragEvent.MOUSE_DRAG_OVER, new EventHandler<MouseDragEvent>() { - @Override - public void handle(MouseDragEvent event) { - // the user is dragging over this node, react appropriately - // this happens even if we are the source of the drag - - } - }); - addEventFilter(MouseDragEvent.MOUSE_DRAG_EXITED, new EventHandler<MouseDragEvent>() { @Override public void handle(MouseDragEvent event) { @@ -179,13 +170,25 @@ public class GUIOutput extends GUIGene { } }); + addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { + @Override + public void handle(MouseEvent event) { + setLocked(!isLocked()); + } + }); + addEventFilter(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { // cursor has left this node without dragging, or it is dragging and this is the source if (stateProperty.get() == GUIGeneState.HOVER) { - stateProperty.set(GUIGeneState.NEUTRAL); - setConnections(GUIGeneState.NEUTRAL); + if (isLocked()) { + + } else { + stateProperty.set(GUIGeneState.NEUTRAL); + setConnections(GUIGeneState.NEUTRAL); + } + } } }); @@ -274,4 +277,18 @@ public class GUIOutput extends GUIGene { stateProperty.set(GUIGeneState.NEUTRAL); setConnections(GUIGeneState.NEUTRAL); } + + @Override + public void setLocked(boolean value) { + //stateProperty.set(GUIGeneState.HOVER); + locked += value ? 1 : -1; + setConnections(value ? GUIGeneState.HOVER : GUIGeneState.ACTIVE_HOVER); + + if (output.getSource() instanceof Node) { + parent.getGuiNode(((Node) output.getSource()).getRow(), ((Node) output.getSource()).getColumn()).setLocked(value); + } else if (output.getSource() instanceof Input) { + parent.getGuiInput(((Input) output.getSource()).getIndex()).setLocked(value); + } + + } } |