Interface ILspPaintGroupsChangeListener

All Known Subinterfaces:
ILspEditableStyledPainter, ILspLabelPainter, ILspPainter, ILspPathLocationLabelPainter, ILspStampLocationLabelPainter
All Known Implementing Classes:
TLsp3DMeshPainter, TLspDensityPainter, TLspLabelPainter, TLspLOSCoveragePainter, TLspOpenFlightPainter, TLspShapePainter, TLspTiledWMSProxyPainter

public interface ILspPaintGroupsChangeListener
Listener to receive notifications of changes in the paint groups.

It can for example be used to listen to changes of a layer's working set.

The listener can support a synchronizing its state with other listeners. This mechanism works as follows:

  1. The prepareChanges(java.util.List<com.luciad.view.lightspeed.layer.paintgroup.TLspPaintGroupsChangedEvent>, java.lang.Object, com.luciad.view.lightspeed.layer.paintgroup.ILspPaintGroupsChangeListener.Callback) method is called: the listener performs the necessary preparation for the events and calls ILspPaintGroupsChangeListener.Callback.changesReady(java.lang.Object) when it is ready. Note that the listener should not update its internal state yet.
  2. The commitChanges(java.lang.Object) method is called: the listener updates its internal state, using the data prepared earlier, to reflect the changes. Note that his commit should be as lightweight as possible as it might block the paint thread.
Alternatively a listener can choose to not synchronize its state with other listeners by immediately calling the ILspPaintGroupsChangeListener.Callback.changesReady(Object) method and ignoring the commitChanges(Object) method.

Note that the methods of this listener are not necessarily invoked on the paint thread. As a result it is for example not safe to access layers and views. Also one should be very careful when using blocking calls or synchronization in general. Some noteworthy things that are not allowed:

A typical implementation would do one of the following:
  • schedule a task that can be executed asynchronously by using the view's task executor
  • schedule a task for the next repaint by using a view listener
Since:
2012.0
  • Method Details

    • prepareChanges

      void prepareChanges(List<TLspPaintGroupsChangedEvent> aEvents, Object aEventId, ILspPaintGroupsChangeListener.Callback aCallback)
      Called when the paint groups will change.

      The listener should prepare the necessary changes for the events but not commit them yet. The ILspPaintGroupsChangeListener.Callback.changesReady(java.lang.Object) method must be invoked when the listener is ready to commit the changes.

      If aEventId is null then the changes may be committed immediately. In this case there will be no call to commitChanges(Object).

      Note that it is not mandatory to do this two-phased commit cycle. You may commit or apply the changes immediately, but you still must invoke the callback.

      Parameters:
      aEvents - the changes
      aEventId - the event id or null
      aCallback - the callback or null
    • commitChanges

      void commitChanges(Object aEventId)
      Called when the changes for a specified event should be committed.
      Parameters:
      aEventId - the event id