APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.control.skin

public abstract Class TableViewSkinBase<M, S, C extends Control, I extends IndexedCell<M>, TC extends TableColumnBase<S, ?>>

extends VirtualContainerBase<C extends Control, I extends IndexedCell<M>>
Class Inheritance
Known Direct Subclasses
javafx.scene.control.skin.TreeTableViewSkin, javafx.scene.control.skin.TableViewSkin
Type Parameters
<M>
The type of the item stored in each row (for TableView, this is the type of the items list, and for TreeTableView, this is the type of the TreeItem).
<S>
The type of the item, as represented by the selection model (for TableView, this is, again, the type of the items list, and for TreeTableView, this is TreeItem typed to the same type as M).
<C>
The type of the virtualised control (e.g TableView, TreeTableView)
<I>
The type of cell used by this virtualised control (e.g. TableRow, TreeTableRow)
<TC>
The type of TableColumnBase used by this virtualised control (e.g. TableColumn, TreeTableColumn)
Imports
java.lang.ref.WeakReference, java.util.List, javafx.application.Platform, javafx.beans.InvalidationListener, .Observable, .WeakInvalidationListener, javafx.beans.property.ObjectProperty, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, .ObservableMap, .WeakListChangeListener, javafx.geometry.HPos, .VPos, javafx.scene.AccessibleAttribute, .Node, javafx.scene.control.Control, .FocusModel, .IndexedCell, .Label, .ResizeFeaturesBase, .ScrollToEvent, .SelectionModel, .TableColumnBase, .TableFocusModel, .TablePositionBase, .TableSelectionModel, .TableView, .TreeTableView, javafx.scene.layout.Region, .StackPane, javafx.util.Callback, com.sun.javafx.scene.control.ListenerHelper, .Properties, com.sun.javafx.scene.control.skin.resources.ControlResources

TableViewSkinBase is the base skin class used by controls such as javafx.scene.control.TableView and javafx.scene.control.TreeTableView (the concrete classes are TableViewSkin and TreeTableViewSkin, respectively).
Since
9
See Also
TableView, TreeTableView, TableViewSkin, TreeTableViewSkin

Field Summary

Modifier and TypeField and Description
private Region
columnReorderLine

This region is used to overlay atop the table when the user is performing a column resize operation or a column reordering operation.

private Region
columnReorderOverlay

A region which is resized and positioned such that it perfectly matches the dimensions of any TableColumn that is being reordered by the user.

private boolean
private final String
pack-priv VirtualFlow<I>
private static final double
private static final boolean
private int
pack-priv boolean
private final String
private Label
private StackPane
placeholderRegion

Region placed over the top of the flow (and possibly the header row) if there is no data and/or there are no columns specified.

private ListChangeListener<S>
private Callback<C, I>
private TableHeaderRow
tableHeaderRow

The entire header region for all columns.

private int
private WeakListChangeListener<S>
private WeakInvalidationListener
private InvalidationListener

Constructor Summary

AccessConstructor and Description
public
TableViewSkinBase(final C
the control
control
)

Constructs a TableViewSkinBase for the given control.

Method Summary

Modifier and TypeMethod and Description
private void
protected double
computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefHeight.

Calculates the preferred height of this SkinBase.

protected double
computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computePrefWidth.

Calculates the preferred width of this SkinBase.

protected TableHeaderRow

Returns:

A new TableHeaderRow instance.
createTableHeaderRow
()

Creates a new TableHeaderRow instance.

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.

pack-priv Region
private TablePositionBase<? extends TC>
private TableFocusModel<M, ?>
private TableSelectionModel<S>
protected TableHeaderRow

Returns:

the TableHeaderRow for this TableViewSkinBase
getTableHeaderRow
()

Returns the TableHeaderRow created using createTableHeaderRow().

private ObservableList<? extends TC>
pack-priv void
private boolean
isCellFocused(int row)

private boolean
isCellSelected(int row)

private boolean
isLeadIndex(boolean isFocusDriven, int index)

protected void
layoutChildren(final double x, double y, final double w, final double h)

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

Called during the layout pass of the scenegraph.

protected void
onFocusAboveCell()

Called when the focus is set on the cell above the current focused cell in order to scroll to it to make it visible.

protected void
onFocusBelowCell()

Called when the focus is set on the cell below the current focused cell in order to scroll to it to make it visible.

protected void
onFocusLeftCell()

Called when the focus is set on the left cell of the current selected one in order to horizontally scroll to it to make it visible.

protected void
onFocusRightCell()

Called when the focus is set on the right cell of the current selected one in order to horizontally scroll to it to make it visible.

protected void
onMoveToFirstCell()

Called when the selection is set on the first cell of the table (first row and first column) in order to scroll to it to make it visible.

protected void
onMoveToLastCell()

