Class StandardConnectionSocket

java.lang.Object
javafx.scene.Node
javafx.scene.shape.Shape
javafx.scene.shape.Polygon
pamViewFX.fxNodes.connectionPane.StandardConnectionSocket
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, ConnectorNode

public class StandardConnectionSocket extends javafx.scene.shape.Polygon
A socket which allows connections to parent nodes.
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

    Constructors
    Constructor
    Description
    StandardConnectionSocket(StandardConnectionNode connectionNode, double plugBodyWidth, double plugEndWidth, double plugBodyHeight, double plugEndHeight, double cornerRadius, javafx.geometry.Orientation orientation)
    Create a connection socket.
    StandardConnectionSocket(StandardConnectionNode connectionNode, double socketBodyWidth, double socketEndWidth, double socketBodyHeight, double socketEndHeight, double cornerRadius, javafx.geometry.Orientation orientation, ConnectionLine connectionLine)
    Create a branch connection socket.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    checkPossibleConnection(boolean notify)
    Check whether a shape can connect and send appropriate flag to itself and the shape it can connect to.
    javafx.scene.shape.Line
    Line which connects a plug to a socket if the plug comes close.
    Get the connected shape- the shape this shape is connected to.
    Get the connectionNode associated with the shape.
    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.
    javafx.scene.paint.Color
     
    double
     
    javafx.scene.paint.Color
     
    javafx.geometry.Orientation
    Get the orientation of the shape .
     
    Get the connection plug that this branch socket is attached to.
    Get a list of connection shapes which might connect with this shape.
    javafx.scene.shape.Shape
    Get the Shape associated with the Collision shape.
    Get all connection lines associated with a ConnectionSocket.
    getSocketPolygon(double socketBodyWidth, double socketEndWidth, double socketBodyHeight, double socketEndHeight, double cornerRadius)
    Get the polygon point array for the plug.
    boolean
    Check whether the socket is a branch socket or not.
    boolean
    Check whether there is an error in the connection
    void
    setBranch(boolean branch)
    Set whether the socket is a branch socket or not.
    void
    Set the connected shape- the shape which this shape is connected to.
    void
     
    void
    setConnectionStatus(int type, ConnectorNode connectionShape)
    Set the connection status.
    void
    setDisableColour(javafx.scene.paint.Color disableColour)
     
    void
    setError(boolean isError)
    Set the connection to have an error flag.
    void
    setHighLightColour(javafx.scene.paint.Color highLightColour)
     
    void
    setNormalColour(javafx.scene.paint.Color normalColour)
     
    void
    Set the plug and lines to show an error
    void
    Set all connection lines associated with a ConnectionSocket.

    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 javafx.css.Styleable

    getStyleableNode
  • Constructor Details

    • StandardConnectionSocket

      public StandardConnectionSocket(StandardConnectionNode connectionNode, double plugBodyWidth, double plugEndWidth, double plugBodyHeight, double plugEndHeight, double cornerRadius, javafx.geometry.Orientation orientation)
      Create a connection socket.
      Parameters:
      plugBodyWidth - - the width of the plug body
      plugEndWidth - - the width of the plug connection area- the bit which fits into the socket.
      plugBodyHeight - - the height of the main plug body.
      plugEndHeight - - the height of the plug connection area- the bit which fits into the socket.
    • StandardConnectionSocket

      public StandardConnectionSocket(StandardConnectionNode connectionNode, double socketBodyWidth, double socketEndWidth, double socketBodyHeight, double socketEndHeight, double cornerRadius, javafx.geometry.Orientation orientation, ConnectionLine connectionLine)
      Create a branch connection socket.
      Parameters:
      socketBodyWidth - - the width of the socket body
      socketEndWidth - - the width of the socket connection area- the bit which fits into the socket.
      socketBodyHeight - - the height of the main socket body.
      socketEndHeight - - the height of the socket connection area- the bit which fits into the socket.
      connectionLine - - the parent connection line for the branch socket;
  • Method Details

    • setPlugErrorAppearance

      public void setPlugErrorAppearance()
      Set the plug and lines to show an error
    • getSocketPolygon

      public static ArrayList<Double> getSocketPolygon(double socketBodyWidth, double socketEndWidth, double socketBodyHeight, double socketEndHeight, double cornerRadius)
      Get the polygon point array for the plug.
      Parameters:
      socketBodyWidth - - the width of the plug body.
      socketEndWidth - - the width of the end section of the plug (that fits into the socket).
      socketBodyHeight - - the height of the plug body.
      socketEndHeight - - 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.
    • setConnectionStatus

      public void setConnectionStatus(int type, ConnectorNode connectionShape)
      Description copied from interface: ConnectorNode
      Set the connection status.
      Specified by:
      setConnectionStatus in interface ConnectorNode
      Parameters:
      type - - type of connection status,
      connectionShape - - the connected or possibly connected shape. Can be null if NO_CONNECTION FLAG.
    • getCanConnectLine

      public javafx.scene.shape.Line getCanConnectLine()
      Line which connects a plug to a socket if the plug comes close.
      Returns:
      line which appears when socket comes into contact with connection shape.
    • getSocketConnectionLines

      public ArrayList<ConnectionLine> getSocketConnectionLines()
      Get all connection lines associated with a ConnectionSocket.
      Returns:
      array of all connection lines associated with a ConnectionSocket.
    • setSocketConnectionLines

      public void setSocketConnectionLines(ArrayList<ConnectionLine> connectionLines)
      Set all connection lines associated with a ConnectionSocket. A socket creates its' own connection lines by default.
    • getPossibleConnectionShapes

      public ArrayList<ConnectorNode> 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;
    • isBranch

      public boolean isBranch()
      Check whether the socket is a branch socket or not.
      Returns:
      true if a branch socket.
    • setBranch

      public void setBranch(boolean branch)
      Set whether the socket is a branch socket or not. Branch sockets are connected to ConnectionLines rather than the socket of a ConnectionNode.
      Parameters:
      branch - true of a branch socket.
    • getParentConnectionLine

      public ConnectionLine getParentConnectionLine()
    • getParentConnectionPlug

      public StandardConnectionPlug getParentConnectionPlug()
      Get the connection plug that this branch socket is attached to. Note :this is not the plug connected to the socket but the plug attached to the connection line which the socket attaches to. Use this to trace the socket connection to other ConnectionNodes.
      Returns:
      the plug the socket is attached (not connected) to.
    • isError

      public boolean isError()
      Description copied from interface: ConnectorNode
      Check whether there is an error in the connection
      Returns:
      true if error in connection.
    • setError

      public void setError(boolean isError)
      Description copied from interface: ConnectorNode
      Set the connection to have an error flag.
      Parameters:
      isError - - true if error in connection
    • getConnectionNode

      public StandardConnectionNode getConnectionNode()
      Get the connectionNode associated with the shape.
      Specified by:
      getConnectionNode in interface ConnectorNode
      Returns:
      the ConnectionNode associated with the shape.
    • setConnectionNode

      public void setConnectionNode(StandardConnectionNode connectionNode)
    • getOrientation

      public javafx.geometry.Orientation getOrientation()
      Description copied from interface: ConnectorNode
      Get the orientation of the shape .
      Specified by:
      getOrientation in interface ConnectorNode
      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 interface ConnectorNode
      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 interface ConnectorNode
      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 interface ConnectorNode
      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 interface ConnectorNode
      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

      public void setConnectedShape(ConnectorNode connectionShape)
      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 interface ConnectorNode
      Parameters:
      connectionShape - - the connected shape. Can be null.
    • getConnectedShape

      public ConnectorNode 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 interface ConnectorNode
    • getMinDist

      public double getMinDist()