java.lang.Object
org.snapfx.model.DockSplitPane
- All Implemented Interfaces:
DockContainer,DockElement
Represents a split container in the DockGraph.
Can be oriented horizontally or vertically.
-
Constructor Summary
ConstructorsConstructorDescriptionDockSplitPane(javafx.geometry.Orientation orientation) Creates a split container with the given orientation. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(DockElement element) Adds a child element to this split pane.javafx.collections.ObservableList<DockElement> Returns the list of child elements.List<javafx.beans.property.DoubleProperty> Returns the list of divider positions.Returns the flattened child (only after flattening a root container).getId()Returns the element's ID.javafx.geometry.OrientationReturns the orientation of this split pane.Returns the parent container, ornullif this is the root.voidremoveChild(DockElement element) Removes a child element and attempts to flatten the layout if possible.voidsetDividerPosition(int index, double position) Sets the position of a specific divider.voidsetParent(DockContainer parent) Sets the parent container.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.snapfx.model.DockContainer
cleanupIfEmpty, isEmptyMethods inherited from interface org.snapfx.model.DockElement
removeFromParent
-
Constructor Details
-
DockSplitPane
public DockSplitPane(javafx.geometry.Orientation orientation) Creates a split container with the given orientation.- Parameters:
orientation- split orientation
-
-
Method Details
-
getId
Description copied from interface:DockElementReturns the element's ID.- Specified by:
getIdin interfaceDockElement- Returns:
- unique layout element ID
-
getParent
Description copied from interface:DockElementReturns the parent container, ornullif this is the root.- Specified by:
getParentin interfaceDockElement- Returns:
- parent container or
null
-
setParent
Description copied from interface:DockElementSets the parent container.- Specified by:
setParentin interfaceDockElement- Parameters:
parent- parent container, ornullfor detached/root state
-
getChildren
Description copied from interface:DockContainerReturns the list of child elements.- Specified by:
getChildrenin interfaceDockContainer- Returns:
- mutable observable child list
-
addChild
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:
addChildin interfaceDockContainer- Parameters:
element- The child element to add to this split pane.
-
removeChild
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:
removeChildin interfaceDockContainer- 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
Returns the flattened child (only after flattening a root container).- Returns:
- flattened child, or
nullif not available
-
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
-