Top Description Inners Fields Constructors Methods
javafx.scene.control.skin

public Class ToolBarSkin

extends SkinBase<ToolBar>
Class Inheritance
Imports
com.sun.javafx.scene.NodeHelper, .ParentHelper, java.util.ArrayList, .Collections, .List, com.sun.javafx.scene.control.behavior.BehaviorBase, .ToolBarBehavior, com.sun.javafx.scene.traversal.Algorithm, .ParentTraversalEngine, .TraversalContext, .Direction, javafx.beans.binding.Bindings, javafx.beans.property.ObjectProperty, .DoubleProperty, javafx.beans.value.WritableValue, javafx.collections.ListChangeListener, .ObservableList, .SetChangeListener, javafx.css.PseudoClass, .StyleableDoubleProperty, .StyleableObjectProperty, .StyleableProperty, .CssMetaData, .Styleable, javafx.geometry.HPos, .Orientation, .Pos, .Side, .VPos, javafx.scene.AccessibleAction, .AccessibleAttribute, .AccessibleRole, .Node, .Parent, javafx.scene.control.ContextMenu, .Control, .MenuItem, .CustomMenuItem, .Separator, .SeparatorMenuItem, .SkinBase, .ToolBar, javafx.scene.input.KeyCode, javafx.scene.layout.HBox, .Pane, .StackPane, .VBox, javafx.css.converter.EnumConverter, .SizeConverter, javafx.stage.WindowEvent

Default skin implementation for the ToolBar control.
Since
9
See Also
ToolBar

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv class

Field Summary

Modifier and TypeField and Description
private final BehaviorBase<ToolBar>
private Pane
private ObjectProperty<Pos>
private final ParentTraversalEngine
private ListChangeListener<Node>
private boolean
private boolean
private Pane
overflowBox

The overflow logic needs properly calculated prefWidth(..)/prefHeight(..) values.

private ToolBarSkin.ToolBarOverflowMenu
private int
private double
private double
private double
private double
private DoubleProperty

Constructor Summary

AccessConstructor and Description
public
ToolBarSkin(ToolBar
The control that this skin should be installed onto.
control
)

Creates a new ToolBarSkin instance, installing the necessary child nodes into the Control children list, as well as the necessary input mappings for handling key, mouse, etc events.

Method Summary

