com.vaadin.data.provider.
Class AbstractDataProvider<T,F>
- java.lang.Object
-
- com.vaadin.data.provider.AbstractDataProvider<T,F>
-
Type Parameters:
T
- data typeF
- filter typeAll 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:
-
-
Constructor Summary
Constructors Constructor Description AbstractDataProvider()
-
Method Summary
All Methods Modifier and Type Method Description Registration
addDataProviderListener(DataProviderListener<T> listener)
Adds a data provider listener.
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.
protected void
fireEvent(EventObject event)
Sends the event to all listeners.
void
refreshAll()
Refreshes all data based on currently available data in the underlying provider.
void
refreshItem(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:
DataProvider
Adds a data provider listener. The listener is called when some piece of data is updated.
The
DataProvider.refreshAll()
method firesDataChangeEvent
each time when it's called. It allows to update UI components when user changes something in the underlying data.Specified by:
addDataProviderListener
in interfaceDataProvider<T,F>
Parameters:
listener
- the data change listener, not nullReturns:
a registration for the listener
See Also:
-
refreshAll
public void refreshAll()
Description copied from interface:
DataProvider
Refreshes all data based on currently available data in the underlying provider.
Specified by:
refreshAll
in interfaceDataProvider<T,F>
-
refreshItem
public void refreshItem(T item)
Description copied from interface:
DataProvider
Refreshes the given item. This method should be used to inform all
DataProviderListeners
that 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:
refreshItem
in interfaceDataProvider<T,F>
Parameters:
item
- the item to refreshSee Also:
-
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.
-
-