Package jmri.jmrit.operations.automation
Class AutomationManager
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.automation.AutomationManager
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,PropertyChangeFirer,PropertyChangeProvider,InstanceManagerAutoDefault,InstanceManagerAutoInitialize
public class AutomationManager extends PropertyChangeSupport implements InstanceManagerAutoDefault, InstanceManagerAutoInitialize, java.beans.PropertyChangeListener
Manages automations.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Hashtable<java.lang.String,Automation>_automationHashTableprotected Automation_startupAutomationstatic java.lang.StringLISTLENGTH_CHANGED_PROPERTY-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description AutomationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AutomationcopyAutomation(Automation automation, java.lang.String newName)Makes a new copy of automationvoidderegister(Automation automation)Forget a NamedBean Object created outside the manager.voiddispose()AutomationgetAutomationById(java.lang.String id)AutomationgetAutomationByName(java.lang.String name)java.util.List<Automation>getAutomationsByIdList()Sort by automation id numberjava.util.List<Automation>getAutomationsByNameList()Sort by automation namejavax.swing.JComboBox<Automation>getComboBox()Gets a JComboBox loaded with automations.intgetSize()AutomationgetStartupAutomation()protected java.lang.StringgetStartupAutomationId()voidinitialize()Perform any initialization that occurs after this object has been constructed and made available by the InstanceManager.voidload(org.jdom2.Element root)Construct this Entry from XML.AutomationnewAutomation(java.lang.String name)Finds an existing automation or creates a new automation if needed requires automation's name creates a unique id for this automationvoidpropertyChange(java.beans.PropertyChangeEvent e)voidregister(Automation automation)Remember a NamedBean Object created outside the manager.voidresumeAutomations()Restarts all automations that were running when the operations program was last saved.voidrunStartupAutomation()protected voidsetDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)voidsetStartupAutomation(Automation automation)voidstore(org.jdom2.Element root)Create an XML element to represent this Entry.voidupdateComboBox(javax.swing.JComboBox<Automation> box)Update a JComboBox with the latest automations.-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
LISTLENGTH_CHANGED_PROPERTY
public static final java.lang.String LISTLENGTH_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
_automationHashTable
protected java.util.Hashtable<java.lang.String,Automation> _automationHashTable
-
_startupAutomation
protected Automation _startupAutomation
-
-
Constructor Detail
-
AutomationManager
public AutomationManager()
-
-
Method Detail
-
getSize
public int getSize()
- Returns:
- Number of automations
-
getAutomationByName
public Automation getAutomationByName(java.lang.String name)
- Parameters:
name- The string name of the automation to be returned.- Returns:
- requested Automation object or null if none exists
-
getAutomationById
public Automation getAutomationById(java.lang.String id)
-
newAutomation
public Automation newAutomation(java.lang.String name)
Finds an existing automation or creates a new automation if needed requires automation's name creates a unique id for this automation- Parameters:
name- The string name of the automation.- Returns:
- new automation or existing automation
-
register
public void register(Automation automation)
Remember a NamedBean Object created outside the manager.- Parameters:
automation- The automation that is being registered.
-
deregister
public void deregister(Automation automation)
Forget a NamedBean Object created outside the manager.- Parameters:
automation- The automation to be deleted.
-
getAutomationsByNameList
public java.util.List<Automation> getAutomationsByNameList()
Sort by automation name- Returns:
- list of automations ordered by name
-
getAutomationsByIdList
public java.util.List<Automation> getAutomationsByIdList()
Sort by automation id number- Returns:
- list of automations ordered by id number
-
getComboBox
public javax.swing.JComboBox<Automation> getComboBox()
Gets a JComboBox loaded with automations.- Returns:
- JComboBox with a list of automations.
-
updateComboBox
public void updateComboBox(javax.swing.JComboBox<Automation> box)
Update a JComboBox with the latest automations.- Parameters:
box- the JComboBox needing an update.
-
resumeAutomations
public void resumeAutomations()
Restarts all automations that were running when the operations program was last saved.
-
copyAutomation
public Automation copyAutomation(Automation automation, java.lang.String newName)
Makes a new copy of automation- Parameters:
automation- the automation to copynewName- name for the copy of automation- Returns:
- new copy of automation
-
getStartupAutomation
public Automation getStartupAutomation()
-
getStartupAutomationId
protected java.lang.String getStartupAutomationId()
-
setStartupAutomation
public void setStartupAutomation(Automation automation)
-
runStartupAutomation
public void runStartupAutomation()
-
dispose
public void dispose()
-
load
public void load(org.jdom2.Element root)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-trains.dtd- Parameters:
root- Consist XML element
-
store
public void store(org.jdom2.Element root)
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-trains.dtd.- Parameters:
root- Contents in a JDOM Element
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent e)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
initialize
public void 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
-
-