Package pamViewFX.fxNodes.connectionPane
Class ConnectionPane
java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.layout.Pane
pamViewFX.fxNodes.connectionPane.ConnectionPane
- All Implemented Interfaces:
javafx.css.Styleable
,javafx.event.EventTarget
- Direct Known Subclasses:
ConnectionGroupSubPane
,DataModelConnectPane
public class ConnectionPane
extends javafx.scene.layout.Pane
A pane which allows users to drag rectangles around and connect them
together.
Although not abstract this pane is designed to be sub classed and used for different types of applications. e.g. the PAMGUARD data model.
- Author:
- Jamie Macaulay
-
Property Summary
Properties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
Properties inherited from class javafx.scene.Parent
needsLayout
Properties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
Field Summary
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddNewConnectionNode
(StandardConnectionNode connectionNode, double x, double y) Add a new connection node to the connection pane.static boolean
connectNodes
(StandardConnectionNode childNode, StandardConnectionNode parentNode) Connect two nodes.static ConnectorNode
disconnectNodes
(ConnectionNode childNode, ConnectionNode parentNode) Disconnect a node programtically.Get all connection nodes within the connection pane and any associated sub panes.getAllConnectionNodes
(boolean includeStructures) Get all connection nodes within the connection pane and any associated sub panes.Get all connection structures within the connection pane and any associated sub panes.getChildConnectionNodes
(StandardConnectionNode connectionNode) Get all node children of a connection node.getConnectionLines
(StandardConnectionNode connectionNode) Get all the connection lines from all the ConnectionNodes in a ConnectionPane.Get all connectionNodes added to the ConnectionPane.getConnectionNodes
(boolean includeStructures) Get all connection nodes within the connection pane.static ConnectorNode
getConnectionPlug
(ConnectionNode childNode, ConnectionNode parentNode, boolean includeBranch, boolean bypassStructure) Find the plug used to connect between two nodes.getConnectionPlugs
(StandardConnectionNode connectionNode) Get all the connection plugs from all the ConnectionNodes in a ConnectionPane.getConnectionSockets
(StandardConnectionNode connectionNode) Get all connection sockets from all Connection Nodes.getParentConnectionNodes
(StandardConnectionNode connectionNode) Get all node parents of a connection node.getPlugAcceptingConnectionShapes
(StandardConnectionNode connectionNode) Get all sockets and all plug connection lines from all nodes.double
Get the current zoom factorstatic boolean
isNodeConnected
(StandardConnectionNode childNode, StandardConnectionNode parentNode, boolean includeBranch, boolean bypasStructure) Check whether a parent and child node are connected.void
notifyChange
(int flag) Called whenever a connection undergoes a behaviour that other connection nodes to know about.void
notifyChange
(int flag, StandardConnectionNode connectionNode) Called whenever a connection undergoes a behaviour that other connection nodes to know about.void
removeConnectionNode
(StandardConnectionNode connectionNode) Add a new connection node to the connection pane.toString()
void
zoomIn
(double percent) Zoom into the ConnectionPane by a certain percentagevoid
zoomOut
(double percent) Zoom out of the pane by a certain percentage.Methods inherited from class javafx.scene.layout.Pane
getChildren
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPositionX, snapPositionY, snapSizeX, snapSizeY, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
Methods inherited from class javafx.scene.Parent
getBaselineOffset, getChildrenUnmodifiable, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout
Methods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setEffect, setEventDispatcher, setFocusTraversable, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
Constructor Details
-
ConnectionPane
public ConnectionPane()
-
-
Method Details
-
addNewConnectionNode
public StandardConnectionNode addNewConnectionNode(StandardConnectionNode connectionNode, double x, double y) Add a new connection node to the connection pane.- Parameters:
x
- - x position to add new nodey
- - y position to add new node.- Returns:
- the ConnectionNode which was added.
-
removeConnectionNode
Add a new connection node to the connection pane. -
getPlugAcceptingConnectionShapes
public ArrayList<ConnectorNode> getPlugAcceptingConnectionShapes(StandardConnectionNode connectionNode) Get all sockets and all plug connection lines from all nodes. If connectionNode is specified then the plugs from that connection node are not included.- Parameters:
connectionNode
- - connection node NOT to include in list of plugs. If null then all plugs from all nodes are returned.- Returns:
- a list of all connection plugs from all nodes.
-
getConnectionLines
Get all the connection lines from all the ConnectionNodes in a ConnectionPane.- Parameters:
connectionNode
- - ConnectionNode to be excluded- Returns:
- a list of lines from all non excluded ConnectionNodes.
-
getConnectionPlugs
Get all the connection plugs from all the ConnectionNodes in a ConnectionPane.- Parameters:
connectionNode
- - ConnectionNode to be excluded- Returns:
- a list of plugs from all non excluded ConnectionNodes.
-
getConnectionSockets
Get all connection sockets from all Connection Nodes. This is includes branch sockets.- Parameters:
connectionNode
- - ConnectionNode to be excluded- Returns:
- a list of sockets from all non excluded ConnectionNodes.
-
toString
- Overrides:
toString
in classjavafx.scene.Node
-
getConnectionNodes
Get all connectionNodes added to the ConnectionPane. This does NOT include structures.- Returns:
- a list of ConnectionNodes added to the connection pane.
-
getConnectionNodes
Get all connection nodes within the connection pane.- Parameters:
includeStructures
- - true to include structure nodes.- Returns:
- a list of connection nodes including or not including connection nodes.
-
getAllConnectionNodes
Get all connection nodes within the connection pane and any associated sub panes. Note that this does NOT include connection structures.- Returns:
- a list of connection nodes including or not including connection nodes.
-
getAllConnectionStructures
Get all connection structures within the connection pane and any associated sub panes. Note that this does NOT include connection nodes.- Returns:
- a list of connection structures including or not including connection nodes.
-
getAllConnectionNodes
Get all connection nodes within the connection pane and any associated sub panes.- Parameters:
includeStructures
- - true to include structure nodes.- Returns:
- a list of connection nodes including or not including connection nodes.
-
getChildConnectionNodes
Get all node children of a connection node. Children of a connectionNode are those nodes which are connected directly after that node. i.e. you can draw a line directly from the plug of that node to a socket of a child node, including nay branch sockets;- Parameters:
connectionNode
- - the connection node for which to find children- Returns:
- a list of children. List will be empty if the node has no children.
-
getParentConnectionNodes
Get all node parents of a connection node. Parents of a ConnectionNode are those noses which are connected directly before that node. i.e. you can draw a direct line form the socket of the node to the plug of a parent node. Note that structures are not included as parents.- Parameters:
connectionNode
- - the connection node for which to find parent- Returns:
- a list of children. List will be empty if the node has no children.
-
connectNodes
public static boolean connectNodes(StandardConnectionNode childNode, StandardConnectionNode parentNode) Connect two nodes.- Parameters:
childNode
- - the child node.parentNode
- - the parent node.- Returns:
- true if the connection was successful.
-
isNodeConnected
public static boolean isNodeConnected(StandardConnectionNode childNode, StandardConnectionNode parentNode, boolean includeBranch, boolean bypasStructure) Check whether a parent and child node are connected.- Parameters:
childNode
- - the node which has a plug connected from the parentNode.parentNode
- - the node which connects to the socket.includeBranch
- - include parents connected via branch sockets.bypasStructure
- - if the parent node is a structure go to the next node to check for connection.- Returns:
- true if connected and false if not connected.
-
getConnectionPlug
public static ConnectorNode getConnectionPlug(ConnectionNode childNode, ConnectionNode parentNode, boolean includeBranch, boolean bypassStructure) Find the plug used to connect between two nodes.- Parameters:
childNode
- - the node which has a plug connected from the parentNode.parentNode
- - the node whoch connects to the socket.includeBranch
- - include parents connected via branch sockets.bypasStructure
- - if the parent node is a structure go to the next node to check for connection.- Returns:
- the plug of the parent which connects to the child or null if no plug is found.
-
zoomIn
public void zoomIn(double percent) Zoom into the ConnectionPane by a certain percentage- Parameters:
percent
- Percentage to zoom e.g. 0.1= 10%
-
zoomOut
public void zoomOut(double percent) Zoom out of the pane by a certain percentage.- Parameters:
percent
- Percentage to zoom e.g. 0.1= 10%
-
getZoomFactor
public double getZoomFactor()Get the current zoom factor- Returns:
- the current zoom factor
-
notifyChange
public void notifyChange(int flag) Called whenever a connection undergoes a behaviour that other connection nodes to know about.- Parameters:
flag
- - flag to be passed to other connection nodes.
-
notifyChange
Called whenever a connection undergoes a behaviour that other connection nodes to know about.- Parameters:
flag
- - flag to be passed to other connection nodes.
-
disconnectNodes
Disconnect a node programtically.- Parameters:
parentNode
- - the parent node to disconnect- Returns:
- the plug that was removed
-