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 typeVFXMappingTableCell
- 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 VFXMappingTableCell that comes from the model, a piece of data VFXMappingTableCell which is part of VFXMappingTableCell.
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 VFXMappingTableCell 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 TypeMethodDescriptiondefault 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(StringConverter<E> converter) setExtractor(Function<T, E> extractor) Sets the function used to extract a valueVFXMappingTableCellfrom an itemVFXMappingTableCellMethods inherited from interface io.github.palexdev.virtualizedfx.cells.base.VFXCell
afterLayout, beforeLayout, dispose, onCache, onCreated, onDeCache, toNode, updateIndex, updateItemMethods inherited from interface io.github.palexdev.virtualizedfx.cells.base.VFXTableCell
updateColumn, updateRow
-
Method Details
-
getExtractor
- Returns:
- the function used to extract a value
VFXMappingTableCellfrom an itemVFXMappingTableCell
-
setExtractor
Sets the function used to extract a valueVFXMappingTableCellfrom an itemVFXMappingTableCell -
getConverter
StringConverter<E> getConverter()- Returns:
- the
StringConverterused to convert an extracted valueVFXMappingTableCellto aString
-
setConverter
-
setConverter
Allows easily setting aStringConverterfor the cell by just giving aFunctionas parameter, makes use ofFunctionalStringConverter.to(Function).
-