SplitPane

class SplitPane(initialOrientation: Orientation = Orientation.HORIZONTAL) : Region, WithItems

Lays out items either horizontally or vertically, with movable Dividers between them. Drag the Divider to alter how much space is allocated to each item.

When the SplitPane is resized, the proportion of additional space is governed by the items' Node.growPriority. Node.shrinkPriority is ignored. It is ignored so that expanding, and then contracting the SplitPane back to its original size will guarantee that the dividers will be in their original position.

To replicate JavaFX's setResizableWithParent, set growPriority to 1 for nodes which should grow/shrink, and 0 for those that should remain fixed. Glok's default growPriority is 0, so you have to change all the resizable nodes in Glok, whereas in JavaFX, you have to change all the fixed-size nodes.

Common uses for SplitPanes :

  1. Two see two documents side by side (or two views of the same document)

  2. Tool panels to the left / right, with the main content in the middle.

In the first scenario, each panel should have the same growPriority (the value doesn't matter). In the second scenario, set the center's growPriority to 1, and the tool panels to 0.

Note, SplitPane respects Node.visible for its items. So, if an item becomes invisible, there will be one less divider visible too. The item to the right/south will take up the additional available space (except when it is the rightmost/bottom item which is made invisible, in which case, the item to the left/north which will take up the additional space).

Theme DSL

"split_pane" {

    orientation( Orientation.HORIZONTAL )
    orientation( Orientation.VERTICAL )

    child( "divider" ) {
        // a Region.
    }
}

The divider children are Regions.

SplitPane inherits all the features of Region

Constructors

Link copied to clipboard
constructor(vararg children: Node)
constructor(initialOrientation: Orientation = Orientation.HORIZONTAL)

Types

Link copied to clipboard
inner class Divider(position: Float) : Region

Properties

Link copied to clipboard
open override val children: ObservableList<Node>

The base class Node has no children, so this is an empty list.

Link copied to clipboard
Link copied to clipboard
open override val items: MutableObservableList<Node>
Link copied to clipboard

Functions

Link copied to clipboard
fun adjustDivider(divider: SplitPane.Divider, newPosition: Float)

Adjusts a single divider, and alters other dividers using a heuristic. You may set a divider positions directly, if you prefer full control over the positions.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun nodePrefHeight(): Float

Each subclass of node can determine its preferred height. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.

Link copied to clipboard
open override fun nodePrefWidth(): Float

Each subclass of node can determine its preferred width. As most nodes are composed of smaller nodes, this is typically calculated using evalPrefWidth of the child nodes, with extra added for spacing, padding and borders.

Link copied to clipboard
open override fun toString(): String