- 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
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 toListDataEvent.CONTENTS_CHANGED
static int
INTERVAL_ADDED
Equal toListDataEvent.INTERVAL_ADDED
static int
INTERVAL_REMOVED
Equal toListDataEvent.INTERVAL_REMOVED
-
Constructor Summary
Constructors Constructor Description ManagerDataEvent(Manager<E> source, int type, int index0, int index1, E changedBean)
Create aListDataEvent
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 ofCONTENTS_CHANGED
,INTERVAL_ADDED
orINTERVAL_REMOVED
.java.lang.String
toString()
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 aListDataEvent
object.- Parameters:
source
- the source of the event (null
not permitted).type
- the type of the event (should be one ofCONTENTS_CHANGED
,INTERVAL_ADDED
orINTERVAL_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:
getSource
in 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_ADDED
orINTERVAL_REMOVED
.- Returns:
- the event type
-
toString
public java.lang.String toString()
Get a string representing the state of this event.- Overrides:
toString
in classjava.util.EventObject
- Returns:
- event state as a string
-
-