Class TextField2TableCell<S,​T>

  • Type Parameters:
    S - The type of the objects contained within the TableView items list.
    T - The type of the elements contained within the TableColumn.
    All Implemented Interfaces:
    Styleable, EventTarget, Skinnable

    public class TextField2TableCell<S,​T>
    extends TextFieldTableCell<S,​T>
    A class containing a TableCell implementation that draws a TextField node inside the cell.

    By default, the TextField2TableCell is rendered as a Label when not being edited, and as a TextField when in editing mode. The TextField will, by default, stretch to fill the entire table cell. This table cell supports commit on focus lost

    • Constructor Detail

      • TextField2TableCell

        public TextField2TableCell()
        Creates a default TextField2TableCell with a null converter. Without a StringConverter specified, this cell will not be able to accept input from the TextField (as it will not know how to convert this back to the domain object). It is therefore strongly encouraged to not use this constructor unless you intend to set the converter separately. This table cell supports commit on focus lost.
      • TextField2TableCell

        public TextField2TableCell​(StringConverter<T> converter)
        Creates a TextField2TableCell that provides a TextField when put into editing mode that allows editing of the cell content. This method will work on any TableColumn instance, regardless of its generic type. However, to enable this, a StringConverter must be provided that will convert the given String (from what the user typed in) into an instance of type T. This item will then be passed along to the TableColumn.onEditCommitProperty() callback. This table cell supports commit on focus lost.
        Parameters:
        converter - A converter that can convert the given String (from what the user typed in) into an instance of type T.
    • Method Detail

      • forTableColumn

        public static <S,​T> Callback<TableColumn<S,​T>,​TableCell<S,​T>> forTableColumn​(StringConverter<T> converter)
        Provides a TextField that allows editing of the cell content when the cell is double-clicked, or when TableView.edit(int, TableColumn) is called. This method will work on any TableColumn instance, regardless of its generic type. However, to enable this, a StringConverter must be provided that will convert the given String (from what the user typed in) into an instance of type T. This item will then be passed along to the TableColumn.onEditCommitProperty() callback. This table cell supports commit on focus lost.
        Type Parameters:
        S - The type of the objects contained within the TableView
        T - The type of the elements contained within the TableColumn
        Parameters:
        converter - A StringConverter that can convert the given String (from what the user typed in) into an instance of type T.
        Returns:
        A Callback that can be inserted into the cell factory property of a TableColumn, that enables textual editing of the content.