Top Description Fields Constructors Methods
com.dlsc.gemsfx.paging

public abstract Class ItemPagingControlBase<T>

extends PagingControlBase
Class Inheritance
Known Direct Subclasses
com.dlsc.gemsfx.paging.PagingGridTableView, com.dlsc.gemsfx.paging.PagingListView
Type Parameters
<T>
the type of the items shown in the control
Imports
com.dlsc.gemsfx.LoadingPane, javafx.beans.InvalidationListener, .Observable, javafx.beans.property.BooleanProperty, .LongProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleLongProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .ObservableList, javafx.concurrent.Worker, javafx.geometry.Side, javafx.scene.Node, javafx.scene.control.Label, .MultipleSelectionModel, javafx.util.Callback, java.util.List, java.util.function.Consumer

The abstract superclass for PagingListView and PagingGridTableView. It manages the common attributes of these paging controls, such as the loading service, the loader, the loading status, the load delay, the "fill rows" attribute, etc ...

Field Summary

Modifier and TypeField and Description
private final LongProperty
private final BooleanProperty
private final ObservableList<T>
private final LongProperty
private final ObjectProperty<Callback<PagingLoadRequest, PagingLoadResponse<T>>>
private final ObjectProperty<LoadingService<T>>
private final ObjectProperty<LoadingPane.Status>
private final ObjectProperty<Consumer<T>>
private final ObjectProperty<Side>
private ObjectProperty<Node>
private boolean
private final ObjectProperty<MultipleSelectionModel<T>>
private final BooleanProperty
private final BooleanProperty
Inherited from com.dlsc.gemsfx.paging.PagingControlBase:
pageCount

Constructor Summary

AccessConstructor and Description
protected
ItemPagingControlBase()

Constructs an instance of ItemPagingControlBase and initializes the paging and loading service behavior.

Method Summary

Modifier and TypeMethod and Description
public final LongProperty

Returns:

the commit delay for the nested loading pane
commitLoadStatusDelayProperty
()

The delay in milliseconds before the list view will display the progress indicator for long-running load operations.

public final BooleanProperty

Returns:

a flag used to control whether the last page will be filled with empty cells if needed
fillLastPageProperty
()

The control might not have enough data to fill its last page with items / cells.

public final long
public final ObservableList<T>

Returns:

the currently shown items
getItemsOnCurrentPage
()

Returns an observable list with the items shown by the current page.

public final long
public final Callback<PagingLoadRequest, PagingLoadResponse<T>>
public final LoadingService<T>
public final LoadingPane.Status
public final Consumer<T>
public final Side
public final Node
public final MultipleSelectionModel<T>

Returns:

the currently installed selection model
getSelectionModel
()

Returns the currently installed selection model.

public final boolean
public final boolean
public final boolean
public final LongProperty

Returns:

the delay before data will actually be loaded
loadDelayInMillisProperty
()

The delay in milliseconds before the loading service will actually try to retrieve the data from (for example) a backend.

public final ObjectProperty<Callback<PagingLoadRequest, PagingLoadResponse<T>>>

Returns:

the loader property
loaderProperty
()

Provides access to the loader property, which is a callback used to handle loading of paginated data.

public final ObjectProperty<LoadingService<T>>

Returns:

the loading service
loadingServiceProperty
()

Returns the service responsible for executing the actual loading of the data on a background thread.

public final ObjectProperty<LoadingPane.Status>

Returns:

the loading status
loadingStatusProperty
()

The loading status used for the wrapped LoadingPane.

public final ObjectProperty<Consumer<T>>

Returns:

a callback for opening table items
onOpenItemProperty
()

A callback for opening an item represented by a row in the table view.

public final ObjectProperty<Side>

Returns:

the location where the paging controls will be shown
pagingControlsLocationProperty
()

Controls on which side the paging controls should be located.

public final ObjectProperty<Node>
placeholderProperty()

The Node to show to the user when the PagingListView has no content to show.

