T
- data typeF
- filter typepublic abstract class AbstractDataProvider<T,F> extends Object implements DataProvider<T,F>
Constructor and Description |
---|
AbstractDataProvider() |
Modifier and Type | Method and 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fetch, fromCallbacks, fromFilteringCallbacks, fromStream, getId, isInMemory, ofCollection, ofItems, size, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
public Registration addDataProviderListener(DataProviderListener<T> listener)
DataProvider
The DataProvider.refreshAll()
method fires DataChangeEvent
each time
when it's called. It allows to update UI components when user changes
something in the underlying data.
addDataProviderListener
in interface DataProvider<T,F>
listener
- the data change listener, not nullDataProvider.refreshAll()
public void refreshAll()
DataProvider
refreshAll
in interface DataProvider<T,F>
public void refreshItem(T item)
DataProvider
DataProviderListeners
that an item has been
updated or replaced with a new instance.
For this to work properly, the item must either implement
#equals(Object)
and #hashCode()
to consider both the old
and the new item instances to be equal, or alternatively
DataProvider.getId(Object)
should be implemented to return an appropriate
identifier.
refreshItem
in interface DataProvider<T,F>
item
- the item to refreshDataProvider.getId(Object)
protected Registration addListener(Class<?> eventType, DataProviderListener<T> listener, Method method)
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.protected void fireEvent(EventObject event)
event
- the Event to be sent to all listeners.Copyright © 2017 Vaadin Ltd. All rights reserved.