Package pamViewFX.fxNodes.connectionPane
Class StandardConnectionPlug
java.lang.Object
javafx.scene.Node
javafx.scene.shape.Shape
javafx.scene.shape.Polygon
pamViewFX.fxNodes.connectionPane.StandardConnectionPlug
- All Implemented Interfaces:
javafx.css.Styleable
,javafx.event.EventTarget
,ConnectorNode
Plug connected to a collision rectangle. Plugs can connect to sockets or, if
allowed, connection lines. Plugs can also be dragged without moving the
ConnectionRectangle.
- Author:
- Jamie Macaulay
-
Property Summary
Properties inherited from class javafx.scene.shape.Shape
fill, smooth, strokeDashOffset, strokeLineCap, strokeLineJoin, strokeMiterLimit, stroke, strokeType, strokeWidth
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.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
Fields inherited from interface pamViewFX.fxNodes.connectionPane.ConnectorNode
CONNECTED, CONNECTION_DISABLED, CONNECTOR_MOVED, NO_CONNECTION, POSSIBLE_CONNECTION
-
Constructor Summary
ConstructorDescriptionStandardConnectionPlug
(StandardConnectionNode connectionNode, double plugBodyWidth, double plugEndWidth, double plugBodyHeight, double plugEndHeight, double cornerRadius, javafx.geometry.Orientation orientation) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Check if the shape can connect to another shape and connect if so.checkForCollision
(ConnectorNode shape, ArrayList<? extends ConnectorNode> nodes, double min_dist) Check whether a collision with another shape has occurred.boolean
Check whether a plug is close to rectangle and therefore should be deleted.boolean
checkPossibleConnection
(boolean notify) Check whether a shape can connect and send appropriate flag to itself and the shape it can connect to.void
If dragged then a new disabled plug is made in default positions and the new plug becomes something which can be dragged around the connection pane.Get all branch sockets attached to the connectionLines of the plug.Get the connected shape- the shape this shape is connected to.Get the connectionNode associated with the shape.javafx.scene.layout.Pane
Get the connection node body.int
Check if the shape is currently connected to another shape.javafx.scene.paint.Color
double
getDistance
(javafx.scene.shape.Shape shape) Get the distance form the CollisionShape to another shape.double
getDragX()
double
getDragY()
javafx.scene.paint.Color
javafx.geometry.Point2D
getLocalCords
(double x, double y) Get the local co-ordinates for the plug when given the scene co-ordinates.double
javafx.scene.paint.Color
javafx.geometry.Orientation
Get the orientation of the shape .getPlugPolygon
(double plugBodyWidth, double plugEndWidth, double plugBodyHeight, double plugEndHeight, double cornerRadius) Get the polygon point array for the plug.Get a list of connection shapes which might connect with this shape.javafx.scene.shape.Shape
getShape()
Get the Shape associated with the Collision shape.boolean
isBound()
Check whether the plug is bound to the Connection Rectangle.boolean
isError()
Check whether plug is set to show an error.void
setConnectedShape
(ConnectorNode connectionShape) Set the connected shape- the shape which this shape is connected to.void
setConnectionNode
(StandardConnectionNode connectionNode) void
setConnectionStatus
(int type, ConnectorNode foundShape) Set the connection status.void
Set all connector nodes null.void
setDisableColour
(javafx.scene.paint.Color disableColour) void
setDragX
(double dragX) void
setDragY
(double dragY) void
setError
(boolean isError) Set whether plug is set to show an error.void
setHighLightColour
(javafx.scene.paint.Color highLightColour) void
setNormalColour
(javafx.scene.paint.Color normalColour) void
setPlugConnectionLines
(ArrayList<ConnectionLine> plugConnectionLines) Methods inherited from class javafx.scene.shape.Polygon
getPoints, toString
Methods inherited from class javafx.scene.shape.Shape
fillProperty, getClassCssMetaData, getCssMetaData, getFill, getStroke, getStrokeDashArray, getStrokeDashOffset, getStrokeLineCap, getStrokeLineJoin, getStrokeMiterLimit, getStrokeType, getStrokeWidth, intersect, isSmooth, setFill, setSmooth, setStroke, setStrokeDashOffset, setStrokeLineCap, setStrokeLineJoin, setStrokeMiterLimit, setStrokeType, setStrokeWidth, smoothProperty, strokeDashOffsetProperty, strokeLineCapProperty, strokeLineJoinProperty, strokeMiterLimitProperty, strokeProperty, strokeTypeProperty, strokeWidthProperty, subtract, union
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, getBaselineOffset, 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, isResizable, 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, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, 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, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, 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 pamViewFX.fxNodes.connectionPane.ConnectorNode
checkPossibleConnection, getConnectedShape, getConnectionNode, getConnectionStatus, getDistance, getOrientation, getShape, setConnectedShape
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
Constructor Details
-
StandardConnectionPlug
public StandardConnectionPlug(StandardConnectionNode connectionNode, double plugBodyWidth, double plugEndWidth, double plugBodyHeight, double plugEndHeight, double cornerRadius, javafx.geometry.Orientation orientation)
-
-
Method Details
-
getPlugPolygon
public static ArrayList<Double> getPlugPolygon(double plugBodyWidth, double plugEndWidth, double plugBodyHeight, double plugEndHeight, double cornerRadius) Get the polygon point array for the plug.- Parameters:
plugBodyWidth
- - the width of the plug body.plugEndWidth
- - the width of the end section of the plug (that fits into the socket).plugBodyHeight
- - the height of the plug body.plugEndHeight
- - the height of the end section of the plug (that fits into the socket).cornerRadius
- - the corner radius of the plug- Returns:
- list of points that make a polygon of the plug shape.
-
setConnectorNodesNull
public void setConnectorNodesNull()Set all connector nodes null. This means possible conenctions that are out of range etc are removed -
getLocalCords
public javafx.geometry.Point2D getLocalCords(double x, double y) Get the local co-ordinates for the plug when given the scene co-ordinates. Note this is here just in case this requires overriding in special cases.- Returns:
- the local co-ordinates in for plug.
-
enableFreePlug
public void enableFreePlug()If dragged then a new disabled plug is made in default positions and the new plug becomes something which can be dragged around the connection pane. Sets plug to free mode and adds new disabled plug to node. -
setConnectionStatus
Description copied from interface:ConnectorNode
Set the connection status.- Specified by:
setConnectionStatus
in interfaceConnectorNode
- Parameters:
type
- - type of connection status,foundShape
- - the connected or possibly connected shape. Can be null if NO_CONNECTION FLAG.
-
isBound
public boolean isBound()Check whether the plug is bound to the Connection Rectangle. If so then enableFreePlug() needs to be called to unbind. By default a new diabled plug will be added when called. -
checkPlugDelete
public boolean checkPlugDelete()Check whether a plug is close to rectangle and therefore should be deleted.- Returns:
- true if the plug can be deleted
-
getBranchSockets
Get all branch sockets attached to the connectionLines of the plug.- Returns:
- all branch sockets attached to the connection lines of the plug.
-
getPlugConnectionLines
-
setPlugConnectionLines
-
getPossibleConnectionShapes
Get a list of connection shapes which might connect with this shape.- Returns:
- a list of ConnectionShapes in a ConnectionPane which can connect with the AbstractConnectionShape;
-
getDragX
public double getDragX() -
setDragX
public void setDragX(double dragX) -
getDragY
public double getDragY() -
setDragY
public void setDragY(double dragY) -
isError
public boolean isError()Check whether plug is set to show an error.- Specified by:
isError
in interfaceConnectorNode
- Returns:
- true if the plug shows an error like appearance.
-
setError
public void setError(boolean isError) Set whether plug is set to show an error.- Specified by:
setError
in interfaceConnectorNode
- Parameters:
isError
- - true if error in connectiontrue
- if the plug shows an error like appearance.
-
getConnectionNodeBody
public javafx.scene.layout.Pane getConnectionNodeBody()Get the connection node body.- Returns:
- the connection node body
-
getConnectionNode
Get the connectionNode associated with the shape.- Specified by:
getConnectionNode
in interfaceConnectorNode
- Returns:
- the ConnectionNode associated with the shape.
-
setConnectionNode
-
getOrientation
public javafx.geometry.Orientation getOrientation()Description copied from interface:ConnectorNode
Get the orientation of the shape .- Specified by:
getOrientation
in interfaceConnectorNode
- Returns:
- orientation of the shape.
-
checkConnection
public void checkConnection()Check if the shape can connect to another shape and connect if so. -
checkPossibleConnection
public boolean checkPossibleConnection(boolean notify) Check whether a shape can connect and send appropriate flag to itself and the shape it can connect to.- Specified by:
checkPossibleConnection
in interfaceConnectorNode
- Parameters:
send
- POSSIBLE_CONNECTION to shape and found shape if found.- Returns:
- true if a possible connection has been found.
-
getDistance
public double getDistance(javafx.scene.shape.Shape shape) Description copied from interface:ConnectorNode
Get the distance form the CollisionShape to another shape. Usually this is just the centre point of the shape to the other shape centre, however in some cases might be slightly different e.g. for a line you want the closest point on the line to a shape rather than just the centre of the line.- Specified by:
getDistance
in interfaceConnectorNode
- Parameters:
shape
- - shape to get distance to.- Returns:
- the distance in pixels from the CollisionShape to the shape.
-
getNormalColour
public javafx.scene.paint.Color getNormalColour() -
setNormalColour
public void setNormalColour(javafx.scene.paint.Color normalColour) -
getHighLightColour
public javafx.scene.paint.Color getHighLightColour() -
setHighLightColour
public void setHighLightColour(javafx.scene.paint.Color highLightColour) -
getDisableColour
public javafx.scene.paint.Color getDisableColour() -
setDisableColour
public void setDisableColour(javafx.scene.paint.Color disableColour) -
getShape
public javafx.scene.shape.Shape getShape()Description copied from interface:ConnectorNode
Get the Shape associated with the Collision shape.- Specified by:
getShape
in interfaceConnectorNode
- Returns:
- the shape
-
getConnectionStatus
public int getConnectionStatus()Description copied from interface:ConnectorNode
Check if the shape is currently connected to another shape.- Specified by:
getConnectionStatus
in interfaceConnectorNode
- Returns:
- true if the shape is connected to another shape.
-
checkForCollision
public ConnectorNode checkForCollision(ConnectorNode shape, ArrayList<? extends ConnectorNode> nodes, double min_dist) Check whether a collision with another shape has occurred.- Returns:
- the shape a collision has occurred with. If no collision has occurred return null;
-
setConnectedShape
Description copied from interface:ConnectorNode
Set the connected shape- the shape which this shape is connected to. null if no shape is connected;- Specified by:
setConnectedShape
in interfaceConnectorNode
- Parameters:
connectionShape
- - the connected shape. Can be null.
-
getConnectedShape
Description copied from interface:ConnectorNode
Get the connected shape- the shape this shape is connected to. null if shape is not connected to anything;- Specified by:
getConnectedShape
in interfaceConnectorNode
-
getMinDist
public double getMinDist()
-