TreeTableCell implementation that draws a
ComboBox node inside the cell.
By default, the ComboBoxTreeTableCell is rendered as a Label when not
being edited, and as a ComboBox when in editing mode. The ComboBox will, by
default, stretch to fill the entire table cell.
To create a ComboBoxTreeTableCell, it is necessary to provide zero or more
items that will be shown to the user when the ComboBox menu is
showing. These items must be of the same type as the TreeTableColumn.
| Modifier and Type | Field and Description |
|---|---|
| private ComboBox | |
| private BooleanProperty | |
| private ObjectProperty | |
| private final ObservableList |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ComboBoxTreeTableCell(T...
The items to show in the ComboBox popup menu when selected
by the user. items)Creates a default |
| public | ComboBoxTreeTableCell(StringConverter<T>
A converter, T... StringConverter that can convert an item of type T
into a user-readable string so that it may then be shown in the
ComboBox popup menu.The items to show in the ComboBox popup menu when selected
by the user. items)Creates a |
| public | ComboBoxTreeTableCell(ObservableList<T>
The items to show in the ComboBox popup menu when selected
by the user. items)Creates a default |
| public | ComboBoxTreeTableCell(StringConverter<T>
A converter, ObservableList<T> StringConverter that can convert an item of type T
into a user-readable string so that it may then be shown in the
ComboBox popup menu.The items to show in the ComboBox popup menu when selected
by the user. items)Creates a |
| Modifier and Type | Method and Description |
|---|---|
| public void | cancelEdit()
Overrides javafx. Cancels an edit to the value of the cell. |
| public final BooleanProperty | Returns: the property representing whether the ComboBox, when shown to the user, is editable or notA property representing whether the ComboBox, when shown to the user, is editable or not. |
| public final ObjectProperty | |
| public static < The type of the TreeTableView generic type S, The type of the elements contained within the TreeTableColumn. T> Callback | Returns: ACallback that will return a TreeTableCell that is able to
work on the type of element contained within the TreeTableColumn.Zero or more items that will be shown to the user when the
items)ComboBox menu is showing. These items must be of the same
type as the TreeTableColumn. Note that it is up to the developer to set
event handlers to listen to edit events in the
TreeTableColumn, and react accordingly. Methods of interest include
setOnEditStart,
setOnEditCommit,
and setOnEditCancel.Creates a ComboBox cell factory for use in |
| public static < The type of the TreeTableView generic type S, The type of the elements contained within the TreeTableColumn. T> Callback | Returns: ACallback that will return a TreeTableCell that is able to
work on the type of element contained within the TreeTableColumn.A converter, final T... StringConverter to convert the given item (of
type T) to a String for displaying to the user.Zero or more items that will be shown to the user when the
items)ComboBox menu is showing. These items must be of the same
type as the TreeTableColumn. Note that it is up to the developer to set
event handlers to listen to edit events in the
TreeTableColumn, and react accordingly. Methods of interest include
setOnEditStart,
setOnEditCommit,
and setOnEditCancel.Creates a ComboBox cell factory for use in |
| public static < The type of the TreeTableView generic type S, The type of the elements contained within the TreeTableColumn. T> Callback | Returns: ACallback that will return a TreeTableCell that is able to
work on the type of element contained within the TreeTableColumn.Zero or more items that will be shown to the user when the
items)ComboBox menu is showing. These items must be of the same
type as the TreeTableColumn. Note that it is up to the developer to set
event handlers to listen to edit events in the
TreeTableColumn, and react accordingly. Methods of interest include
setOnEditStart,
setOnEditCommit,
and setOnEditCancel.Creates a ComboBox cell factory for use in |
| public static < The type of the TreeTableView generic type S, The type of the elements contained within the TreeTableColumn. T> Callback | Returns: ACallback that will return a TreeTableCell that is able to
work on the type of element contained within the TreeTableColumn.A converter, final ObservableList<T> StringConverter to convert the given item (of
type T) to a String for displaying to the user.Zero or more items that will be shown to the user when the
items)ComboBox menu is showing. These items must be of the same
type as the TreeTableColumn. Note that it is up to the developer to set
event handlers to listen to edit events in the
TreeTableColumn, and react accordingly. Methods of interest include
setOnEditStart,
setOnEditCommit,
and setOnEditCancel.Creates a ComboBox cell factory for use in |
| public final StringConverter | |
| public ObservableList | Returns: the items to be displayed in this ComboBox when it is showingReturns the items to be displayed in the ComboBox when it is showing. |
| public final boolean | Returns: true if the ComboBox is editableReturns true if the ComboBox is editable. |
| public final void | setComboBoxEditable(boolean
the editable value to be set for this ComboBox value)Configures the ComboBox to be editable (to allow user input outside of the options provide in the dropdown list). |
| public final void | setConverter(StringConverter<T>
the string converter value)Sets the |
| public void | startEdit()
Overrides javafx. Starts an edit to the value of the cell. |
| public void | updateItem(T
The new item for the cell. item, boolean whether or not this cell represents data from the list. If it
is empty, then it does not represent any domain data, but is a cell
being used to render an "empty" row. empty)Overrides javafx. The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. |
| comboBox | back to summary |
|---|---|
| private ComboBox<T> comboBox | |
| comboBoxEditable | back to summary |
|---|---|
| private BooleanProperty comboBoxEditable | |
| converter | back to summary |
|---|---|
| private ObjectProperty<StringConverter<T>> converter | |
| items | back to summary |
|---|---|
| private final ObservableList<T> items | |
| ComboBoxTreeTableCell | back to summary |
|---|---|
| public ComboBoxTreeTableCell() Creates a default ComboBoxTreeTableCell with an empty items list. | |
| ComboBoxTreeTableCell | back to summary |
|---|---|
| public ComboBoxTreeTableCell(T... items) Creates a default
| |
| ComboBoxTreeTableCell | back to summary |
|---|---|
| public ComboBoxTreeTableCell(StringConverter<T> converter, T... items) Creates a
| |
| ComboBoxTreeTableCell | back to summary |
|---|---|
| public ComboBoxTreeTableCell(ObservableList<T> items) Creates a default
| |
| ComboBoxTreeTableCell | back to summary |
|---|---|
| public ComboBoxTreeTableCell(StringConverter<T> converter, ObservableList<T> items) Creates a
| |
| cancelEdit | back to summary |
|---|---|
| public void cancelEdit() Overrides javafx. Doc from javafx. Cancels an edit to the value of the cell. Call this function to transition from an editing state into a non-editing state, without saving any user input.
| |
| comboBoxEditableProperty | back to summary |
|---|---|
| public final BooleanProperty comboBoxEditableProperty() A property representing whether the ComboBox, when shown to the user, is editable or not.
| |
| converterProperty | back to summary |
|---|---|
| public final ObjectProperty The
| |
| forTreeTableColumn | back to summary |
|---|---|
| public static <S, T> Callback Creates a ComboBox cell factory for use in
| |
| forTreeTableColumn | back to summary |
|---|---|
| public static <S, T> Callback Creates a ComboBox cell factory for use in
| |
| forTreeTableColumn | back to summary |
|---|---|
| public static <S, T> Callback Creates a ComboBox cell factory for use in
| |
| forTreeTableColumn | back to summary |
|---|---|
| public static <S, T> Callback Creates a ComboBox cell factory for use in
| |
| getConverter | back to summary |
|---|---|
| public final StringConverter Returns the
| |
| getItems | back to summary |
|---|---|
| public ObservableList Returns the items to be displayed in the ComboBox when it is showing.
| |
| isComboBoxEditable | back to summary |
|---|---|
| public final boolean isComboBoxEditable() Returns true if the ComboBox is editable.
| |
| setComboBoxEditable | back to summary |
|---|---|
| public final void setComboBoxEditable(boolean value) Configures the ComboBox to be editable (to allow user input outside of the options provide in the dropdown list).
| |
| setConverter | back to summary |
|---|---|
| public final void setConverter(StringConverter<T> value) Sets the
| |
| startEdit | back to summary |
|---|---|
| public void startEdit() Overrides javafx. Doc from javafx. Starts an edit to the value of the cell. Call this function to transition from a non-editing state into an editing state, if the cell is editable. If this cell is already in an editing state, it will stay in it.
| |
| updateItem | back to summary |
|---|---|
| public void updateItem(T item, boolean empty) Overrides javafx. Doc from javafx. The updateItem method should not be called by developers, but it is the
best method for developers to override to allow for them to customise the
visuals of the cell. To clarify, developers should never call this method
in their code (they should leave it up to the UI control, such as the
It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:
protected void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(null);
setGraphic(null);
} else {
setText(item.toString());
}
}
Note in this code sample two important points:
| |