use of jmri.jmrit.operations.automation.Automation 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.Automation 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.Automation in project JMRI by JMRI.
the class ResumeAutomationAction method doAction.
@Override
public void doAction() {
if (getAutomationItem() != null) {
Automation automation = getAutomationItem().getAutomationToRun();
if (automation != null) {
setRunning(true);
automation.resume();
}
finishAction(automation != null);
}
}
use of jmri.jmrit.operations.automation.Automation in project JMRI by JMRI.
the class StopAutomationAction method doAction.
@Override
public void doAction() {
if (getAutomationItem() != null) {
Automation automation = getAutomationItem().getAutomationToRun();
if (automation != null) {
setRunning(true);
automation.stop();
}
finishAction(automation != null);
}
}
use of jmri.jmrit.operations.automation.Automation in project JMRI by JMRI.
the class RunAutomationAction method doAction.
@Override
public void doAction() {
if (getAutomationItem() != null) {
Automation automation = getAutomationItem().getAutomationToRun();
if (automation != null) {
setRunning(true);
automation.run();
}
finishAction(automation != null);
}
}
Aggregations