Interface VFXContainer<T>
- All Known Subinterfaces:
VFXPaginated<T>
- All Known Implementing Classes:
VFXGrid,VFXList,VFXPaginatedList,VFXTable
-
Property Summary
PropertiesTypePropertyDescriptionio.github.palexdev.mfxcore.base.properties.styleable.StyleableObjectProperty<BufferSize> Specifies the number of extra cells to add to the container; they act as a buffer, allowing scroll to be smoother.default ReadOnlyBooleanPropertySpecifies whether the data set is empty.Specifies the container's horizontal position.Specifies theObservableListused to store the items.Specifies the maximum possible value forhPosProperty()Specifies the maximum possible value forvPosProperty().default ReadOnlyIntegerPropertySpecifies the number of items in the data structure.Specifies the container's vertical position. -
Method Summary
Modifier and TypeMethodDescriptionio.github.palexdev.mfxcore.base.properties.styleable.StyleableObjectProperty<BufferSize> Specifies the number of extra cells to add to the container; they act as a buffer, allowing scroll to be smoother.default ReadOnlyBooleanPropertySpecifies whether the data set is empty.default BufferSizeGets the value of thebufferSizeproperty.default doublegetHPos()Gets the value of thehPosproperty.default ObservableList<T> getItems()Gets the value of theitemsproperty.default doubleGets the value of themaxHScrollproperty.default doubleGets the value of themaxVScrollproperty.default doubleGets the value of thevirtualMaxXproperty.default doubleGets the value of thevirtualMaxYproperty.default doublegetVPos()Gets the value of thevPosproperty.Specifies the container's horizontal position.default booleanisEmpty()Gets the value of theemptyproperty.Specifies theObservableListused to store the items.Specifies the maximum possible value forhPosProperty()Specifies the maximum possible value forvPosProperty().default voidsetBufferSize(BufferSize bufferSize) Sets the value of thebufferSizeproperty.default voidsetHPos(double hPos) Sets the value of thehPosproperty.default voidsetItems(ObservableList<T> items) Sets the value of theitemsproperty.default voidsetVPos(double vPos) Sets the value of thevPosproperty.default intsize()default ReadOnlyIntegerPropertySpecifies the number of items in the data structure.voidupdate(int... indexes) This method should be used by implementations to "manually" update the container.Specifies the container's vertical position.
-
Property Details
-
items
ListProperty<T> itemsPropertySpecifies theObservableListused to store the items.We use a
ListPropertybecause it offers many commodities such as both the size and emptiness of the list as observable properties, as well as the possibility of adding anInvalidationListenerthat will both inform about changes of the property and in the list.- See Also:
-
size
Specifies the number of items in the data structure.- See Also:
-
empty
-
virtualMaxX
ReadOnlyDoubleProperty virtualMaxXProperty- See Also:
-
virtualMaxY
ReadOnlyDoubleProperty virtualMaxYProperty- See Also:
-
maxVScroll
ReadOnlyDoubleProperty maxVScrollPropertySpecifies the maximum possible value forvPosProperty().- See Also:
-
maxHScroll
ReadOnlyDoubleProperty maxHScrollPropertySpecifies the maximum possible value forhPosProperty()- See Also:
-
vPos
-
hPos
-
bufferSize
io.github.palexdev.mfxcore.base.properties.styleable.StyleableObjectProperty<BufferSize> bufferSizePropertySpecifies the number of extra cells to add to the container; they act as a buffer, allowing scroll to be smoother. To avoid edge cases due to the users abusing the system, this is done by using an enumerator which allows up to three buffer cells.- See Also:
-
-
Method Details
-
update
void update(int... indexes) This method should be used by implementations to "manually" update the container.This can be useful when working with models that do not use JavaFX properties.
Note: the
indexesvar-arg parameter can be used to specify which cells need to be updated. An empty array should update all of them.More details: some cells may use an update mechanism which relies on property invalidation. Follow this example to better understand what I mean:
// Let's say I have a User class with 'firstName' and 'lastName' fields (we also have both getters and setters) // Now, let's assume I have a UserCell class used by the VFXContainer to display User objects (in a label for example) // This is a part of its implementation... public class UserCell extends Label implements VFXCell<User> { private final ObjectProperty<User> item = new SimpleObjectProperty<>() { @Overridden protected void invalidated() { update(); } }; protected void update() { // This will update the cell's text based on the current item } } // Remember, the 'invalidated()' method is called only when the reference changes, because internally it does not // check for equality but for identity // Now let's say I want to change a User's 'lastName' field like this... container.getItems().get(i).setLastName("NewLastName"); // Question: how can we tell the cell to force the update? // There are two possible ways... // 1) For the invalidation to occur, we first set the item property to 'null', and then back to the old value // 2) We use an event-based mechanism to tell cells to force update themselves. This solution requires cells to // subscribe to such events to support "manual" updates // Solution 2 is more flexible, see VFXContainerEvent class- See Also:
-
getItems
Gets the value of theitemsproperty.- Property description:
- Specifies the
ObservableListused to store the items.We use a
ListPropertybecause it offers many commodities such as both the size and emptiness of the list as observable properties, as well as the possibility of adding anInvalidationListenerthat will both inform about changes of the property and in the list. - Returns:
- the value of the
itemsproperty - See Also:
-
itemsProperty
ListProperty<T> itemsProperty()Specifies theObservableListused to store the items.We use a
ListPropertybecause it offers many commodities such as both the size and emptiness of the list as observable properties, as well as the possibility of adding anInvalidationListenerthat will both inform about changes of the property and in the list.- Returns:
- the
itemsproperty - See Also:
-
setItems
Sets the value of theitemsproperty.- Property description:
- Specifies the
ObservableListused to store the items.We use a
ListPropertybecause it offers many commodities such as both the size and emptiness of the list as observable properties, as well as the possibility of adding anInvalidationListenerthat will both inform about changes of the property and in the list. - Parameters:
items- the value for theitemsproperty- See Also:
-
size
default int size() -
sizeProperty
Specifies the number of items in the data structure.- Returns:
- the
sizeproperty
-
isEmpty
default boolean isEmpty()Gets the value of theemptyproperty.- Property description:
- Specifies whether the data set is empty.
- Returns:
- the value of the
emptyproperty - See Also:
-
emptyProperty
Specifies whether the data set is empty.- Returns:
- the
emptyproperty - See Also:
-
getVirtualMaxX
default double getVirtualMaxX()Gets the value of thevirtualMaxXproperty.- Property description:
- Returns:
- the value of the
virtualMaxXproperty - See Also:
-
virtualMaxXProperty
ReadOnlyDoubleProperty virtualMaxXProperty()- Returns:
- the
virtualMaxXproperty - See Also:
-
getVirtualMaxY
default double getVirtualMaxY()Gets the value of thevirtualMaxYproperty.- Property description:
- Returns:
- the value of the
virtualMaxYproperty - See Also:
-
virtualMaxYProperty
ReadOnlyDoubleProperty virtualMaxYProperty()- Returns:
- the
virtualMaxYproperty - See Also:
-
getMaxVScroll
default double getMaxVScroll()Gets the value of themaxVScrollproperty.- Property description:
- Specifies the maximum possible value for
vPosProperty(). - Returns:
- the value of the
maxVScrollproperty - See Also:
-
maxVScrollProperty
ReadOnlyDoubleProperty maxVScrollProperty()Specifies the maximum possible value forvPosProperty().- Returns:
- the
maxVScrollproperty - See Also:
-
getMaxHScroll
default double getMaxHScroll()Gets the value of themaxHScrollproperty.- Property description:
- Specifies the maximum possible value for
hPosProperty() - Returns:
- the value of the
maxHScrollproperty - See Also:
-
maxHScrollProperty
ReadOnlyDoubleProperty maxHScrollProperty()Specifies the maximum possible value forhPosProperty()- Returns:
- the
maxHScrollproperty - See Also:
-
getVPos
default double getVPos()Gets the value of thevPosproperty.- Property description:
- Specifies the container's vertical position.
- Returns:
- the value of the
vPosproperty - See Also:
-
vPosProperty
DoubleProperty vPosProperty()Specifies the container's vertical position.- Returns:
- the
vPosproperty - See Also:
-
setVPos
default void setVPos(double vPos) Sets the value of thevPosproperty.- Property description:
- Specifies the container's vertical position.
- Parameters:
vPos- the value for thevPosproperty- See Also:
-
getHPos
default double getHPos()Gets the value of thehPosproperty.- Property description:
- Specifies the container's horizontal position.
- Returns:
- the value of the
hPosproperty - See Also:
-
hPosProperty
DoubleProperty hPosProperty()Specifies the container's horizontal position.- Returns:
- the
hPosproperty - See Also:
-
setHPos
default void setHPos(double hPos) Sets the value of thehPosproperty.- Property description:
- Specifies the container's horizontal position.
- Parameters:
hPos- the value for thehPosproperty- See Also:
-
getBufferSize
Gets the value of thebufferSizeproperty.- Property description:
- Specifies the number of extra cells to add to the container; they act as a buffer, allowing scroll to be smoother. To avoid edge cases due to the users abusing the system, this is done by using an enumerator which allows up to three buffer cells.
- Returns:
- the value of the
bufferSizeproperty - See Also:
-
bufferSizeProperty
io.github.palexdev.mfxcore.base.properties.styleable.StyleableObjectProperty<BufferSize> bufferSizeProperty()Specifies the number of extra cells to add to the container; they act as a buffer, allowing scroll to be smoother. To avoid edge cases due to the users abusing the system, this is done by using an enumerator which allows up to three buffer cells.- Returns:
- the
bufferSizeproperty - See Also:
-
setBufferSize
Sets the value of thebufferSizeproperty.- Property description:
- Specifies the number of extra cells to add to the container; they act as a buffer, allowing scroll to be smoother. To avoid edge cases due to the users abusing the system, this is done by using an enumerator which allows up to three buffer cells.
- Parameters:
bufferSize- the value for thebufferSizeproperty- See Also:
-