Class ListChangedEvent<T>

  • Type Parameters:
    T - type of items in the list that changed
    All Implemented Interfaces:
    java.io.Serializable

    public final class ListChangedEvent<T>
    extends java.util.EventObject
    Event indicating that an item has been added to or removed from a list that implements ListenableList.

    In addition to the the list that fired the event, this instance will give you the items added or removed, the index they were added to/removed from and an enum that indicates whether this was an add or a remove.

    Since:
    100.0.0
    See Also:
    ListenableList, Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ListChangedEvent.Action
      Indicates the type of change that occurred on the list.
    • Field Summary

      • Fields inherited from class java.util.EventObject

        source
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ListChangedEvent.Action getAction()
      Indicates whether the items were added (ADDED) or removed (REMOVED).
      int getIndex()
      Gets the index the items were added to or removed from.
      java.util.List<T> getItems()
      Gets the items added to or removed from the list.
      ListenableList<T> getSource()  
      • Methods inherited from class java.util.EventObject

        toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ListChangedEvent

        public ListChangedEvent​(ListenableList<T> source,
                                int index,
                                java.util.List<T> items,
                                ListChangedEvent.Action action)
        Creates a new ListChangedEvent instance.
        Parameters:
        source - the list that changed
        index - the index at which items were added or removed
        items - items affected by change
        action - type of change
        Since:
        100.0.0
    • Method Detail

      • getSource

        public ListenableList<T> getSource()
        Overrides:
        getSource in class java.util.EventObject
      • getIndex

        public int getIndex()
        Gets the index the items were added to or removed from.
        Returns:
        index the items were added to or removed from
        Since:
        100.0.0
      • getItems

        public java.util.List<T> getItems()
        Gets the items added to or removed from the list.
        Returns:
        an unmodifiable list of the items added to or removed from the list. This will throw an UnsupportedOperationException if an attempt is made to modify it.
        Since:
        100.0.0
      • getAction

        public ListChangedEvent.Action getAction()
        Indicates whether the items were added (ADDED) or removed (REMOVED).
        Returns:
        whether the item was added or removed
        Since:
        100.0.0