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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intEqual toListDataEvent.CONTENTS_CHANGEDstatic final intEqual toListDataEvent.INTERVAL_ADDEDstatic final intEqual toListDataEvent.INTERVAL_REMOVEDFields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionManagerDataEvent(Manager<E> source, int type, int index0, int index1, E changedBean) Create aListDataEventobject. -
Method Summary
Modifier and TypeMethodDescriptionGet the changed bean or null.intGet the index of the first item in the range of modified list items.intGet the index of the last item in the range of modified list items.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.toString()Get a string representing the state of this event.
-
Field Details
-
CONTENTS_CHANGED
Equal toListDataEvent.CONTENTS_CHANGED- See Also:
-
INTERVAL_ADDED
Equal toListDataEvent.INTERVAL_ADDED- See Also:
-
INTERVAL_REMOVED
Equal toListDataEvent.INTERVAL_REMOVED- See Also:
-
-
Constructor Details
-
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 Details
-
getSource
Get the source of the event in a type-safe manner.- Overrides:
getSourcein 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_ADDEDorINTERVAL_REMOVED.- Returns:
- the event type
-
toString
Get a string representing the state of this event.- Overrides:
toStringin classEventObject- Returns:
- event state as a string
-