Class DetailGlazedListsEventLayer<T>

java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
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.
  • Constructor Details

    • 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 Details

    • 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)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • 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 DetailGlazedListsEventLayer is activated. You can deactivate it prior performing bulk updates and activate it again after the update is finished for a better event handling.

      Note: When activating the list change handling again, there will be no event fired in NatTable automatically. For bulk updates with deactivated internal handling it is therefore necessary to fire a custom event to trigger the NatTable refresh operation.

      Since:
      1.6
    • 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 DetailGlazedListsEventLayer is activated. You can deactivate it prior performing bulk updates and activate it again after the update is finished for a better event handling.

      Note: When activating the list change handling again, there will be no event fired in NatTable automatically. For bulk updates with deactivated internal handling it is therefore necessary to fire a custom event to trigger the NatTable refresh operation.

      Since:
      1.6
    • isActive

      public boolean isActive()
      Returns:
      Whether this DetailGlazedListsEventLayer will propagate ListEvents into NatTable or not.
      Since:
      1.6
    • 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