Module org.snapfx

Class DockSplitPane

java.lang.Object
org.snapfx.model.DockSplitPane
All Implemented Interfaces:
DockContainer, DockElement

public class DockSplitPane extends Object implements DockContainer
Represents a split container in the DockGraph. Can be oriented horizontally or vertically.
  • Constructor Details

    • DockSplitPane

      public DockSplitPane(javafx.geometry.Orientation orientation)
      Creates a split container with the given orientation.
      Parameters:
      orientation - split orientation
  • Method Details

    • getId

      public String getId()
      Description copied from interface: DockElement
      Returns the element's ID.
      Specified by:
      getId in interface DockElement
      Returns:
      unique layout element ID
    • getParent

      public DockContainer getParent()
      Description copied from interface: DockElement
      Returns the parent container, or null if this is the root.
      Specified by:
      getParent in interface DockElement
      Returns:
      parent container or null
    • setParent

      public void setParent(DockContainer parent)
      Description copied from interface: DockElement
      Sets the parent container.
      Specified by:
      setParent in interface DockElement
      Parameters:
      parent - parent container, or null for detached/root state
    • getChildren

      public javafx.collections.ObservableList<DockElement> getChildren()
      Description copied from interface: DockContainer
      Returns the list of child elements.
      Specified by:
      getChildren in interface DockContainer
      Returns:
      mutable observable child list
    • addChild

      public void addChild(DockElement element)
      Adds a child element to this split pane. If the child is another split pane with the same orientation, it flattens the layout by merging the child's children directly into this split pane. This method also updates the divider positions to maintain a consistent layout as children are added.
      Specified by:
      addChild in interface DockContainer
      Parameters:
      element - The child element to add to this split pane.
    • removeChild

      public void removeChild(DockElement element)
      Removes a child element and attempts to flatten the layout if possible. If only one child remains after removal, it promotes that child to take this container's place in the hierarchy. This method ensures that the layout remains clean and avoids unnecessary nesting of containers.
      Specified by:
      removeChild in interface DockContainer
      Parameters:
      element - The child element to remove from this container.
    • getOrientation

      public javafx.geometry.Orientation getOrientation()
      Returns the orientation of this split pane.
      Returns:
      split orientation
    • getFlattenedChild

      public DockElement getFlattenedChild()
      Returns the flattened child (only after flattening a root container).
      Returns:
      flattened child, or null if not available
    • getDividerPositions

      public List<javafx.beans.property.DoubleProperty> getDividerPositions()
      Returns the list of divider positions. Each position is a value between 0.0 and 1.0 representing the relative position of the divider.
      Returns:
      mutable divider-position properties
    • setDividerPosition

      public void setDividerPosition(int index, double position)
      Sets the position of a specific divider.
      Parameters:
      index - The index of the divider to set (0-based).
      position - The new position for the divider (between 0.0 and 1.0).
    • toString

      public String toString()
      Overrides:
      toString in class Object