Class VFXLabeledCellSkin<T>
- All Implemented Interfaces:
Skin<VFXCellBase<T>>
- Direct Known Subclasses:
VFXObservingTableCell.VFXObservingTableCellSkin
VFXCellBase.
This will display the data specified by the VFXCellBase.itemProperty() as a String in a Label.
It's the only children of this skin, takes all the available space and has the following properties bound to the cell:
- the alignment property bound to VFXCellBase.alignmentProperty()
- the graphic property bound to VFXCellBase.graphicProperty().
The label's text will be updated on two occasions:
1) when the VFXCellBase.itemProperty() is invalidated
2) when an event of type VFXContainerEvent.UPDATE reaches the cell
You can modify addListeners() to change such behavior. For example, rather than using an InvalidationListener
you could use a ChangeListener instead, add your own logic, etc. (useful when you want to optimize update performance).
(It's recommended to use SkinBase.listeners(When[]), SkinBase.events(WhenEvent[]) and in general When constructs.
Simply because they make your life easier, also disposal would be automatic this way).
Last but not least, the label's text is updated by the update() method.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds anInvalidationListeneron theVFXCellBase.itemProperty()to callupdate()when it changes, and anEventHandlerto support "manual" updates through events of typeVFXContainerEvent.UPDATE.protected doublecomputePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) protected voidinitBehavior(CellBaseBehavior<T> behavior) protected voidlayoutChildren(double x, double y, double w, double h) protected voidupdate()This is responsible for updating the label's text using the value specified by theVFXCellBase.itemProperty().Methods inherited from class io.github.palexdev.mfxcore.controls.SkinBase
dispose, 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
-
label
protected final io.github.palexdev.mfxcore.controls.Label label
-
-
Constructor Details
-
VFXLabeledCellSkin
-
-
Method Details
-
addListeners
protected void addListeners()Adds anInvalidationListeneron theVFXCellBase.itemProperty()to callupdate()when it changes, and anEventHandlerto support "manual" updates through events of typeVFXContainerEvent.UPDATE.(Uses
WhenandWhenEventconstructs).- See Also:
-
update
protected void update()This is responsible for updating the label's text using the value specified by theVFXCellBase.itemProperty().If the item is
nullsets the text to an empty string, otherwise callstoString()on it. -
initBehavior
- Overrides:
initBehaviorin classio.github.palexdev.mfxcore.controls.SkinBase<VFXCellBase<T>, CellBaseBehavior<T>>
-
computePrefWidth
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computePrefWidthin classSkinBase<VFXCellBase<T>>
-
layoutChildren
protected void layoutChildren(double x, double y, double w, double h) - Overrides:
layoutChildrenin classSkinBase<VFXCellBase<T>>
-