Called when the selection is set on the last cell of the table (last row and last column) in order to scroll to it to make it visible.

protected int

Returns:

the new index to select, or to focus if isFocusDriven is true
onScrollPageDown
(boolean
true if focused cell should be considered over selection
isFocusDriven
)

Returns the index of the selected (or focused, if isFocusDriven is true) cell after a page scroll operation.

protected int

Returns:

the new index to select, or to focus if isFocusDriven is true
onScrollPageUp
(boolean
true if focused cell should be considered over selection
isFocusDriven
)

Returns the index of the selected (or focused, if isFocusDriven is true) cell after a page scroll operation.

protected void
onSelectAboveCell()

Called when the selection is set on the the cell above the current focused cell in order to scroll to it to make it visible.

protected void
onSelectBelowCell()

Called when the selection is set on the cell below the current focused cell in order to scroll to it to make it visible.

protected void
onSelectLeftCell()

Called when the selection is set on the left cell of the current selected one in order to horizontally scroll to it to make it visible.

protected void
onSelectRightCell()

Called when the selection is set on the right cell of the current selected one in order to horizontally scroll to it to make it visible.

protected Object
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.SkinBase.queryAccessibleAttribute.

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

private void
public void
scrollHorizontally()

Scrolls to the column containing the current focused cell.

protected void
scrollHorizontally(TC
the column to scroll to
col
)

Programmatically scrolls to the given column.

private void
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).

pack-priv final void
pack-priv void
private void
private void
updateVisibleColumnCount()

Keeps track of how many leaf columns are currently visible in this table.

private void
updateVisibleLeafColumnWidthListeners(List<? extends TC> added, List<? extends TC> removed)

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

Field Detail

columnReorderLineback to summary
private Region columnReorderLine

This region is used to overlay atop the table when the user is performing a column resize operation or a column reordering operation. It is a line that runs the height of the table to indicate either the final width of of the selected column, or the position the column will be 'dropped' into when the reordering operation completes.

columnReorderOverlayback to summary
private Region columnReorderOverlay

A region which is resized and positioned such that it perfectly matches the dimensions of any TableColumn that is being reordered by the user. This is useful, for example, as a semi-transparent overlay to give feedback to the user as to which column is currently being moved.

contentWidthDirtyback to summary
private boolean contentWidthDirty
EMPTY_TABLE_TEXTback to summary
private final String EMPTY_TABLE_TEXT
flowback to summary
pack-priv VirtualFlow<I> flow

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

GOLDEN_RATIO_MULTIPLIERback to summary
private static final double GOLDEN_RATIO_MULTIPLIER
IS_PANNABLEback to summary
private static final boolean IS_PANNABLE
itemCountback to summary
private int itemCount
needCellsReconfiguredback to summary
pack-priv boolean needCellsReconfigured
NO_COLUMNS_TEXTback to summary
private final String NO_COLUMNS_TEXT
placeholderLabelback to summary
private Label placeholderLabel
placeholderRegionback to summary
private StackPane placeholderRegion

Region placed over the top of the flow (and possibly the header row) if there is no data and/or there are no columns specified.

rowCountListenerback to summary
private ListChangeListener<S> rowCountListener
rowFactoryback to summary
private Callback<C, I> rowFactory
tableHeaderRowback to summary
private TableHeaderRow tableHeaderRow

The entire header region for all columns. This header region handles column reordering and resizing. It also handles the positioning and resizing of thte columnReorderLine and columnReorderOverlay.

visibleColCountback to summary
private int visibleColCount
weakRowCountListenerback to summary
private WeakListChangeListener<S> weakRowCountListener
weakWidthListenerback to summary
private WeakInvalidationListener weakWidthListener
widthListenerback to summary
private InvalidationListener widthListener

Constructor Detail

TableViewSkinBaseback to summary
public TableViewSkinBase(final C control)

Constructs a TableViewSkinBase for the given control.

Parameters
control:C

the control

Method Detail

checkContentWidthStateback to summary
private void checkContentWidthState()
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.

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.

Annotations
@Override
createTableHeaderRowback to summary
protected TableHeaderRow createTableHeaderRow()

Creates a new TableHeaderRow instance. By default this method should not be overridden, but in some circumstances it makes sense (e.g. testing, or when extreme customization is desired).

Returns:TableHeaderRow

A new TableHeaderRow instance.

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
getColumnReorderLineback to summary
pack-priv Region getColumnReorderLine()
getFocusedCellback to summary
private TablePositionBase<? extends TC> getFocusedCell()
getFocusModelback to summary
private TableFocusModel<M, ?> getFocusModel()
getSelectionModelback to summary
private TableSelectionModel<S> getSelectionModel()
getTableHeaderRowback to summary
protected TableHeaderRow getTableHeaderRow()

