// the drag has entered this node, react appropriately
// this happens even if we are the source of the drag
if (isAllowed((GUIGene) event.getGestureSource(), (GUIGene) event.getSource())) {
((GUIGene) event.getGestureSource()).setConnectionLine((GUIGene) event.getSource());
Connection source = ((GUIGene) event.getGestureSource()).getChangingConnection();
if (node == source) {
setState(GUIGeneState.NO_CHANGE_TARGET);
} else {
setState(GUIGeneState.VALID_TARGET);
}
} else {
setState(GUIGeneState.INVALID_TARGET);
}
}
});
addEventFilter(MouseDragEvent.MOUSE_DRAG_EXITED, new EventHandler<MouseDragEvent>() {
@Override
public void handle(MouseDragEvent event) {
// the drag has exited this node, react appropriately
// this happens even if we are the source of the drag
parent.setTarget(false);
if (event.isPrimaryButtonDown()) {
if (event.getGestureSource() == event.getSource()) {
setState(GUIGeneState.SOURCE);
} else {
if (getState() == GUIGeneState.NO_CHANGE_TARGET) {
setState(GUIGeneState.INDIRECT_HOVER);
} else {
setState(GUIGeneState.NEUTRAL);
((GUIGene) event.getGestureSource()).setConnectionStates(GUIGeneState.INDIRECT_HOVER);
}
}
}
}
});
addEventFilter(MouseDragEvent.MOUSE_DRAG_RELEASED, new EventHandler<MouseDragEvent>() {
@Override
public void handle(MouseDragEvent event) {
GUIGene source = ((GUIGene) event.getGestureSource());
// set states to reflect the new situation
if (source.isLocked()) {
source.setState(GUIGeneState.HOVER);
source.setConnectionStates(GUIGeneState.HOVER);
} else {
source.setState(GUIGeneState.NEUTRAL);
source.setConnectionStates(GUIGeneState.NEUTRAL);
}
// the user released the drag gesture on this node, react appropriately
if (isAllowed((GUIGene) event.getGestureSource(), (GUIGene) event.getSource())) {
if (source.isLocked()) {
// remove locks from the old connection, add the to setConnethe new
// note that the old connection may still have locks after this
parent.getGuiGene(source.getChangingConnection()).removeLocks(source.getLocks());
addLocks(source.getLocks());
} else {
if (source instanceof GUIOutput) {
source.resetState();
}
}
source.setChangingConnection(node);
}
source.updateLines();
setState(GUIGeneState.HOVER);
}
});
addEventFilter(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() {