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 <E> Registration |
addListener(Class<E> eventType,
SerializableConsumer<E> 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.
|
void |
refreshItem(T item,
boolean refreshChildren)
Refreshes the given item and all of the children of the item as well.
|
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, boolean refreshChildren)
DataProvider
refreshItem
in interface DataProvider<T,F>
item
- the item to refreshrefreshChildren
- whether or not to refresh child itemsBy default it just does a standard refreshItem, in a hierarchical
DataProvider it is supposed to refresh all of the children as well
in case 'refreshChildren' is true.
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
Object.equals(Object)
and Object.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 <E> Registration addListener(Class<E> eventType, SerializableConsumer<E> method)
E
- the event typeeventType
- the type of the listened event. Events of this type or its
subclasses activate the listener.method
- the consumer to receive the event.protected void fireEvent(EventObject event)
event
- the Event to be sent to all listeners.Copyright © 2025. All rights reserved.