Class TreeTableColumn<S,T>
- Type Parameters:
S- The type of the TableView generic type (i.e. S == TableView<S>)T- The type of the content in all cells in this TableColumn.
- All Implemented Interfaces:
Styleable, EventTarget
TreeTableView is made up of a number of TreeTableColumn instances. Each
TreeTableColumn in a TreeTableView 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 TreeTableColumn also
contains the necessary properties to:
- Be resized (using
minWidth/prefWidth/maxWidthandwidthproperties) - Have its
visibilitytoggled - Display
header text - Display any
nested columnsit may contain - Have a
context menuwhen the user right-clicks the column header area - Have the contents of the table be sorted (using
comparator,sortableandsortType)
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). This can be
achieved using some variation on the following code:
firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
// p.getValue() returns the TreeItem<Person> instance for a particular TreeTableView row,
// p.getValue().getValue() returns the Person instance inside the TreeItem<Person>
return p.getValue().getValue().firstNameProperty();
}
});
}
This approach assumes that the object returned from p.getValue().getValue()
has a JavaFX ObservableValue that can simply be returned. The benefit of this
is that the TableView will internally create bindings to ensure that,
should the returned ObservableValue change, the cell contents will be
automatically refreshed.
In situations where a TableColumn must interact with classes created before
JavaFX, or that generally do not wish to use JavaFX APIs for properties, it is
possible to wrap the returned value in a ReadOnlyObjectWrapper instance. For
example:
firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
// p.getValue() returns the TreeItem<Person> instance for a particular TreeTableView row,
// p.getValue().getValue() returns the Person instance inside the TreeItem<Person>
return new ReadOnlyObjectWrapper(p.getValue().getValue().getFirstName());
}
});
}
It is hoped that over time there will be convenience cell value factories
developed and made available to developers. As of the JavaFX 2.0 release,
there is one such convenience class: TreeItemPropertyValueFactory.
This class removes the need to write the code above, instead relying on reflection to
look up a given property from a String. Refer to the
TreeItemPropertyValueFactory class documentation for more information
on how to use this with a TableColumn.
Finally, for more detail on how to use TableColumn, there is further documentation in
the TableView class documentation.- Since:
- JavaFX 8.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA support class used in TreeTableColumn as a wrapper class to provide all necessary information for a particularCell.static classAn event that is fired when a user performs an edit on a table cell.static enumEnumeration that specifies the type of sorting being applied to a specific column. -
Property Summary
PropertiesTypePropertyDescriptionfinal ObjectProperty<Callback<TreeTableColumn<S, T>, TreeTableCell<S, T>>> The cell factory for all cells in this column.The cell value factory needs to be set to specify how to populate all cells within a single TreeTableColumn.This event handler will be fired when the user cancels editing a cell.This event handler will be fired when the user successfully commits their editing.This event handler will be fired when the user successfully initiates editing.Used to state whether this column, if it is part of a sort order (seeTreeTableView.getSortOrder()for more details), should be sorted in ascending or descending order.final ReadOnlyObjectProperty<TreeTableView<S>> The TreeTableView that this TreeTableColumn belongs to.Properties declared in class TableColumnBase
comparator, contextMenu, editable, graphic, id, maxWidth, minWidth, parentColumn, prefWidth, reorderable, resizable, sortable, sortNode, style, text, visible, widthTypePropertyDescriptionfinal ObjectProperty<Comparator<T>> Comparator function used when sorting this table column.final ObjectProperty<ContextMenu> This menu will be shown whenever the user right clicks within the header area of this TableColumnBase.final BooleanPropertySpecifies whether this table column allows editing.final ObjectProperty<Node> The graphic to show in the table column to allow the user to indicate graphically what is in the column.final StringPropertyThe id of this TableColumnBase.final DoublePropertyThe maximum width the table column is permitted to be resized to.final DoublePropertyThe minimum width the table column is permitted to be resized to.final ReadOnlyObjectProperty<TableColumnBase<TreeItem<S>, ?>> This read-only property will always refer to the parent of this column, in the situation where nested columns are being used.final DoublePropertyThe preferred width of the TableColumn.final BooleanPropertyA boolean property to toggle on and off the 'reorderability' of this column (with drag and drop - reordering by modifying the appropriatecolumnslist is always allowed).final BooleanPropertyUsed to indicate whether the width of this column can change.final BooleanPropertyA boolean property to toggle on and off the 'sortability' of this column.final ObjectProperty<Node> The node to use as the "sort arrow", shown to the user in situations where the table column is part of the sort order.final StringPropertyA string representation of the CSS style associated with this TableColumnBase instance.final StringPropertyThis is the text to show in the header for this column.final BooleanPropertyToggling this will immediately toggle the visibility of this column, and all children columns.final ReadOnlyDoublePropertyThe width of this column. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Callback<TreeTableColumn<?, ?>, TreeTableCell<?, ?>> If no cellFactory is specified on a TreeTableColumn instance, then this one will be used by default.Fields declared in class TableColumnBase
DEFAULT_COMPARATORModifier and TypeFieldDescriptionstatic final ComparatorBy default all columns will use this comparator to perform sorting. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a default TreeTableColumn with default cell factory, comparator, and onEditCommit implementation.TreeTableColumn(String text) Creates a TreeTableColumn with the text set to the provided string, with default cell factory, comparator, and onEditCommit implementation. -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty<Callback<TreeTableColumn<S, T>, TreeTableCell<S, T>>> The cell factory for all cells in this column.The cell value factory needs to be set to specify how to populate all cells within a single TreeTableColumn.static <S,T> EventType <TreeTableColumn.CellEditEvent<S, T>> Parent event for any TreeTableColumn edit event.static <S,T> EventType <TreeTableColumn.CellEditEvent<S, T>> Indicates that the editing has been canceled, meaning that no change should be made to the backing data source.static <S,T> EventType <TreeTableColumn.CellEditEvent<S, T>> Indicates that the editing has been committed by the user, meaning that a change should be made to the backing data source to reflect the new data.static <S,T> EventType <TreeTableColumn.CellEditEvent<S, T>> Indicates that the user has performed some interaction to start an edit event, or alternatively theTreeTableView.edit(int, javafx.scene.control.TreeTableColumn)method has been called.final Callback<TreeTableColumn<S, T>, TreeTableCell<S, T>> Gets the value of thecellFactoryproperty.final ObservableValue<T> getCellObservableValue(int index) Attempts to return an ObservableValue<T> for the item in the given index (which is of type S).final ObservableValue<T> getCellObservableValue(TreeItem<S> item) Attempts to return an ObservableValue<T> for the given item (which is of type S).final Callback<TreeTableColumn.CellDataFeatures<S, T>, ObservableValue<T>> Gets the value of thecellValueFactoryproperty.static List<CssMetaData<? extends Styleable, ?>> Gets theCssMetaDataassociated with this class, which may include theCssMetaDataof its superclasses.final ObservableList<TreeTableColumn<S, ?>> This enables support for nested columns, which can be useful to group together related data.List<CssMetaData<? extends Styleable, ?>> The CssMetaData of this Styleable.final EventHandler<TreeTableColumn.CellEditEvent<S, T>> Gets the value of theonEditCancelproperty.final EventHandler<TreeTableColumn.CellEditEvent<S, T>> Gets the value of theonEditCommitproperty.final EventHandler<TreeTableColumn.CellEditEvent<S, T>> Gets the value of theonEditStartproperty.final TreeTableColumn.SortTypeGets the value of thesortTypeproperty.Return the parent of this Styleable, or null if there is no parent.final TreeTableView<S> Gets the value of thetreeTableViewproperty.The type of thisStyleablethat is to be used in selector matching.This event handler will be fired when the user cancels editing a cell.This event handler will be fired when the user successfully commits their editing.This event handler will be fired when the user successfully initiates editing.final voidsetCellFactory(Callback<TreeTableColumn<S, T>, TreeTableCell<S, T>> value) Sets the value of thecellFactoryproperty.final voidSets the value of thecellValueFactoryproperty.final voidSets the value of theonEditCancelproperty.final voidSets the value of theonEditCommitproperty.final voidSets the value of theonEditStartproperty.final voidSets the value of thesortTypeproperty.Used to state whether this column, if it is part of a sort order (seeTreeTableView.getSortOrder()for more details), should be sorted in ascending or descending order.final ReadOnlyObjectProperty<TreeTableView<S>> The TreeTableView that this TreeTableColumn belongs to.Methods declared in class TableColumnBase
buildEventDispatchChain, comparatorProperty, contextMenuProperty, editableProperty, getCellData, getCellData, getComparator, getContextMenu, getGraphic, getId, getMaxWidth, getMinWidth, getParentColumn, getPrefWidth, getProperties, getPseudoClassStates, getSortNode, getStyle, getStyleClass, getText, getUserData, getWidth, graphicProperty, hasProperties, idProperty, isEditable, isReorderable, isResizable, isSortable, isVisible, maxWidthProperty, minWidthProperty, parentColumnProperty, prefWidthProperty, reorderableProperty, resizableProperty, setComparator, setContextMenu, setEditable, setGraphic, setId, setMaxWidth, setMinWidth, setPrefWidth, setReorderable, setResizable, setSortable, setSortNode, setStyle, setText, setUserData, setVisible, sortableProperty, sortNodeProperty, styleProperty, textProperty, visibleProperty, widthPropertyModifier and TypeMethodDescriptionConstruct an event dispatch chain for this target.final ObjectProperty<Comparator<T>> Comparator function used when sorting this table column.final ObjectProperty<ContextMenu> This menu will be shown whenever the user right clicks within the header area of this TableColumnBase.final BooleanPropertySpecifies whether this table column allows editing.final TgetCellData(int index) Returns the actual value for a cell at a given row index (and which belongs to this table column).final TgetCellData(TreeItem<S> item) Returns the actual value for a cell from the given item.final Comparator<T> Gets the value of thecomparatorproperty.final ContextMenuGets the value of thecontextMenuproperty.final NodeGets the value of thegraphicproperty.final StringgetId()Gets the value of theidproperty.final doubleGets the value of themaxWidthproperty.final doubleGets the value of theminWidthproperty.final TableColumnBase<TreeItem<S>, ?> Gets the value of theparentColumnproperty.final doubleGets the value of theprefWidthproperty.final ObservableMap<Object, Object> Returns an observable map of properties on this table column for use primarily by application developers.final ObservableSet<PseudoClass> Return the pseudo-class state of this Styleable.final NodeGets the value of thesortNodeproperty.final StringgetStyle()Gets the value of thestyleproperty.A list of String identifiers which can be used to logically group Nodes, specifically for an external style engine.final StringgetText()Gets the value of thetextproperty.Returns a previously set Object property, or null if no such property has been set using theTableColumnBase.setUserData(java.lang.Object)method.final doublegetWidth()Gets the value of thewidthproperty.final ObjectProperty<Node> The graphic to show in the table column to allow the user to indicate graphically what is in the column.booleanTests if this table column has properties.final StringPropertyThe id of this TableColumnBase.final booleanGets the value of theeditableproperty.final booleanGets the value of thereorderableproperty.final booleanGets the value of theresizableproperty.final booleanGets the value of thesortableproperty.final booleanGets the value of thevisibleproperty.final DoublePropertyThe maximum width the table column is permitted to be resized to.final DoublePropertyThe minimum width the table column is permitted to be resized to.final ReadOnlyObjectProperty<TableColumnBase<TreeItem<S>, ?>> This read-only property will always refer to the parent of this column, in the situation where nested columns are being used.final DoublePropertyThe preferred width of the TableColumn.final BooleanPropertyA boolean property to toggle on and off the 'reorderability' of this column (with drag and drop - reordering by modifying the appropriatecolumnslist is always allowed).final BooleanPropertyUsed to indicate whether the width of this column can change.final voidsetComparator(Comparator<T> value) Sets the value of thecomparatorproperty.final voidsetContextMenu(ContextMenu value) Sets the value of thecontextMenuproperty.final voidsetEditable(boolean value) Sets the value of theeditableproperty.final voidsetGraphic(Node value) Sets the value of thegraphicproperty.final voidSets the value of theidproperty.final voidsetMaxWidth(double value) Sets the value of themaxWidthproperty.final voidsetMinWidth(double value) Sets the value of theminWidthproperty.final voidsetPrefWidth(double value) Sets the value of theprefWidthproperty.final voidsetReorderable(boolean value) Sets the value of thereorderableproperty.final voidsetResizable(boolean value) Sets the value of theresizableproperty.final voidsetSortable(boolean value) Sets the value of thesortableproperty.final voidsetSortNode(Node value) Sets the value of thesortNodeproperty.final voidSets the value of thestyleproperty.final voidSets the value of thetextproperty.voidsetUserData(Object value) Convenience method for setting a single Object property that can be retrieved at a later date.final voidsetVisible(boolean value) Sets the value of thevisibleproperty.final BooleanPropertyA boolean property to toggle on and off the 'sortability' of this column.final ObjectProperty<Node> The node to use as the "sort arrow", shown to the user in situations where the table column is part of the sort order.final StringPropertyA string representation of the CSS style associated with this TableColumnBase instance.final StringPropertyThis is the text to show in the header for this column.final BooleanPropertyToggling this will immediately toggle the visibility of this column, and all children columns.final ReadOnlyDoublePropertyThe width of this column.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface EventTarget
addEventFilter, addEventHandler, removeEventFilter, removeEventHandlerModifier and TypeMethodDescriptiondefault <E extends Event>
voidaddEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter) Registers an event filter for this target.default <E extends Event>
voidaddEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Registers an event handler for this target.default <E extends Event>
voidremoveEventFilter(EventType<E> eventType, EventHandler<? super E> eventFilter) Unregisters a previously registered event filter from this target.default <E extends Event>
voidremoveEventHandler(EventType<E> eventType, EventHandler<? super E> eventHandler) Unregisters a previously registered event handler from this target.Methods declared in interface Styleable
getStyleableNodeModifier and TypeMethodDescriptiondefault NodeReturns the Node that represents this Styleable object.
-
Property Details
-
treeTableView
The TreeTableView that this TreeTableColumn belongs to.- See Also:
-
cellValueFactory
public final ObjectProperty<Callback<TreeTableColumn.CellDataFeatures<S,T>, ObservableValue<T>>> cellValueFactoryPropertyThe cell value factory needs to be set to specify how to populate all cells within a single TreeTableColumn. A cell value factory is aCallbackthat provides aTreeTableColumn.CellDataFeaturesinstance, and expects anObservableValueto be returned. The returned ObservableValue instance will be observed internally to allow for updates to the value to be immediately reflected on screen.An example of how to set a cell value factory is:
A common approach is to want to populate cells in a TreeTableColumn using a single value from a Java bean. To support this common scenario, there is thefirstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<Person, String> p) { // p.getValue() returns the TreeItem<Person> instance for a particular TreeTableView row, // p.getValue().getValue() returns the Person instance inside the TreeItem<Person> return p.getValue().getValue().firstNameProperty(); } });}TreeItemPropertyValueFactoryclass. Refer to this class for more information on how to use it, but briefly here is how the above use case could be simplified using the TreeItemPropertyValueFactory class:firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory<Person,String>("firstName"));- See Also:
-
cellFactory
The cell factory for all cells in this column. The cell factory is responsible for rendering the data contained within each TreeTableCell for a single TreeTableColumn.By default TreeTableColumn uses a
default cell factory, but this can be replaced with a custom implementation, for example to show data in a different way or to support editing. There is a lot of documentation on creating custom cell factories elsewhere (seeCellandTreeTableViewfor example).Finally, there are a number of pre-built cell factories available in the
javafx.scene.control.cellpackage.- See Also:
-
sortType
Used to state whether this column, if it is part of a sort order (seeTreeTableView.getSortOrder()for more details), should be sorted in ascending or descending order. Simply toggling this property will result in the sort order changing in the TreeTableView, assuming of course that this column is in the sortOrder ObservableList to begin with.- See Also:
-
onEditStart
This event handler will be fired when the user successfully initiates editing.- See Also:
-
onEditCommit
This event handler will be fired when the user successfully commits their editing.- See Also:
-
onEditCancel
This event handler will be fired when the user cancels editing a cell.- See Also:
-
-
Field Details
-
DEFAULT_CELL_FACTORY
If no cellFactory is specified on a TreeTableColumn instance, then this one will be used by default. At present it simply renders the TableCell item property within thegraphicproperty if theitemis a Node, or it simply callstoString()if it is not null, setting the resulting string inside thetextproperty.
-
-
Constructor Details
-
TreeTableColumn
public TreeTableColumn()Creates a default TreeTableColumn with default cell factory, comparator, and onEditCommit implementation. -
TreeTableColumn
Creates a TreeTableColumn with the text set to the provided string, with default cell factory, comparator, and onEditCommit implementation.- Parameters:
text- The string to show when the TreeTableColumn is placed within the TreeTableView.
-
-
Method Details
-
editAnyEvent
Parent event for any TreeTableColumn edit event.- Type Parameters:
S- the type of the TreeTableView generic typeT- the type of the content in all cells in this TreeTableColumn- Returns:
- the edit event
-
editStartEvent
Indicates that the user has performed some interaction to start an edit event, or alternatively theTreeTableView.edit(int, javafx.scene.control.TreeTableColumn)method has been called.- Type Parameters:
S- the type of the TreeTableView generic typeT- the type of the content in all cells in this TreeTableColumn- Returns:
- the edit start event
-
editCancelEvent
Indicates that the editing has been canceled, meaning that no change should be made to the backing data source.- Type Parameters:
S- the type of the TreeTableView generic typeT- the type of the content in all cells in this TreeTableColumn- Returns:
- the edit cancel event
-
editCommitEvent
Indicates that the editing has been committed by the user, meaning that a change should be made to the backing data source to reflect the new data.- Type Parameters:
S- the type of the TreeTableView generic typeT- the type of the content in all cells in this TreeTableColumn- Returns:
- the edit commit event
-
treeTableViewProperty
The TreeTableView that this TreeTableColumn belongs to.- Returns:
- the
treeTableViewproperty - See Also:
-
getTreeTableView
Gets the value of thetreeTableViewproperty.- Property description:
- The TreeTableView that this TreeTableColumn belongs to.
- Returns:
- the value of the
treeTableViewproperty - See Also:
-
setCellValueFactory
public final void setCellValueFactory(Callback<TreeTableColumn.CellDataFeatures<S, T>, ObservableValue<T>> value) Sets the value of thecellValueFactoryproperty.- Property description:
- The cell value factory needs to be set to specify how to populate all
cells within a single TreeTableColumn. A cell value factory is a
Callbackthat provides aTreeTableColumn.CellDataFeaturesinstance, and expects anObservableValueto be returned. The returned ObservableValue instance will be observed internally to allow for updates to the value to be immediately reflected on screen.An example of how to set a cell value factory is:
A common approach is to want to populate cells in a TreeTableColumn using a single value from a Java bean. To support this common scenario, there is thefirstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<Person, String> p) { // p.getValue() returns the TreeItem<Person> instance for a particular TreeTableView row, // p.getValue().getValue() returns the Person instance inside the TreeItem<Person> return p.getValue().getValue().firstNameProperty(); } });}TreeItemPropertyValueFactoryclass. Refer to this class for more information on how to use it, but briefly here is how the above use case could be simplified using the TreeItemPropertyValueFactory class:firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory<Person,String>("firstName")); - Parameters:
value- the value for thecellValueFactoryproperty- See Also:
-
getCellValueFactory
public final Callback<TreeTableColumn.CellDataFeatures<S,T>, ObservableValue<T>> getCellValueFactory()Gets the value of thecellValueFactoryproperty.- Property description:
- The cell value factory needs to be set to specify how to populate all
cells within a single TreeTableColumn. A cell value factory is a
Callbackthat provides aTreeTableColumn.CellDataFeaturesinstance, and expects anObservableValueto be returned. The returned ObservableValue instance will be observed internally to allow for updates to the value to be immediately reflected on screen.An example of how to set a cell value factory is:
A common approach is to want to populate cells in a TreeTableColumn using a single value from a Java bean. To support this common scenario, there is thefirstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<Person, String> p) { // p.getValue() returns the TreeItem<Person> instance for a particular TreeTableView row, // p.getValue().getValue() returns the Person instance inside the TreeItem<Person> return p.getValue().getValue().firstNameProperty(); } });}TreeItemPropertyValueFactoryclass. Refer to this class for more information on how to use it, but briefly here is how the above use case could be simplified using the TreeItemPropertyValueFactory class:firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory<Person,String>("firstName")); - Returns:
- the value of the
cellValueFactoryproperty - See Also:
-
cellValueFactoryProperty
public final ObjectProperty<Callback<TreeTableColumn.CellDataFeatures<S,T>, ObservableValue<T>>> cellValueFactoryProperty()The cell value factory needs to be set to specify how to populate all cells within a single TreeTableColumn. A cell value factory is aCallbackthat provides aTreeTableColumn.CellDataFeaturesinstance, and expects anObservableValueto be returned. The returned ObservableValue instance will be observed internally to allow for updates to the value to be immediately reflected on screen.An example of how to set a cell value factory is:
A common approach is to want to populate cells in a TreeTableColumn using a single value from a Java bean. To support this common scenario, there is thefirstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<Person, String> p) { // p.getValue() returns the TreeItem<Person> instance for a particular TreeTableView row, // p.getValue().getValue() returns the Person instance inside the TreeItem<Person> return p.getValue().getValue().firstNameProperty(); } });}TreeItemPropertyValueFactoryclass. Refer to this class for more information on how to use it, but briefly here is how the above use case could be simplified using the TreeItemPropertyValueFactory class:firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory<Person,String>("firstName"));- Returns:
- the
cellValueFactoryproperty - See Also:
-
setCellFactory
Sets the value of thecellFactoryproperty.- Property description:
- The cell factory for all cells in this column. The cell factory
is responsible for rendering the data contained within each TreeTableCell
for a single TreeTableColumn.
By default TreeTableColumn uses a
default cell factory, but this can be replaced with a custom implementation, for example to show data in a different way or to support editing. There is a lot of documentation on creating custom cell factories elsewhere (seeCellandTreeTableViewfor example).Finally, there are a number of pre-built cell factories available in the
javafx.scene.control.cellpackage. - Parameters:
value- the value for thecellFactoryproperty- See Also:
-
getCellFactory
Gets the value of thecellFactoryproperty.- Property description:
- The cell factory for all cells in this column. The cell factory
is responsible for rendering the data contained within each TreeTableCell
for a single TreeTableColumn.
By default TreeTableColumn uses a
default cell factory, but this can be replaced with a custom implementation, for example to show data in a different way or to support editing. There is a lot of documentation on creating custom cell factories elsewhere (seeCellandTreeTableViewfor example).Finally, there are a number of pre-built cell factories available in the
javafx.scene.control.cellpackage. - Returns:
- the value of the
cellFactoryproperty - See Also:
-
cellFactoryProperty
public final ObjectProperty<Callback<TreeTableColumn<S,T>, TreeTableCell<S, cellFactoryProperty()T>>> The cell factory for all cells in this column. The cell factory is responsible for rendering the data contained within each TreeTableCell for a single TreeTableColumn.By default TreeTableColumn uses a
default cell factory, but this can be replaced with a custom implementation, for example to show data in a different way or to support editing. There is a lot of documentation on creating custom cell factories elsewhere (seeCellandTreeTableViewfor example).Finally, there are a number of pre-built cell factories available in the
javafx.scene.control.cellpackage.- Returns:
- the
cellFactoryproperty - See Also:
-
sortTypeProperty
Used to state whether this column, if it is part of a sort order (seeTreeTableView.getSortOrder()for more details), should be sorted in ascending or descending order. Simply toggling this property will result in the sort order changing in the TreeTableView, assuming of course that this column is in the sortOrder ObservableList to begin with.- Returns:
- the
sortTypeproperty - See Also:
-
setSortType
Sets the value of thesortTypeproperty.- Property description:
- Used to state whether this column, if it is part of a sort order (see
TreeTableView.getSortOrder()for more details), should be sorted in ascending or descending order. Simply toggling this property will result in the sort order changing in the TreeTableView, assuming of course that this column is in the sortOrder ObservableList to begin with. - Parameters:
value- the value for thesortTypeproperty- See Also:
-
getSortType
Gets the value of thesortTypeproperty.- Property description:
- Used to state whether this column, if it is part of a sort order (see
TreeTableView.getSortOrder()for more details), should be sorted in ascending or descending order. Simply toggling this property will result in the sort order changing in the TreeTableView, assuming of course that this column is in the sortOrder ObservableList to begin with. - Returns:
- the value of the
sortTypeproperty - See Also:
-
setOnEditStart
Sets the value of theonEditStartproperty.- Property description:
- This event handler will be fired when the user successfully initiates editing.
- Parameters:
value- the value for theonEditStartproperty- See Also:
-
getOnEditStart
Gets the value of theonEditStartproperty.- Property description:
- This event handler will be fired when the user successfully initiates editing.
- Returns:
- the value of the
onEditStartproperty - See Also:
-
onEditStartProperty
This event handler will be fired when the user successfully initiates editing.- Returns:
- the
onEditStartproperty - See Also:
-
setOnEditCommit
Sets the value of theonEditCommitproperty.- Property description:
- This event handler will be fired when the user successfully commits their editing.
- Parameters:
value- the value for theonEditCommitproperty- See Also:
-
getOnEditCommit
Gets the value of theonEditCommitproperty.- Property description:
- This event handler will be fired when the user successfully commits their editing.
- Returns:
- the value of the
onEditCommitproperty - See Also:
-
onEditCommitProperty
public final ObjectProperty<EventHandler<TreeTableColumn.CellEditEvent<S,T>>> onEditCommitProperty()This event handler will be fired when the user successfully commits their editing.- Returns:
- the
onEditCommitproperty - See Also:
-
setOnEditCancel
Sets the value of theonEditCancelproperty.- Property description:
- This event handler will be fired when the user cancels editing a cell.
- Parameters:
value- the value for theonEditCancelproperty- See Also:
-
getOnEditCancel
Gets the value of theonEditCancelproperty.- Property description:
- This event handler will be fired when the user cancels editing a cell.
- Returns:
- the value of the
onEditCancelproperty - See Also:
-
onEditCancelProperty
public final ObjectProperty<EventHandler<TreeTableColumn.CellEditEvent<S,T>>> onEditCancelProperty()This event handler will be fired when the user cancels editing a cell.- Returns:
- the
onEditCancelproperty - See Also:
-
getColumns
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.
- Specified by:
getColumnsin classTableColumnBase<TreeItem<S>, T>- 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.
-
getCellObservableValue
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
cell value factory, and returning whatever it returns when passed aCellDataFeatures(see, for example, the CellDataFeatures classes belonging toTableColumnandTreeTableColumnfor more information).- Specified by:
getCellObservableValuein classTableColumnBase<TreeItem<S>, T>- Parameters:
index- The index of the item (of type S) for which an ObservableValue<T> is sought.- Returns:
- An ObservableValue<T> for this specific table column.
-
getCellObservableValue
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
cell value factory, and returning whatever it returns when passed aCellDataFeatures(see, for example, the CellDataFeatures classes belonging toTableColumnandTreeTableColumnfor more information).- Specified by:
getCellObservableValuein classTableColumnBase<TreeItem<S>, T>- Parameters:
item- The item (of type S) for which an ObservableValue<T> is sought.- Returns:
- An ObservableValue<T> for this specific table column.
-
getTypeSelector
The type of thisStyleablethat is to be used in selector matching. This is analogous to an "element" in HTML. (CSS Type Selector).- Specified by:
getTypeSelectorin interfaceStyleable- Returns:
- "TreeTableColumn"
-
getStyleableParent
Return the parent of this Styleable, or null if there is no parent.- Specified by:
getStyleableParentin interfaceStyleable- Returns:
getTreeTableView()
-
getCssMetaData
The CssMetaData of this Styleable. This may be returned as an unmodifiable list.- Specified by:
getCssMetaDatain interfaceStyleable- Returns:
- the CssMetaData
-
getClassCssMetaData
Gets theCssMetaDataassociated with this class, which may include theCssMetaDataof its superclasses. It is currently an empty list.- Returns:
- an empty list
-