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>
_automationHashTable
protected java.lang.String
_comment
protected AutomationItem
_currentAutomationItem
protected AutomationItem
_gotoAutomationItem
protected java.lang.String
_id
protected int
_IdNumber
protected AutomationItem
_lastAutomationItem
protected java.lang.String
_name
protected boolean
_running
static java.lang.String
CURRENT_ITEM_CHANGED_PROPERTY
static java.lang.String
DISPOSE
static java.lang.String
LISTCHANGE_CHANGED_PROPERTY
static java.lang.String
REGEX
static java.lang.String
RUNNING_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 AutomationItem
addItem()
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.void
copyAutomation(Automation automation)
Copies automation.void
deleteItem(AutomationItem item)
Delete a AutomationItemvoid
dispose()
java.lang.String
getActionStatus()
javax.swing.JComboBox<AutomationItem>
getComboBox()
Gets a JComboBox loaded with automation items.java.lang.String
getComment()
java.lang.String
getCurrentActionString()
AutomationItem
getCurrentAutomationItem()
java.lang.String
getId()
AutomationItem
getItemById(java.lang.String id)
Get a AutomationItem by idAutomationItem
getItemBySequenceId(int sequenceId)
java.util.List<AutomationItem>
getItemsBySequenceList()
Get a list of AutomationItems sorted by automation orderAutomationItem
getLastAutomationItem()
java.lang.String
getMessage()
java.lang.String
getName()
int
getSize()
boolean
isActionRunning()
boolean
isLastActionSuccessful()
boolean
isReadyToRun()
Used to determine if automation is at the start of its sequence.boolean
isRunning()
void
moveItemDown(AutomationItem item)
Places a AutomationItem later in the automation.void
moveItemUp(AutomationItem item)
Places a AutomationItem earlier in the automationvoid
propertyChange(java.beans.PropertyChangeEvent e)
void
register(AutomationItem item)
Remember a NamedBean Object created outside the manager.void
reset()
protected void
resetAutomationItems(AutomationItem item)
void
resume()
void
run()
void
setComment(java.lang.String comment)
void
setCurrentAutomationItem(AutomationItem item)
protected void
setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
void
setName(java.lang.String name)
void
setNextAutomationItem()
void
setRunning(boolean running)
void
step()
void
stop()
org.jdom2.Element
store()
Create an XML element to represent this Entry.java.lang.String
toString()
-
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:
toString
in 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
protected 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:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
setDirtyAndFirePropertyChange
protected void setDirtyAndFirePropertyChange(java.lang.String p, java.lang.Object old, java.lang.Object n)
-
-