Search in sources :

Example 1 with AutomationItem

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

Example 2 with AutomationItem

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

Example 3 with AutomationItem

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 });
}
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 4 with AutomationItem

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

Example 5 with AutomationItem

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

Aggregations

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