Class TableViewSkinBase<M, S, C extends Control, I extends IndexedCell<M>, TC extends TableColumnBase<S,?>>
java.lang.Object
javafx.scene.control.SkinBase<C>
javafx.scene.control.skin.VirtualContainerBase<C,I>
javafx.scene.control.skin.TableViewSkinBase<M,S,C,I,TC>
- 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)
- All Implemented Interfaces:
Skin<C>
- Direct Known Subclasses:
TableViewSkin, TreeTableViewSkin
public abstract class TableViewSkinBase<M, S, C extends Control, I extends IndexedCell<M>, TC extends TableColumnBase<S,?>>
extends VirtualContainerBase<C,I>
TableViewSkinBase is the base skin class used by controls such as
TableView and TreeTableView
(the concrete classes are TableViewSkin and TreeTableViewSkin,
respectively).- Since:
- 9
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTableViewSkinBase(C control) Constructs aTableViewSkinBasefor the given control. -
Method Summary
Modifier and TypeMethodDescriptionprotected TableHeaderRowCreates a new TableHeaderRow instance.protected TableHeaderRowReturns theTableHeaderRowcreated usingcreateTableHeaderRow().protected voidCalled when the focus is set on the cell above the current focused cell in order to scroll to it to make it visible.protected voidCalled when the focus is set on the cell below the current focused cell in order to scroll to it to make it visible.protected voidCalled 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 voidCalled 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 voidCalled 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 voidCalled 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 intonScrollPageDown(boolean isFocusDriven) Returns the index of the selected (or focused, ifisFocusDrivenistrue) cell after a page scroll operation.protected intonScrollPageUp(boolean isFocusDriven) Returns the index of the selected (or focused, ifisFocusDrivenistrue) cell after a page scroll operation.protected voidCalled 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 voidCalled when the selection is set on the cell below the current focused cell in order to scroll to it to make it visible.protected voidCalled 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 voidCalled 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.voidScrolls to the column containing the current focused cell.protected voidscrollHorizontally(TC col) Programmatically scrolls to the given column.protected voidThis method is called when it is possible that the item count has changed (i.e.Methods declared in class VirtualContainerBase
createVirtualFlow, dispose, getItemCount, getVirtualFlow, markItemCountDirtyModifier and TypeMethodDescriptionprotected VirtualFlow<I> Create the virtualized container that handles the layout and scrolling of all the cells.voiddispose()Called when a previously installed skin is about to be removed from its associated control.protected abstract intReturns the total number of items in this container, including those that are currently hidden because they are out of view.protected final VirtualFlow<I> Get the virtualized container.protected final voidCall this method to indicate that the item count should be updated on the next pulse.Methods declared in class SkinBase
computeBaselineOffset, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, consumeMouseEvents, executeAccessibleAction, getChildren, getClassCssMetaData, getCssMetaData, getNode, getSkinnable, layoutChildren, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, registerInvalidationListener, registerListChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners, unregisterInvalidationListeners, unregisterListChangeListenersModifier and TypeMethodDescriptionprotected doublecomputeBaselineOffset(double topInset, double rightInset, double bottomInset, double leftInset) Calculates the baseline offset based on the first managed child.protected doublecomputeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Computes the maximum allowable height of the Skin, based on the provided width.protected doublecomputeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) Computes the maximum allowable width of the Skin, based on the provided height.protected doublecomputeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Computes the minimum allowable height of the Skin, based on the provided width.protected doublecomputeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) Computes the minimum allowable width of the Skin, based on the provided height.protected doublecomputePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) Calculates the preferred height of thisSkinBase.protected doublecomputePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) Calculates the preferred width of thisSkinBase.protected final voidconsumeMouseEvents(boolean value) Determines whether all mouse events should be automatically consumed.protected voidexecuteAccessibleAction(AccessibleAction action, Object... parameters) This method is called by the assistive technology to request the action indicated by the argument should be executed.final ObservableList<Node> Returns the children of the skin.static List<CssMetaData<? extends Styleable, ?>> Returns the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.List<CssMetaData<? extends Styleable, ?>> This method should delegate toNode.getClassCssMetaData()so that a Node's CssMetaData can be accessed without the need for reflection.final NodegetNode()Gets the Node which represents this Skin.final CGets the Skinnable to which this Skin is assigned.protected voidlayoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) Called during the layout pass of the scenegraph.protected voidlayoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment) Utility method which lays out the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidlayoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, boolean fillWidth, boolean fillHeight, HPos halignment, VPos valignment) Utility method which lays out the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidlayoutInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment) Utility method which lays out the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidpositionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, HPos halignment, VPos valignment) Utility method which positions the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.protected voidpositionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight, double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment) Utility method which positions the child within an area of this skin defined byareaX,areaY,areaWidthxareaHeight, with a baseline offset relative to that area.final voidpseudoClassStateChanged(PseudoClass pseudoClass, boolean active) Used to specify that a pseudo-class of this Node has changed.protected ObjectqueryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) This method is called by the assistive technology to request the value for an attribute.protected final voidregisterChangeListener(ObservableValue<?> observable, Consumer<ObservableValue<?>> operation) Registers an operation to perform when the givenobservablesends a change event.protected final voidregisterInvalidationListener(Observable observable, Consumer<Observable> operation) Registers an operation to perform when the givenobservablesends an invalidation event.protected final voidregisterListChangeListener(ObservableList<?> observableList, Consumer<ListChangeListener.Change<?>> operation) Registers an operation to perform when the givenobservableListsends a list change event.protected doubleUtility method to get the bottom inset which includes padding and border inset.protected doubleUtility method to get the left inset which includes padding and border inset.protected doubleUtility method to get the right inset which includes padding and border inset.protected doubleUtility method to get the top inset which includes padding and border inset.protected doublesnapPosition(double value) Deprecated, for removal: This API element is subject to removal in a future version.protected doublesnapPositionX(double value) Convenience method for accessing thesnapPositionX()method on the skinnable.protected doublesnapPositionY(double value) Convenience method for accessing thesnapPositionY()method on the skinnable.protected doublesnapSize(double value) Deprecated, for removal: This API element is subject to removal in a future version.replaced bysnapSizeX()andsnapSizeY()protected doublesnapSizeX(double value) Convenience method for accessing thesnapSizeX()method on the skinnable.protected doublesnapSizeY(double value) Convenience method for accessing thesnapSizeY()method on the skinnable.protected doublesnapSpace(double value) Deprecated, for removal: This API element is subject to removal in a future version.replaced bysnapSpaceX()andsnapSpaceY()protected doublesnapSpaceX(double value) Convenience method for accessing thesnapSpaceX()method on the skinnable.protected doublesnapSpaceY(double value) Convenience method for accessing thesnapSpaceY()method on the skinnable.protected final Consumer<ObservableValue<?>> unregisterChangeListeners(ObservableValue<?> observable) Unregisters all operations that have been registered usingSkinBase.registerChangeListener(ObservableValue, Consumer)for the givenobservable.protected final Consumer<Observable> unregisterInvalidationListeners(Observable observable) Unregisters all operations that have been registered usingSkinBase.registerInvalidationListener(Observable, Consumer)for the givenobservable.protected final Consumer<ListChangeListener.Change<?>> unregisterListChangeListeners(ObservableList<?> observableList) Unregisters all operations that have been registered usingSkinBase.registerListChangeListener(ObservableList, Consumer)for the givenobservableList.
-
Constructor Details
-
TableViewSkinBase
Constructs aTableViewSkinBasefor the given control.- Parameters:
control- the control
-
-
Method Details
-
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:
- A new TableHeaderRow instance.
-
getTableHeaderRow
Returns theTableHeaderRowcreated usingcreateTableHeaderRow().- Returns:
- the
TableHeaderRowfor thisTableViewSkinBase - Since:
- 12
-
updateItemCount
protected void 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 theVirtualContainerBase.getItemCount()method.- Specified by:
updateItemCountin classVirtualContainerBase<C extends Control, I extends IndexedCell<M>>
-
onFocusAboveCell
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
-
onFocusBelowCell
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
-
onSelectAboveCell
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
-
onSelectBelowCell
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
-
onSelectLeftCell
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
-
onSelectRightCell
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
-
onFocusLeftCell
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
-
onFocusRightCell
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
-
onMoveToFirstCell
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
-
onMoveToLastCell
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
-
onScrollPageDown
protected int onScrollPageDown(boolean isFocusDriven) Returns the index of the selected (or focused, ifisFocusDrivenistrue) 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-trueif focused cell should be considered over selection- Returns:
- the new index to select, or to focus if
isFocusDrivenistrue - Since:
- 12
-
onScrollPageUp
protected int onScrollPageUp(boolean isFocusDriven) Returns the index of the selected (or focused, ifisFocusDrivenistrue) 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-trueif focused cell should be considered over selection- Returns:
- the new index to select, or to focus if
isFocusDrivenistrue - Since:
- 12
-
scrollHorizontally
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
-
scrollHorizontally
Programmatically scrolls to the given column. This call will ensure that the column is aligned on the left edge of theTableViewand also that the columns don't become detached from the right edge of the table.- Parameters:
col- the column to scroll to- Since:
- 12
-
snapPositionX()andsnapPositionY()