java.lang.Object
java.util.EventObject
jmri.Manager.ManagerDataEvent<E>
- Type Parameters:
E
- the type to support in the event
- All Implemented Interfaces:
Serializable
@Immutable public static final class Manager.ManagerDataEvent<E extends NamedBean> extends 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
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
.String
toString()
Get a string representing the state of this event.
-
Field Details
-
CONTENTS_CHANGED
Equal toListDataEvent.CONTENTS_CHANGED
- See Also:
- Constant Field Values
-
INTERVAL_ADDED
Equal toListDataEvent.INTERVAL_ADDED
- See Also:
- Constant Field Values
-
INTERVAL_REMOVED
Equal toListDataEvent.INTERVAL_REMOVED
- See Also:
- Constant Field Values
-
-
Constructor Details
-
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 Details
-
getSource
Get the source of the event in a type-safe manner.- Overrides:
getSource
in classEventObject
- Returns:
- the event source
-
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
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
Get the changed bean or null.- Returns:
- null if more than one bean was changed
-
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
Get a string representing the state of this event.- Overrides:
toString
in classEventObject
- Returns:
- event state as a string
-