Class Action
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrit.operations.automation.actions.Action
-
- All Implemented Interfaces:
PropertyChangeFirer,PropertyChangeProvider
- Direct Known Subclasses:
ActivateTrainScheduleAction,ApplyTrainScheduleAction,BuildTrainAction,BuildTrainIfSelectedAction,CounterAction,DeselectTrainAction,GenerateSwitchListChangesAction,GotoAction,HaltAction,IsTrainEnRouteAction,MessageYesNoAction,MoveTrainAction,NoAction,PrintSwitchListChangesAction,PrintTrainBuildReportAction,PrintTrainManifestAction,PrintTrainManifestIfSelectedAction,ResetSwitchListsAction,ResetTrainAction,RunAutomationAction,RunSwitchListChangesAction,RunTrainAction,SelectTrainAction,TerminateTrainAction,UpdateSwitchListAction,WaitSwitchListAction,WaitTrainAction,WaitTrainTerminatedAction
public abstract class Action extends PropertyChangeSupport
-
-
Field Summary
Fields Modifier and Type Field Description protected AutomationItem_automationItemstatic java.lang.StringACTION_COMPLETE_CHANGED_PROPERTYstatic java.lang.StringACTION_GOTO_CHANGED_PROPERTYstatic java.lang.StringACTION_HALT_CHANGED_PROPERTYstatic java.lang.StringACTION_RUNNING_CHANGED_PROPERTYstatic intCLOSEDstatic intFINISH_FAILEDstatic intHALTstatic intNO_MESSAGE_SENTstatic intOKAY-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description Action()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidcancelAction()abstract voiddoAction()intfinishAction(boolean success)Completes the action by displaying the correct message if there's one.intfinishAction(boolean success, java.lang.Object[] buttons)Completes the action by displaying the correct message if there's one.java.lang.StringgetActionFailedString()java.lang.StringgetActionString()java.lang.StringgetActionSuccessfulString()AutomationItemgetAutomationItem()abstract intgetCode()protected intgetCode(int code)Mask off menu bits.javax.swing.JComboBox<?>getComboBox()java.lang.StringgetFormatedMessage(java.lang.String message)Formats a message using fixed arguments in the following order:abstract java.lang.StringgetName()java.lang.StringgetStatus()booleanisAutomationMenuEnabled()booleanisConcurrentAction()Used to determine if this action can run concurrently with other actions.booleanisGotoMenuEnabled()booleanisMessageFailEnabled()booleanisMessageOkEnabled()booleanisRouteMenuEnabled()booleanisTrainMenuEnabled()intsendMessage(java.lang.String message, java.lang.Object[] buttons, boolean success)Displays message if there's one.voidsetAutomationItem(AutomationItem item)voidsetRunning(boolean running)java.lang.StringtoString()For combo boxes.-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
ACTION_COMPLETE_CHANGED_PROPERTY
public static final java.lang.String ACTION_COMPLETE_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
ACTION_HALT_CHANGED_PROPERTY
public static final java.lang.String ACTION_HALT_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
ACTION_RUNNING_CHANGED_PROPERTY
public static final java.lang.String ACTION_RUNNING_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
ACTION_GOTO_CHANGED_PROPERTY
public static final java.lang.String ACTION_GOTO_CHANGED_PROPERTY
- See Also:
- Constant Field Values
-
HALT
public static final int HALT
- See Also:
- Constant Field Values
-
OKAY
public static final int OKAY
- See Also:
- Constant Field Values
-
CLOSED
public static final int CLOSED
- See Also:
- Constant Field Values
-
NO_MESSAGE_SENT
public static final int NO_MESSAGE_SENT
- See Also:
- Constant Field Values
-
FINISH_FAILED
public static final int FINISH_FAILED
- See Also:
- Constant Field Values
-
_automationItem
protected AutomationItem _automationItem
-
-
Constructor Detail
-
Action
public Action()
-
-
Method Detail
-
getCode
public abstract int getCode()
-
getName
public abstract java.lang.String getName()
-
doAction
public abstract void doAction()
-
cancelAction
public abstract void cancelAction()
-
toString
public java.lang.String toString()
For combo boxes.- Overrides:
toStringin classjava.lang.Object
-
getCode
protected int getCode(int code)
Mask off menu bits.- Parameters:
code- the integer to be modified by masking off menu bits.- Returns:
- code and ActionCodes.CODE_MASK
-
isTrainMenuEnabled
public boolean isTrainMenuEnabled()
-
isRouteMenuEnabled
public boolean isRouteMenuEnabled()
-
isMessageOkEnabled
public boolean isMessageOkEnabled()
-
isMessageFailEnabled
public boolean isMessageFailEnabled()
-
isAutomationMenuEnabled
public boolean isAutomationMenuEnabled()
-
isGotoMenuEnabled
public boolean isGotoMenuEnabled()
-
isConcurrentAction
public boolean isConcurrentAction()
Used to determine if this action can run concurrently with other actions.- Returns:
- true if a concurrent action
-
setAutomationItem
public void setAutomationItem(AutomationItem item)
-
getAutomationItem
public AutomationItem getAutomationItem()
-
getActionString
public java.lang.String getActionString()
-
getStatus
public java.lang.String getStatus()
-
getActionSuccessfulString
public java.lang.String getActionSuccessfulString()
-
getActionFailedString
public java.lang.String getActionFailedString()
-
setRunning
public void setRunning(boolean running)
-
finishAction
public int finishAction(boolean success)
Completes the action by displaying the correct message if there's one. Will halt if the option to halt the automation is enabled or the user requested the automation to halt.- Parameters:
success- true if action succeeded- Returns:
- OKAY, HALT, CLOSED, NO_MESSAGE_SENT, FINISH_FAILED
-
finishAction
public int finishAction(boolean success, java.lang.Object[] buttons)
Completes the action by displaying the correct message if there's one. Will halt if the option to halt the automation is enabled or the user requested the automation to halt.- Parameters:
success- true if action succeededbuttons- buttons to display in message- Returns:
- OKAY, HALT, CLOSED, NO_MESSAGE_SENT, FINISH_FAILED
-
sendMessage
public int sendMessage(java.lang.String message, java.lang.Object[] buttons, boolean success)
Displays message if there's one.- Parameters:
buttons- the buttons to display, if success and two or more buttons, the second button becomes the defaultsuccess- true if action succeededmessage- the text to be displayed- Returns:
- array number for which button was pressed, NO_MESSAGE_SENT, CLOSED
-
getFormatedMessage
public java.lang.String getFormatedMessage(java.lang.String message)
Formats a message using fixed arguments in the following order:action name, train name, route location name, automation name, goto item id, train schedule day.
- Parameters:
message- the string to be formated- Returns:
- formated message
-
getComboBox
public javax.swing.JComboBox<?> getComboBox()
-
-