use of jmri.jmrit.operations.automation.AutomationItem in project JMRI by JMRI.
the class GotoAction method getComboBox.
@Override
public JComboBox<AutomationItem> getComboBox() {
if (getAutomationItem() != null) {
Automation automation = AutomationManager.instance().getAutomationById(getAutomationItem().getId().split(Automation.REGEX)[0]);
JComboBox<AutomationItem> cb = automation.getComboBox();
cb.setSelectedItem(getAutomationItem().getGotoAutomationItem());
return cb;
}
return null;
}
use of jmri.jmrit.operations.automation.AutomationItem in project JMRI by JMRI.
the class GotoFailureAction method doAction.
@Override
public void doAction() {
if (getAutomationItem() != null) {
AutomationItem automationItem = getAutomationItem().getGotoAutomationItem();
if (automationItem != null) {
setRunning(true);
// the old property controls conditional branch if failure
firePropertyChange(ACTION_GOTO_CHANGED_PROPERTY, false, automationItem);
}
finishAction(automationItem != null);
}
}
use of jmri.jmrit.operations.automation.AutomationItem in project JMRI by JMRI.
the class Action method getFormatedMessage.
/**
* Formats a message using fixed arguments in the following order:
* <p>
* action name, train name, route location name, automation name, goto item id,
* train schedule day.
* @param message the string to be formated
*
* @return formated message
*/
public String getFormatedMessage(String message) {
String trainName = "";
Train train = getAutomationItem().getTrain();
if (train != null) {
trainName = " " + train.getName();
}
String routeLocationName = "";
RouteLocation rl = getAutomationItem().getRouteLocation();
if (rl != null) {
routeLocationName = " " + rl.getName();
}
String automationName = "";
Automation automation = getAutomationItem().getAutomationToRun();
if (automation != null) {
automationName = " " + automation.getName();
}
String itemId = "";
AutomationItem item = getAutomationItem().getGotoAutomationItem();
if (item != null) {
itemId = " " + item.getId();
}
String day = "";
TrainSchedule trainSchedule = getAutomationItem().getTrainSchedule();
if (trainSchedule != null) {
day = " " + trainSchedule.getName();
}
return MessageFormat.format(message, new Object[] { getName(), trainName, routeLocationName, automationName, itemId, day });
}
use of jmri.jmrit.operations.automation.AutomationItem in project JMRI by JMRI.
the class GotoSuccessAction method doAction.
@Override
public void doAction() {
if (getAutomationItem() != null) {
AutomationItem automationItem = getAutomationItem().getGotoAutomationItem();
if (automationItem != null) {
setRunning(true);
// the old property controls conditional branch if successful
firePropertyChange(ACTION_GOTO_CHANGED_PROPERTY, true, automationItem);
}
finishAction(automationItem != null);
}
}
use of jmri.jmrit.operations.automation.AutomationItem in project JMRI by JMRI.
the class GotoAction method doAction.
@Override
public void doAction() {
if (getAutomationItem() != null) {
AutomationItem automationItem = getAutomationItem().getGotoAutomationItem();
if (automationItem != null) {
setRunning(true);
// the old property = null unconditional branch
firePropertyChange(ACTION_GOTO_CHANGED_PROPERTY, null, automationItem);
}
finishAction(automationItem != null);
}
}
Aggregations