private void
public abstract void
refresh()

Triggers an explicit refresh of the control.

public final void
reload()

Triggers an explicit reload of the list view.

public final ObjectProperty<MultipleSelectionModel<T>>

Returns:

the selectionModel property
selectionModelProperty
()

The SelectionModel provides the API through which it is possible to select single or multiple items within a ListView, as well as inspect which items have been selected by the user.

public final void
setCommitLoadStatusDelay(long commitLoadStatusDelay)

public final void
setFillLastPage(boolean fillLastPage)

public final void
setLoadDelayInMillis(long loadDelayInMillis)

public final void
public final void
setLoadingService(LoadingService<T> loadingService)

public final void
public final void
setOnOpenItem(Consumer<T> onOpenItem)

public final void
setPagingControlsLocation(Side pagingControlsLocation)

public final void
public final void
setSelectionModel(MultipleSelectionModel<T>
the MultipleSelectionModel to be used in this ListView
value
)

Sets the MultipleSelectionModel to be used in the ListView.

public final void
setShowPagingControls(boolean showPagingControls)

public final void
setUsingScrollPane(boolean usingScrollPane)

public final BooleanProperty

Returns:

a property that is true if the paging controls should be visible
showPagingControlsProperty
()

A flag used to control the visibility of the paging controls (page buttons, previous, next, etc...).

public final BooleanProperty
Inherited from com.dlsc.gemsfx.paging.PagingControlBase:
alignmentPropertyavailablePageSizesPropertyfirstLastPageDisplayModePropertyfirstPagefirstPageDividerPropertyfirstPageTextPropertygetAlignmentgetAvailablePageSizesgetFirstLastPageDisplayModegetFirstPageDividergetFirstPageTextgetLastPageDividergetLastPageTextgetMaxPageIndicatorsCountgetMessageLabelProvidergetMessageLabelStrategygetNextPageTextgetPagegetPageCountgetPageSizegetPageSizeSelectorLabelgetPreviousPageTextgetTotalItemCountisSameWidthPageButtonsisShowPageSizeSelectorisShowPreviousNextPageButtonlastPagelastPageDividerPropertylastPageTextPropertymaxPageIndicatorsCountPropertymessageLabelProviderPropertymessageLabelStrategyPropertynextPagenextPageTextPropertypageCountPropertypagePropertypageSizePropertypageSizeSelectorLabelPropertypreviousPagepreviousPageTextPropertysameWidthPageButtonsPropertysetAlignmentsetAvailablePageSizessetFirstLastPageDisplayModesetFirstPageDividersetFirstPageTextsetLastPageDividersetLastPageTextsetMaxPageIndicatorsCountsetMessageLabelProvidersetMessageLabelStrategysetNextPageTextsetPagesetPageSizesetPageSizeSelectorLabelsetPreviousPageTextsetSameWidthPageButtonssetShowPageSizeSelectorsetShowPreviousNextPageButtonsetTotalItemCountshowPageSizeSelectorPropertyshowPreviousNextPageButtonPropertytotalItemCountProperty

Field Detail

commitLoadStatusDelayback to summary
private final LongProperty commitLoadStatusDelay
fillLastPageback to summary
private final BooleanProperty fillLastPage
itemsOnCurrentPageback to summary
private final ObservableList<T> itemsOnCurrentPage
loadDelayInMillisback to summary
private final LongProperty loadDelayInMillis
loaderback to summary
private final ObjectProperty<Callback<PagingLoadRequest, PagingLoadResponse<T>>> loader
loadingServiceback to summary
private final ObjectProperty<LoadingService<T>> loadingService
loadingStatusback to summary
private final ObjectProperty<LoadingPane.Status> loadingStatus
onOpenItemback to summary
private final ObjectProperty<Consumer<T>> onOpenItem
pagingControlsLocationback to summary
private final ObjectProperty<Side> pagingControlsLocation
placeholderback to summary
private ObjectProperty<Node> placeholder
processingServiceback to summary
private boolean processingService
selectionModelback to summary
private final ObjectProperty<MultipleSelectionModel<T>> selectionModel
showPagingControlsback to summary
private final BooleanProperty showPagingControls
usingScrollPaneback to summary
private final BooleanProperty usingScrollPane

