Search in sources :

Example 1 with Automation

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;
}
Also used : Automation(jmri.jmrit.operations.automation.Automation) AutomationItem(jmri.jmrit.operations.automation.AutomationItem)

Example 2 with Automation

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 });
}
Also used : Automation(jmri.jmrit.operations.automation.Automation) AutomationItem(jmri.jmrit.operations.automation.AutomationItem) TrainSchedule(jmri.jmrit.operations.trains.timetable.TrainSchedule) RouteLocation(jmri.jmrit.operations.routes.RouteLocation) Train(jmri.jmrit.operations.trains.Train)

Example 3 with Automation

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);
    }
}
Also used : Automation(jmri.jmrit.operations.automation.Automation)

Example 4 with Automation

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);
    }
}
Also used : Automation(jmri.jmrit.operations.automation.Automation)

Example 5 with Automation

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);
    }
}
Also used : Automation(jmri.jmrit.operations.automation.Automation)

Aggregations

Automation (jmri.jmrit.operations.automation.Automation)5 AutomationItem (jmri.jmrit.operations.automation.AutomationItem)2 RouteLocation (jmri.jmrit.operations.routes.RouteLocation)1 Train (jmri.jmrit.operations.trains.Train)1 TrainSchedule (jmri.jmrit.operations.trains.timetable.TrainSchedule)1