Interface VFXCell<T>
- Type Parameters:
T- the type of item to display
- All Known Subinterfaces:
VFXMappingTableCell<T,,E> VFXTableCell<T>
- All Known Implementing Classes:
VFXCellBase,VFXDefaultTableRow,VFXObservingTableCell,VFXSimpleCell,VFXSimpleTableCell,VFXTableRow
- A way to convert themselves to a Node, can be implemented in various ways see toNode()
- A way to keep track of its index
- A way to keep track of the displayed item
Aside from these core functionalities, the API also offers other hooks: - Virtualized containers that make use of a cache (to avoid creating new cells every time one is needed) should
make use of onCache() and onDeCache(). Implementations can track cache/de-cache operations by overriding
these methods
- When cells are not needed anymore, dispose() should be called (automatically handled by the framework
don't worry). Here implementations can specify operations to do before the cell is GCd.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidThe system automatically calls this after the cell is laid out.default voidThe system automatically calls this before the cell is laid out.default voiddispose()Automatically called by the framework when the cell is not needed anymore.default voidonCache()Virtualized containers that make use of a cache to store unneeded cells that may be required again in a second time should call this when adding the cell to the cache.default voidonCreated(VFXContext<T> context) Called when a cell is created and associated with aVFXContainer.default voidVirtualized containers that make use of a cache to store unneeded cells that may be required again in a second time should call this when removing the cell from the cache.toNode()Converts the cell to aNode.voidupdateIndex(int index) Automatically called by the framework when the cell needs to update its index.voidupdateItem(T item) Automatically called by the framework when the cell needs to update its item.
-
Method Details
-
toNode
Node toNode()Converts the cell to aNode.Implementations can check these examples:
// Example 1 public class SimpleCell<T> extends Label implements VFXCell<T> { ... ... @Override public Node toNode() { return this; } } // Example 2 public class SimpleCell<T> implements VFXCell<T> { private final Label label = ...; ... ... @Override public Node toNode() { return label; } } -
updateIndex
void updateIndex(int index) Automatically called by the framework when the cell needs to update its index.Note though, that there is no 100% guarantee the new given index is different from the current one. If you have some operations happen when the index changes, for performance reasons, I recommend you to first ensure the new index really is different.
See
VFXCellBaseand read how this is handled. -
updateItem
Automatically called by the framework when the cell needs to update its item.Note though, that there is no 100% guarantee the new given item is different from the current one. If you have some operations happen when the item changes, for performance reasons, I recommend you to first ensure the new item really is different.
See
VFXCellBaseand read how this is handled. -
beforeLayout
default void beforeLayout()The system automatically calls this before the cell is laid out. -
afterLayout
default void afterLayout()The system automatically calls this after the cell is laid out. -
onCreated
Called when a cell is created and associated with aVFXContainer. This method provides the cell with a reference to its container, along with additional services that the cell may use to extend its functionalities.It's up to the implementation to decide how to use it.
Note: This method should only be called by the container that created this cell. Calling it with a different or incorrect container instance may lead to inconsistent behavior or errors.- See Also:
-
onCache
default void onCache()Virtualized containers that make use of a cache to store unneeded cells that may be required again in a second time should call this when adding the cell to the cache.Users can intercept/hook to this operation by overriding this method.
-
onDeCache
default void onDeCache()Virtualized containers that make use of a cache to store unneeded cells that may be required again in a second time should call this when removing the cell from the cache.Users can intercept/hook to this operation by overriding this method.
-
dispose
default void dispose()Automatically called by the framework when the cell is not needed anymore. The user can override this to perform some operations before the cell is GCd.
-