Class GlazedListsEventLayer<T>
- Type Parameters:
T
- Type of the bean in the backing list.
- All Implemented Interfaces:
ca.odell.glazedlists.event.ListEventListener<T>
,PropertyChangeListener
,EventListener
,ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
- GlazedLists events -
ListEvent
- Bean updates - PropertyChangeEvent(s)
RowStructuralRefreshEvent
is fired for any number of GlazedLists
events received during that interval.
PropertyChangeEvent(s) are propagated immediately as a
PropertyUpdateEvent
.
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
underlyingLayer
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainter
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
Constructor Summary
ConstructorDescriptionGlazedListsEventLayer
(IUniqueIndexLayer underlyingLayer, ca.odell.glazedlists.EventList<T> eventList) -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Activates the handling of GlazedLists events.void
Deactivates the handling of GlazedLists events.void
This method can be used to discard event processing.boolean
doCommand
(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.protected void
int
getColumnPositionByIndex
(int columnIndex) protected Runnable
int
getRowPositionByIndex
(int rowIndex) boolean
isActive()
boolean
void
listChanged
(ca.odell.glazedlists.event.ListEvent<T> event) void
void
setEventList
(ca.odell.glazedlists.EventList<T> newEventList) void
setTestMode
(boolean testMode) Activate the test mode, which is needed for unit testing.Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, getCellByPosition, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getProvidedLabels, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerCommandHandlers, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
addLayerListener, configure, dispose, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getProvidedLabels, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayerListener
handleLayerEvent
Methods inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
loadState, saveState
-
Constructor Details
-
GlazedListsEventLayer
public GlazedListsEventLayer(IUniqueIndexLayer underlyingLayer, ca.odell.glazedlists.EventList<T> eventList)
-
-
Method Details
-
getEventNotifier
- Returns:
- The
Runnable
that is triggered all 100ms to fire a NatTable refresh event.
-
listChanged
- Specified by:
listChanged
in interfaceca.odell.glazedlists.event.ListEventListener<T>
-
propertyChange
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
fireEventFromSWTDisplayThread
Fires the givenILayerEvent
on the SWT Display thread in casetestMode
isfalse
. Needed because the GlazedLists list change handling is done in a background thread, but NatTable event handling needs to be triggered in the UI thread to be able to trigger repainting.- Parameters:
event
- The event to fire
-
doCommand
Description copied from interface:ILayer
Opportunity to respond to a command as it flows down the stack. If the layer is not interested in the command it should allow the command to keep traveling down the stack.Note: Before the layer can process a command it must convert the command to its local coordinates using
ILayerCommand.convertToTargetLayer(ILayer)
- Specified by:
doCommand
in interfaceILayer
- Overrides:
doCommand
in classAbstractLayerTransform
- Parameters:
command
- The command to execute.- Returns:
true
if the command has been handled and was therefore consumed,false
otherwise.
-
isDisposed
public boolean isDisposed()- Returns:
true
if this layer was terminated,false
if it is still active.
-
setEventList
- Parameters:
newEventList
- theEventList
to listen on.
-
setTestMode
public void setTestMode(boolean testMode) Activate the test mode, which is needed for unit testing. When enabling the test mode, the events are not fired in the UI thread.- Parameters:
testMode
-true
to enable the test mode,false
for real mode.
-
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
GlazedListsEventLayer
is activated. You can deactivate it prior performing bulk updates and activate it again after the update is finished for a better event handling. -
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
GlazedListsEventLayer
is activated. You can deactivate it prior performing bulk updates and activate it again after the update is finished for a better event handling. -
isActive
public boolean isActive()- Returns:
- Whether this
GlazedListsEventLayer
will propagateListEvent
s into NatTable or not.
-
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:
- 1.6
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex) - Specified by:
getColumnPositionByIndex
in interfaceIUniqueIndexLayer
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex) - Specified by:
getRowPositionByIndex
in interfaceIUniqueIndexLayer
-