Package javafx.scene

Class Parent

java.lang.Object
javafx.scene.Node
javafx.scene.Parent
All Implemented Interfaces:
LayoutMeasurable, LayoutMeasurableMixin, HasBlendModeProperty, HasClipProperty, HasEffectProperty, HasLayoutXProperty, HasLayoutYProperty, HasManagedProperty, HasMouseTransparentProperty, HasOnMouseClickedProperty, HasOpacityProperty, HasParentProperty, HasVisibleProperty, Styleable, EventTarget, INode
Direct Known Subclasses:
Group, Region, WebView

public class Parent extends Node
Author:
Bruno Salmon
  • Property Details

  • Constructor Details

    • Parent

      public Parent(Node... nodes)
  • Method Details

    • getChildren

      public ObservableList<Node> getChildren()
    • getChildrenUnmodifiable

      public ObservableList<Node> getChildrenUnmodifiable()
      Gets the list of children of this Parent as a read-only list.
      Returns:
      read-only access to this parent's children ObservableList
    • getManagedChildren

      protected <E extends Node> List<E> getManagedChildren()
      Gets the list of all managed children of this Parent.
      Type Parameters:
      E - the type of the children nodes
      Returns:
      list of all managed children in this parent
    • setNeedsLayout

      protected final void setNeedsLayout(boolean value)
      Sets the value of the needsLayout property.
      Property description:
      Indicates that this Node and its subnodes requires a layout pass on the next pulse.
      Parameters:
      value - the value for the needsLayout property
      See Also:
    • isNeedsLayout

      public final boolean isNeedsLayout()
    • needsLayoutProperty

      public final Property<Boolean> needsLayoutProperty()
      Indicates that this Node and its subnodes requires a layout pass on the next pulse.
      Returns:
      the needsLayout property
      See Also:
    • setLayoutFlag

      public void setLayoutFlag(LayoutFlags flag)
    • requestLayout

      public void requestLayout()
      Requests a layout pass to be performed before the next scene is rendered. This is batched up asynchronously to happen once per "pulse", or frame of animation.

      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.

    • requestParentLayout

      protected final void requestParentLayout()
      Requests a layout pass of the parent to be performed before the next scene is rendered. This is batched up asynchronously to happen once per "pulse", or frame of animation.

      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.

    • impl_prefWidth

      protected double impl_prefWidth(double height)
      Overrides:
      impl_prefWidth in class Node
    • impl_prefHeight

      protected double impl_prefHeight(double width)
      Overrides:
      impl_prefHeight in class Node
    • impl_minWidth

      protected double impl_minWidth(double height)
      Overrides:
      impl_minWidth in class Node
    • impl_minHeight

      protected double impl_minHeight(double width)
      Overrides:
      impl_minHeight in class Node
    • computePrefWidth

      protected double computePrefWidth(double height)
      Calculates the preferred width of this 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.
      Parameters:
      height - the height that should be used if preferred width depends on it
      Returns:
      the calculated preferred width
    • computePrefHeight

      protected double computePrefHeight(double width)
      Calculates the preferred height of this 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.
      Parameters:
      width - the width that should be used if preferred height depends on it
      Returns:
      the calculated preferred height
    • computeMinWidth

      protected double computeMinWidth(double height)
      Calculates the minimum width of this Parent. The default implementation simply returns the pref width.
      Parameters:
      height - the height that should be used if min width depends on it
      Returns:
      the calculated min width
    • computeMinHeight

      protected double computeMinHeight(double width)
      Calculates the min height of this Parent. The default implementation simply returns the pref height;
      Parameters:
      width - the width that should be used if min height depends on it
      Returns:
      the calculated min height
    • getBaselineOffset

      public double getBaselineOffset()
      Calculates the baseline offset based on the first managed child. If there is no such child, returns INode.getBaselineOffset().
      Returns:
      baseline offset
    • layout

      public void layout()
      Executes a top-down layout pass on the scene graph under this parent. Calling this method while the Parent is doing layout is a no-op.
    • layoutChildren

      protected void layoutChildren()
      Invoked during the layout pass to layout the children in this 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.

    • setSceneRoot

      public void setSceneRoot(boolean sceneRoot)
    • impl_computeGeomBounds

      public BaseBounds impl_computeGeomBounds(BaseBounds bounds, BaseTransform tx)
      This set is used to track all of the children of this group which are dirty. It is only used in cases where the number of children is > some value (currently 10). For very wide trees, this can provide a very important speed boost. For the sake of memory consumption, this is null unless the number of children ever crosses the threshold where it will be activated.
      Specified by:
      impl_computeGeomBounds in class Node