Class TLcdLayeredEvent

All Implemented Interfaces:
ILcdDispatchableEvent, Serializable

public class TLcdLayeredEvent extends ALcdDispatchableEvent
TLcdLayeredEvent implements dispatchable events for an ILcdLayered.
See Also:
  • Field Details

    • STATE_CHANGED

      public static final int STATE_CHANGED
      Event ID to indicate that something has changed. This ID is bit-wise part of the other event modes.
      See Also:
    • LAYER_ADDED

      public static final int LAYER_ADDED
      Event ID to indicate that a ILcdLayer has been added to an ILcdLayered. This ID contains the STATE_CHANGED ID.
      See Also:
    • LAYER_REMOVED

      public static final int LAYER_REMOVED
      Event ID to indicate that a ILcdLayer has been removed from an ILcdLayered. This ID contains the STATE_CHANGED ID.
      See Also:
    • LAYER_MOVED

      public static final int LAYER_MOVED
      Event ID to indicate that the position of a ILcdLayer in a ILcdLayered has changed. This ID contains the STATE_CHANGED ID.
      See Also:
    • ALL_REMOVED

      @Deprecated public static final int ALL_REMOVED
      Deprecated.
      Use multiple LAYER_REMOVED events instead, so that the listener knows what layers were removed.
      Event ID to indicate that all ILcdLayer have been removed from an ILcdLayered. This ID contains the STATE_CHANGED ID.
      See Also:
  • Constructor Details

    • TLcdLayeredEvent

      public TLcdLayeredEvent()
    • TLcdLayeredEvent

      public TLcdLayeredEvent(ILcdLayered source, int id)
      Creates an event with given source and change type.
      Parameters:
      source - the originating ILcdLayered of this event.
      id - the type of change of this event. Can be one of STATE_CHANGED, LAYER_ADDED, LAYER_MOVED, LAYER_REMOVED, ALL_REMOVED.
    • TLcdLayeredEvent

      public TLcdLayeredEvent(ILcdLayered source, int id, ILcdLayer aLayer)
      Creates an event with given source, change type and layer for which the change occurred.
      Parameters:
      source - the originating ILcdLayered of this event.
      id - the type of change of this event. Can be one of STATE_CHANGED, LAYER_ADDED, LAYER_MOVED, LAYER_REMOVED, ALL_REMOVED.
      aLayer - the ILcdLayer for which a change occurred.
    • TLcdLayeredEvent

      public TLcdLayeredEvent(ILcdLayered source, int id, ILcdLayer aLayer, int aOriginalIndex, int aNewIndex)
      Creates an event with given source, change type, layer and index for which the change occurred.
      Parameters:
      source - the originating ILcdLayered of this event
      id - the type of change of this event. Can be one of STATE_CHANGED, LAYER_ADDED, LAYER_MOVED, LAYER_REMOVED, ALL_REMOVED.
      aLayer - the ILcdLayer for which a change occurred
      aOriginalIndex - the index of the layer in the ILcdLayeredbefore the change, or -1 when the id is ALL_REMOVED or when the layer was added to the ILcdLayered
      aNewIndex - the index of the layer in the ILcdLayered after the change, or -1 when the id is ALL_REMOVED or when the layer is removed from the ILcdLayered
      See Also:
  • Method Details

    • dispatch

      public void dispatch(EventListener listener)
      Description copied from interface: ILcdDispatchableEvent
      Sends this ILcdDispatchableEvent to the given listener.
      Specified by:
      dispatch in interface ILcdDispatchableEvent
      Specified by:
      dispatch in class ALcdDispatchableEvent
      Parameters:
      listener - the listener that will receive this ILcdDispatchableEvent.
    • getID

      public int getID()
      Returns an ID indicating the type of event.
      Returns:
      the ID of this event, which indicates the type of event. The ID can be one of STATE_CHANGED, LAYER_ADDED, LAYER_MOVED, LAYER_REMOVED, ALL_REMOVED.
    • getLayered

      public ILcdLayered getLayered()
      Returns the ILcdLayered the change causing this event has occurred on.
      Returns:
      the ILcdLayered the change causing this event has occurred on.
    • getLayer

      public ILcdLayer getLayer()
      Returns the ILcdLayer which caused a change on the ILcdLayered, or null when no layer was set during the construction of this event.
      Returns:
      the ILcdLayer which caused a change on the ILcdLayered, or null when no layer was set during the construction of this event.
    • toString

      public String toString()
      Returns the source and a string representation of the type of event.
      Overrides:
      toString in class ALcdDispatchableEvent
      Returns:
      the source and a string representation of the type of event.
    • getOriginalIndex

      public int getOriginalIndex()

      Returns the index of the layer in getLayered() before the event occurred. In case of:

      • LAYER_ADDED: the index will be -1, since the layer was not a part of the ILcdLayered before the event
      • LAYER_REMOVED: the index is the old index of the removed layer, before the remove operation took place
      • LAYER_MOVED: the index is the original index of the layer, before the move operation took place
      • ALL_REMOVED: the index is irrelevant, and -1 will be returned
      Returns:
      the index of the ILcdLayer in the ILcdLayered before the event occurred, or -1 if no index was set
    • getNewIndex

      public int getNewIndex()

      Returns the index of the layer in getLayered() after the event occured. In case of:

      • LAYER_ADDED: the index will be the index on which the layer was added.
      • LAYER_REMOVED: the index will be -1, since the layer is no longer part of the ILcdLayered
      • LAYER_MOVED: the index will be the new index of the layer, after the move operation took place
      • ALL_REMOVED: the index is irrelevant, and -1 will be returned
      Returns:
      the index of the ILcdLayer in the ILcdLayered after the event occured, or -1 if no index was set