public class CircularPane extends Pane
This pane lays it children out in a circle or part of a circle (arc).
In order to understand how to use this pane, it is important to understand how it places its children. Placing nodes on a circle in essence is not that difficult; a circle is 360 degrees, so each node is spaced 360 / n degrees apart, the real challenge is to determine how large the circle must be. Nodes in JavaFX are rectangles with a width and a height, but for calculating in a circle the rectangular shape is impractical. So CircularPane treats its child nodes as circles, or for better visualization: as beads on a chain.
The first step is to determine how large a single bead is. This already is an interesting question. A beat should encompass the contents of the node, but CircularPane does not know what exactly is drawn in the node. It could be a simple flat or vertical line, where the encompassing circle’s diameter is equal to the width or height (whichever is the largest). But if the contents is an X or a rectangle, then then encompassing circle’s diameter is equal to the diagonal. Since CircularPane does not know, it has to assume the worst and use the diagonal. But the childrenAreCircles property allows the user to inform CircularPane than all the children are circular (or smaller), so it can then use the width or height to calculate the encompassing circle (bead).
CircularPane segments the 360 degrees in equal parts; 360 / number of children. The largest bead determines the distance from the origin to where it fits in a segment, and this determines the size of the chain.
By setting a debug color, the beads will be drawn and will clarify the layout.
Type | Property and Description |
---|---|
ObjectProperty<EventHandler<ActionEvent>> |
animateInFinished
animateInFinished
|
ObjectProperty<EventHandler<ActionEvent>> |
animateOutFinished
animateOutFinished
|
ReadOnlyBooleanProperty |
animatingIn
animatingIn
|
ReadOnlyBooleanProperty |
animatingOut
animatingOut
|
ReadOnlyBooleanProperty |
animating
animating
|
ObjectProperty<Duration> |
animationDuration
animationDuration
|
ObjectProperty<CircularPane.AnimationInterpolation> |
animationInterpolation
animationInterpolation: calculate the position of a node during the animation (default: move from origin), use node.relocate to position node (or manually apply layoutBounds.minX/Y)
|
ObjectProperty<Double> |
arc
arc in degrees: the arc is used to determine the end position; default = 360 = north (top)
|
ObjectProperty<Boolean> |
childrenAreCircular
childrenAreCircular: if all children are circular, then we can use a different size
|
ObjectProperty<Boolean> |
clipAwayExcessWhitespace
clipAwayExcessWhitespace: cut away excess whitespace on the outside
|
ObjectProperty<Double> |
diameter
diameter: diameter of the whole layout
|
ObjectProperty<Double> |
gap
gap: space between nodes
|
ObjectProperty<Paint> |
showDebug
debug: show debug hints
|
ObjectProperty<Double> |
startAngle
StartAngle in degrees: the startAngle is used to determine the starting position; default = 0 = north (top)
|
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
impl_traversalEngine, needsLayout
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, impl_showMnemonics, impl_treeVisible, 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, visible
Modifier and Type | Class and Description |
---|---|
static interface |
CircularPane.AnimationInterpolation |
class |
CircularPane.AnimationLayoutInfo
This class holds additional layout information for animation.
|
class |
CircularPane.LayoutInfo
This class holds layout information at pane level
|
class |
CircularPane.NodeLayoutInfo
This class holds layout information at node level
|
USE_COMPUTED_SIZE, USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor and Description |
---|
CircularPane() |
getChildren
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, 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, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, 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, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public ObjectProperty<Double> startAngleProperty
StartAngle in degrees: the startAngle is used to determine the starting position; default = 0 = north (top)
getStartAngle()
,
setStartAngle(Double)
public ObjectProperty<Double> arcProperty
arc in degrees: the arc is used to determine the end position; default = 360 = north (top)
getArc()
,
setArc(Double)
public ObjectProperty<Double> gapProperty
gap: space between nodes
getGap()
,
setGap(Double)
public ObjectProperty<Double> diameterProperty
diameter: diameter of the whole layout
getDiameter()
,
setDiameter(Double)
public ObjectProperty<Boolean> childrenAreCircularProperty
childrenAreCircular: if all children are circular, then we can use a different size
public ObjectProperty<Boolean> clipAwayExcessWhitespaceProperty
clipAwayExcessWhitespace: cut away excess whitespace on the outside
public ObjectProperty<Duration> animationDurationProperty
animationDuration
public ObjectProperty<CircularPane.AnimationInterpolation> animationInterpolationProperty
animationInterpolation: calculate the position of a node during the animation (default: move from origin), use node.relocate to position node (or manually apply layoutBounds.minX/Y)
public final ReadOnlyBooleanProperty animatingProperty
animating
isAnimating()
public final ReadOnlyBooleanProperty animatingInProperty
animatingIn
isAnimatingIn()
public final ReadOnlyBooleanProperty animatingOutProperty
animatingOut
isAnimatingOut()
public ObjectProperty<EventHandler<ActionEvent>> animateInFinishedProperty
animateInFinished
public ObjectProperty<EventHandler<ActionEvent>> animateOutFinishedProperty
animateOutFinished
public ObjectProperty<Paint> showDebugProperty
debug: show debug hints
getShowDebug()
,
setShowDebug(Paint)
public CircularPane withId(String v)
Id
public ObjectProperty<Double> startAngleProperty()
StartAngle in degrees: the startAngle is used to determine the starting position; default = 0 = north (top)
getStartAngle()
,
setStartAngle(Double)
public Double getStartAngle()
public void setStartAngle(Double value)
public CircularPane withStartAngle(Double value)
public ObjectProperty<Double> arcProperty()
arc in degrees: the arc is used to determine the end position; default = 360 = north (top)
getArc()
,
setArc(Double)
public Double getArc()
public void setArc(Double value)
public CircularPane withArc(Double value)
public ObjectProperty<Double> gapProperty()
gap: space between nodes
getGap()
,
setGap(Double)
public Double getGap()
public void setGap(Double value)
public CircularPane withGap(Double value)
public ObjectProperty<Double> diameterProperty()
diameter: diameter of the whole layout
getDiameter()
,
setDiameter(Double)
public Double getDiameter()
public void setDiameter(Double value)
public CircularPane withDiameter(Double value)
public ObjectProperty<Boolean> childrenAreCircularProperty()
childrenAreCircular: if all children are circular, then we can use a different size
public Boolean getChildrenAreCircular()
public void setChildrenAreCircular(Boolean value)
public CircularPane withChildrenAreCircular(Boolean value)
public ObjectProperty<Boolean> clipAwayExcessWhitespaceProperty()
clipAwayExcessWhitespace: cut away excess whitespace on the outside
public Boolean getClipAwayExcessWhitespace()
public void setClipAwayExcessWhitespace(Boolean value)
public CircularPane withClipAwayExcessWhitespace(Boolean value)
public ObjectProperty<Duration> animationDurationProperty()
animationDuration
public Duration getAnimationDuration()
public void setAnimationDuration(Duration value)
public CircularPane withAnimationDuration(Duration value)
public ObjectProperty<CircularPane.AnimationInterpolation> animationInterpolationProperty()
animationInterpolation: calculate the position of a node during the animation (default: move from origin), use node.relocate to position node (or manually apply layoutBounds.minX/Y)
public CircularPane.AnimationInterpolation getAnimationInterpolation()
public void setAnimationInterpolation(CircularPane.AnimationInterpolation value)
public CircularPane withAnimationInterpolation(CircularPane.AnimationInterpolation value)
public final ReadOnlyBooleanProperty animatingProperty()
animating
isAnimating()
public final boolean isAnimating()
public final ReadOnlyBooleanProperty animatingInProperty()
animatingIn
isAnimatingIn()
public final boolean isAnimatingIn()
public final ReadOnlyBooleanProperty animatingOutProperty()
animatingOut
isAnimatingOut()
public final boolean isAnimatingOut()
public ObjectProperty<EventHandler<ActionEvent>> animateInFinishedProperty()
animateInFinished
public EventHandler<ActionEvent> getOnAnimateInFinished()
public void setOnAnimateInFinished(EventHandler<ActionEvent> value)
public CircularPane witOnhAnimateInFinished(EventHandler<ActionEvent> value)
public ObjectProperty<EventHandler<ActionEvent>> animateOutFinishedProperty()
animateOutFinished
public EventHandler<ActionEvent> getOnAnimateOutFinished()
public void setOnAnimateOutFinished(EventHandler<ActionEvent> value)
public CircularPane withOnAnimateOutFinished(EventHandler<ActionEvent> value)
public ObjectProperty<Paint> showDebugProperty()
debug: show debug hints
getShowDebug()
,
setShowDebug(Paint)
public Paint getShowDebug()
public void setShowDebug(Paint value)
public CircularPane withShowDebug(Paint value)
protected double computeMinWidth(double height)
computeMinWidth
in class Region
protected double computeMinHeight(double width)
computeMinHeight
in class Region
protected double computePrefWidth(double height)
computePrefWidth
in class Region
protected double computePrefHeight(double width)
computePrefHeight
in class Region
protected double computeMaxWidth(double height)
computeMaxWidth
in class Region
protected double computeMaxHeight(double width)
computeMaxHeight
in class Region
protected void layoutChildren()
layoutChildren
in class Parent
public void requestLayout()
requestLayout
in class Parent
protected CircularPane.LayoutInfo calculateLayout(jfxtras.scene.layout.CircularPane.MinPrefMax size)
public void animateIn()
public void animateOut()
public static void animateFromTheOrigin(double progress, CircularPane.AnimationLayoutInfo animationLayoutInfo)
progress
- animationLayoutInfo
- public static void animateSpiralOut(double progress, CircularPane.AnimationLayoutInfo animationLayoutInfo)
progress
- animationLayoutInfo
- public static void animateFromTheOriginWithFadeRotate(double progress, CircularPane.AnimationLayoutInfo animationLayoutInfo)
progress
- animationLayoutInfo
- public static void animateOverTheArc(double progress, CircularPane.AnimationLayoutInfo animationLayoutInfo)
progress
- animationLayoutInfo
- public static void animateOverTheArcWithFade(double progress, CircularPane.AnimationLayoutInfo animationLayoutInfo)
progress
- animationLayoutInfo
- public static void animateAppear(double progress, CircularPane.AnimationLayoutInfo animationLayoutInfo)
progress
- animationLayoutInfo
- public CircularPane add(Node node)
public CircularPane remove(Node node)