Package jmri.jmrit.operations.automation
Class Automation
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.automation.Automation
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,PropertyChangeFirer,PropertyChangeProvider
public class Automation extends PropertyChangeSupport implements java.beans.PropertyChangeListener
Automation for operations
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashMap<java.lang.String,AutomationItem>_automationHashTableprotected java.lang.String_commentprotected AutomationItem_currentAutomationItemprotected AutomationItem_gotoAutomationItemprotected java.lang.String_idprotected int_IdNumberprotected AutomationItem_lastAutomationItemprotected java.lang.String_nameprotected boolean_runningstatic java.lang.StringCURRENT_ITEM_CHANGED_PROPERTYstatic java.lang.StringDISPOSEstatic java.lang.StringLISTCHANGE_CHANGED_PROPERTYstatic java.lang.StringREGEXstatic java.lang.StringRUNNING_CHANGED_PROPERTY-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description Automation(java.lang.String id, java.lang.String name)Automation(org.jdom2.Element e)Construct this Entry from XML.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AutomationItemaddItem()AutomationItemaddNewItem(int sequence)Add a automation item at a specific place (sequence) in the automation Allowable sequence numbers are 0 to max size of automation. 0 = start of list.voidcopyAutomation(Automation automation)Copies automation.voiddeleteItem(AutomationItem item)Delete a AutomationItemvoiddispose()java.lang.StringgetActionStatus()javax.swing.JComboBox<AutomationItem>getComboBox()Gets a JComboBox loaded with automation items.java.lang.StringgetComment()java.lang.StringgetCurrentActionString()AutomationItemgetCurrentAutomationItem()java.lang.StringgetId()AutomationItemgetItemById(java.lang.String id)Get a AutomationItem by idAutomationItemgetItemBySequenceId(int sequenceId)java.util.List<AutomationItem>getItemsBySequenceList()Get a list of AutomationItems sorted by automation orderAutomationItemgetLastAutomationItem()java.lang.StringgetMessage()java.lang.StringgetName()intgetSize()booleanisActionRunning()booleanisLastActionSuccessful()booleanisReadyToRun()Used to determine if automation is at the start of its sequence.booleanisRunning()voidmoveItemDown(AutomationItem item)Places a AutomationItem later in the automation.voidmoveItemUp(AutomationItem item)Places a AutomationItem earlier in the automationvoidpropertyChange(java.beans.PropertyChangeEvent e)voidregister(AutomationItem item)Remember a NamedBean Object created outside the manager.voidreset()voidresetAutomationItems(AutomationItem item)voidresume()voidrun()voidsetComment(java.lang.String comment)voidsetCurrentAutomationItem(AutomationItem item)protected voidsetDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)voidsetName(java.lang.String name)voidsetNextAutomationItem()voidsetRunning(boolean running)voidstep()voidstop()org.jdom2.Elementstore()Create an XML element to represent this Entry.java.lang.StringtoString()-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
_id
protected java.lang.String _id
-
_name
protected java.lang.String _name
-
_comment
protected java.lang.String _comment
-
_currentAutomationItem
protected AutomationItem _currentAutomationItem
-
_lastAutomationItem
protected AutomationItem _lastAutomationItem
-
_gotoAutomationItem
protected AutomationItem _gotoAutomationItem
-
_running
protected boolean _running
-
_automationHashTable
protected java.util.HashMap<java.lang.String,AutomationItem> _automationHashTable
-
_IdNumber
protected int _IdNumber
-
REGEX
public static final java.lang.String REGEX
- See Also:
- Constant Field Values
-
LISTCHANGE_CHANGED_PROPERTY
public static final java.lang.String LISTCHANGE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
CURRENT_ITEM_CHANGED_PROPERTY
public static final java.lang.String CURRENT_ITEM_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
RUNNING_CHANGED_PROPERTY
public static final java.lang.String RUNNING_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
DISPOSE
public static final java.lang.String DISPOSE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Automation
public Automation(java.lang.String id, java.lang.String name)
-
Automation
public Automation(org.jdom2.Element e)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in operations-trains.dtd- Parameters:
e- Consist XML element
-
-
Method Detail
-
getId
public java.lang.String getId()
-
setName
public void setName(java.lang.String name)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getName
public java.lang.String getName()
-
getSize
public int getSize()
-
setComment
public void setComment(java.lang.String comment)
-
getComment
public java.lang.String getComment()
-
getCurrentActionString
public java.lang.String getCurrentActionString()
-
getActionStatus
public java.lang.String getActionStatus()
-
getMessage
public java.lang.String getMessage()
-
setRunning
public void setRunning(boolean running)
-
isRunning
public boolean isRunning()
-
isActionRunning
public boolean isActionRunning()
-
isReadyToRun
public boolean isReadyToRun()
Used to determine if automation is at the start of its sequence.- Returns:
- true if the current action is the first action in the list.
-
run
public void run()
-
step
public void step()
-
stop
public void stop()
-
resume
public void resume()
-
reset
public void reset()
-
resetAutomationItems
public void resetAutomationItems(AutomationItem item)
-
setNextAutomationItem
public void setNextAutomationItem()
-
setCurrentAutomationItem
public void setCurrentAutomationItem(AutomationItem item)
-
getCurrentAutomationItem
public AutomationItem getCurrentAutomationItem()
-
getLastAutomationItem
public AutomationItem getLastAutomationItem()
-
isLastActionSuccessful
public boolean isLastActionSuccessful()
-
dispose
public void dispose()
-
addItem
public AutomationItem addItem()
-
addNewItem
public AutomationItem addNewItem(int sequence)
Add a automation item at a specific place (sequence) in the automation Allowable sequence numbers are 0 to max size of automation. 0 = start of list.- Parameters:
sequence- where to add a new item in the automation- Returns:
- automation item
-
register
public void register(AutomationItem item)
Remember a NamedBean Object created outside the manager.- Parameters:
item- the item to be added to this automation.
-
deleteItem
public void deleteItem(AutomationItem item)
Delete a AutomationItem- Parameters:
item- The item to be deleted.
-
getItemById
public AutomationItem getItemById(java.lang.String id)
Get a AutomationItem by id- Parameters:
id- The string id of the item.- Returns:
- automation item
-
getItemsBySequenceList
public java.util.List<AutomationItem> getItemsBySequenceList()
Get a list of AutomationItems sorted by automation order- Returns:
- list of AutomationItems ordered by sequence
-
getComboBox
public javax.swing.JComboBox<AutomationItem> getComboBox()
Gets a JComboBox loaded with automation items.- Returns:
- JComboBox with a list of automation items.
-
moveItemUp
public void moveItemUp(AutomationItem item)
Places a AutomationItem earlier in the automation- Parameters:
item- The item to move up one position in the automation.
-
moveItemDown
public void moveItemDown(AutomationItem item)
Places a AutomationItem later in the automation.- Parameters:
item- The item to move later in the automation.
-
getItemBySequenceId
public AutomationItem getItemBySequenceId(int sequenceId)
-
copyAutomation
public void copyAutomation(Automation automation)
Copies automation.- Parameters:
automation- the automation to copy
-
store
public org.jdom2.Element store()
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in operations-trains.dtd.- Returns:
- 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)
-
-