Class LayerListEvent

java.lang.Object
com.luciad.layers.LayerListEvent

public final class LayerListEvent extends Object
An event object, describing a change in a LayerList instance.
  • Method Details

    • added

      @NotNull public static LayerListEvent added(@NotNull Layer layer, long index) throws NullPointerException
      Returns a new event that indicates that a layer has been added to the LayerList.
      Parameters:
      layer - the layer that was added, must not be null
      index - the index if the layer in the LayerList
      Returns:
      a new event that indicates that a layer has been added to the LayerList
      Throws:
      NullPointerException - when the layer is null.
    • moved

      @NotNull public static LayerListEvent moved(@NotNull Layer layer, long oldIndex, long newIndex) throws NullPointerException
      Returns a new event that indicates that a layer has been moved in the LayerList.
      Parameters:
      layer - the layer that was moved, must not be null
      oldIndex - the previous index in the LayerList
      newIndex - the new index in the LayerList
      Returns:
      a new event that indicates that a layer has been moved in the LayerList
      Throws:
      NullPointerException - when the layer is null.
    • removed

      @NotNull public static LayerListEvent removed(@NotNull Layer layer, long oldIndex) throws NullPointerException
      Returns a new event that indicates that a layer has been removed from the LayerList.
      Parameters:
      layer - the layer that was removed, must not be null
      oldIndex - the index of the layer in the LayerList before it was removed
      Returns:
      a new event that indicates that a layer has been removed from the LayerList
      Throws:
      NullPointerException - when the layer is null.
    • getLayer

      @NotNull public Layer getLayer()
      Returns the layer for which a change was made.
      Returns:
      the layer for which a change was made.
    • getEventType

      @NotNull public LayerListEvent.Type getEventType()
      Returns the event type.

      Depending on this type, the LayerListEvent#getOldIndex and LayerListEvent#getNewIndex methods return different values:

      • Added: getOldIndex returns null, getNewIndex returns the index at which the layer was added
      • Moved: both getOldIndex and getNewIndex return a value
      • Removed: getNewIndex returns null, getOldIndex return the index from which the layer was removed
      Returns:
      the event type.
    • getOldIndex

      @Nullable public Long getOldIndex()
      Returns the old index of the layer, or nothing in case of an LayerListChangeType::Added event.
      Returns:
      the old index of the layer, or nothing in case of an LayerListChangeType::Added event.
    • getNewIndex

      @Nullable public Long getNewIndex()
      Returns the new index of the layer, or nothing in case of an LayerListChangeType::Removed event.
      Returns:
      the new index of the layer, or nothing in case of an LayerListChangeType::Removed event.