TableView and TreeTableView) are
made up of zero or more instances of a concrete TableColumnBase subclass
(TableColumn and TreeTableColumn, respectively). Each
table column in a table is responsible for displaying (and editing) the contents
of that column. As well as being responsible for displaying and editing data
for a single column, a table column also contains the necessary properties to:
minWidth/prefWidth/maxWidth
and width properties)
visibility toggled
header text
nested columns it may contain
context menu when the user
right-clicks the column header area
comparator, sortable and
sortType).
text
(what to show in the column header area), and the column
cell value factory (which is used to populate individual cells in the
column). Refer to the class documentation for TableColumn and
TreeTableColumn for more information.
TableColumn, TreeTableColumn, TablePositionBase
| Modifier and Type | Field and Description |
|---|---|
| private ObjectProperty | comparator
Comparator function used when sorting this table column. |
| private ObjectProperty | contextMenu
This menu will be shown whenever the user right clicks within the header area of this TableColumnBase. |
| public static final Comparator | DEFAULT_COMPARATOR
By default all columns will use this comparator to perform sorting. |
| pack-priv static final double | |
| pack-priv static final double | |
| pack-priv static final double | |
| private BooleanProperty | editable
Specifies whether this table column allows editing. |
| pack-priv final EventHandlerManager | |
| private ObjectProperty | graphic
The graphic to show in the table column to allow the user to indicate graphically what is in the column. |
| private StringProperty | id
The id of this TableColumnBase. |
| private DoubleProperty | |
| private DoubleProperty | minWidth
The minimum width the table column is permitted to be resized to. |
| private ReadOnlyObjectWrapper | parentColumn
This read-only property will always refer to the parent of this column, in the situation where nested columns are being used. |
| private final DoubleProperty | |
| private ObservableMap | |
| private BooleanProperty | reorderable
A boolean property to toggle on and off the 'reorderability' of this column
(with drag and drop - reordering by modifying the appropriate |
| private BooleanProperty | resizable
Used to indicate whether the width of this column can change. |
| private BooleanProperty | sortable
A boolean property to toggle on and off the 'sortability' of this column. |
| private ObjectProperty | sortNode
The node to use as the "sort arrow", shown to the user in situations where the table column is part of the sort order. |
| private StringProperty | style
A string representation of the CSS style associated with this TableColumnBase instance. |
| private final ObservableList | |
| private StringProperty | text
This is the text to show in the header for this column. |
| private static final Object | |
| private BooleanProperty | visible
Toggling this will immediately toggle the visibility of this column, and all children columns. |
| private ReadOnlyDoubleWrapper |
| Access | Constructor and Description |
|---|---|
| protected | TableColumnBase()
Creates a default TableColumn with default cell factory, comparator, and onEditCommit implementation. |
| protected | TableColumnBase(String
The string to show when the TableColumn is placed within the TableView. text)Creates a TableColumn with the text set to the provided string, with default cell factory, comparator, and onEditCommit implementation. |
| Modifier and Type | Method and Description |
|---|---|
| public <E extends Event> void | addEventFilter(EventType<E> eventType, EventHandler<? super E> eventHandler)
Overrides default javafx. Registers an event filter for this target. |
| public <E extends Event> void | addEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler)
Overrides default javafx. Registers an event handler for this target. |
| public EventDispatchChain | buildEventDispatchChain(EventDispatchChain tail)
Implements javafx. Construct an event dispatch chain for this target. |
| public final ObjectProperty | |
| public final ObjectProperty | |
| pack-priv void | |
| public final BooleanProperty | |
| public final T | Returns: The data that belongs to the cell at the intersection of the given row index and the table column that this method is called on.The row index for which the data is required. index)Returns the actual value for a cell at a given row index (and which belongs to this table column). |
| public final T | Returns: The data that should be used in a specific cell in this column, based on the item passed in as an argument.The item from which a value of type T should be extracted. item)Returns the actual value for a cell from the given item. |
| public abstract ObservableValue | Returns: An ObservableValue<T> for this specific table column.The index of the item (of type S) for which an
ObservableValue<T> is sought. index)Attempts to return an ObservableValue<T> for the item in the given index (which is of type S). |
| public abstract ObservableValue | Returns: An ObservableValue<T> for this specific table column.The item (of type S) for which an ObservableValue<T> is
sought. item)Attempts to return an ObservableValue<T> for the given item (which is of type S). |
| public abstract ObservableList | Returns: An ObservableList containing TableColumnBase instances (or subclasses) that are the children of this TableColumnBase. If these children TableColumnBase instances are set as visible, they will appear beneath this table column.This enables support for nested columns, which can be useful to group together related data. |
| public final Comparator | |
| public final ContextMenu | |
| public final Node | |
| public final String | |
| public final double | |
| public final double | |
| public final TableColumnBase | |
| public final double | |
| public final ObservableMap | Returns: an observable map of properties on this table column for use primarily by application developersReturns an observable map of properties on this table column for use primarily by application developers. |
| public final ObservableSet | getPseudoClassStates()
Implements javafx. Return the pseudo-class state of this Styleable. |
| public final Node | |
| public final String | getStyle()
Implements javafx. A string representation of the CSS style associated with this
specific |
| public ObservableList | getStyleClass()
Implements javafx. A list of String identifiers which can be used to logically group Nodes, specifically for an external style engine. |
| public final String | |
| public Object | Returns: The Object that was previously set, or null if no property has been set or if null was set.Returns a previously set Object property, or null if no such property
has been set using the |
| public final double | |
| public final ObjectProperty | |
| public boolean | |
| public final StringProperty | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final DoubleProperty | Returns: maximum width propertyThe maximum width the table column is permitted to be resized to. |
| public final DoubleProperty | |
| public final ReadOnlyObjectProperty | |
| private ReadOnlyObjectWrapper | |
| public final DoubleProperty | |
| public <E extends Event> void | removeEventFilter(EventType<E> eventType, EventHandler<? super E> eventHandler)
Overrides default javafx. Unregisters a previously registered event filter from this target. |
| public <E extends Event> void | removeEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler)
Overrides default javafx. Unregisters a previously registered event handler from this target. |
| public final BooleanProperty | |
| public final BooleanProperty | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| pack-priv void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public void | setUserData(Object
The value to be stored - this can later be retrieved by calling
value)TableColumnBase#getUserData().Convenience method for setting a single Object property that can be retrieved at a later date. |
| public final void | |
| pack-priv void | |
| public final BooleanProperty | |
| public final ObjectProperty | |
| public final StringProperty | |
| public final StringProperty | |
| pack-priv void | |
| public final BooleanProperty | |
| public final ReadOnlyDoubleProperty |
| comparator | back to summary |
|---|---|
| private ObjectProperty<Comparator<T>> comparator Comparator function used when sorting this table column. The two Objects given as arguments are the cell data for two individual cells in this column. | |
| contextMenu | back to summary |
|---|---|
| private ObjectProperty<ContextMenu> contextMenu This menu will be shown whenever the user right clicks within the header area of this TableColumnBase. | |
| DEFAULT_COMPARATOR | back to summary |
|---|---|
| public static final Comparator<T> DEFAULT_COMPARATOR By default all columns will use this comparator to perform sorting. This
comparator simply performs null checks, and checks if the object is
| |
| DEFAULT_MAX_WIDTH | back to summary |
|---|---|
| pack-priv static final double DEFAULT_MAX_WIDTH | |
| DEFAULT_MIN_WIDTH | back to summary |
|---|---|
| pack-priv static final double DEFAULT_MIN_WIDTH | |
| DEFAULT_WIDTH | back to summary |
|---|---|
| pack-priv static final double DEFAULT_WIDTH | |
| editable | back to summary |
|---|---|
| private BooleanProperty editable Specifies whether this table column allows editing. This, unlike
| |
| eventHandlerManager | back to summary |
|---|---|
| pack-priv final EventHandlerManager eventHandlerManager | |
| graphic | back to summary |
|---|---|
| private ObjectProperty<Node> graphic The graphic to show in the table column to allow the user to indicate graphically what is in the column. | |
| id | back to summary |
|---|---|
| private StringProperty id The id of this TableColumnBase. This simple string identifier is useful
for finding a specific TableColumnBase within a UI control that uses
TableColumnBase instances. The default value is
| |
| maxWidth | back to summary |
|---|---|
| private DoubleProperty maxWidth | |
| minWidth | back to summary |
|---|---|
| private DoubleProperty minWidth The minimum width the table column is permitted to be resized to. | |
| parentColumn | back to summary |
|---|---|
| private ReadOnlyObjectWrapper<TableColumnBase<S, ?>> parentColumn This read-only property will always refer to the parent of this column, in the situation where nested columns are being used. In the currently existing subclasses, to create a nested
column is simply a matter of placing the relevant TableColumnBase instances
inside the columns ObservableList (for example, see
| |
| prefWidth | back to summary |
|---|---|
| private final DoubleProperty prefWidth | |
| properties | back to summary |
|---|---|
| private ObservableMap<Object, Object> properties | |
| reorderable | back to summary |
|---|---|
| private BooleanProperty reorderable A boolean property to toggle on and off the 'reorderability' of this column
(with drag and drop - reordering by modifying the appropriate
| |
| resizable | back to summary |
|---|---|
| private BooleanProperty resizable Used to indicate whether the width of this column can change. It is up to the resizing policy to enforce this however. | |
| sortable | back to summary |
|---|---|
| private BooleanProperty sortable A boolean property to toggle on and off the 'sortability' of this column.
When this property is true, this column can be included in sort
operations. If this property is false, it will not be included in sort
operations, even if it is contained within the sort order list of the
underlying UI control (e.g. For example, iIf a TableColumn instance is contained within the TableView sortOrder ObservableList, and its sortable property toggles state, it will force the TableView to perform a sort, as it is likely the view will need updating. | |
| sortNode | back to summary |
|---|---|
| private ObjectProperty<Node> sortNode The node to use as the "sort arrow", shown to the user in situations where
the table column is part of the sort order. It may be the only item in
the sort order, or it may be a secondary, tertiary, or latter sort item,
and the node should reflect this visually. This is only used in the case of
the table column being in the sort order (refer to, for example,
The sort node is commonly seen represented as a triangle that rotates on screen to indicate whether the table column is part of the sort order, and if so, whether the sort is ascending or descending, and what position in the sort order it is in. | |
| style | back to summary |
|---|---|
| private StringProperty style A string representation of the CSS style associated with this TableColumnBase instance. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule. Parsing this style might not be supported on some limited platforms. It is recommended to use a standalone CSS file instead.
| |
| styleClass | back to summary |
|---|---|
| private final ObservableList<String> styleClass | |
| text | back to summary |
|---|---|
| private StringProperty text This is the text to show in the header for this column. | |
| USER_DATA_KEY | back to summary |
|---|---|
| private static final Object USER_DATA_KEY | |
| visible | back to summary |
|---|---|
| private BooleanProperty visible Toggling this will immediately toggle the visibility of this column, and all children columns. | |
| width | back to summary |
|---|---|
| private ReadOnlyDoubleWrapper width | |
| TableColumnBase | back to summary |
|---|---|
| protected TableColumnBase() Creates a default TableColumn with default cell factory, comparator, and onEditCommit implementation. | |
| TableColumnBase | back to summary |
|---|---|
| protected TableColumnBase(String text) Creates a TableColumn with the text set to the provided string, with default cell factory, comparator, and onEditCommit implementation.
| |
| addEventFilter | back to summary |
|---|---|
| public <E extends Event> void addEventFilter(EventType<E> eventType, EventHandler<? super E> eventHandler) Overrides default javafx. Doc from javafx. Registers an event filter for this target.
The filter is called when the target receives an
| |
| addEventHandler | back to summary |
|---|---|
| public <E extends Event> void addEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Overrides default javafx. Doc from javafx. Registers an event handler for this target.
The handler is called when the target receives an
| |
| buildEventDispatchChain | back to summary |
|---|---|
| public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail) Implements javafx. Doc from javafx. Construct an event dispatch chain for this target. The event dispatch
chain contains event dispatchers which might be interested in processing
of events targeted at this In the case the event target is part of some hierarchy, the chain for it is usually built from event dispatchers collected from the root of the hierarchy to the event target. The event dispatch chain is constructed by modifications to the provided initial event dispatch chain. The returned chain should have the initial chain at its end so the dispatchers should be prepended to the initial chain. The caller shouldn't assume that the initial chain remains unchanged nor that the returned value will reference a different chain.
| |
| comparatorProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| contextMenuProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| doSetWidth | back to summary |
|---|---|
| pack-priv void doSetWidth(double width) | |
| editableProperty | back to summary |
|---|---|
| public final BooleanProperty editableProperty() | |
| getCellData | back to summary |
|---|---|
| public final T getCellData(final int index) Returns the actual value for a cell at a given row index (and which belongs to this table column).
| |
| getCellData | back to summary |
|---|---|
| public final T getCellData(final S item) Returns the actual value for a cell from the given item.
| |
| getCellObservableValue | back to summary |
|---|---|
| public abstract ObservableValue Attempts to return an ObservableValue<T> for the item in the given index (which is of type S). In other words, this method expects to receive an integer value that is greater than or equal to zero, and less than the size of the underlying data model. If the index is valid, this method will return an ObservableValue<T> for this specific column. This is achieved by calling the
| |
| getCellObservableValue | back to summary |
|---|---|
| public abstract ObservableValue Attempts to return an ObservableValue<T> for the given item (which is of type S). In other words, this method expects to receive an object from the underlying data model for the entire 'row' in the table, and it must return an ObservableValue<T> for the value in this specific column. This is achieved by calling the
| |
| getColumns | back to summary |
|---|---|
| public abstract ObservableList This enables support for nested columns, which can be useful to group together related data. For example, we may have a 'Name' column with two nested columns for 'First' and 'Last' names. This has no impact on the table as such - all column indices point to the leaf columns only, and it isn't possible to sort using the parent column, just the leaf columns. In other words, this is purely a visual feature.
| |
| getComparator | back to summary |
|---|---|
| public final Comparator | |
| getContextMenu | back to summary |
|---|---|
| public final ContextMenu getContextMenu() | |
| getGraphic | back to summary |
|---|---|
| public final Node getGraphic() | |
| getId | back to summary |
|---|---|
| public final String getId() Implements javafx. Doc from javafx. The id of this
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows:
| |
| getMaxWidth | back to summary |
|---|---|
| public final double getMaxWidth() | |
| getMinWidth | back to summary |
|---|---|
| public final double getMinWidth() | |
| getParentColumn | back to summary |
|---|---|
| public final TableColumnBase | |
| getPrefWidth | back to summary |
|---|---|
| public final double getPrefWidth() | |
| getProperties | back to summary |
|---|---|
| public final ObservableMap Returns an observable map of properties on this table column for use primarily by application developers.
| |
| getPseudoClassStates | back to summary |
|---|---|
| public final ObservableSet Implements javafx. Doc from javafx. Return the pseudo-class state of this Styleable. CSS assumes this set is read-only.
| |
| getSortNode | back to summary |
|---|---|
| public final Node getSortNode() | |
| getStyle | back to summary |
|---|---|
| public final String getStyle() Implements javafx. Doc from javafx. A string representation of the CSS style associated with this
specific
| |
| getStyleClass | back to summary |
|---|---|
| public ObservableList Implements javafx. A list of String identifiers which can be used to logically group Nodes, specifically for an external style engine. This variable is analogous to the "class" attribute on an HTML element and, as such, each element of the list is a style class to which this Node belongs.
| |
| getText | back to summary |
|---|---|
| public final String getText() | |
| getUserData | back to summary |
|---|---|
| public Object getUserData() Returns a previously set Object property, or null if no such property
has been set using the
| |
| getWidth | back to summary |
|---|---|
| public final double getWidth() | |
| graphicProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| hasProperties | back to summary |
|---|---|
| public boolean hasProperties() Tests if this table column has properties.
| |
| idProperty | back to summary |
|---|---|
| public final StringProperty idProperty() | |
| isEditable | back to summary |
|---|---|
| public final boolean isEditable() | |
| isReorderable | back to summary |
|---|---|
| public final boolean isReorderable() | |
| isResizable | back to summary |
|---|---|
| public final boolean isResizable() | |
| isSortable | back to summary |
|---|---|
| public final boolean isSortable() | |
| isVisible | back to summary |
|---|---|
| public final boolean isVisible() | |
| maxWidthProperty | back to summary |
|---|---|
| public final DoubleProperty maxWidthProperty() The maximum width the table column is permitted to be resized to.
| |
| minWidthProperty | back to summary |
|---|---|
| public final DoubleProperty minWidthProperty() | |
| parentColumnProperty | back to summary |
|---|---|
| public final ReadOnlyObjectProperty | |
| parentColumnPropertyImpl | back to summary |
|---|---|
| private ReadOnlyObjectWrapper | |
| prefWidthProperty | back to summary |
|---|---|
| public final DoubleProperty prefWidthProperty() The preferred width of the TableColumn.
| |
| removeEventFilter | back to summary |
|---|---|
| public <E extends Event> void removeEventFilter(EventType<E> eventType, EventHandler<? super E> eventHandler) Overrides default javafx. Doc from javafx. Unregisters a previously registered event filter from this target.
Since it is possible to register a single
| |
| removeEventHandler | back to summary |
|---|---|
| public <E extends Event> void removeEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Overrides default javafx. Doc from javafx. Unregisters a previously registered event handler from this target.
Since it is possible to register a single
| |
| reorderableProperty | back to summary |
|---|---|
| public final BooleanProperty reorderableProperty() | |
| resizableProperty | back to summary |
|---|---|
| public final BooleanProperty resizableProperty() | |
| setComparator | back to summary |
|---|---|
| public final void setComparator(Comparator<T> value) | |
| setContextMenu | back to summary |
|---|---|
| public final void setContextMenu(ContextMenu value) | |
| setEditable | back to summary |
|---|---|
| public final void setEditable(boolean value) | |
| setGraphic | back to summary |
|---|---|
| public final void setGraphic(Node value) | |
| setId | back to summary |
|---|---|
| public final void setId(String value) | |
| setMaxWidth | back to summary |
|---|---|
| public final void setMaxWidth(double value) | |
| setMinWidth | back to summary |
|---|---|
| public final void setMinWidth(double value) | |
| setParentColumn | back to summary |
|---|---|
| pack-priv void setParentColumn(TableColumnBase<S, ?> value) | |
| setPrefWidth | back to summary |
|---|---|
| public final void setPrefWidth(double value) | |
| setReorderable | back to summary |
|---|---|
| public final void setReorderable(boolean value) | |
| setResizable | back to summary |
|---|---|
| public final void setResizable(boolean value) | |
| setSortable | back to summary |
|---|---|
| public final void setSortable(boolean value) | |
| setSortNode | back to summary |
|---|---|
| public final void setSortNode(Node value) | |
| setStyle | back to summary |
|---|---|
| public final void setStyle(String value) | |
| setText | back to summary |
|---|---|
| public final void setText(String value) | |
| setUserData | back to summary |
|---|---|
| public void setUserData(Object value) Convenience method for setting a single Object property that can be
retrieved at a later date. This is functionally equivalent to calling
the getProperties().put(Object key, Object value) method. This can later
be retrieved by calling
| |
| setVisible | back to summary |
|---|---|
| public final void setVisible(boolean value) | |
| setWidth | back to summary |
|---|---|
| pack-priv void setWidth(double value) | |
| sortableProperty | back to summary |
|---|---|
| public final BooleanProperty sortableProperty() | |
| sortNodeProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| styleProperty | back to summary |
|---|---|
| public final StringProperty styleProperty() | |
| textProperty | back to summary |
|---|---|
| public final StringProperty textProperty() | |
| updateColumnWidths | back to summary |
|---|---|
| pack-priv void updateColumnWidths() | |
| visibleProperty | back to summary |
|---|---|
| public final BooleanProperty visibleProperty() | |
| widthProperty | back to summary |
|---|---|
| public final ReadOnlyDoubleProperty widthProperty() The width of this column. Modifying this will result in the column width adjusting visually. It is recommended to not bind this property to an external property, as that will result in the column width not being adjustable by the user through dragging the left and right borders of column headers.
| |