Class ConnectionLine

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

public class ConnectionLine extends javafx.scene.shape.Line implements ConnectorNode
Line which connects a plug or socket to a ConnectionRectangle or other ConnectionLine.
Author:
Jamie Macaulay
  • Property Summary

    Properties inherited from class javafx.scene.shape.Line

    endX, endY, startX, startY

    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
    ConnectionLine(StandardConnectionNode connectionNode, ConnectorNode connectionShape)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a new socket to the line.
    void
    Add a temporary socket to the line.
    boolean
    Check whether the current connection shape has a parent ConnectionNode whihc already has a branch plug on the line.
    boolean
    checkPossibleConnection(boolean notify)
    Check whether a connection has
    Get the connected shape- the shape this shape is connected to.
    Get the connection node the shape is associated with;
    int
    Check whether a connection line can connect to another ConnectionShape or not; i.e.
    double
    getDistance(javafx.scene.shape.Shape shape)
    Get the distance form the CollisionShape to another shape.
    javafx.geometry.Orientation
    Get the orientation of the shape .
    Get the parent connection shape.
    javafx.scene.shape.Shape
    Get the Shape associated with the Collision shape.
    boolean
    Chick if branch sockets can connect to line
    boolean
    Checkj whether the line is showing error status.
    void
    Remove any temporary socket from the line.
    void
    setAllowBranchSockets(boolean allowBranchSockets)
    Allow the line to accept branch sockets.
    void
    Set the connected shape- the shape which this shape is connected to.
    void
    setConnectionStatus(int type, ConnectorNode connectionShape)
    Set the connection status.
    void
    setError(boolean isError)
    Set line to show error.
    void
    setNormalColor(javafx.scene.paint.Color color)
    Set the colour of the line

    Methods inherited from class javafx.scene.shape.Line

    endXProperty, endYProperty, getEndX, getEndY, getStartX, getStartY, setEndX, setEndY, setStartX, setStartY, startXProperty, startYProperty, 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

  • Method Details

    • setNormalColor

      public void setNormalColor(javafx.scene.paint.Color color)
      Set the colour of the line
      Parameters:
      color - - colour of the line
    • 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.
    • 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()
      Check whether a connection line can connect to another ConnectionShape or not; i.e. will register a collision of another shape comes near.
      Specified by:
      getConnectionStatus in interface ConnectorNode
      Returns:
      flag for connection type.
    • 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.
    • checkBranchSocketParent

      public boolean checkBranchSocketParent(ConnectorNode connectionShape)
      Check whether the current connection shape has a parent ConnectionNode whihc already has a branch plug on the line. A parent node cannot have two branch connections.
      Parameters:
      connectionShape - - shape attempting to connect via branch socket.
      Returns:
      true if the parent ConnectionNodde of the shape is not already connected to the line.
    • removeTempSocket

      public void removeTempSocket()
      Remove any temporary socket from the line.
    • addTempSocket

      public void addTempSocket(ConnectorNode plugShape)
      Add a temporary socket to the line.
    • addBranchNewSocket

      public void addBranchNewSocket(ConnectorNode plugShape)
      Add a new socket to the line.
      Parameters:
      plugShape - - plug to connect this new socket to.
    • 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.
    • setConnectedShape

      public void setConnectedShape(ConnectorNode connecionShape)
      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:
      connecionShape - - 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
    • getConnectionNode

      public StandardConnectionNode getConnectionNode()
      Description copied from interface: ConnectorNode
      Get the connection node the shape is associated with;
      Specified by:
      getConnectionNode in interface ConnectorNode
      Returns:
      the connection node the shape is associated with;
    • isError

      public boolean isError()
      Checkj whether the line is showing error status.
      Specified by:
      isError in interface ConnectorNode
      Returns:
      true if showing error status.
    • setError

      public void setError(boolean isError)
      Set line to show error.
      Specified by:
      setError in interface ConnectorNode
      Parameters:
      isError - - true to show error.
    • isAllowBranchSockets

      public boolean isAllowBranchSockets()
      Chick if branch sockets can connect to line
      Returns:
      true if branch sockets can connect
    • setAllowBranchSockets

      public void setAllowBranchSockets(boolean allowBranchSockets)
      Allow the line to accept branch sockets.
      Parameters:
      allowBranchSockets -
    • getParentConnectionShape

      public ConnectorNode getParentConnectionShape()
      Get the parent connection shape. Each line connects a ConnectionShape to a ConnectionNode - the connectionShape the line connects to is the ParentConnectionShape.
      Returns:
      the ConnectionShape the line connects the ConnectionNode to.
    • checkPossibleConnection

      public boolean checkPossibleConnection(boolean notify)
      Description copied from interface: ConnectorNode
      Check whether a connection has
      Specified by:
      checkPossibleConnection in interface ConnectorNode
      Returns: