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

public Class TreeViewSkin<T>

extends VirtualContainerBase<TreeView<T>, TreeCell<T>>
Class Inheritance
Type Parameters
<T>
the type of the item contained within the TreeItem value property for all tree items in this TreeView
Imports
java.lang.ref.WeakReference, java.util.ArrayList, .List, javafx.beans.InvalidationListener, .Observable, .WeakInvalidationListener, javafx.collections.FXCollections, .MapChangeListener, .ObservableList, .ObservableMap, javafx.event.EventHandler, .EventType, .WeakEventHandler, javafx.geometry.NodeOrientation, javafx.scene.AccessibleAction, .AccessibleAttribute, .Node, javafx.scene.control.Control, .FocusModel, .MultipleSelectionModel, .ScrollBar, .SelectionModel, .TreeCell, .TreeItem, .TreeItem.TreeModificationEvent, .TreeView, javafx.scene.input.MouseEvent, javafx.scene.layout.HBox, .StackPane, com.sun.javafx.scene.control.Properties, com.sun.javafx.scene.control.behavior.TreeViewBehavior

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

Field Summary

Modifier and TypeField and Description
private final TreeViewBehavior<T>
private final VirtualFlow<TreeCell<T>>
private static final boolean
private MapChangeListener<Object, Object>
private EventHandler<TreeItem.TreeModificationEvent<T>>
private WeakReference<TreeItem<T>>
private WeakEventHandler<TreeItem.TreeModificationEvent<T>>

Constructor Summary

AccessConstructor and Description
public
TreeViewSkin(final TreeView<T>
The control that this skin should be installed onto.
control
)

Creates a new TreeViewSkin 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
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.

private TreeCell<T>
private TreeCell<T>
public void
dispose()

Overrides javafx.scene.control.skin.VirtualContainerBase.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.

protected int
getItemCount()

Implements abstract javafx.scene.control.skin.VirtualContainerBase.getItemCount.

Returns the total number of items in this container, including those that are currently hidden because they are out of view.

private TreeItem<T>
private void
horizontalUnitScroll(boolean right)

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.skin.VirtualContainerBase.layoutChildren.

Called during the layout pass of the scenegraph.

private void
private void
private void
private void
private int
onScrollPageDown(boolean isFocusDriven)

Function used to scroll the container down by one 'page'.

private int
onScrollPageUp(boolean isFocusDriven)

Function used to scroll the container up by one 'page'.

private void
private void
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 void
setRoot(TreeItem<T> newRoot)

protected void
updateItemCount()

Implements abstract javafx.scene.control.skin.VirtualContainerBase.updateItemCount.

This method is called when it is possible that the item count has changed (i.e. scrolling has occurred, the control has resized, etc).

private void
verticalUnitScroll(boolean down)

Inherited from javafx.scene.control.skin.VirtualContainerBase:
checkStatecreateVirtualFlowgetMaxCellWidthgetVirtualFlowgetVirtualFlowPreferredHeightmarkItemCountDirtyrequestRebuildCells

Field Detail

behaviorback to summary
private final TreeViewBehavior<T> behavior
flowback to summary
private final VirtualFlow<TreeCell<T>> flow

Hides javafx.scene.control.skin.VirtualContainerBase.flow.

IS_PANNABLEback to summary
private static final boolean IS_PANNABLE
propertiesMapListenerback to summary
private MapChangeListener<Object, Object> propertiesMapListener
rootListenerback to summary
private EventHandler<TreeItem.TreeModificationEvent<T>> rootListener
weakRootback to summary
private WeakReference<TreeItem<T>> weakRoot
weakRootListenerback to summary
private WeakEventHandler<TreeItem.TreeModificationEvent<T>> weakRootListener

Constructor Detail

TreeViewSkinback to summary
public TreeViewSkin(final TreeView<T> control)

Creates a new TreeViewSkin 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:TreeView<T>

The control that this skin should be installed onto.

Method Detail

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
createCellback to summary
private TreeCell<T> createCell(VirtualFlow<TreeCell<T>> flow)
createDefaultCellImplback to summary
private TreeCell<T> createDefaultCellImpl()
disposeback to summary
public void dispose()

Overrides javafx.scene.control.skin.VirtualContainerBase.dispose.

Implements javafx.scene.control.Skin.dispose.

Doc from javafx.scene.control.skin.VirtualContainerBase.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.

Overridden to remove EventHandler.

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
getItemCountback to summary
protected int getItemCount()

Implements abstract javafx.scene.control.skin.VirtualContainerBase.getItemCount.

Doc from javafx.scene.control.skin.VirtualContainerBase.getItemCount.

Returns the total number of items in this container, including those that are currently hidden because they are out of view.

Returns:int

the total number of items in this container

Annotations
@Override
getRootback to summary
private TreeItem<T> getRoot()
horizontalUnitScrollback to summary
private void horizontalUnitScroll(boolean right)
layoutChildrenback to summary
protected void layoutChildren(final double x, final double y, final double w, final double h)

Overrides javafx.scene.control.skin.VirtualContainerBase.layoutChildren.

Doc from javafx.scene.control.skin.VirtualContainerBase.layoutChildren.

Called during the layout pass of the scenegraph.

Parameters
x:double

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

the x position

y:double

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

the y position

w:double

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

the width

h:double

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

the height

Annotations
@Override
onFocusNextCellback to summary
private void onFocusNextCell()
onFocusPreviousCellback to summary
private void onFocusPreviousCell()
onMoveToFirstCellback to summary
private void onMoveToFirstCell()
onMoveToLastCellback to summary
private void onMoveToLastCell()
onScrollPageDownback to summary
private int onScrollPageDown(boolean isFocusDriven)

Function used to scroll the container down by one 'page'.

onScrollPageUpback to summary
private int onScrollPageUp(boolean isFocusDriven)

Function used to scroll the container up by one 'page'.

onSelectNextCellback to summary
private void onSelectNextCell()
onSelectPreviousCellback to summary
private void onSelectPreviousCell()
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
setRootback to summary
private void setRoot(TreeItem<T> newRoot)
updateItemCountback to summary
protected void updateItemCount()

Implements abstract javafx.scene.control.skin.VirtualContainerBase.updateItemCount.

Doc from javafx.scene.control.skin.VirtualContainerBase.updateItemCount.

This method is called when it is possible that the item count has changed (i.e. scrolling has occurred, the control has resized, etc). This method should recalculate the item count and store that for future use by the getItemCount method.

Annotations
@Override
verticalUnitScrollback to summary
private void verticalUnitScroll(boolean down)