org.eclipse.nebula.widgets.nattable.extension.glazedlists
Class DetailGlazedListsEventLayer<T>

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
      extended by org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
          extended by org.eclipse.nebula.widgets.nattable.extension.glazedlists.DetailGlazedListsEventLayer<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

public class DetailGlazedListsEventLayer<T>
extends AbstractLayerTransform
implements IUniqueIndexLayer, ca.odell.glazedlists.event.ListEventListener<T>, PropertyChangeListener

This layer acts as the event listener for:

  1. Glazed list events - ListEvent
  2. Bean updates - PropertyChangeEvent(s)
Compared to the GlazedListsEventLayer, this layer does not conflate events and only fire a single RowStructuralRefreshEvent for all events within 100ms. Instead it will fire a corresponding NatTable event with the detail information for every ListEvent fired by the GlazedLists immediately.

Author:
Dirk Fauth

Field Summary
 
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, layerPainter
 
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
 
Constructor Summary
DetailGlazedListsEventLayer(IUniqueIndexLayer underlyingLayer, ca.odell.glazedlists.EventList<T> eventList)
          Create a new DetailGlazedListsEventLayer which is in fact a ListEventListener that listens to GlazedLists events and translate them into events that are understandable by the NatTable.
 
Method Summary
 int getColumnPositionByIndex(int columnIndex)
           
 int getRowPositionByIndex(int rowIndex)
           
 void listChanged(ca.odell.glazedlists.event.ListEvent<T> event)
          GlazedLists event handling.
 void propertyChange(PropertyChangeEvent event)
          Object property updated event
 void setEventList(ca.odell.glazedlists.EventList<T> newEventList)
          Change the underlying EventList this layer is listening to.
 
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, doCommand, 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, 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, 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, doCommand, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, 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 Detail

DetailGlazedListsEventLayer

public DetailGlazedListsEventLayer(IUniqueIndexLayer underlyingLayer,
                                   ca.odell.glazedlists.EventList<T> eventList)
Create a new DetailGlazedListsEventLayer which is in fact a ListEventListener that listens to GlazedLists events and translate them into events that are understandable by the NatTable.

Parameters:
underlyingLayer - The underlying layer of type IUniqueIndexLayer
eventList - The EventList this layer should be added as listener.
Method Detail

listChanged

public void listChanged(ca.odell.glazedlists.event.ListEvent<T> event)
GlazedLists event handling. Will transform received GlazedLists ListEvents into corresponding NatTable RowStructuralChangeEvents. Ensures that no other changes can be made to the GlazedLists instance until the events are processed in NatTable itself. This is necessary to avoid concurrent modifications which will lead to asynchronous states of NatTable and GlazedLists.

Specified by:
listChanged in interface ca.odell.glazedlists.event.ListEventListener<T>

propertyChange

public void propertyChange(PropertyChangeEvent event)
Object property updated event

Specified by:
propertyChange in interface PropertyChangeListener

setEventList

public void setEventList(ca.odell.glazedlists.EventList<T> newEventList)
Change the underlying EventList this layer is listening to.

Parameters:
newEventList - the EventList to listen on.

getColumnPositionByIndex

public int getColumnPositionByIndex(int columnIndex)
Specified by:
getColumnPositionByIndex in interface IUniqueIndexLayer

getRowPositionByIndex

public int getRowPositionByIndex(int rowIndex)
Specified by:
getRowPositionByIndex in interface IUniqueIndexLayer


Copyright © 2015. All rights reserved.