Class CellFactory<T, C extends VFXCell<T>>
- All Implemented Interfaces:
Observable,Property<Function<T,,C>> ReadOnlyProperty<Function<T,,C>> ObservableValue<Function<T,,C>> WritableValue<Function<T,C>>
Encapsulates a cell generation function (create(Object)) along with a reference to the associated VFXContainer,
allowing each created cell to access the container instance upon creation. In other words, this wrapper is an easy
way to provide all cells the container they belong to without radical API changes.
Basically provides a hook that invokes VFXCell.onCreated(VFXContainer) on each newly generated cell,
passing the container instance to the cell. This is particularly useful when cells need contextual information from
the container, such as configuration, state, selection handling.
Note 1: nothing prevents you from creating cells using the function directly, however, keep in mind that to automatically make use of the new
VFXCell.onCreated(VFXContainer) hook, you must use create(Object)
instead.
Note 2: for convenience this extends
Property and delegates the implemented methods to the wrapped
cell factory property.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(InvalidationListener listener) voidaddListener(ChangeListener<? super Function<T, C>> listener) voidbind(ObservableValue<? extends Function<T, C>> observable) voidbindBidirectional(Property<Function<T, C>> other) booleanConvenience method to check whether the cell generating function is notnull.Creates a new cell for the given item, using the current cell factory function.getBean()getName()getOwner()getValue()booleanisBound()protected voidonInvalidated(Function<T, C> newFactory) Hook method called when the cell factory function is invalidated.voidremoveListener(InvalidationListener listener) voidremoveListener(ChangeListener<? super Function<T, C>> listener) voidvoidunbind()voidunbindBidirectional(Property<Function<T, C>> other) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javafx.beans.Observable
subscribe
-
Constructor Details
-
CellFactory
-
-
Method Details
-
create
Creates a new cell for the given item, using the current cell factory function.If the factory function is set, it generates a cell, calls
VFXCell.onCreated(VFXContainer)on it, and then returns it. Returnsnullif no factory function is defined. -
onInvalidated
-
bind
-
unbind
-
isBound
-
bindBidirectional
-
unbindBidirectional
-
getBean
- Specified by:
getBeanin interfaceReadOnlyProperty<T>
-
getName
- Specified by:
getNamein interfaceReadOnlyProperty<T>
-
addListener
- Specified by:
addListenerin interfaceObservableValue<T>
-
removeListener
- Specified by:
removeListenerin interfaceObservableValue<T>
-
getValue
- Specified by:
getValuein interfaceObservableValue<T>- Specified by:
getValuein interfaceWritableValue<T>
-
addListener
- Specified by:
addListenerin interfaceObservable
-
removeListener
- Specified by:
removeListenerin interfaceObservable
-
setValue
-
getOwner
- Returns:
- the container that owns this cell factory and inherently the cells created by it.
-
canCreate
public boolean canCreate()Convenience method to check whether the cell generating function is notnull.
-