- java.lang.Object
-
- java.util.EventObject
-
- jmri.Manager.ManagerDataEvent<E>
-
- Type Parameters:
E- the type to support in the event
- All Implemented Interfaces:
java.io.Serializable
@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
ListDataEventwithout 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 intCONTENTS_CHANGEDEqual toListDataEvent.CONTENTS_CHANGEDstatic intINTERVAL_ADDEDEqual toListDataEvent.INTERVAL_ADDEDstatic intINTERVAL_REMOVEDEqual toListDataEvent.INTERVAL_REMOVED
-
Constructor Summary
Constructors Constructor Description ManagerDataEvent(Manager<E> source, int type, int index0, int index1, E changedBean)Create aListDataEventobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EgetChangedBean()Get the changed bean or null.intgetIndex0()Get the index of the first item in the range of modified list items.intgetIndex1()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.intgetType()Get a code representing the type of this event, which is usually one ofCONTENTS_CHANGED,INTERVAL_ADDEDorINTERVAL_REMOVED.java.lang.StringtoString()Get a string representing the state of this event.
-
-
-
Field Detail
-
CONTENTS_CHANGED
public static final int CONTENTS_CHANGED
Equal toListDataEvent.CONTENTS_CHANGED- See Also:
- Constant Field Values
-
INTERVAL_ADDED
public static final int INTERVAL_ADDED
Equal toListDataEvent.INTERVAL_ADDED- See Also:
- Constant Field Values
-
INTERVAL_REMOVED
public static final int INTERVAL_REMOVED
Equal toListDataEvent.INTERVAL_REMOVED- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ManagerDataEvent
public ManagerDataEvent(@Nonnull Manager<E> source, int type, int index0, int index1, E changedBean)
Create aListDataEventobject.- Parameters:
source- the source of the event (nullnot permitted).type- the type of the event (should be one ofCONTENTS_CHANGED,INTERVAL_ADDEDorINTERVAL_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<E> getSource()
Get the source of the event in a type-safe manner.- Overrides:
getSourcein classjava.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
-
getType
public int getType()
Get a code representing the type of this event, which is usually one ofCONTENTS_CHANGED,INTERVAL_ADDEDorINTERVAL_REMOVED.- Returns:
- the event type
-
toString
public java.lang.String toString()
Get a string representing the state of this event.- Overrides:
toStringin classjava.util.EventObject- Returns:
- event state as a string
-
-