Modifier and TypeMethod and Description
private void
private final ObjectProperty<Pos>
protected double
computeMaxHeight(double
The width of the Skin, in case this value might dictate the maximum height.
width
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

protected double
computeMaxWidth(double
The height of the Skin, in case this value might dictate the maximum width.
height
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computeMaxWidth.

Computes the maximum allowable width of the Skin, based on the provided height.

protected double
computeMinHeight(double
The width of the Skin, in case this value might dictate the minimum height.
width
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

protected double
computeMinWidth(double
The height of the Skin, in case this value might dictate the minimum width.
height
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computeMinWidth.

Computes the minimum allowable width of the Skin, based on the provided height.

protected double
computePrefHeight(double
the width that should be used if preferred height depends on it
width
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computePrefHeight.

Calculates the preferred height of this SkinBase.

protected double
computePrefWidth(double
the height that should be used if preferred width depends on it
height
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computePrefWidth.

Calculates the preferred width of this SkinBase.

public void
dispose()

Overrides javafx.scene.control.SkinBase.dispose.

Implements javafx.scene.control.Skin.dispose.

Called when a previously installed skin is about to be removed from its associated control.

protected void
executeAccessibleAction(AccessibleAction
the action to execute
action
,
Object...
optional list of parameters
parameters
)

Overrides javafx.scene.control.SkinBase.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

private final Pos
public static List<CssMetaData<? extends Styleable, ?>>

Returns:

the CssMetaData associated with this class, which may include the CssMetaData of its superclasses
getClassCssMetaData
()

Hides javafx.scene.control.SkinBase.getClassCssMetaData.

Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getCssMetaData()

Overrides javafx.scene.control.SkinBase.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

private int

Returns:

the index of the first node that does not fit in the toolbar, or the size of the items list else
getOverflowNodeIndex
(double
the length of the toolbar
length
)

Calculate the index of the node that does not fit in the toolbar and must be moved to the overflow menu.

private final double
private double
private void
protected void
layoutChildren(final double
the x position
x
,
final double
the y position
y
,
final double
the width
w
,
final double
the height
h
)

Overrides javafx.scene.control.SkinBase.layoutChildren.

Called during the layout pass of the scenegraph.

private void
organizeOverflow(double length)

protected Object
queryAccessibleAttribute(AccessibleAttribute
the requested attribute
attribute
,
Object...
optional list of parameters
parameters
)

Overrides javafx.scene.control.SkinBase.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

private final void
private final void
setSpacing(double value)

private double
snapSpacing(double value)

private final DoubleProperty
Inherited from javafx.scene.control.SkinBase:
computeBaselineOffsetconsumeMouseEventsgetChildrengetNodegetSkinnablelayoutInArealayoutInArealayoutInAreapositionInAreapositionInAreapseudoClassStateChangedregisterChangeListenerregisterInvalidationListenerregisterListChangeListenersnappedBottomInsetsnappedLeftInsetsnappedRightInsetsnappedTopInsetsnapPositionsnapPositionXsnapPositionYsnapSizesnapSizeXsnapSizeYsnapSpacesnapSpaceXsnapSpaceYunregisterChangeListenersunregisterInvalidationListenersunregisterListChangeListeners

Field Detail

behaviorback to summary
private final BehaviorBase<ToolBar> behavior
boxback to summary
private Pane box
boxAlignmentback to summary
private ObjectProperty<Pos> boxAlignment
engineback to summary
private final ParentTraversalEngine engine
itemsListenerback to summary
private ListChangeListener<Node> itemsListener
needsUpdateback to summary
private boolean needsUpdate
overflowback to summary
private boolean overflow
overflowBoxback to summary
private Pane overflowBox

The overflow logic needs properly calculated prefWidth(..)/prefHeight(..) values. These values are valid if the elements have been added to the scene and the CSS has been applied properly. To ensure this, we add the overflow items to this pane if they are not currently visible in the overflow menu.

overflowMenuback to summary
private ToolBarSkin.ToolBarOverflowMenu overflowMenu
overflowNodeIndexback to summary
private int overflowNodeIndex
previousHeightback to summary
private double previousHeight
previousWidthback to summary
private double previousWidth
savedPrefHeightback to summary
private double savedPrefHeight
savedPrefWidthback to summary
private double savedPrefWidth
spacingback to summary
private DoubleProperty spacing

Constructor Detail

ToolBarSkinback to summary
public ToolBarSkin(ToolBar control)

Creates a new ToolBarSkin instance, installing the necessary child nodes into the Control children list, as well as the necessary input mappings for handling key, mouse, etc events.

Parameters
control:ToolBar

The control that this skin should be installed onto.

Method Detail

addNodesToToolBarback to summary
private void addNodesToToolBar()
boxAlignmentPropertyback to summary
private final ObjectProperty<Pos> boxAlignmentProperty()
computeMaxHeightback to summary
protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMaxHeight.

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

Parameters
width:double

The width of the Skin, in case this value might dictate the maximum height.

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

A double representing the maximum height of this Skin.

Annotations
@Override
computeMaxWidthback to summary
protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMaxWidth.

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

Computes the maximum allowable width of the Skin, based on the provided height.

Parameters
height:double

The height of the Skin, in case this value might dictate the maximum width.

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

A double representing the maximum width of this Skin.

Annotations
@Override
computeMinHeightback to summary
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinHeight.

Doc from javafx.scene.control.SkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

Parameters
width:double

The width of the Skin, in case this value might dictate the minimum height.

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

A double representing the minimum height of this Skin.

Annotations
@Override
computeMinWidthback to summary
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinWidth.

Doc from javafx.scene.control.SkinBase.computeMinWidth.

Computes the minimum allowable width of the Skin, based on the provided height.

Parameters
height:double

The height of the Skin, in case this value might dictate the minimum width.

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

A double representing the minimum width of this Skin.

Annotations
@Override
computePrefHeightback to summary
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefHeight.

Doc from javafx.scene.control.SkinBase.computePrefHeight.

Calculates the preferred height of this SkinBase. 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:double

the width that should be used if preferred height depends on it

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

the calculated preferred height

Annotations
@Override
computePrefWidthback to summary
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefWidth.

Doc from javafx.scene.control.SkinBase.computePrefWidth.

Calculates the preferred width of this SkinBase. 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:double

the height that should be used if preferred width depends on it

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

the calculated preferred width

Annotations
@Override
disposeback to summary
public void dispose()

Overrides javafx.scene.control.SkinBase.dispose.

Implements javafx.scene.control.Skin.dispose.

Doc from javafx.scene.control.SkinBase.dispose.

Called when a previously installed skin is about to be removed from its associated control. This allows the skin to do clean up, like removing listeners and bindings, and undo any changes to the control's properties. After this method completes, getSkinnable() and getNode() should return null.

Calling dispose() more than once has no effect.

Annotations
@Override
executeAccessibleActionback to summary
protected void executeAccessibleAction(AccessibleAction action, Object... parameters)

Overrides javafx.scene.control.SkinBase.executeAccessibleAction.

Doc from javafx.scene.control.SkinBase.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

This method is commonly overridden by subclasses to implement action that are required for a specific role.
If a particular action is not handled, the superclass implementation must be called.

Parameters
action:AccessibleAction

the action to execute

parameters:Object[]

optional list of parameters

Annotations
@Override
getBoxAlignmentback to summary
private final Pos getBoxAlignment()
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.SkinBase.getClassCssMetaData.

Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

Returns:List<CssMetaData<? extends Styleable, ?>>

the CssMetaData associated with this class, which may include the CssMetaData of its superclasses

getCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getCssMetaData()

Overrides javafx.scene.control.SkinBase.getCssMetaData.

Doc from javafx.scene.control.SkinBase.getCssMetaData.

This method should delegate to Node#getClassCssMetaData() so that a Node's CssMetaData can be accessed without the need for reflection.

Returns:List<CssMetaData<? extends Styleable, ?>>

The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.

Annotations
@Override
getOverflowNodeIndexback to summary
private int getOverflowNodeIndex(double length)

Calculate the index of the node that does not fit in the toolbar and must be moved to the overflow menu.

Parameters
length:double

the length of the toolbar

Returns:int

the index of the first node that does not fit in the toolbar, or the size of the items list else

getSpacingback to summary
private final double getSpacing()
getToolbarLengthback to summary
private double getToolbarLength(ToolBar toolbar)
initializeback to summary
private void initialize()
layoutChildrenback to summary
protected void layoutChildren(final double x, final double y, final double w, final double h)

Overrides javafx.scene.control.SkinBase.layoutChildren.

Doc from javafx.scene.control.SkinBase.layoutChildren.

Called during the layout pass of the scenegraph.

Parameters
x:double

the x position

y:double

the y position

w:double

the width

h:double

the height

Annotations
@Override
organizeOverflowback to summary
private void organizeOverflow(double length)
queryAccessibleAttributeback to summary
protected Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.SkinBase.queryAccessibleAttribute.

Doc from javafx.scene.control.SkinBase.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
If a particular attribute is not handled, the superclass implementation must be called.

Parameters
attribute:AccessibleAttribute

the requested attribute

parameters:Object[]

optional list of parameters

Returns:Object

the value for the requested attribute

Annotations
@Override
setBoxAlignmentback to summary
private final void setBoxAlignment(Pos value)
setSpacingback to summary
private final void setSpacing(double value)
snapSpacingback to summary
private double snapSpacing(double value)
spacingPropertyback to summary
private final DoubleProperty spacingProperty()
javafx.scene.control.skin back to summary

private Class ToolBarSkin.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<ToolBar, Pos>
private static final CssMetaData<ToolBar, Number>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALIGNMENTback to summary
private static final CssMetaData<ToolBar, Pos> ALIGNMENT
SPACINGback to summary
private static final CssMetaData<ToolBar, Number> SPACING
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()
javafx.scene.control.skin back to summary

pack-priv Class ToolBarSkin.ToolBarOverflowMenu

extends StackPane
Class Inheritance

Field Summary

Modifier and TypeField and Description
private StackPane
private ObservableList<Node>
private ContextMenu

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected double
computePrefHeight(double
the width that should be used if preferred height depends on it
width
)

Overrides javafx.scene.layout.StackPane.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy.

protected double
computePrefWidth(double
the height that should be used if preferred width depends on it
height
)

Overrides javafx.scene.layout.StackPane.computePrefWidth.

Computes the preferred width of this region for the given height.

private List<MenuItem>
public void
executeAccessibleAction(AccessibleAction
the action to execute
action
,
Object...
optional list of parameters
parameters
)

Overrides javafx.scene.Node.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

private void
fire()

protected void
layoutChildren()

Overrides javafx.scene.layout.StackPane.layoutChildren.

Invoked during the layout pass to layout the children in this Parent.

Inherited from javafx.scene.layout.StackPane:
alignmentPropertyclearConstraintscomputeMinHeightcomputeMinWidthgetAlignmentgetAlignmentgetClassCssMetaDatagetContentBiasgetCssMetaDatagetMarginrequestLayoutsetAlignmentsetAlignmentsetMargin

Field Detail

downArrowback to summary
private StackPane downArrow
overflowItemsback to summary
private ObservableList<Node> overflowItems
popupback to summary
private ContextMenu popup

Constructor Detail

ToolBarOverflowMenuback to summary
public ToolBarOverflowMenu(ObservableList<Node> items)

Method Detail

computePrefHeightback to summary
protected double computePrefHeight(double width)

Overrides javafx.scene.layout.StackPane.computePrefHeight.

Doc from javafx.scene.layout.Region.computePrefHeight.

Computes the preferred height of this region for the given width; Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a HORIZONTAL content bias, then the width parameter can be ignored.

Parameters
width:double

Doc from javafx.scene.Parent.computePrefHeight.

the width that should be used if preferred height depends on it

Returns:double

the computed preferred height for this region

Annotations
@Override
computePrefWidthback to summary
protected double computePrefWidth(double height)

Overrides javafx.scene.layout.StackPane.computePrefWidth.

Doc from javafx.scene.layout.Region.computePrefWidth.

Computes the preferred width of this region for the given height. Region subclasses should override this method to return an appropriate value based on their content and layout strategy. If the subclass doesn't have a VERTICAL content bias, then the height parameter can be ignored.

Parameters
height:double

Doc from javafx.scene.Parent.computePrefWidth.

the height that should be used if preferred width depends on it

Returns:double

the computed preferred width for this region

Annotations
@Override
createMenuItemsback to summary
private List<MenuItem> createMenuItems()
executeAccessibleActionback to summary
public void executeAccessibleAction(AccessibleAction action, Object... parameters)

Overrides javafx.scene.Node.executeAccessibleAction.

Doc from javafx.scene.Node.executeAccessibleAction.

This method is called by the assistive technology to request the action indicated by the argument should be executed.

This method is commonly overridden by subclasses to implement action that are required for a specific role.
If a particular action is not handled, the superclass implementation must be called.

Parameters
action:AccessibleAction

the action to execute

parameters:Object[]

optional list of parameters

Annotations
@Override
fireback to summary
private void fire()
layoutChildrenback to summary
protected void layoutChildren()

Overrides javafx.scene.layout.StackPane.layoutChildren.

Doc from javafx.scene.Parent.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.

Annotations
@Override