Constructor Detail

ItemPagingControlBaseback to summary
protected ItemPagingControlBase()

Constructs an instance of ItemPagingControlBase and initializes the paging and loading service behavior. This constructor sets up listeners and bindings for various properties to control the behavior of the pagination mechanism and the underlying loading service. Specifically:

  • Automatically unbinds and resets the state of the previous loading service when a new one is set.
  • Binds the new loading service's properties such as page, page size, load delay, and loader to their corresponding properties in this control.
  • Updates the loading status based on the state of the new loading service.
  • Sets up listeners for reloading or refreshing the data whenever relevant properties, such as page or page size, are changed.
  • Adds validation for certain operations, ensuring that invalid configurations such as negative load delays or unsupported paging control locations throw exceptions with descriptive error messages.
Additionally, the constructor initializes the loading service with a default LoadingService, applies delay validation, and specifies constraints for the paging controls' location.

Method Detail

commitLoadStatusDelayPropertyback to summary
public final LongProperty commitLoadStatusDelayProperty()

The delay in milliseconds before the list view will display the progress indicator for long-running load operations.

Returns:LongProperty

the commit delay for the nested loading pane

See Also
LoadingPane#commitDelayProperty()
fillLastPagePropertyback to summary
public final BooleanProperty fillLastPageProperty()

The control might not have enough data to fill its last page with items / cells. This flag can be used to control whether we want the control to become smaller because of missing items or if we want the view to fill the page with empty cells.

Returns:BooleanProperty

a flag used to control whether the last page will be filled with empty cells if needed

getCommitLoadStatusDelayback to summary
public final long getCommitLoadStatusDelay()
getItemsOnCurrentPageback to summary
public final ObservableList<T> getItemsOnCurrentPage()

Returns an observable list with the items shown by the current page.

Returns:ObservableList<T>

the currently shown items

getLoadDelayInMillisback to summary
public final long getLoadDelayInMillis()
getLoaderback to summary
public final Callback<PagingLoadRequest, PagingLoadResponse<T>> getLoader()
getLoadingServiceback to summary
public final LoadingService<T> getLoadingService()
getLoadingStatusback to summary
public final LoadingPane.Status getLoadingStatus()
getOnOpenItemback to summary
public final Consumer<T> getOnOpenItem()
getPagingControlsLocationback to summary
public final Side getPagingControlsLocation()
getPlaceholderback to summary
public final Node getPlaceholder()
getSelectionModelback to summary
public final MultipleSelectionModel<T> getSelectionModel()

Returns the currently installed selection model.

Returns:MultipleSelectionModel<T>

the currently installed selection model

isFillLastPageback to summary
public final boolean isFillLastPage()
isShowPagingControlsback to summary
public final boolean isShowPagingControls()
isUsingScrollPaneback to summary
public final boolean isUsingScrollPane()
loadDelayInMillisPropertyback to summary
public final LongProperty loadDelayInMillisProperty()

The delay in milliseconds before the loading service will actually try to retrieve the data from (for example) a backend. This delay is around a few hundred milliseconds by default. Delaying the loading has the advantage that sudden property changes will not trigger multiple backend queries but will get batched together in a single reload operation.

Returns:LongProperty

the delay before data will actually be loaded

loaderPropertyback to summary
public final ObjectProperty<Callback<PagingLoadRequest, PagingLoadResponse<T>>> loaderProperty()

Provides access to the loader property, which is a callback used to handle loading of paginated data. The callback is responsible for processing PagingLoadRequest and returning the corresponding PagingLoadResponse.

Returns:ObjectProperty<Callback<PagingLoadRequest, PagingLoadResponse<T>>>

