Class VFXObservingTableCell.VFXObservingTableCellSkin
java.lang.Object
javafx.scene.control.SkinBase<VFXCellBase<T>>
io.github.palexdev.mfxcore.controls.SkinBase<VFXCellBase<T>, CellBaseBehavior<T>>
io.github.palexdev.virtualizedfx.cells.VFXLabeledCellSkin<T>
io.github.palexdev.virtualizedfx.cells.VFXObservingTableCell.VFXObservingTableCellSkin
- All Implemented Interfaces:
Skin<VFXCellBase<T>>
- Enclosing class:
VFXObservingTableCell<T,E>
Default skin implementation used by
VFXObservingTableCell and extension of VFXLabeledCellSkin.
I could have overridden the base class in-line, but I decided to make it a separate class to make it easier to customize.
Theupdate() method is overridden and functions quite differently, make sure to carefully read the documentation.
The addListeners() method has also been modified to call onItemChanged() rather than update()
directly when the VFXCellBase.itemProperty() changes.-
Field Summary
FieldsFields inherited from class io.github.palexdev.virtualizedfx.cells.VFXLabeledCellSkin
label -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds anInvalidationListeneron theVFXCellBase.itemProperty()to callonItemChanged()when it changes, and anEventHandlerto support "manual" updates through events of typeVFXContainerEvent.UPDATE(although this should not be needed here).voiddispose()protected voidThe auto-updating feature of this cell implementation is no magic.protected voidupdate()Updates the label's text by using the converter on the property extracted byVFXObservingTableCell.getProperty().Methods inherited from class io.github.palexdev.virtualizedfx.cells.VFXLabeledCellSkin
computePrefWidth, initBehavior, layoutChildrenMethods inherited from class io.github.palexdev.mfxcore.controls.SkinBase
events, getBehavior, getControl, listenersMethods inherited from class javafx.scene.control.SkinBase
computeBaselineOffset, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, consumeMouseEvents, executeAccessibleAction, getChildren, getClassCssMetaData, getCssMetaData, getNode, getSkinnable, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, registerInvalidationListener, registerListChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners, unregisterInvalidationListeners, unregisterListChangeListeners
-
Field Details
-
listener
-
-
Constructor Details
-
VFXObservingTableCellSkin
-
-
Method Details
-
onItemChanged
protected void onItemChanged()The auto-updating feature of this cell implementation is no magic. A simpleInvalidationListeneris attached to the extracted property to callupdate()when it changes.This method does exactly this. When the
VFXCellBase.itemProperty()changes it also means that the property extracted byVFXObservingTableCell.getProperty()is now invalid, and so is the previous listener.Simply re-builds the listener when this happens, and by invoking
VFXObservingTableCell.getProperty()we also validate the local reference to the property (to be precise the reference is stored in the cell not here in the skin). Note that this will also callupdate(). -
addListeners
protected void addListeners()Adds anInvalidationListeneron theVFXCellBase.itemProperty()to callonItemChanged()when it changes, and anEventHandlerto support "manual" updates through events of typeVFXContainerEvent.UPDATE(although this should not be needed here).(Uses
WhenandWhenEventconstructs).- Overrides:
addListenersin classVFXLabeledCellSkin<T>- See Also:
-
update
protected void update()Updates the label's text by using the converter on the property extracted byVFXObservingTableCell.getProperty().- Overrides:
updatein classVFXLabeledCellSkin<T>- See Also:
-
dispose
public void dispose()- Specified by:
disposein interfaceSkin<VFXCellBase<T>>- Overrides:
disposein classio.github.palexdev.mfxcore.controls.SkinBase<VFXCellBase<T>, CellBaseBehavior<T>>
-