Class AbstractDataFetchEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DataFetchEndedEvent,DataFetchFailedEvent,DataFetchStartedEvent
getOffset() and getLimit() say what was asked for;
DataFetchEndedEvent.getRowsReturned() says what came back. A
component that repeatedly asks for far more than it renders, or a data
provider that returns short pages, both show up as a gap between the two.
The events carry only plain values and the resolved Component, never
the query or the data provider, so that observers cannot retain or mutate
loading state.
This type cannot be listened for. The
service event bus dispatches by exact
runtime type, so a listener registered for this class is never notified;
register for DataFetchStartedEvent, DataFetchFailedEvent or
DataFetchEndedEvent instead.
- Since:
- 25.3
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDataFetchEvent(UI ui, Component component, int offset, int limit, boolean filtered) Creates a new fetch event. -
Method Summary
Modifier and TypeMethodDescriptionGets the component whose data is being fetched, so that an observer can attribute the query to aGrid,ComboBoxorTreeGridrather than only to the request.intgetLimit()Gets the number of items requested.intGets the index of the first item requested.Gets the UI from which this event originates.getUI()Gets the UI from which this event originates.booleanTells whether a filter was set on the query, which distinguishes a combo box loading matches for what the user typed from one loading the whole data set.Methods inherited from class java.util.EventObject
toString
-
Constructor Details
-
AbstractDataFetchEvent
protected AbstractDataFetchEvent(UI ui, Component component, int offset, int limit, boolean filtered) Creates a new fetch event.- Parameters:
ui- the UI the fetching component belongs to, notnullcomponent- the component whose data is being fetched, ornullif it could not be resolvedoffset- the index of the first item requestedlimit- the number of items requestedfiltered- whether a filter was set on the query
-
-
Method Details
-
getSource
Gets the UI from which this event originates.- Overrides:
getSourcein classEventObject- Returns:
- the UI, never
null
-
getUI
Gets the UI from which this event originates.- Returns:
- the UI, never
null
-
getComponent
Gets the component whose data is being fetched, so that an observer can attribute the query to aGrid,ComboBoxorTreeGridrather than only to the request.Empty when the component could not be resolved from the state node, for example when the data communicator is driven by a bare element.
- Returns:
- the component, or an empty optional
-
getOffset
public int getOffset()Gets the index of the first item requested.- Returns:
- the offset, never negative
-
getLimit
public int getLimit()Gets the number of items requested. The data provider may return fewer; compare againstDataFetchEndedEvent.getRowsReturned().- Returns:
- the limit, never negative
-
isFiltered
public boolean isFiltered()Tells whether a filter was set on the query, which distinguishes a combo box loading matches for what the user typed from one loading the whole data set.- Returns:
trueif the query carried a filter
-