Package org.fxmisc.flowless
Interface Cell<T,N extends javafx.scene.Node>
- All Known Implementing Classes:
CellWrapper
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Provides efficient memory usage by wrapping a
Node
within this object and reusing it when
isReusable()
is true.-
Method Summary
Modifier and TypeMethodDescriptionafterDispose
(Runnable action) afterReset
(Runnable action) afterUpdateIndex
(IntConsumer action) afterUpdateItem
(Consumer<? super T> action) beforeDispose
(Runnable action) beforeReset
(Runnable action) beforeUpdateIndex
(IntConsumer action) beforeUpdateItem
(Consumer<? super T> action) default void
dispose()
Called when this cell is no longer going to be used at all.getNode()
default boolean
Indicates whether this cell can be reused to display different items.default void
reset()
Called when this cell is no longer used to display its item.default void
updateIndex
(int index) Called to update index of a visible cell.default void
updateItem
(T item) If this cell is reusable (as indicated byisReusable()
), this method is called to display a different item.static <T,
N extends javafx.scene.Node>
Cell<T, N> wrapNode
(N node)
-
Method Details
-
wrapNode
-
getNode
N getNode() -
isReusable
default boolean isReusable()Indicates whether this cell can be reused to display different items.Default implementation returns
false
. -
updateItem
If this cell is reusable (as indicated byisReusable()
), this method is called to display a different item.reset()
will have been called before a call to this method.The default implementation throws
UnsupportedOperationException
.- Parameters:
item
- the new item to display
-
updateIndex
default void updateIndex(int index) Called to update index of a visible cell.Default implementation does nothing.
-
reset
default void reset()Called when this cell is no longer used to display its item. If this cell is reusable, it may later be asked to display a different item by a call toupdateItem(Object)
.Default implementation does nothing.
-
dispose
default void dispose()Called when this cell is no longer going to be used at all.reset()
will have been called before this method is invoked.Default implementation does nothing.
-
beforeDispose
-
afterDispose
-
beforeReset
-
afterReset
-
beforeUpdateItem
-
afterUpdateItem
-
beforeUpdateIndex
-
afterUpdateIndex
-