Interface VFXMappingTableCell<T,E>
- Type Parameters:
T- the data type in the tableE- the data type the cell is going to use from items of typeT
- All Superinterfaces:
VFXCell<T>, VFXTableCell<T>
- All Known Implementing Classes:
VFXObservingTableCell, VFXSimpleTableCell
Extension of
VFXTableCell to propose users a specific way of using VFXTable.
I structured this virtualized container with this API in mind. Each VFXTableColumn should produce cells
that display from an object T that comes from the model, a piece of data E which is part of T.
Consider this example:
// My model class...
record User(int id, String name) {}
// My columns (assuming UserCell is a custom cell)
VFXTableColumn<User, UserCell> idColumn = new VFXDefaultTableColumn<>("ID");
VFXTableColumn<User, UserCell> nameColumn = new VFXDefaultTableColumn<>("Name");
// Let's set their cell factories
idColumn.setCellFactory(user -> new UserCell(user, User::id));
nameColumn.setCellFactory(user -> new UserCell(user, User::name));
// See the second parameter in the constructors? I call that function the 'extractor' which basically tells the cell
// which piece of data it should display from the a User object
For this API to work, we need two additional requirements:
1) Cells need to have an 'extractor' function
2) Cells may want to also have a 'converter' function. This is going to be used to convert extracted data of
type E to string to be used, for example, in a label. Of course, this is optional if the data is not going
to be displayed as a string
-
Method Summary
Modifier and TypeMethodDescriptionjavafx.util.StringConverter<E> default VFXMappingTableCell<T, E> setConverter(Function<E, String> fn) Allows easily setting aStringConverterfor the cell by just giving aFunctionas parameter, makes use ofFunctionalStringConverter.to(Function).setConverter(javafx.util.StringConverter<E> converter) setExtractor(Function<T, E> extractor) Methods inherited from interface VFXCell
afterLayout, beforeLayout, dispose, onCache, onCreated, onDeCache, toNode, updateIndex, updateItemMethods inherited from interface VFXTableCell
updateColumn, updateRow
-
Method Details
-
getExtractor
-
setExtractor
-
getConverter
-
setConverter
-
setConverter
-