Package com.vaadin.data.provider
Class AbstractDataProvider<T,F>
- java.lang.Object
-
- com.vaadin.data.provider.AbstractDataProvider<T,F>
-
- Type Parameters:
T- data typeF- filter type
- All Implemented Interfaces:
DataProvider<T,F>,Serializable
- Direct Known Subclasses:
AbstractBackEndDataProvider,AbstractHierarchicalDataProvider,ListDataProvider
public abstract class AbstractDataProvider<T,F> extends Object implements DataProvider<T,F>
Abstract data provider implementation which takes care of refreshing data from the underlying data provider.- Since:
- 8.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractDataProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegistrationaddDataProviderListener(DataProviderListener<T> listener)Adds a data provider listener.protected RegistrationaddListener(Class<?> eventType, DataProviderListener<T> listener, Method method)Registers a new listener with the specified activation method to listen events generated by this component.protected voidfireEvent(EventObject event)Sends the event to all listeners.voidrefreshAll()Refreshes all data based on currently available data in the underlying provider.voidrefreshItem(T item)Refreshes the given item.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.data.provider.DataProvider
fetch, getId, isInMemory, size, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
-
-
-
-
Method Detail
-
addDataProviderListener
public Registration addDataProviderListener(DataProviderListener<T> listener)
Description copied from interface:DataProviderAdds a data provider listener. The listener is called when some piece of data is updated.The
DataProvider.refreshAll()method firesDataChangeEventeach time when it's called. It allows to update UI components when user changes something in the underlying data.- Specified by:
addDataProviderListenerin interfaceDataProvider<T,F>- Parameters:
listener- the data change listener, not null- Returns:
- a registration for the listener
- See Also:
DataProvider.refreshAll()
-
refreshAll
public void refreshAll()
Description copied from interface:DataProviderRefreshes all data based on currently available data in the underlying provider.- Specified by:
refreshAllin interfaceDataProvider<T,F>
-
refreshItem
public void refreshItem(T item)
Description copied from interface:DataProviderRefreshes the given item. This method should be used to inform allDataProviderListenersthat an item has been updated or replaced with a new instance.For this to work properly, the item must either implement
Object.equals(Object)andObject.hashCode()to consider both the old and the new item instances to be equal, or alternativelyDataProvider.getId(Object)should be implemented to return an appropriate identifier.- Specified by:
refreshItemin interfaceDataProvider<T,F>- Parameters:
item- the item to refresh- See Also:
DataProvider.getId(Object)
-
addListener
protected Registration addListener(Class<?> eventType, DataProviderListener<T> listener, Method method)
Registers a new listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called.- Parameters:
eventType- the type of the listened event. Events of this type or its subclasses activate the listener.listener- the object instance who owns the activation method.method- the activation method.- Returns:
- a registration for the listener
-
fireEvent
protected void fireEvent(EventObject event)
Sends the event to all listeners.- Parameters:
event- the Event to be sent to all listeners.
-
-