the loader property

loadingServicePropertyback to summary
public final ObjectProperty<LoadingService<T>> loadingServiceProperty()

Returns the service responsible for executing the actual loading of the data on a background thread.

Returns:ObjectProperty<LoadingService<T>>

the loading service

loadingStatusPropertyback to summary
public final ObjectProperty<LoadingPane.Status> loadingStatusProperty()

The loading status used for the wrapped LoadingPane. The loading pane will appear if the loader takes a long time to return the new page items.

Returns:ObjectProperty<LoadingPane.Status>

the loading status

onOpenItemPropertyback to summary
public final ObjectProperty<Consumer<T>> onOpenItemProperty()

A callback for opening an item represented by a row in the table view.

Returns:ObjectProperty<Consumer<T>>

a callback for opening table items

pagingControlsLocationPropertyback to summary
public final ObjectProperty<Side> pagingControlsLocationProperty()

Controls on which side the paging controls should be located. Currently only Side#TOP and Side#BOTTOM are supported.

Returns:ObjectProperty<Side>

the location where the paging controls will be shown

placeholderPropertyback to summary
public final ObjectProperty<Node> placeholderProperty()

The Node to show to the user when the PagingListView has no content to show. This happens when the list model has no data or when a filter has been applied to the list model, resulting in there being nothing to show the user.

processServiceback to summary
private void processService(LoadingService<T> service)
refreshback to summary
public abstract void refresh()

Triggers an explicit refresh of the control. Refreshing the view does not trigger data loading.

reloadback to summary
public final void reload()

Triggers an explicit reload of the list view.

selectionModelPropertyback to summary
public final ObjectProperty<MultipleSelectionModel<T>> selectionModelProperty()

The SelectionModel provides the API through which it is possible to select single or multiple items within a ListView, as well as inspect which items have been selected by the user. Note that it has a generic type that must match the type of the ListView itself.

Returns:ObjectProperty<MultipleSelectionModel<T>>

the selectionModel property

setCommitLoadStatusDelayback to summary
public final void setCommitLoadStatusDelay(long commitLoadStatusDelay)
setFillLastPageback to summary
public final void setFillLastPage(boolean fillLastPage)
setLoadDelayInMillisback to summary
public final void setLoadDelayInMillis(long loadDelayInMillis)
setLoaderback to summary
public final void setLoader(Callback<PagingLoadRequest, PagingLoadResponse<T>> loader)
setLoadingServiceback to summary
public final void setLoadingService(LoadingService<T> loadingService)
setLoadingStatusback to summary
public final void setLoadingStatus(LoadingPane.Status loadingStatus)
setOnOpenItemback to summary
public final void setOnOpenItem(Consumer<T> onOpenItem)
setPagingControlsLocationback to summary
public final void setPagingControlsLocation(Side pagingControlsLocation)
setPlaceholderback to summary
public final void setPlaceholder(Node value)
setSelectionModelback to summary
public final void setSelectionModel(MultipleSelectionModel<T> value)

Sets the MultipleSelectionModel to be used in the ListView. Despite a ListView requiring a MultipleSelectionModel, it is possible to configure it to only allow single selection (see MultipleSelectionModel#setSelectionMode(javafx.scene.control.SelectionMode) for more information).

Parameters
value:MultipleSelectionModel<T>

the MultipleSelectionModel to be used in this ListView

setShowPagingControlsback to summary
public final void setShowPagingControls(boolean showPagingControls)
setUsingScrollPaneback to summary
public final void setUsingScrollPane(boolean usingScrollPane)
showPagingControlsPropertyback to summary
public final BooleanProperty showPagingControlsProperty()

A flag used to control the visibility of the paging controls (page buttons, previous, next, etc...).

Returns:BooleanProperty

a property that is true if the paging controls should be visible

usingScrollPanePropertyback to summary
public final BooleanProperty usingScrollPaneProperty()