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
PropertiesTypePropertyDescriptionjavafx.beans.property.SimpleDoublePropertyjavafx.beans.property.ObjectProperty<javafx.scene.paint.Color>javafx.beans.property.DoublePropertyjavafx.beans.property.BooleanPropertyjavafx.beans.property.DoublePropertyjavafx.beans.property.ObjectProperty<javafx.scene.paint.Color>javafx.beans.property.DoublePropertyjavafx.beans.property.BooleanPropertyjavafx.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, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties 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_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecomputeMaxHeight(double WIDTH) protected doublecomputeMaxWidth(double HEIGHT) protected doublecomputeMinHeight(double WIDTH) protected doublecomputeMinWidth(double HEIGHT) protected doublecomputePrefHeight(double WIDTH) protected doublecomputePrefWidth(double HEIGHT) voiddispose()javafx.beans.property.SimpleDoublePropertyjavafx.beans.property.ObjectProperty<javafx.scene.paint.Color>javafx.beans.property.DoublePropertyjavafx.beans.property.BooleanPropertyvoidExecutes the Fruchterman-Reingold algorithm, which is responsible for the placement of the nodes depending on their distance and attraction to each otherjavafx.collections.ObservableList<javafx.scene.Node>javafx.scene.paint.ColorGets the value of the property edgeColor.doubleGets the value of the property edgeWidthFactor.doublegetMinNodeDistance(double radius) doubleGets the value of the property nodeBorderWidth.javafx.scene.paint.ColorGets the value of the property nodeHighlightingColor.doubleGets the value of the property nodeSizeFactor.javafx.scene.paint.ColorGets the value of the property selectedNodeBorderColor.javafx.scene.paint.ColorGets the value of the property selectedNodeFillColor.voidhighlightGroup(String group) Highlights all nodes in the given group by changing the strokevoidhighlightGroup(String groupValue, javafx.scene.paint.Color strokeColor, javafx.scene.paint.Color fillColor) Highlight all nodes which have a group value equal togroupValuevoidhighlightNode(GraphNode node) Highlights the node with the default color for highlightingvoidhighlightNode(GraphNode node, javafx.scene.paint.Color color) Highlights node in the given colorbooleanbooleanvoidvoidPerforms the action of theingroupConsumeron all nodes in the group and performs the action ofoutgroupConsumeron those that are notjavafx.beans.property.DoublePropertyjavafx.beans.property.ObjectProperty<javafx.scene.paint.Color>javafx.beans.property.DoublePropertyjavafx.beans.property.BooleanPropertyvoidredraw()voidrestart()javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>javafx.beans.property.ObjectProperty<javafx.scene.paint.Color>voidsetEdgeColor(javafx.scene.paint.Color COLOR) Sets the value of the property edgeColor.voidsetEdgeWidthFactor(double WIDTH) Sets the value of the property edgeWidthFactor.voidsetForceInverted(boolean forceInverted) If set True, a high Value of the Edge results in a low attractionvoidsetInitialPosition(int width, int height) voidsetNodeBorderWidth(double WIDTH) Sets the value of the property nodeBorderWidth.voidsetNodeEdgeModel(NodeEdgeModel nodeEdgeModel) voidsetNodeHighlightingColor(javafx.scene.paint.Color COLOR) Sets the value of the property nodeHighlightingColor.voidsetNodeSizeFactor(double nodeSizeFactor) Sets the value of the property nodeSizeFactor.voidsetPhysicsActive(boolean physicsActive) If set to false, no physical calculations will be performed anymore and Fruchterman-Reingold wont be executedvoidsetSelectedNodeBorderColor(javafx.scene.paint.Color COLOR) Sets the value of the property selectedNodeBorderColor.voidsetSelectedNodeFillColor(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, widthPropertyMethods inherited from class javafx.scene.Parent
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods 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, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
selectedNodeFillColor
public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> selectedNodeFillColorProperty -
selectedNodeBorderColor
public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> selectedNodeBorderColorProperty -
nodeSizeFactor
public javafx.beans.property.DoubleProperty nodeSizeFactorProperty- See Also:
-
edgeColor
public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> edgeColorProperty- See Also:
-
edgeWidthFactor
public javafx.beans.property.DoubleProperty edgeWidthFactorProperty -
nodeHighlightingColor
public javafx.beans.property.ObjectProperty<javafx.scene.paint.Color> nodeHighlightingColorProperty -
nodeBorderWidth
public javafx.beans.property.DoubleProperty nodeBorderWidthProperty -
physicsActive
public javafx.beans.property.BooleanProperty physicsActiveProperty- See Also:
-
forceInverted
public javafx.beans.property.BooleanProperty forceInvertedProperty- See Also:
-
distanceScalingFactor
public javafx.beans.property.SimpleDoubleProperty distanceScalingFactorProperty
-
-
Constructor Details
-
GraphPanel
public GraphPanel() -
GraphPanel
-
-
Method Details
-
layoutChildren
public void layoutChildren()- Overrides:
layoutChildrenin classjavafx.scene.Parent
-
computeMinWidth
protected double computeMinWidth(double HEIGHT) - Overrides:
computeMinWidthin classjavafx.scene.layout.Region
-
computeMinHeight
protected double computeMinHeight(double WIDTH) - Overrides:
computeMinHeightin classjavafx.scene.layout.Region
-
computePrefWidth
protected double computePrefWidth(double HEIGHT) - Overrides:
computePrefWidthin classjavafx.scene.layout.Region
-
computePrefHeight
protected double computePrefHeight(double WIDTH) - Overrides:
computePrefHeightin classjavafx.scene.layout.Region
-
computeMaxWidth
protected double computeMaxWidth(double HEIGHT) - Overrides:
computeMaxWidthin classjavafx.scene.layout.Region
-
computeMaxHeight
protected double computeMaxHeight(double WIDTH) - Overrides:
computeMaxHeightin classjavafx.scene.layout.Region
-
restart
public void restart() -
mapGroup
public void mapGroup(String group, Consumer<GraphNode> ingroupConsumer, Consumer<GraphNode> outgroupConsumer) Performs the action of theingroupConsumeron all nodes in the group and performs the action ofoutgroupConsumeron those that are not- Parameters:
group- The group to processingroupConsumer- The action to perform on the ingroup nodesoutgroupConsumer- The action to perform on the outgroup nodes
-
highlightGroup
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 togroupValue- Parameters:
groupValue- A possible value for the current groupstrokeColor-fillColor-
-
getChildren
public javafx.collections.ObservableList<javafx.scene.Node> getChildren()- Overrides:
getChildrenin classjavafx.scene.Parent
-
highlightNode
Highlights the node with the default color for highlighting- Parameters:
node-
-
highlightNode
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() -
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() -
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
-
setInitialPosition
public void setInitialPosition(int width, int height) -
calculateDegreeCentrality
-
calculateDegreeCentralityNormalized
-
calculateClosenessCentrality
-
calculateClosenessCentralityNormalized
-
calculateBetweennessCentrality
-
dispose
public void dispose() -
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() -
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() -
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() -
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()
-