public abstract class Parent extends Node
This class handles all hierarchical scene graph operations, including adding/removing child nodes, marking branches dirty for layout and rendering, picking, bounds calculations, and executing the layout pass on each pulse.
There are two direct concrete Parent subclasses
BASELINE_OFFSET_SAME_AS_HEIGHT
Modifier | Constructor and Description |
---|---|
protected |
Parent()
Constructs a new
Parent . |
Modifier and Type | Method and Description |
---|---|
protected double |
computeMinHeight(double width)
Calculates the min height of this
Parent . |
protected double |
computeMinWidth(double height)
Calculates the minimum width of this
Parent . |
protected double |
computePrefHeight(double width)
Calculates the preferred height of this
Parent . |
protected double |
computePrefWidth(double height)
Calculates the preferred width of this
Parent . |
double |
getBaselineOffset()
Calculates the baseline offset based on the first managed child.
|
protected ObservableList<Node> |
getChildren()
Gets the list of children of this
Parent . |
ObservableList<Node> |
getChildrenUnmodifiable()
Gets the list of children of this
Parent as a read-only
list. |
ParentTraversalEngine |
getImpl_traversalEngine()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected <E extends Node> |
getManagedChildren()
Gets the list of all managed children of this
Parent . |
ObservableList<String> |
getStylesheets()
Gets an observable list of string URLs linking to the stylesheets to use
with this Parent's contents.
|
protected boolean |
impl_computeContains(double localX,
double localY)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
BaseBounds |
impl_computeGeomBounds(BaseBounds bounds,
BaseTransform tx)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected NGNode |
impl_createPeer()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
List<String> |
impl_getAllParentStylesheets()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected void |
impl_pickNodeLocal(PickRay pickRay,
PickResultChooser result)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected void |
impl_processCSS(WritableValue<Boolean> unused)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
Object |
impl_processMXNode(MXNodeAlgorithm alg,
MXNodeAlgorithmContext ctx)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
ObjectProperty<ParentTraversalEngine> |
impl_traversalEngineProperty()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_updatePeer()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
boolean |
isNeedsLayout() |
void |
layout()
Executes a top-down layout pass on the scene graph under this parent.
|
protected void |
layoutChildren()
Invoked during the layout pass to layout the children in this
Parent . |
Node |
lookup(String selector)
Finds this
Node , or the first sub-node, based on the given CSS selector. |
double |
minHeight(double width)
Returns the node's minimum height for use in layout calculations.
|
double |
minWidth(double height)
Returns the node's minimum width for use in layout calculations.
|
ReadOnlyBooleanProperty |
needsLayoutProperty() |
double |
prefHeight(double width)
Returns the node's preferred height for use in layout calculations.
|
double |
prefWidth(double height)
Returns the node's preferred width for use in layout calculations.
|
Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
Object... parameters)
This method is called by the assistive technology to request
the value for an attribute.
|
void |
requestLayout()
Requests a layout pass to be performed before the next scene is
rendered.
|
protected void |
requestParentLayout()
Requests a layout pass of the parent to be performed before the next scene is
rendered.
|
void |
setImpl_traversalEngine(ParentTraversalEngine value)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected void |
setNeedsLayout(boolean value) |
protected void |
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, getClassCssMetaData, getClip, getContentBias, getCssMetaData, 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_computeLayoutBounds, 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_notifyLayoutBoundsChanged, 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, 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, lookupAll, managedProperty, maxHeight, maxWidth, 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, 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, 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
@Deprecated public void impl_updatePeer()
Node
impl_updatePeer
in class Node
protected ObservableList<Node> getChildren()
Parent
.
See the class documentation for Node
for scene graph structure
restrictions on setting a Parent
's children list.
If these restrictions are violated by a change to the list of children,
the change is ignored and the previous value of the children list is
restored. An IllegalArgumentException
is thrown in this case.
If this Parent
node is attached to a Scene
attached to a Window
that is showning (Window.isShowing()
), then its
list of children must only be modified on the JavaFX Application Thread.
An IllegalStateException
is thrown if this restriction is
violated.
Note to subclasses: if you override this method, you must return from your implementation the result of calling this super method. The actual list instance returned from any getChildren() implementation must be the list owned and managed by this Parent. The only typical purpose for overriding this method is to promote the method to be public.
Parent
.public ObservableList<Node> getChildrenUnmodifiable()
Parent
as a read-only
list.protected <E extends Node> List<E> getManagedChildren()
Parent
.E
- the type of the children nodes@Deprecated protected void impl_pickNodeLocal(PickRay pickRay, PickResultChooser result)
Node
impl_pickNodeLocal
in class Node
public Node lookup(String selector)
Node
Node
, or the first sub-node, based on the given CSS selector.
If this node is a Parent
, then this function will traverse down
into the branch until it finds a match. If more than one sub-node matches the
specified selector, this function returns the first of them.
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows: scene.lookup("#myId");
.
@Deprecated public final void setImpl_traversalEngine(ParentTraversalEngine value)
@Deprecated public final ParentTraversalEngine getImpl_traversalEngine()
@Deprecated public final ObjectProperty<ParentTraversalEngine> impl_traversalEngineProperty()
protected final void setNeedsLayout(boolean value)
public final boolean isNeedsLayout()
public final ReadOnlyBooleanProperty needsLayoutProperty()
public void requestLayout()
If this parent is either a layout root or unmanaged, then it will be added directly to the scene's dirty layout list, otherwise requestParentLayout will be invoked.
protected final void requestParentLayout()
This may be used when the current parent have changed it's min/max/preferred width/height, but doesn't know yet if the change will lead to it's actual size change. This will be determined when it's parent recomputes the layout with the new hints.
public double prefWidth(double height)
Node
Layout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the preferred width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
prefWidth
in class Node
height
- the height that should be used if preferred width depends on itNode.isResizable()
,
Node.getContentBias()
,
Node.autosize()
public double prefHeight(double width)
Node
Layout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the preferred height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
prefHeight
in class Node
width
- the width that should be used if preferred height depends on itNode.getContentBias()
,
Node.autosize()
public double minWidth(double height)
Node
Layout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the minimum width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
If Node's Node.maxWidth(double)
is lower than this number,
minWidth
takes precedence. This means the Node should never be resized below minWidth
.
minWidth
in class Node
height
- the height that should be used if minimum width depends on itNode.isResizable()
,
Node.getContentBias()
public double minHeight(double width)
Node
Layout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the minimum height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the width parameter whether -1 or a positive value. All other subclasses may ignore the width parameter (which will likely be -1).
If Node's Node.maxHeight(double)
is lower than this number,
minHeight
takes precedence. This means the Node should never be resized below minHeight
.
minHeight
in class Node
width
- the width that should be used if minimum height depends on itNode.isResizable()
,
Node.getContentBias()
protected double computePrefWidth(double height)
Parent
. The default
implementation calculates this width as the width of the area occupied
by its managed children when they are positioned at their
current positions at their preferred widths.height
- the height that should be used if preferred width depends
on itprotected double computePrefHeight(double width)
Parent
. The default
implementation calculates this height as the height of the area occupied
by its managed children when they are positioned at their current
positions at their preferred heights.width
- the width that should be used if preferred height depends
on itprotected double computeMinWidth(double height)
Parent
. The default
implementation simply returns the pref width.height
- the height that should be used if min width depends
on itprotected double computeMinHeight(double width)
Parent
. The default
implementation simply returns the pref height;width
- the width that should be used if min height depends
on itpublic double getBaselineOffset()
Node.getBaselineOffset()
.getBaselineOffset
in class Node
public final void layout()
protected void layoutChildren()
Parent
. By default it will only set the size of managed,
resizable content to their preferred sizes and does not do any node
positioning.
Subclasses should override this function to layout content as needed.
public final ObservableList<String> getStylesheets()
Scene.getStylesheets()
for details.
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
@Deprecated public List<String> impl_getAllParentStylesheets()
@Deprecated protected void impl_processCSS(WritableValue<Boolean> unused)
Node
super.impl_processCSS()
to ensure that
this Node's CSS state is properly updated.
Note that the difference between this method and Node.impl_processCSS(boolean)
is that this method
updates styles for this node on down; whereas, impl_processCSS(boolean)
invokes
Node.applyCss()
which will look for the top-most ancestor that needs CSS update and apply styles
from that node on down.
The WritableValue<Boolean> parameter is no longer used.impl_processCSS
in class Node
@Deprecated protected NGNode impl_createPeer()
impl_createPeer
in class Node
@Deprecated public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx)
Node
impl_computeGeomBounds
in class Node
protected void updateBounds()
@Deprecated protected boolean impl_computeContains(double localX, double localY)
impl_computeContains
in class Node
@Deprecated public Object impl_processMXNode(MXNodeAlgorithm alg, MXNodeAlgorithmContext ctx)
Node
impl_processMXNode
in class Node
alg
- current algorithm to process this nodectx
- current contextpublic Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
Node
This method is commonly overridden by subclasses to implement
attributes that are required for a specific role.
If a particular attribute is not handled, the super class implementation
must be called.
queryAccessibleAttribute
in class Node
attribute
- the requested attributeparameters
- optional list of parametersAccessibleAttribute
Copyright © 2020. All rights reserved.