Class GlazedListsFilterRowComboBoxDataProvider<T>
- All Implemented Interfaces:
ca.odell.glazedlists.event.ListEventListener<T>,EventListener,ILayerCommandHandler<UpdateDataCommand>,IComboBoxDataProvider,ILayerListener
This implementation is necessary for a special case. If a filter is applied and a new row is added to the data model, the FilterList won't show the new row because the current applied filter is not aware of the new values. This is because of the inverse filter logic in then Excel like filter row. As the FilterList doesn't show the new value, there is no ListEvent fired further, so the FilterRowComboBoxDataProvider is not informed about the structural change.
This implementation solves this issue by listening to the wrapped source EventList of the FilterList instead of the NatTable IStructuralChangeEvent.
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.nattable.filterrow.combobox.FilterRowComboBoxDataProvider
cachingEnabled, lazyLoading -
Constructor Summary
ConstructorsConstructorDescriptionGlazedListsFilterRowComboBoxDataProvider(ILayer bodyLayer, Collection<T> baseCollection, IColumnAccessor<T> columnAccessor) GlazedListsFilterRowComboBoxDataProvider(ILayer bodyLayer, Collection<T> baseCollection, IColumnAccessor<T> columnAccessor, boolean lazy) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the handling of GlazedLists events.protected List<?>collectValues(Collection<T> collection, int columnIndex) Iterates over all rows of the given collection and collects the distinct values for the given column index.voidDeactivates the handling of GlazedLists events.voidThis method can be used to discard event processing.voiddispose()Cleanup acquired resources.voidhandleLayerEvent(ILayerEvent event) Handle an event notification from anILayerbooleanisActive()booleanvoidlistChanged(ca.odell.glazedlists.event.ListEvent<T> listChanges) Methods inherited from class org.eclipse.nebula.widgets.nattable.filterrow.combobox.FilterRowComboBoxDataProvider
addCacheUpdateListener, buildUpdateEvent, buildUpdateEvent, buildValueCache, clearCache, clearCache, collectValues, collectValuesForColumn, configureComparator, disableUpdateEvents, doCommand, enableUpdateEvents, fireCacheUpdateEvent, getAllValues, getCachedColumnIndexes, getColumnComparator, getCommandClass, getFilterCollection, getValueCache, getValueCacheLock, getValues, getValues, isCachingEnabled, isDistinctNullAndEmpty, isEventFromBodyLayer, isFilterApplied, isFilterChanged, isUpdateEventsEnabled, removeCacheUpdateListener, setCachingEnabled, setContentFilter, setDistinctNullAndEmpty, setFilterCollection, setLastFilter, updateCache, updateCache
-
Constructor Details
-
GlazedListsFilterRowComboBoxDataProvider
public GlazedListsFilterRowComboBoxDataProvider(ILayer bodyLayer, Collection<T> baseCollection, IColumnAccessor<T> columnAccessor) - Parameters:
bodyLayer- A layer in the body region. Usually the DataLayer or a layer that is responsible for list event handling. Needed to register ourself as listener for data changes.baseCollection- The base collection used to collect the unique values from. This need to be a collection that is not filtered, otherwise after modifications the content of the filter row combo boxes will only contain the current visible (not filtered) elements.columnAccessor- The IColumnAccessor to be able to read the values out of the base collection objects.
-
GlazedListsFilterRowComboBoxDataProvider
public GlazedListsFilterRowComboBoxDataProvider(ILayer bodyLayer, Collection<T> baseCollection, IColumnAccessor<T> columnAccessor, boolean lazy) - Parameters:
bodyLayer- A layer in the body region. Usually the DataLayer or a layer that is responsible for list event handling. Needed to register ourself as listener for data changes.baseCollection- The base collection used to collect the unique values from. This need to be a collection that is not filtered, otherwise after modifications the content of the filter row combo boxes will only contain the current visible (not filtered) elements.columnAccessor- The IColumnAccessor to be able to read the values out of the base collection objects.lazy-trueto configure thisFilterRowComboBoxDataProvidershould load the combobox values lazily,falseto pre-build the value cache.- Since:
- 1.4
-
-
Method Details
-
listChanged
- Specified by:
listChangedin interfaceca.odell.glazedlists.event.ListEventListener<T>
-
handleLayerEvent
Description copied from interface:ILayerListenerHandle an event notification from anILayer- Specified by:
handleLayerEventin interfaceILayerListener- Overrides:
handleLayerEventin classFilterRowComboBoxDataProvider<T>- Parameters:
event- the event
-
dispose
public void dispose()Description copied from class:FilterRowComboBoxDataProviderCleanup acquired resources.- Overrides:
disposein classFilterRowComboBoxDataProvider<T>
-
isDisposed
public boolean isDisposed()- Returns:
trueif this layer was terminated,falseif it is still active.- Since:
- 2.1
-
activate
public void activate()Activates the handling of GlazedLists events. By activating on receiving GlazedLists change events, there will be NatTable events fired to indicate that re-rendering is necessary.This is usually necessary to perform huge updates of the data model to avoid concurrency issues. By default the
GlazedListsFilterRowComboBoxDataProvideris activated. You can deactivate it prior performing bulk updates and activate it again after the update is finished for a better event handling.- Since:
- 2.1
-
deactivate
public void deactivate()Deactivates the handling of GlazedLists events. By deactivating there will be no NatTable events fired on GlazedLists change events.This is usually necessary to perform huge updates of the data model to avoid concurrency issues. By default the
GlazedListsFilterRowComboBoxDataProvideris activated. You can deactivate it prior performing bulk updates and activate it again after the update is finished for a better event handling.- Since:
- 2.1
-
isActive
public boolean isActive()- Returns:
- Whether this
GlazedListsFilterRowComboBoxDataProviderwill propagateListEvents into NatTable or not. - Since:
- 2.1
-
discardEventsToProcess
public void discardEventsToProcess()This method can be used to discard event processing.It is useful in cases scenarios where list changes are tracked while the handling is deactivated. By default list changes are also tracked while the handling is deactivated, so automatically a refresh is triggered on activation. For cases where a custom event is fired for updates, it could make sense to discard the events to process to avoid that a full refresh event is triggered.
- Since:
- 2.1
-
collectValues
Description copied from class:FilterRowComboBoxDataProviderIterates over all rows of the given collection and collects the distinct values for the given column index.- Overrides:
collectValuesin classFilterRowComboBoxDataProvider<T>- Parameters:
collection- The collection out of which the distinct values should be collected.columnIndex- The column index for which the values should be collected- Returns:
- List of all distinct values that are contained in the given collection for the given column.
-