Class ListChangedEvent<T>

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

    public final class ListChangedEvent<T>
    extends 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
    • Constructor Detail

      • ListChangedEvent

        public ListChangedEvent​(ListenableList<T> source,
                                int index,
                                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

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