Class TrainScheduleManager
java.lang.Object
jmri.beans.PropertyChangeSupport
jmri.jmrit.operations.trains.schedules.TrainScheduleManager
- All Implemented Interfaces:
PropertyChangeListener,EventListener,PropertyChangeFirer,PropertyChangeProvider,InstanceManagerAutoDefault,InstanceManagerAutoInitialize
public class TrainScheduleManager
extends PropertyChangeSupport
implements InstanceManagerAutoDefault, InstanceManagerAutoInitialize, PropertyChangeListener
Manages train schedules. The default is the days of the week, but can be
anything the user wants when defining when trains will run.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Hashtable<String,TrainSchedule> static final Stringstatic final Stringstatic final StringFields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidderegister(TrainSchedule schedule) Forget a NamedBean Object created outside the manager.voiddispose()Gets a JComboBox loaded with schedules starting with null.getScheduleByName(String name) Sort by train schedule id numbersSort by train schedule nameGets a JComboBox loaded with schedules starting with null.voidPerform any initialization that occurs after this object has been constructed and made available by the InstanceManager.voidload(org.jdom2.Element root) newSchedule(String name) Finds an existing schedule or creates a new schedule if needed requires schedule's name creates a unique id for this scheduleintvoidvoidregister(TrainSchedule schedule) Remember a NamedBean Object created outside the manager.protected voidsetDirtyAndFirePropertyChange(String p, Object old, Object n) voidSets the selected schedule idvoidstore(org.jdom2.Element root) Create an XML element to represent this Entry.voidUpdate a JComboBox with the latest schedules.Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
NONE
- See Also:
-
LISTLENGTH_CHANGED_PROPERTY
- See Also:
-
SCHEDULE_ID_CHANGED_PROPERTY
- See Also:
-
_scheduleHashTable
-
-
Constructor Details
-
TrainScheduleManager
public TrainScheduleManager()
-
-
Method Details
-
dispose
-
numEntries
- Returns:
- Number of schedules
-
setTrainScheduleActiveId
Sets the selected schedule id- Parameters:
id- Selected schedule id
-
getTrainScheduleActiveId
-
getActiveSchedule
-
getScheduleByName
- Parameters:
name- The schedule string name to search for.- Returns:
- requested TrainSchedule object or null if none exists
-
getScheduleById
-
newSchedule
Finds an existing schedule or creates a new schedule if needed requires schedule's name creates a unique id for this schedule- Parameters:
name- The string name of the schedule.- Returns:
- new TrainSchedule or existing TrainSchedule
-
register
Remember a NamedBean Object created outside the manager.- Parameters:
schedule- The TrainSchedule to add.
-
deregister
Forget a NamedBean Object created outside the manager.- Parameters:
schedule- The TrainSchedule to delete.
-
getSchedulesByNameList
Sort by train schedule name- Returns:
- list of train schedules ordered by name
-
getSchedulesByIdList
Sort by train schedule id numbers- Returns:
- list of train schedules ordered by id numbers
-
getComboBox
Gets a JComboBox loaded with schedules starting with null.- Returns:
- JComboBox with a list of schedules.
-
getSelectComboBox
Gets a JComboBox loaded with schedules starting with null.- Returns:
- JComboBox with a list of schedules starting with null.
-
updateComboBox
Update a JComboBox with the latest schedules.- Parameters:
box- the JComboBox needing an update.- Throws:
IllegalArgumentException- if box is null
-
buildSwitchLists
-
store
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-trains.dtd.- Parameters:
root- The common Element for operations-trains.dtd.
-
load
-
createDefaultSchedules
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
setDirtyAndFirePropertyChange
-
initialize
Description copied from interface:InstanceManagerAutoInitializePerform any initialization that occurs after this object has been constructed and made available by the InstanceManager.- Specified by:
initializein interfaceInstanceManagerAutoInitialize
-