Package jmri

Class Manager.ManagerDataEvent<E extends NamedBean>

  • Type Parameters:
    E - the type to support in the event
    All Implemented Interfaces:
    java.io.Serializable
    Enclosing interface:
    Manager<E extends NamedBean>

    @Immutable
    public static final class Manager.ManagerDataEvent<E extends NamedBean>
    extends java.util.EventObject
    Define an event that encapsulates changes to a list.

    Intended to be equivalent to ListDataEvent without introducing a Swing dependency into core JMRI.

    Since:
    JMRI 4.11.4 - for use in DataModel code
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CONTENTS_CHANGED
      Equal to ListDataEvent.CONTENTS_CHANGED
      static int INTERVAL_ADDED
      Equal to ListDataEvent.INTERVAL_ADDED
      static int INTERVAL_REMOVED
      Equal to ListDataEvent.INTERVAL_REMOVED
      • Fields inherited from class java.util.EventObject

        source
    • Constructor Summary

      Constructors 
      Constructor Description
      ManagerDataEvent​(Manager<E> source, int type, int index0, int index1, E changedBean)
      Create a ListDataEvent object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      E getChangedBean()
      Get the changed bean or null.
      int getIndex0()
      Get the index of the first item in the range of modified list items.
      int getIndex1()
      Get the index of the last item in the range of modified list items.
      Manager<E> getSource()
      Get the source of the event in a type-safe manner.
      int getType()
      Get a code representing the type of this event, which is usually one of CONTENTS_CHANGED, INTERVAL_ADDED or INTERVAL_REMOVED.
      java.lang.String toString()
      Get a string representing the state of this event.
      • Methods inherited from class java.lang.Object

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

      • ManagerDataEvent

        public ManagerDataEvent​(@Nonnull
                                Manager<E> source,
                                int type,
                                int index0,
                                int index1,
                                E changedBean)
        Create a ListDataEvent object.
        Parameters:
        source - the source of the event (null not permitted).
        type - the type of the event (should be one of CONTENTS_CHANGED, INTERVAL_ADDED or INTERVAL_REMOVED, although this is not enforced).
        index0 - the index for one end of the modified range of list elements.
        index1 - the index for the other end of the modified range of list elements.
        changedBean - used when just one bean is added or removed, otherwise null
    • Method Detail

      • getSource

        public Manager<EgetSource()
        Get the source of the event in a type-safe manner.
        Overrides:
        getSource in class java.util.EventObject
        Returns:
        the event source
      • getIndex0

        public int getIndex0()
        Get the index of the first item in the range of modified list items.
        Returns:
        index of the first item in the range of modified list items
      • getIndex1

        public int getIndex1()
        Get the index of the last item in the range of modified list items.
        Returns:
        index of the last item in the range of modified list items
      • getChangedBean

        public E getChangedBean()
        Get the changed bean or null.
        Returns:
        null if more than one bean was changed
      • toString

        public java.lang.String toString()
        Get a string representing the state of this event.
        Overrides:
        toString in class java.util.EventObject
        Returns:
        event state as a string