Top Description Fields Constructors Methods
org.controlsfx.control.tableview2.cell

public Class ComboBox2TableCell<S, T>

extends ComboBoxTableCell<S, T>
Class Inheritance
Type Parameters
<S>
The type of the objects contained within the TableView items list.
<T>
The type of the elements contained within the TableColumn.
Imports
javafx.beans.InvalidationListener, .Observable, javafx.beans.value.ChangeListener, javafx.collections.FXCollections, .ObservableList, javafx.event.Event, .EventHandler, javafx.scene.control.ComboBox, .TableCell, .TableColumn, .TablePosition, .TableView, javafx.scene.control.cell.ComboBoxTableCell, javafx.scene.input.KeyEvent, javafx.util.Callback, .StringConverter

A class containing a TableCell implementation that draws a ComboBox node inside the cell.

By default, the ComboBox2TableCell is rendered as a javafx.scene.control.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 ComboBox2TableCell, 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 TableColumn. This table cell supports commit on focus lost. By default the ComboBox will be set as editable.

Field Summary

Modifier and TypeField and Description
private ComboBox<T>
private final ChangeListener<Boolean>
private final EventHandler<KeyEvent>

Constructor Summary

AccessConstructor and Description
public
ComboBox2TableCell()

Creates a default ComboBox2TableCell with an empty items list.

public
ComboBox2TableCell(T...
The items to show in the ComboBox popup menu when selected by the user.
items
)

Creates a default ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown.

public
ComboBox2TableCell(StringConverter<T>
A 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.
converter
,
T...
The items to show in the ComboBox popup menu when selected by the user.
items
)

Creates a ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown, and the StringConverter being used to convert the item in to a user-readable form.

public
ComboBox2TableCell(ObservableList<T>
The items to show in the ComboBox popup menu when selected by the user.
items
)

Creates a default ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown.

public
ComboBox2TableCell(StringConverter<T>
A 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.
converter
,
ObservableList<T>
The items to show in the ComboBox popup menu when selected by the user.
items
)

Creates a ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown, and the StringConverter being used to convert the item in to a user-readable form.

Method Summary

Modifier and TypeMethod and Description
public void
commitEdit(T item)

Overrides javafx.scene.control.TableCell.commitEdit.

Commits an edit to the value of the cell.

public static <
The type of the objects contained within the TableView
S
,
The type of the elements contained within the TableColumn.
T
>
Callback<TableColumn<S, T>, TableCell<S, T>>

Returns:

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.
forTableColumn
(final T...
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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.
items
)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls.

public static <
The type of the objects contained within the TableView
S
,
The type of the elements contained within the TableColumn.
T
>
Callback<TableColumn<S, T>, TableCell<S, T>>

Returns:

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.
forTableColumn
(final StringConverter<T>
A StringConverter to convert the given item (of type T) to a String for displaying to the user.
converter
,
final T...
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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.
items
)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls.

public static <
The type of the objects contained within the TableView
S
,
The type of the elements contained within the TableColumn.
T
>
Callback<TableColumn<S, T>, TableCell<S, T>>

Returns:

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.
forTableColumn
(final ObservableList<T>
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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.
items
)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls.

public static <
The type of the objects contained within the TableView
S
,
The type of the elements contained within the TableColumn.
T
>
Callback<TableColumn<S, T>, TableCell<S, T>>

Returns:

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.
forTableColumn
(final StringConverter<T>
A StringConverter to convert the given item (of type T) to a String for displaying to the user.
converter
,
final ObservableList<T>
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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.
items
)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls.

private void
updateListeners(boolean editable)

Inherited from javafx.scene.control.cell.ComboBoxTableCell:
cancelEditcomboBoxEditablePropertyconverterPropertygetConvertergetItemsisComboBoxEditablesetComboBoxEditablesetConverterstartEditupdateItem

Field Detail

comboBoxback to summary
private ComboBox<T> comboBox

Hides javafx.scene.control.cell.ComboBoxTableCell.comboBox.

* Fields * *

focusListenerback to summary
private final ChangeListener<Boolean> focusListener
keyEventHandlerback to summary
private final EventHandler<KeyEvent> keyEventHandler

Constructor Detail

ComboBox2TableCellback to summary
public ComboBox2TableCell()

Creates a default ComboBox2TableCell with an empty items list. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

ComboBox2TableCellback to summary
public ComboBox2TableCell(T... items)

Creates a default ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
items:T[]

The items to show in the ComboBox popup menu when selected by the user.