Returns the TableHeaderRow created using createTableHeaderRow().

Returns:TableHeaderRow

the TableHeaderRow for this TableViewSkinBase

Since
12
getVisibleLeafColumnsback to summary
private ObservableList<? extends TC> getVisibleLeafColumns()
horizontalScrollback to summary
pack-priv void horizontalScroll()
isCellFocusedback to summary
private boolean isCellFocused(int row)
isCellSelectedback to summary
private boolean isCellSelected(int row)
isLeadIndexback to summary
private boolean isLeadIndex(boolean isFocusDriven, int index)
layoutChildrenback to summary
protected void layoutChildren(final double x, 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.

Annotations
@Override
onFocusAboveCellback to summary
protected void onFocusAboveCell()

Called when the focus is set on the cell above the current focused cell in order to scroll to it to make it visible.

Since
12
onFocusBelowCellback to summary
protected void onFocusBelowCell()

Called when the focus is set on the cell below the current focused cell in order to scroll to it to make it visible.

Since
12
onFocusLeftCellback to summary
protected void onFocusLeftCell()

Called when the focus is set on the left cell of the current selected one in order to horizontally scroll to it to make it visible.

Since
12
onFocusRightCellback to summary
protected void onFocusRightCell()

Called when the focus is set on the right cell of the current selected one in order to horizontally scroll to it to make it visible.

Since
12
onMoveToFirstCellback to summary
protected void onMoveToFirstCell()

Called when the selection is set on the first cell of the table (first row and first column) in order to scroll to it to make it visible.

Since
12
onMoveToLastCellback to summary
protected void onMoveToLastCell()

Called when the selection is set on the last cell of the table (last row and last column) in order to scroll to it to make it visible.

Since
12
onScrollPageDownback to summary
protected int onScrollPageDown(boolean isFocusDriven)

Returns the index of the selected (or focused, if isFocusDriven is true) cell after a page scroll operation. If the selected/focused cell is not the last fully visible cell, then the last fully visible cell is selected/focused. Otherwise, the content is scrolled such that the cell is made visible at the top of the viewport (and the new last fully visible cell is selected/focused instead).

Parameters
isFocusDriven:boolean

true if focused cell should be considered over selection

Returns:int

the new index to select, or to focus if isFocusDriven is true

Since
12
onScrollPageUpback to summary
protected int onScrollPageUp(boolean isFocusDriven)

Returns the index of the selected (or focused, if isFocusDriven is true) cell after a page scroll operation. If the selected/focused cell is not the first fully visible cell, then the first fully visible cell is selected/focused. Otherwise, the content is scrolled such that the cell is made visible at the bottom of the viewport (and the new first fully visible cell is selected/focused instead).

Parameters
isFocusDriven:boolean

true if focused cell should be considered over selection

Returns:int

the new index to select, or to focus if isFocusDriven is true

Since
12
onSelectAboveCellback to summary
protected void onSelectAboveCell()

Called when the selection is set on the the cell above the current focused cell in order to scroll to it to make it visible.

Since
12
onSelectBelowCellback to summary
protected void onSelectBelowCell()

Called when the selection is set on the cell below the current focused cell in order to scroll to it to make it visible.

Since
12
onSelectLeftCellback to summary
protected void onSelectLeftCell()

Called when the selection is set on the left cell of the current selected one in order to horizontally scroll to it to make it visible.

Since
12
onSelectRightCellback to summary
protected void onSelectRightCell()

Called when the selection is set on the right cell of the current selected one in order to horizontally scroll to it to make it visible.

Since
12
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.

Annotations
@Override
refreshViewback to summary
private void refreshView()
scrollHorizontallyback to summary
public void scrollHorizontally()

Scrolls to the column containing the current focused cell.

Handles the horizontal scrolling when the selection mode is cell-based and the newly selected cell belongs to a column which is not completely visible.

Since
12
scrollHorizontallyback to summary
protected void scrollHorizontally(TC col)

Programmatically scrolls to the given column. This call will ensure that the column is aligned on the left edge of the TableView and also that the columns don't become detached from the right edge of the table.

Parameters
col:TC

the column to scroll to

Since
12
updateContentWidthback to summary
private void updateContentWidth()
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
updatePlaceholderRegionVisibilityback to summary
pack-priv final void updatePlaceholderRegionVisibility()
updateSuppressBreadthBarback to summary
pack-priv void updateSuppressBreadthBar()
updateTableItemsback to summary
private void updateTableItems(ObservableList<S> oldList, ObservableList<S> newList)
updateVisibleColumnCountback to summary
private void updateVisibleColumnCount()

Keeps track of how many leaf columns are currently visible in this table.

updateVisibleLeafColumnWidthListenersback to summary
private void updateVisibleLeafColumnWidthListeners(List<? extends TC> added, List<? extends TC> removed)