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
underlyingLayerFields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainterFields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionGlazedListsEventLayer(IUniqueIndexLayer underlyingLayer, ca.odell.glazedlists.EventList<T> eventList) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activates the handling of GlazedLists events.voidDeactivates the handling of GlazedLists events.voidThis method can be used to discard event processing.booleandoCommand(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.protected voidintgetColumnPositionByIndex(int columnIndex) protected RunnableintgetRowPositionByIndex(int rowIndex) booleanisActive()booleanvoidlistChanged(ca.odell.glazedlists.event.ListEvent<T> event) voidvoidsetEventList(ca.odell.glazedlists.EventList<T> newEventList) voidsetTestMode(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, underlyingToLocalRowPositionsMethods 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, unregisterPersistableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, unregisterPersistableMethods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayerListener
handleLayerEventMethods 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
Runnablethat is triggered all 100ms to fire a NatTable refresh event.
-
listChanged
- Specified by:
listChangedin interfaceca.odell.glazedlists.event.ListEventListener<T>
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
fireEventFromSWTDisplayThread
Fires the givenILayerEventon the SWT Display thread in casetestModeisfalse. 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:ILayerOpportunity 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:
doCommandin interfaceILayer- Overrides:
doCommandin classAbstractLayerTransform- Parameters:
command- The command to execute.- Returns:
trueif the command has been handled and was therefore consumed,falseotherwise.
-
isDisposed
public boolean isDisposed()- Returns:
trueif this layer was terminated,falseif it is still active.
-
setEventList
- Parameters:
newEventList- theEventListto 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-trueto enable the test mode,falsefor 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
GlazedListsEventLayeris 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
GlazedListsEventLayeris 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
GlazedListsEventLayerwill propagateListEvents 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:
getColumnPositionByIndexin interfaceIUniqueIndexLayer
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex) - Specified by:
getRowPositionByIndexin interfaceIUniqueIndexLayer
-