FlowPane
Lays out its children from left to right, then top to bottom, moving onto a new row when the previous row is full.
Warning
Glok isn't designed to handle flowing content. Don't use this control, until you understand its limitations...
nodeMinHeight and nodePrefHeight are of little use, because it depends on the height of this control. When Glok begins laying out nodes, the height isn't known. It is a chicken and egg problem.
Breaking this cycle is a bit of a bodge. Before a layout occurs, nodeMinHeight and nodePrefHeight are meaningless (they return 0). At the end of layoutChildren, we now know the height required. nodeMinHeight and nodePrefHeight are now meaningful.
But now the node may need to be laid out AGAIN, but we can't do that straight away, because we are currently laying out this node. So we use Platform.runLater.
The net result : This node requires 2 frames to render correctly. Example problems during the 1st frame :
In a
ScrollPane
: The scroll bars won't be present. (Not so bad)In a
VBox
: This node will take up no space, and may overlap with sibling nodes (Very bad).
NEVER place a FlowPane within another FlowPane, because in combination they may cause a layout to be done every frame.
Properties
The base class Node has no children, so this is an empty list.
If a mouse is clicked on a node, should it request the focus? For controls which can be read-only
(such as TextArea / TextField), we may want to jump over them when pressing Tab
(i.e. focusTraversable = false), but if they are clicked, then they should accept input focus. The user may wish to select, and copy part of the text.
The focus border is only ever drawn when the focus is set using keyboard shortcuts. So, when you use TAB or Shift+TAB, the extra focusBorder is drawn, but otherwise, it isn't drawn. This gives an uncluttered most of the time (when TAB isn't used).
true
when this node has the input focus. Only 1 node has the input focus.
A Background, which is drawn ON TOP of the node to highlight it. Used to highlight a section, when using the F6
and Shift+F6
keyboard shortcuts.
Is this part of the cycle of node that can accept keyboard focus when he user presses the Tab
key (or Shift-Tab
).
On a scale of 0..1, if this Node's parent has extra space compared to its preferred size, how much extra space should be give to this Node relative to its siblings?
The actual height of this node, in LogicalPixels.
Supposedly unique identifier (or blank). However, it is up to the application developer to ensure the id is unique.
The position of this Node, relative to its parent Node in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
The position of this Node, relative to its parent Node in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
A simple way to override the value calculated by nodeMinHeight. Most of the time, this value is null
, and therefore nodeMinHeight is used.
A simple way to override the value calculated by nodeMinWidth. Most of the time, this value is null
, and therefore nodeMinWidth is used.
A simple way to override the value calculated by nodePrefHeight. Most of the time, this value is null
, and therefore nodePrefHeight is used.
A simple way to override the value calculated by nodeMinWidth. Most of the time, this value is null
, and therefore nodeMinWidth is used.
Similar to styles, but used for temporary styles, such as :hover
.
An ObservableOptionalFont, whose value is Theme.defaultFont. To access this is quite convoluted, because both Node.scene and Scene.theme can change.
The X position of the Node relative to the top left of the window in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
The Y position of the Node relative to the top left of the window in LogicalPixels. The position and size of Nodes are assigned by their parent in layout, using setChildBounds.
To help navigating a scene using keyboard shortcuts (not using a mouse), it is helpful to jump to different sections of the scene. The keyboard shortcut F6
is similar to TAB
, but instead of moving one Node at a time, it jumps to the next node, where this is true
. Shift+F6
navigates in the opposite direction.
On a scale of 0..1, if this Node's parent has less space compared to its preferred size, how much should this node shrink by compared to its siblings.
Used by the Theme to determine how this node should be styled. Similar in concept to CSS's class
attribute.
Defines a popup that appears when the user hover the mouse over this node for a period of time. Typically, containing help text and a KeyCombination.displayText (if this node can be activated using a keyboard shortcut).
When false
, this node will not appear in the scene, and will not take up any spaces.
The actual width of this node, in LogicalPixels.
Functions
Consider using these convenience functions instead : onMousePressed, onMouseReleased, onPopupTrigger, onMouseClicked, onMouseDragged, onMouseMoved, onMouseEntered, onMouseExited, onKeyPressed, onKeyReleased.
Sets Region.borderSize.
Converts em
units to LogicalPixels.
If overrideMaxHeight is set, then return that, otherwise return nodeMaxHeight. Caching is used to improve speed, as calculating sizes can be relatively expensive.
If overrideMaxWidth is set, then return that, otherwise return nodeMaxWidth. Caching is used to improve speed, as calculating sizes can be relatively expensive.
If overrideMinWidth is set, then return that, otherwise return nodeMinHeight. Caching is used to improve speed, as calculating sizes can be relatively expensive.
If overrideMinWidth is set, then return that, otherwise return nodeMinWidth. Caching is used to improve speed, as calculating sizes can be relatively expensive.
If overridePrefWidth is set, then return that, otherwise return nodePrefHeight. Caching is used to improve speed, as calculating sizes can be relatively expensive.
If overridePrefWidth is set, then return that, otherwise return nodePrefWidth. Caching is used to improve speed, as calculating sizes can be relatively expensive.
@return this
if none of my children are at sceneX,sceneY. Otherwise, the child (or one of its ancestors).
Checks this node, and all descendants for a matching id. @return The first node which matches, or null if none match.
Tests each node from this one to the root node. When filter hold true, that node is returned, stopping the iteration. If none are found, returns null.
Applies a block of code on this node, and all of its ancestors, starting at the root node and working downwards to this node.
Applies a block of code on this node, and all of its ancestors, starting at this node and working up to the root node.
Sets [Region.background to NoBackground
The default implementation returns NO_MAXIMUM (an arbitrary large number : 100,000).
The default implementation returns NO_MAXIMUM (an arbitrary large number : 100,000).
Each subclass should override this, to calculate the minimum height it requires. In general, do not call this, and instead call evalMinHeight.
Each subclass should override this to calculate the minimum width it requires. In general, do not call this, and instead call evalMinWidth.
Each subclass much override this to calculate its preferred height. In general, do not call this, and instead call evalPrefHeight.
Each subclass much override this to calculate its preferred width. In general, do not call this, and instead call evalPrefWidth.
A more convenient version of addEventHandler for EventType.FILES_DROPPED.
A more convenient version of addEventHandler for EventType.KEY_PRESSED.
A more convenient version of addEventHandler for EventType.KEY_RELEASED.
A more convenient version of addEventHandler for EventType.KEY_TYPED.
A more convenient version of addEventHandler for EventType.MOUSE_CLICKED.
A more convenient version of addEventHandler for EventType.MOUSE_DRAGGED.
A more convenient version of addEventHandler for EventType.MOUSE_ENTERED.
A more convenient version of addEventHandler for EventType.MOUSE_EXITED.
A more convenient version of addEventHandler for EventType.MOUSE_MOVED.
A more convenient version of addEventHandler for EventType.MOUSE_PRESSED.
A more convenient version of addEventHandler for EventType.MOUSE_RELEASED.
handler will fire when the secondary mouse button is pressed/released depending on the platform.
A more convenient version of addEventHandler for EventType.SCROLL.
Sets Region.background to Color[color]
Sets Region.background to PlainBackground
Adds a style to Node.pseudoStyle
Adds or removes the pseudoStyle depending on test. See Node.pseudoStyles
When test is true
, trueStyle is added, and falseStyle is removed from Node.pseudoStyles.
Gives the input focus to this node, so that keyboard events are sent to it.
Informs all ancestors that the pref/min/max size of this node has changed, and therefore layoutChildren needs to be called again before the scene is rendered. Cached data, such as prefWidth/height should be invalidated.
Informs that this node needs to be redrawn. Currently, this causes the whole scene to be redrawn.
Ensure that this node is visible, by asking all ancestor nodes, which are Scrollable, to scroll to this node. ScrollPanes will adjust their scroll bars, TabPanes will select the appropriate tab, TitledPanes will open their content etc.
Adds a style to Node.styles
Adds a thin bar below this node. Dragging the bar changes the Node.overridePrefHeight of the node, therefore the node grows/shrinks.