Class TableCellAutoCommit<S,T>

Type Parameters:
S - The type of the TableView generic type (i.e., S == TableView<S>). This should also match with the first generic type in TableColumn.
T - The type of the item contained within the Cell.
All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class TableCellAutoCommit<S,T> extends TableCell<S,T>
An editable cell in a TableView that commits changes upon focus lost. Based on a Gist by GitHub user james-d.
  • Constructor Details

    • TableCellAutoCommit

      public TableCellAutoCommit(StringConverter<T> converter)
      Constructs an EditCell with the given converter.
      Parameters:
      converter - The converter used to convert the cell value to a string.
  • Method Details

    • forTableColumn

      public static <S> Callback<TableColumn<S,String>,TableCell<S,String>> forTableColumn()
      Returns a callback that creates an EditCell for a TableColumn with String type. Uses the default String converter provided by DefaultStringConverter.
      Type Parameters:
      S - the type of the TableView items
      Returns:
      a callback that creates an EditCell for a TableColumn with String type
    • forTableColumn

      public static <S, T> Callback<TableColumn<S,T>,TableCell<S,T>> forTableColumn(StringConverter<T> converter)
      Returns a callback that creates an EditCell for a TableColumn.
      Type Parameters:
      S - The type of the TableView items.
      T - The type of the cell value.
      Parameters:
      converter - The converter used to convert the cell value to String type.
      Returns:
      A callback that creates an EditCell for a TableColumn.
    • startEdit

      public void startEdit()
      Overrides:
      startEdit in class TableCell<S,T>
    • cancelEdit

      public void cancelEdit()
      Overrides:
      cancelEdit in class TableCell<S,T>
    • commitEdit

      public void commitEdit(@Nullable T newValue)
      Overrides:
      commitEdit in class TableCell<S,T>