Annotations
@SafeVarargs
ComboBox2TableCellback to summary
public ComboBox2TableCell(StringConverter<T> converter, T... items)

Creates a ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown, and the StringConverter being used to convert the item in to a user-readable form. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
converter:StringConverter<T>

A 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.

items:T[]

The items to show in the ComboBox popup menu when selected by the user.

Annotations
@SafeVarargs
ComboBox2TableCellback to summary
public ComboBox2TableCell(ObservableList<T> items)

Creates a default ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
items:ObservableList<T>

The items to show in the ComboBox popup menu when selected by the user.

ComboBox2TableCellback to summary
public ComboBox2TableCell(StringConverter<T> converter, ObservableList<T> items)

Creates a ComboBox2TableCell instance with the given items being used to populate the ComboBox when it is shown, and the StringConverter being used to convert the item in to a user-readable form. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
converter:StringConverter<T>

A 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.

items:ObservableList<T>

The items to show in the ComboBox popup menu when selected by the user.

Method Detail

commitEditback to summary
public void commitEdit(T item)

Overrides javafx.scene.control.TableCell.commitEdit.

Doc from javafx.scene.control.TableCell.commitEdit.

Commits an edit to the value of the cell. Call this function when appropriate (based on the user interaction requirements of your cell editing user interface) to do two things:

  1. Fire the appropriate events back to the backing UI control (e.g., ListView). This will begin the process of pushing this edit back to the relevant data source / property (although it does not guarantee that this will be successful - that is dependent upon the specific edit commit handler being used). Refer to the UI control class javadoc for more detail.
  2. Begin the transition from an editing state into a non-editing state.

In general there is no need to override this method in custom cell implementations - it should be sufficient to simply call this method when appropriate (e.g., when the user pressed the Enter key, you may do something like cell.commitEdit(converter.fromString(textField.getText()));

Annotations
@Override
forTableColumnback to summary
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(final T... items)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls. By default, the ComboBoxCell is rendered as a javafx.scene.control.Label when not being edited, and as a ComboBox when in editing mode. The ComboBox will, by default, stretch to fill the entire list cell. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
<S>
The type of the objects contained within the TableView
<T>
The type of the elements contained within the TableColumn.
items:T[]

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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.

Returns:Callback<TableColumn<S, T>, TableCell<S, T>>

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.

Annotations
@SafeVarargs
forTableColumnback to summary
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(final StringConverter<T> converter, final T... items)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls. By default, the ComboBoxCell is rendered as a javafx.scene.control.Label when not being edited, and as a ComboBox when in editing mode. The ComboBox will, by default, stretch to fill the entire list cell. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
<S>
The type of the objects contained within the TableView
<T>
The type of the elements contained within the TableColumn.
converter:StringConverter<T>

A StringConverter to convert the given item (of type T) to a String for displaying to the user.

items:T[]

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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.

Returns:Callback<TableColumn<S, T>, TableCell<S, T>>

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.

Annotations
@SafeVarargs
forTableColumnback to summary
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(final ObservableList<T> items)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls. By default, the ComboBoxCell is rendered as a javafx.scene.control.Label when not being edited, and as a ComboBox when in editing mode. The ComboBox will, by default, stretch to fill the entire list cell. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
<S>
The type of the objects contained within the TableView
<T>
The type of the elements contained within the TableColumn.
items:ObservableList<T>

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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.

Returns:Callback<TableColumn<S, T>, TableCell<S, T>>

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.

forTableColumnback to summary
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(final StringConverter<T> converter, final ObservableList<T> items)

Hides javafx.scene.control.cell.ComboBoxTableCell.forTableColumn.

Creates a ComboBox cell factory for use in TableColumn controls. By default, the ComboBoxCell is rendered as a javafx.scene.control.Label when not being edited, and as a ComboBox when in editing mode. The ComboBox will, by default, stretch to fill the entire list cell. This table cell supports commit on focus lost. By default the ComboBox is set as editable.

Parameters
<S>
The type of the objects contained within the TableView
<T>
The type of the elements contained within the TableColumn.
converter:StringConverter<T>

A StringConverter to convert the given item (of type T) to a String for displaying to the user.

items:ObservableList<T>

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 TableColumn. Note that it is up to the developer to set event handlers to listen to edit events in the TableColumn, and react accordingly. Methods of interest include setOnEditStart, setOnEditCommit, and setOnEditCancel.

Returns:Callback<TableColumn<S, T>, TableCell<S, T>>

A Callback that will return a TableCell that is able to work on the type of element contained within the TableColumn.

updateListenersback to summary
private void updateListeners(boolean editable)