java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
eu.hansolo.fx.charts.forcedirectedgraph.GraphPanel
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget

@DefaultProperty("children") public class GraphPanel extends javafx.scene.layout.Region
authors: Michael Läuchli, MLaeuchli (github) Stefan Mettler, orizion (github)
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.SimpleDoubleProperty
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     
    javafx.beans.property.DoubleProperty
     
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.DoubleProperty
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     
    javafx.beans.property.DoubleProperty
     
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     

    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

    Constructors
    Constructor
    Description
     
    GraphPanel(NodeEdgeModel nodeEdgeModel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
     
     
     
    protected double
    computeMaxHeight(double WIDTH)
     
    protected double
    computeMaxWidth(double HEIGHT)
     
    protected double
    computeMinHeight(double WIDTH)
     
    protected double
    computeMinWidth(double HEIGHT)
     
    protected double
    computePrefHeight(double WIDTH)
     
    protected double
    computePrefWidth(double HEIGHT)
     
    void
     
    javafx.beans.property.SimpleDoubleProperty
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     
    javafx.beans.property.DoubleProperty
     
    javafx.beans.property.BooleanProperty
     
    void
    Executes the Fruchterman-Reingold algorithm, which is responsible for the placement of the nodes depending on their distance and attraction to each other
    javafx.collections.ObservableList<javafx.scene.Node>
     
    javafx.scene.paint.Color
    Gets the value of the property edgeColor.
    double
    Gets the value of the property edgeWidthFactor.
    double
    getMinNodeDistance(double radius)
     
    double
    Gets the value of the property nodeBorderWidth.
     
    javafx.scene.paint.Color
    Gets the value of the property nodeHighlightingColor.
    double
    Gets the value of the property nodeSizeFactor.
    javafx.scene.paint.Color
    Gets the value of the property selectedNodeBorderColor.
    javafx.scene.paint.Color
    Gets the value of the property selectedNodeFillColor.
    void
    Highlights all nodes in the given group by changing the stroke
    void
    highlightGroup(String groupValue, javafx.scene.paint.Color strokeColor, javafx.scene.paint.Color fillColor)
    Highlight all nodes which have a group value equal to groupValue
    void
    Highlights the node with the default color for highlighting
    void
    highlightNode(GraphNode node, javafx.scene.paint.Color color)
    Highlights node in the given color
    boolean
     
    boolean
     
    void
     
    void
    mapGroup(String group, Consumer<GraphNode> ingroupConsumer, Consumer<GraphNode> outgroupConsumer)
    Performs the action of the ingroupConsumer on all nodes in the group and performs the action of outgroupConsumer on those that are not
    javafx.beans.property.DoubleProperty
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     
    javafx.beans.property.DoubleProperty
     
    javafx.beans.property.BooleanProperty
     
    void
     
    void
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     
    javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>
     
    void
    setEdgeColor(javafx.scene.paint.Color COLOR)
    Sets the value of the property edgeColor.
    void
    setEdgeWidthFactor(double WIDTH)
    Sets the value of the property edgeWidthFactor.
    void
    setForceInverted(boolean forceInverted)
    If set True, a high Value of the Edge results in a low attraction
    void
    setInitialPosition(int width, int height)
     
    void
    setNodeBorderWidth(double WIDTH)
    Sets the value of the property nodeBorderWidth.
    void
     
    void
    setNodeHighlightingColor(javafx.scene.paint.Color COLOR)
    Sets the value of the property nodeHighlightingColor.
    void
    setNodeSizeFactor(double nodeSizeFactor)
    Sets the value of the property nodeSizeFactor.
    void
    setPhysicsActive(boolean physicsActive)
    If set to false, no physical calculations will be performed anymore and Fruchterman-Reingold wont be executed
    void
    setSelectedNodeBorderColor(javafx.scene.paint.Color COLOR)
    Sets the value of the property selectedNodeBorderColor.
    void
    setSelectedNodeFillColor(javafx.scene.paint.Color COLOR)
    Sets the value of the property selectedNodeFillColor.

    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, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty

    Methods inherited from class javafx.scene.Parent

    getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds

    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, getInitialCursor, getInitialFocusTraversable, 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, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, 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, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Property Details

  • Constructor Details

    • GraphPanel

      public GraphPanel()
    • GraphPanel

      public GraphPanel(NodeEdgeModel nodeEdgeModel)
  • Method Details

    • layoutChildren

      public void layoutChildren()
      Overrides:
      layoutChildren in class javafx.scene.Parent
    • computeMinWidth

      protected double computeMinWidth(double HEIGHT)
      Overrides:
      computeMinWidth in class javafx.scene.layout.Region
    • computeMinHeight

      protected double computeMinHeight(double WIDTH)
      Overrides:
      computeMinHeight in class javafx.scene.layout.Region
    • computePrefWidth

      protected double computePrefWidth(double HEIGHT)
      Overrides:
      computePrefWidth in class javafx.scene.layout.Region
    • computePrefHeight

      protected double computePrefHeight(double WIDTH)
      Overrides:
      computePrefHeight in class javafx.scene.layout.Region
    • computeMaxWidth

      protected double computeMaxWidth(double HEIGHT)
      Overrides:
      computeMaxWidth in class javafx.scene.layout.Region
    • computeMaxHeight

      protected double computeMaxHeight(double WIDTH)
      Overrides:
      computeMaxHeight in class javafx.scene.layout.Region
    • restart

      public void restart()
    • mapGroup

      public void mapGroup(String group, Consumer<GraphNode> ingroupConsumer, Consumer<GraphNode> outgroupConsumer)
      Performs the action of the ingroupConsumer on all nodes in the group and performs the action of outgroupConsumer on those that are not
      Parameters:
      group - The group to process
      ingroupConsumer - The action to perform on the ingroup nodes
      outgroupConsumer - The action to perform on the outgroup nodes
    • highlightGroup

      public void highlightGroup(String group)
      Highlights all nodes in the given group by changing the stroke
      Parameters:
      group - The group to highlight
    • highlightGroup

      public void highlightGroup(String groupValue, javafx.scene.paint.Color strokeColor, javafx.scene.paint.Color fillColor)
      Highlight all nodes which have a group value equal to groupValue
      Parameters:
      groupValue - A possible value for the current group
      strokeColor -
      fillColor -
    • getChildren

      public javafx.collections.ObservableList<javafx.scene.Node> getChildren()
      Overrides:
      getChildren in class javafx.scene.Parent
    • highlightNode

      public void highlightNode(GraphNode node)
      Highlights the node with the default color for highlighting
      Parameters:
      node -
    • highlightNode

      public void highlightNode(GraphNode node, javafx.scene.paint.Color color)
      Highlights node in the given color
      Parameters:
      node -
      color -
    • getMinNodeDistance

      public double getMinNodeDistance(double radius)
    • getSelectedNodeFillColor

      public javafx.scene.paint.Color getSelectedNodeFillColor()
      Gets the value of the property selectedNodeFillColor.
      Property description:
    • setSelectedNodeFillColor

      public void setSelectedNodeFillColor(javafx.scene.paint.Color COLOR)
      Sets the value of the property selectedNodeFillColor.
      Property description:
    • selectedNodeFillColorProperty

      public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> selectedNodeFillColorProperty()
      See Also:
    • getSelectedNodeBorderColor

      public javafx.scene.paint.Color getSelectedNodeBorderColor()
      Gets the value of the property selectedNodeBorderColor.
      Property description:
    • setSelectedNodeBorderColor

      public void setSelectedNodeBorderColor(javafx.scene.paint.Color COLOR)
      Sets the value of the property selectedNodeBorderColor.
      Property description:
    • selectedNodeBorderColorProperty

      public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> selectedNodeBorderColorProperty()
      See Also:
    • getNodeSizeFactor

      public double getNodeSizeFactor()
      Gets the value of the property nodeSizeFactor.
      Property description:
    • nodeSizeFactorProperty

      public javafx.beans.property.DoubleProperty nodeSizeFactorProperty()
      See Also:
    • setNodeSizeFactor

      public void setNodeSizeFactor(double nodeSizeFactor)
      Sets the value of the property nodeSizeFactor.
      Property description:
    • fruchtermanReingold

      public void fruchtermanReingold()
      Executes the Fruchterman-Reingold algorithm, which is responsible for the placement of the nodes depending on their distance and attraction to each other
    • setNodeEdgeModel

      public void setNodeEdgeModel(NodeEdgeModel nodeEdgeModel)
    • setInitialPosition

      public void setInitialPosition(int width, int height)
    • calculateDegreeCentrality

      public NodeEdgeModel calculateDegreeCentrality()
    • calculateDegreeCentralityNormalized

      public NodeEdgeModel calculateDegreeCentralityNormalized()
    • calculateClosenessCentrality

      public NodeEdgeModel calculateClosenessCentrality()
    • calculateClosenessCentralityNormalized

      public NodeEdgeModel calculateClosenessCentralityNormalized()
    • calculateBetweennessCentrality

      public NodeEdgeModel calculateBetweennessCentrality()
    • dispose

      public void dispose()
    • getNodeEdgeModel

      public NodeEdgeModel getNodeEdgeModel()
    • getEdgeColor

      public javafx.scene.paint.Color getEdgeColor()
      Gets the value of the property edgeColor.
      Property description:
    • setEdgeColor

      public void setEdgeColor(javafx.scene.paint.Color COLOR)
      Sets the value of the property edgeColor.
      Property description:
    • edgeColorProperty

      public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> edgeColorProperty()
      See Also:
    • getEdgeWidthFactor

      public double getEdgeWidthFactor()
      Gets the value of the property edgeWidthFactor.
      Property description:
    • setEdgeWidthFactor

      public void setEdgeWidthFactor(double WIDTH)
      Sets the value of the property edgeWidthFactor.
      Property description:
    • edgeWidthFactorProperty

      public javafx.beans.property.DoubleProperty edgeWidthFactorProperty()
      See Also:
    • getNodeHighlightingColor

      public javafx.scene.paint.Color getNodeHighlightingColor()
      Gets the value of the property nodeHighlightingColor.
      Property description:
    • nodeHighlightingColorProperty

      public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> nodeHighlightingColorProperty()
      See Also:
    • setNodeHighlightingColor

      public void setNodeHighlightingColor(javafx.scene.paint.Color COLOR)
      Sets the value of the property nodeHighlightingColor.
      Property description:
    • getNodeBorderWidth

      public double getNodeBorderWidth()
      Gets the value of the property nodeBorderWidth.
      Property description:
    • setNodeBorderWidth

      public void setNodeBorderWidth(double WIDTH)
      Sets the value of the property nodeBorderWidth.
      Property description:
    • nodeBorderWidthProperty

      public javafx.beans.property.DoubleProperty nodeBorderWidthProperty()
      See Also:
    • isPhysicsActive

      public boolean isPhysicsActive()
      Returns:
      Boolean, true if physics simulation is currently active, false otherwise
    • physicsActiveProperty

      public javafx.beans.property.BooleanProperty physicsActiveProperty()
      See Also:
    • setPhysicsActive

      public void setPhysicsActive(boolean physicsActive)
      If set to false, no physical calculations will be performed anymore and Fruchterman-Reingold wont be executed
      Parameters:
      physicsActive - Boolean, sets if physics simulations should be activated or not
    • isForceInverted

      public boolean isForceInverted()
      Returns:
      Boolean, true if force is inverted (High Value = small Force), false otherwise
    • forceInvertedProperty

      public javafx.beans.property.BooleanProperty forceInvertedProperty()
      See Also:
    • setForceInverted

      public void setForceInverted(boolean forceInverted)
      If set True, a high Value of the Edge results in a low attraction
      Parameters:
      forceInverted -
    • distanceScalingFactorProperty

      public javafx.beans.property.SimpleDoubleProperty distanceScalingFactorProperty()
    • redraw

      public void redraw()