Search in sources :

Example 6 with ConditionalAction

use of jmri.ConditionalAction in project JMRI by JMRI.

the class Maintenance method search.

/**
     * Search if a given string is used as the name of a NamedBean.
     *
     * @param name the string to look for
     * @param text body of the message to be displayed reporting the result
     * @return true if name is found at least once as a bean name
     */
static boolean search(String name, JTextArea text) {
    String[] names = getTypeAndNames(name);
    if (log.isDebugEnabled()) {
        log.debug("search for " + name + " as " + names[0] + " \"" + names[1] + "\" (" + names[2] + ")");
    }
    if (names[0].length() == 0) {
        if (text != null) {
            text.append(MessageFormat.format(rbm.getString("ElementNotFound"), (Object[]) names));
            return false;
        }
    }
    if (text != null) {
        text.append(MessageFormat.format(rbm.getString("ReferenceFollows"), (Object[]) names));
    }
    String sysName = names[2];
    String userName = names[1];
    int referenceCount = 0;
    StringBuilder tempText = new StringBuilder();
    boolean found = false;
    boolean empty = true;
    // search for references among each class known to be listeners
    Iterator<String> iter1 = InstanceManager.getDefault(jmri.LogixManager.class).getSystemNameList().iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        Logix x = InstanceManager.getDefault(jmri.LogixManager.class).getBySystemName(sName);
        if (x == null) {
            log.error("Error getting Logix  - " + sName);
            break;
        }
        tempText = new StringBuilder();
        String uName = x.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { "", Bundle.getMessage("BeanNameLogix"), uName, sName });
        for (int i = 0; i < x.getNumConditionals(); i++) {
            sName = x.getConditionalByNumberOrder(i);
            if (sName == null) {
                log.error("Null conditional system name");
                break;
            }
            Conditional c = InstanceManager.getDefault(jmri.ConditionalManager.class).getBySystemName(sName);
            if (c == null) {
                log.error("Invalid conditional system name - " + sName);
                break;
            }
            uName = c.getUserName();
            String line2 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { "\t", Bundle.getMessage("BeanNameConditional"), uName, sName });
            String line = MessageFormat.format(rbm.getString("ConditionalReference"), "\t");
            if (sysName.equals(sName) || (userName != null && userName.length() > 0 && userName.equals(uName))) {
                if (testName(sysName, found, names, line1, null, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
            }
            ArrayList<ConditionalVariable> variableList = c.getCopyOfStateVariables();
            for (int k = 0; k < variableList.size(); k++) {
                ConditionalVariable v = variableList.get(k);
                line = MessageFormat.format(rbm.getString("VariableReference"), new Object[] { "\t\t", v.getTestTypeString(), v.getDataString() });
                if (testName(v.getName(), found, names, line1, line2, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
            }
            ArrayList<ConditionalAction> actionList = c.getCopyOfActions();
            for (int k = 0; k < actionList.size(); k++) {
                ConditionalAction a = actionList.get(k);
                line = MessageFormat.format(rbm.getString("ActionReference"), new Object[] { "\t\t", a.getTypeString(), a.getOptionString(false), a.getActionDataString() });
                if (testName(a.getDeviceName(), found, names, line1, line2, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
            }
            if (text != null && found) {
                text.append(tempText.toString());
                tempText = new StringBuilder();
                found = false;
                empty = false;
                line1 = null;
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append("\t" + MessageFormat.format(rbm.getString("NoReference"), "Logix"));
        // cannot put escaped tab char at start of getString
        } else {
            text.append("\n");
        }
    }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    jmri.jmrit.logix.OBlockManager oBlockManager = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class);
    iter1 = oBlockManager.getSystemNameList().iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.jmrit.logix.OBlock block = oBlockManager.getBySystemName(sName);
        String uName = block.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", Bundle.getMessage("BeanNameOBlock"), uName, sName });
        Sensor sensor = block.getSensor();
        if (sensor != null) {
            String line = MessageFormat.format(rbm.getString("OBlockSensor"), "\t");
            if (testName(sensor.getSystemName(), found, names, line1, null, line, tempText)) {
                found = true;
                referenceCount++;
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "OBlock"));
        } else {
            text.append("\n");
        }
    }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    jmri.RouteManager routeManager = InstanceManager.getDefault(jmri.RouteManager.class);
    iter1 = routeManager.getSystemNameList().iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.Route r = routeManager.getBySystemName(sName);
        if (r == null) {
            log.error("Error getting Route  - " + sName);
            break;
        }
        String uName = r.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", Bundle.getMessage("BeanNameRoute"), uName, sName });
        for (int i = 0; i < jmri.Route.MAX_CONTROL_SENSORS; i++) {
            String line = "\t" + MessageFormat.format(rbm.getString("ControlReference"), Bundle.getMessage("BeanNameSensor"));
            if (testName(r.getRouteSensorName(i), found, names, line1, null, line, tempText)) {
                found = true;
                referenceCount++;
            }
        }
        String line = MessageFormat.format("TurnoutsAlignedSensor", Bundle.getMessage("BeanNameSensor"));
        if (testName(r.getTurnoutsAlignedSensor(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = "\t" + MessageFormat.format(rbm.getString("ControlReference"), Bundle.getMessage("BeanNameTurnout"));
        if (testName(r.getControlTurnout(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format("LockControlTurnout", Bundle.getMessage("BeanNameTurnout"));
        if (testName(r.getLockControlTurnout(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        for (int i = 0; i < r.getNumOutputTurnouts(); i++) {
            line = "\t" + MessageFormat.format(rbm.getString("OutputReference"), Bundle.getMessage("BeanNameTurnout"));
            if (testName(r.getOutputTurnoutByIndex(i), found, names, line1, null, line, tempText)) {
                found = true;
                referenceCount++;
            }
        }
        for (int i = 0; i < r.getNumOutputSensors(); i++) {
            line = "\t" + MessageFormat.format(rbm.getString("OutputReference"), Bundle.getMessage("BeanNameSensor"));
            if (testName(r.getOutputSensorByIndex(i), found, names, line1, null, line, tempText)) {
                found = true;
                referenceCount++;
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "Route"));
        } else {
            text.append("\n");
        }
    }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    jmri.TransitManager transitManager = InstanceManager.getDefault(jmri.TransitManager.class);
    iter1 = transitManager.getSystemNameList().iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.Transit transit = transitManager.getBySystemName(sName);
        if (transit == null) {
            log.error("Error getting Transit - " + sName);
            break;
        }
        String uName = transit.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", Bundle.getMessage("BeanNameTransit"), uName, sName });
        ArrayList<jmri.TransitSection> sectionList = transit.getTransitSectionList();
        for (int i = 0; i < sectionList.size(); i++) {
            jmri.TransitSection transitSection = sectionList.get(i);
            jmri.Section section = transitSection.getSection();
            uName = section.getUserName();
            sName = section.getSystemName();
            String line2 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { "\t", rbm.getString("TransitSection"), uName, sName });
            if (sName.equals(sysName) || uName.equals(userName)) {
                tempText.append(line1);
                tempText.append(line2);
                tempText.append(MessageFormat.format(rbm.getString("SectionReference"), "\t\t"));
                found = true;
                referenceCount++;
            }
            String line = MessageFormat.format(rbm.getString("ForwardBlocking"), "\t\t");
            if (testName(section.getForwardBlockingSensorName(), found, names, line1, line2, line, tempText)) {
                found = true;
                referenceCount++;
            }
            line = MessageFormat.format(rbm.getString("ForwardStopping"), "\t\t");
            if (testName(section.getForwardStoppingSensorName(), found, names, line1, line2, line, tempText)) {
                found = true;
                referenceCount++;
            }
            line = MessageFormat.format(rbm.getString("ReverseBlocking"), "\t\t");
            if (testName(section.getReverseBlockingSensorName(), found, names, line1, line2, line, tempText)) {
                found = true;
                referenceCount++;
            }
            line = MessageFormat.format(rbm.getString("ReverseStopping"), "\t\t");
            if (testName(section.getReverseStoppingSensorName(), found, names, line1, line2, line, tempText)) {
                found = true;
                referenceCount++;
            }
            ArrayList<jmri.Block> blockList = section.getBlockList();
            for (int k = 0; k < blockList.size(); k++) {
                jmri.Block block = blockList.get(k);
                sName = block.getSystemName();
                uName = block.getUserName();
                tempText.append(MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { "\t\t", Bundle.getMessage("BeanNameBlock"), uName, sName }));
                if (sName.equals(sysName) || uName.equals(userName)) {
                    tempText.append(MessageFormat.format(rbm.getString("BlockReference"), "\t\t"));
                    found = true;
                    referenceCount++;
                }
                Sensor sensor = block.getSensor();
                if (sensor != null) {
                    line = MessageFormat.format(rbm.getString("BlockSensor"), "\t\t");
                    if (testName(sensor.getSystemName(), found, names, line1, line2, line, tempText)) {
                        found = true;
                        referenceCount++;
                    }
                }
            }
            if (text != null && found) {
                text.append(tempText.toString());
                tempText = new StringBuilder();
                found = false;
                empty = false;
                line1 = null;
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "Transit"));
        } else {
            text.append("\n");
        }
    }
    // if (text != null) {
    //   text.append(rbm.getString("NestMessage"));
    // }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    jmri.SectionManager sectionManager = InstanceManager.getDefault(jmri.SectionManager.class);
    java.util.List<String> sysNameList = sectionManager.getSystemNameList();
    transitManager = InstanceManager.getDefault(jmri.TransitManager.class);
    iter1 = transitManager.getSystemNameList().iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.Transit transit = transitManager.getBySystemName(sName);
        if (transit != null) {
            ArrayList<jmri.TransitSection> sectionList = transit.getTransitSectionList();
            for (int i = 0; i < sectionList.size(); i++) {
                jmri.TransitSection transitSection = sectionList.get(i);
                jmri.Section section = transitSection.getSection();
                sysNameList.remove(section.getSystemName());
            }
        }
    }
    iter1 = sysNameList.iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.Section section = sectionManager.getBySystemName(sName);
        if (section == null) {
            log.error("Error getting Section - " + sName);
            break;
        }
        String uName = section.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", Bundle.getMessage("BeanNameSection"), uName, sName });
        if (sName.equals(sysName) || uName.equals(userName)) {
            tempText.append(MessageFormat.format(rbm.getString("SectionReference"), "\t"));
            found = true;
            referenceCount++;
        }
        String line = MessageFormat.format(rbm.getString("ForwardBlocking"), "\t");
        if (testName(section.getForwardBlockingSensorName(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("ForwardStopping"), "\t");
        if (testName(section.getForwardStoppingSensorName(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("ReverseBlocking"), "\t");
        if (testName(section.getReverseBlockingSensorName(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("ReverseStopping"), "\t");
        if (testName(section.getReverseStoppingSensorName(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        ArrayList<jmri.Block> blockList = section.getBlockList();
        for (int k = 0; k < blockList.size(); k++) {
            jmri.Block block = blockList.get(k);
            sName = block.getSystemName();
            uName = block.getUserName();
            String line2 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { "\t", Bundle.getMessage("BeanNameBlock"), uName, sName });
            if (sName.equals(sysName) || (uName != null && uName.equals(userName))) {
                tempText.append(line2);
                tempText.append(MessageFormat.format(rbm.getString("BlockReference"), "\t"));
                found = true;
                referenceCount++;
            }
            Sensor sensor = block.getSensor();
            if (sensor != null) {
                line = MessageFormat.format(rbm.getString("BlockSensor"), "\t\t");
                if (testName(sensor.getSystemName(), found, names, line1, line2, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "Section"));
        } else {
            text.append("\n");
        }
    }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    jmri.BlockManager blockManager = InstanceManager.getDefault(jmri.BlockManager.class);
    sysNameList = blockManager.getSystemNameList();
    sectionManager = InstanceManager.getDefault(jmri.SectionManager.class);
    iter1 = sectionManager.getSystemNameList().iterator();
    while (iter1.hasNext()) {
        String sName = iter1.next();
        jmri.Section section = sectionManager.getBySystemName(sName);
        if (section != null) {
            for (Block block : section.getBlockList()) {
                sysNameList.remove(block.getSystemName());
            }
        }
    }
    iter1 = sysNameList.iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.Block b = blockManager.getBySystemName(sName);
        String uName = b.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", Bundle.getMessage("BeanNameBlock"), uName, sName });
        if (sName.equals(sysName) || (uName != null && uName.equals(userName))) {
            tempText.append(line1);
            tempText.append(MessageFormat.format(rbm.getString("BlockReference"), "\t"));
            found = true;
            referenceCount++;
        }
        jmri.Sensor s = b.getSensor();
        if (s != null) {
            String line = MessageFormat.format(rbm.getString("BlockSensor"), "\t\t");
            if (testName(s.getSystemName(), found, names, line1, null, line, tempText)) {
                found = true;
                referenceCount++;
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "Block"));
        } else {
            text.append("\n");
        }
    }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    jmri.jmrit.display.layoutEditor.LayoutBlockManager lbm = InstanceManager.getDefault(LayoutBlockManager.class);
    iter1 = lbm.getSystemNameList().iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.jmrit.display.layoutEditor.LayoutBlock lb = lbm.getBySystemName(sName);
        if (lb == null) {
            log.error("Error getting LayoutBlock - " + sName);
            break;
        }
        String uName = lb.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", rbm.getString("LayoutBlock"), uName, sName });
        jmri.Sensor s = lb.getOccupancySensor();
        if (s != null) {
            String line = MessageFormat.format(rbm.getString("OccupancySensor"), "\t\t");
            if (testName(s.getSystemName(), found, names, line1, null, line, tempText)) {
                found = true;
                referenceCount++;
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "LayoutBlock"));
        } else {
            text.append("\n");
        }
    }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    java.util.Enumeration<BlockBossLogic> enumeration = BlockBossLogic.entries();
    while (enumeration.hasMoreElements()) {
        // get the next Logix
        BlockBossLogic bbl = enumeration.nextElement();
        String sName = bbl.getName();
        String uName = bbl.getDrivenSignal();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", rbm.getString("BlockBossLogic"), uName, sName });
        if (uName.equals(sysName) || uName.equals(userName) || sName.equals(sysName) || sName.equals(userName)) {
            tempText.append(line1);
            tempText.append(MessageFormat.format(rbm.getString("SignalReference"), "\t"));
            found = true;
            referenceCount++;
        }
        String line = MessageFormat.format(rbm.getString("WatchSensorReference"), "1\t");
        if (testName(bbl.getSensor1(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "2\t");
        if (testName(bbl.getSensor2(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "3\t");
        if (testName(bbl.getSensor3(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "4\t");
        if (testName(bbl.getSensor4(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "5\t");
        if (testName(bbl.getSensor5(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchTurnoutReference"), "\t");
        if (testName(bbl.getTurnout(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSignalReference"), "1\t");
        if (testName(bbl.getWatchedSignal1(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchTurnoutReference"), "1Alt\t");
        if (testName(bbl.getWatchedSignal1Alt(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchTurnoutReference"), "2\t");
        if (testName(bbl.getWatchedSignal2(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchTurnoutReference"), "2Alt\t");
        if (testName(bbl.getWatchedSignal2Alt(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "1\t");
        if (testName(bbl.getWatchedSensor1(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "1Alt\t");
        if (testName(bbl.getWatchedSensor1Alt(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "2\t");
        if (testName(bbl.getWatchedSensor2(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        line = MessageFormat.format(rbm.getString("WatchSensorReference"), "2Alt\t");
        if (testName(bbl.getWatchedSensor2Alt(), found, names, line1, null, line, tempText)) {
            found = true;
            referenceCount++;
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "BlockBossLogic"));
        } else {
            text.append("\n");
        }
    }
    tempText = new StringBuilder();
    found = false;
    empty = true;
    jmri.ConditionalManager conditionalManager = InstanceManager.getDefault(jmri.ConditionalManager.class);
    sysNameList = conditionalManager.getSystemNameList();
    iter1 = InstanceManager.getDefault(jmri.LogixManager.class).getSystemNameList().iterator();
    while (iter1.hasNext()) {
        String sName = iter1.next();
        Logix x = InstanceManager.getDefault(jmri.LogixManager.class).getBySystemName(sName);
        for (int i = 0; i < x.getNumConditionals(); i++) {
            sName = x.getConditionalByNumberOrder(i);
            sysNameList.remove(sName);
        }
    }
    iter1 = sysNameList.iterator();
    while (iter1.hasNext()) {
        // get the next Logix
        String sName = iter1.next();
        jmri.Conditional c = conditionalManager.getBySystemName(sName);
        if (c == null) {
            log.error("Error getting Condition - " + sName);
            break;
        }
        String uName = c.getUserName();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", Bundle.getMessage("BeanNameConditional"), uName, sName });
        if (sName.equals(sysName) || uName.equals(userName)) {
            tempText.append(line1);
            tempText.append(MessageFormat.format(rbm.getString("ConditionalReference"), "\t"));
            found = true;
        //referenceCount++; Don't count, this conditional is orphaned by logix(es)
        }
        ArrayList<ConditionalVariable> variableList = c.getCopyOfStateVariables();
        for (int k = 0; k < variableList.size(); k++) {
            ConditionalVariable v = variableList.get(k);
            String line = MessageFormat.format(rbm.getString("VariableReference"), new Object[] { "\t\t", v.getTestTypeString(), v.getDataString() });
            if (testName(v.getName(), found, names, line1, null, line, tempText)) {
                found = true;
            //referenceCount++; Don't count, this conditional is orphaned by logix(es)
            }
        }
        ArrayList<ConditionalAction> actionList = c.getCopyOfActions();
        for (int k = 0; k < actionList.size(); k++) {
            ConditionalAction a = actionList.get(k);
            String line = MessageFormat.format(rbm.getString("ActionReference"), new Object[] { "\t\t", a.getTypeString(), a.getOptionString(false), a.getActionDataString() });
            if (testName(a.getDeviceName(), found, names, line1, null, line, tempText)) {
                found = true;
            //referenceCount++; Don't count, this conditional is orphaned by logix(es)
            }
        }
        if (text != null && found) {
            text.append(tempText.toString());
            tempText = new StringBuilder();
            found = false;
            empty = false;
            line1 = null;
        }
    }
    if (text != null) {
        if (empty) {
            text.append(MessageFormat.format(rbm.getString("NoReference"), "Conditional"));
        }
        text.append("\n");
    }
    found = false;
    empty = true;
    ArrayList<jmri.jmrit.display.Editor> panelList = jmri.jmrit.display.PanelMenu.instance().getEditorPanelList();
    for (int i = 0; i < panelList.size(); i++) {
        jmri.jmrit.display.Editor panelEditor = panelList.get(i);
        name = panelEditor.getTitle();
        String line1 = MessageFormat.format(rbm.getString("ReferenceTitle"), new Object[] { " ", rbm.getString("Panel"), name, name });
        List<Positionable> contents = panelEditor.getContents();
        for (int k = 0; k < contents.size(); k++) {
            Positionable o = contents.get(k);
            if (o.getClass().getName().equals("jmri.jmrit.display.SensorIcon")) {
                name = ((jmri.jmrit.display.SensorIcon) o).getSensor().getSystemName();
                String line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("BeanNameSensor") });
                if (testName(name, found, names, line1, null, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
            } else if (o.getClass().getName().equals("jmri.jmrit.display.TurnoutIcon")) {
                name = ((jmri.jmrit.display.TurnoutIcon) o).getTurnout().getSystemName();
                String line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("BeanNameTurnout") });
                if (testName(name, found, names, line1, null, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
            } else if (o.getClass().getName().equals("jmri.jmrit.display.SignalHeadIcon")) {
                name = ((jmri.jmrit.display.SignalHeadIcon) o).getSignalHead().getSystemName();
                String line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("BeanNameSignalHead") });
                if (testName(name, found, names, line1, null, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
            } else if (o.getClass().getName().equals("jmri.jmrit.display.MultiSensorIcon")) {
                jmri.jmrit.display.MultiSensorIcon msi = (jmri.jmrit.display.MultiSensorIcon) o;
                for (int j = 0; j < msi.getNumEntries(); j++) {
                    name = msi.getSensorName(j);
                    String line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("MultiSensor") });
                    if (testName(name, found, names, line1, null, line, tempText)) {
                        found = true;
                        referenceCount++;
                    }
                }
            } else if (o.getClass().getName().equals("jmri.jmrit.display.IndicatorTurnoutIcon")) {
                jmri.jmrit.display.IndicatorTurnoutIcon ito = (jmri.jmrit.display.IndicatorTurnoutIcon) o;
                name = ito.getTurnout().getSystemName();
                String line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("IndicatorTO") });
                if (testName(name, found, names, line1, null, line, tempText)) {
                    found = true;
                    referenceCount++;
                }
                Sensor sensor = ito.getOccSensor();
                if (sensor != null) {
                    name = sensor.getSystemName();
                    line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("IndicatorTO") });
                    if (testName(name, found, names, line1, null, line, tempText)) {
                        found = true;
                        referenceCount++;
                    }
                }
                jmri.jmrit.logix.OBlock block = ito.getOccBlock();
                if (block != null) {
                    sensor = block.getSensor();
                    if (sensor != null) {
                        name = sensor.getSystemName();
                        line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("IndicatorTO") });
                        if (testName(name, found, names, line1, null, line, tempText)) {
                            found = true;
                            referenceCount++;
                        }
                    }
                }
            } else if (o.getClass().getName().equals("jmri.jmrit.display.IndicatorTrackIcon")) {
                jmri.jmrit.display.IndicatorTrackIcon track = (jmri.jmrit.display.IndicatorTrackIcon) o;
                Sensor sensor = track.getOccSensor();
                if (sensor != null) {
                    name = sensor.getSystemName();
                    String line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("IndicatorTrack") });
                    if (testName(name, found, names, line1, null, line, tempText)) {
                        found = true;
                        referenceCount++;
                    }
                }
                jmri.jmrit.logix.OBlock block = track.getOccBlock();
                if (block != null) {
                    sensor = block.getSensor();
                    if (sensor != null) {
                        name = sensor.getSystemName();
                        String line = MessageFormat.format(rbm.getString("PanelReference"), new Object[] { "\t", Bundle.getMessage("IndicatorTrack") });
                        if (testName(name, found, names, line1, null, line, tempText)) {
                            found = true;
                            referenceCount++;
                        }
                    }
                }
            }
            if (text != null && found) {
                text.append(tempText.toString());
                tempText = new StringBuilder();
                found = false;
                empty = false;
                line1 = null;
            }
        }
        if (text != null) {
            if (empty) {
                text.append(MessageFormat.format(rbm.getString("NoReference"), "Panel"));
            }
        }
    }
    if (text != null) {
        if (referenceCount == 0) {
            text.append(MessageFormat.format(rbm.getString("Orphan"), (Object[]) names));
        } else {
            text.append(MessageFormat.format(rbm.getString("ReferenceFound"), new Object[] { Integer.valueOf(referenceCount), userName, sysName }));
        }
    }
    if (names[0] != null) {
        // The manager is always a listener
        int numListeners = Integer.parseInt(names[3]) - 1;
        // PickLists are also listeners
        numListeners = numListeners - jmri.jmrit.picker.PickListModel.getNumInstances(names[0]);
        if (names[0].equals("Sensor")) {
            // NOI18N
            numListeners = numListeners - jmri.jmrit.picker.PickListModel.getNumInstances("MultiSensor");
        }
        if (numListeners > referenceCount) {
            if (names[0].length() == 0) {
                names[0] = "Unknown Type?";
            }
            /*
                 JOptionPane.showMessageDialog(null,
                 MessageFormat.format(rbm.getString("OrphanName"), (Object[])names)+" has "+numListeners+
                 " listeners installed and only "+referenceCount+
                 " references found.\n"+names[0]+
                 " Tables are listeneners.  Check that the table is closed.",
                 rbm.getString("infoTitle"), JOptionPane.INFORMATION_MESSAGE);
                 */
            if (text != null) {
                text.append(MessageFormat.format(rbm.getString("OrphanName"), (Object[]) names) + " has " + numListeners + " listeners installed and only " + referenceCount + " references found.\n" + names[0] + " Tables are listeneners.  Check that the table is closed.");
            }
        }
    }
    return (referenceCount > 0);
}
Also used : Sensor(jmri.Sensor) Conditional(jmri.Conditional) Conditional(jmri.Conditional) Block(jmri.Block) Logix(jmri.Logix) LayoutBlockManager(jmri.jmrit.display.layoutEditor.LayoutBlockManager) Block(jmri.Block) Sensor(jmri.Sensor) ConditionalAction(jmri.ConditionalAction) ConditionalVariable(jmri.ConditionalVariable) BlockBossLogic(jmri.jmrit.blockboss.BlockBossLogic) Positionable(jmri.jmrit.display.Positionable)

Example 7 with ConditionalAction

use of jmri.ConditionalAction in project JMRI by JMRI.

the class LogixTableAction method buildConditionalListing.

/**
     * Builds the text representing the current conditionals for the selected
     * Logix statement
     */
void buildConditionalListing() {
    String showSystemName, showCondName, condName, operand, tStr;
    ConditionalVariable variable;
    ConditionalAction action;
    numConditionals = _curLogix.getNumConditionals();
    showSystemName = _curLogix.getSystemName();
    condText.setText(null);
    for (int rx = 0; rx < numConditionals; rx++) {
        conditionalRowNumber = rx;
        _curConditional = _conditionalManager.getBySystemName(_curLogix.getConditionalByNumberOrder(rx));
        _variableList = _curConditional.getCopyOfStateVariables();
        _logixSysName = _curConditional.getSystemName();
        _actionList = _curConditional.getCopyOfActions();
        showCondName = _curConditional.getUserName();
        if (showCondName == null) {
            showCondName = "";
        }
        showSystemName = _curConditional.getSystemName();
        // If no user name for a conditional, create one using C + row number
        if (showCondName.equals("")) {
            showCondName = "C" + (rx + 1);
        }
        condText.append("\n   " + showSystemName + "  " + showCondName + "\n");
        if (_curConditional.getLogicType() == Conditional.MIXED) {
            _antecedent = _curConditional.getAntecedentExpression();
            condText.append("   " + rbx.getString("BrowserAntecedent") + " " + _antecedent + "\n");
        }
        for (int i = 0; i < _variableList.size(); i++) {
            variable = _variableList.get(i);
            tStr = "        ";
            // Makes {Rx}bb or {Rxx}b
            tStr = tStr + " R" + (i + 1) + (i > 9 ? "" : "  ");
            condText.append(tStr);
            operand = variable.getOpernString();
            if (i == 0) {
                // add the IF to the first conditional
                condText.append(rbx.getString("BrowserIF") + " " + operand + " ");
            } else {
                condText.append(" " + operand + " ");
            }
            if (variable.isNegated()) {
                condText.append(rbx.getString("LogicNOT") + " ");
            }
            condText.append(variable.toString() + "\n");
        }
        if (_actionList.size() > 0) {
            condText.append("              " + rbx.getString("BrowserTHEN") + "\n");
            for (int i = 0; i < _actionList.size(); i++) {
                action = _actionList.get(i);
                condName = action.description(false);
                condText.append("                 " + condName + "\n");
            }
        // for _actionList
        } else {
            condText.append("            " + rbx.getString("BrowserNoAction") + "\n");
        }
    }
    // for numConditionals
    condText.setCaretPosition(0);
}
Also used : ConditionalAction(jmri.ConditionalAction) DefaultConditionalAction(jmri.implementation.DefaultConditionalAction) ConditionalVariable(jmri.ConditionalVariable)

Example 8 with ConditionalAction

use of jmri.ConditionalAction in project JMRI by JMRI.

the class SensorGroupConditional method calculate.

@SuppressWarnings("null")
@Override
public int calculate(boolean enabled, PropertyChangeEvent evt) {
    int currentState = super.calculate(false, evt);
    if (!enabled || evt == null) {
        return currentState;
    }
    String listener = ((Sensor) evt.getSource()).getSystemName();
    log.debug("SGConditional \"" + getUserName() + "\" (" + getSystemName() + ") has event from \"" + listener + "\"");
    if (Sensor.INACTIVE == ((Integer) evt.getNewValue()).intValue()) {
        return currentState;
    }
    for (int i = 0; i < _actionList.size(); i++) {
        ConditionalAction action = _actionList.get(i);
        Sensor sn = InstanceManager.sensorManagerInstance().getSensor(action.getDeviceName());
        if (sn == null) {
            log.error("invalid sensor name in action - " + action.getDeviceName());
        }
        if (// don't change who triggered the action
        !listener.equals(action.getDeviceName())) {
            // find the old one and reset it
            if (sn.getState() != action.getActionData()) {
                try {
                    sn.setKnownState(action.getActionData());
                } catch (JmriException e) {
                    log.warn("Exception setting sensor " + action.getDeviceName() + " in action");
                }
            }
        }
    }
    log.debug("SGConditional \"" + getUserName() + "\" (" + getSystemName() + "), state= " + currentState + "has set the group actions for " + listener);
    return currentState;
}
Also used : ConditionalAction(jmri.ConditionalAction) JmriException(jmri.JmriException) Sensor(jmri.Sensor)

Example 9 with ConditionalAction

use of jmri.ConditionalAction in project JMRI by JMRI.

the class RouteTableAction method cloneActionList.

ArrayList<ConditionalAction> cloneActionList(ArrayList<ConditionalAction> actionList, int option) {
    ArrayList<ConditionalAction> list = new ArrayList<>();
    for (int i = 0; i < actionList.size(); i++) {
        ConditionalAction action = actionList.get(i);
        ConditionalAction clone = new DefaultConditionalAction();
        clone.setType(action.getType());
        clone.setOption(option);
        clone.setDeviceName(action.getDeviceName());
        clone.setActionData(action.getActionData());
        clone.setActionString(action.getActionString());
        list.add(clone);
    }
    return list;
}
Also used : DefaultConditionalAction(jmri.implementation.DefaultConditionalAction) ConditionalAction(jmri.ConditionalAction) DefaultConditionalAction(jmri.implementation.DefaultConditionalAction) ArrayList(java.util.ArrayList)

Example 10 with ConditionalAction

use of jmri.ConditionalAction in project JMRI by JMRI.

the class RouteTableAction method exportPressed.

/////////////////////// Export to Logix ////////////////////////////
/**
     * Responds to the Export button - export to Logix.
     *
     * @param e the action event
     */
void exportPressed(ActionEvent e) {
    curRoute = checkNamesOK();
    String sName = _systemName.getText();
    if (sName.length() == 0) {
        sName = fixedSystemName.getText();
    }
    String uName = _userName.getText();
    String logixSystemName = LOGIX_SYS_NAME + sName;
    Logix logix = InstanceManager.getDefault(jmri.LogixManager.class).getBySystemName(logixSystemName);
    if (logix == null) {
        logix = InstanceManager.getDefault(jmri.LogixManager.class).createNewLogix(logixSystemName, uName);
        if (logix == null) {
            log.error("Failed to create Logix " + logixSystemName + ", " + uName);
            return;
        }
    }
    logix.deActivateLogix();
    initializeIncludedList();
    /////////////////// Construct output actions for change to true //////////////////////
    ArrayList<ConditionalAction> actionList = new ArrayList<>();
    for (int i = 0; i < _includedSensorList.size(); i++) {
        RouteSensor rSensor = _includedSensorList.get(i);
        String name = rSensor.getUserName();
        if (name == null || name.length() == 0) {
            name = rSensor.getSysName();
        }
        actionList.add(new DefaultConditionalAction(Conditional.ACTION_OPTION_ON_CHANGE_TO_TRUE, Conditional.ACTION_SET_SENSOR, name, rSensor.getState(), ""));
    }
    for (int i = 0; i < _includedTurnoutList.size(); i++) {
        RouteTurnout rTurnout = _includedTurnoutList.get(i);
        String name = rTurnout.getUserName();
        if (name == null || name.length() == 0) {
            name = rTurnout.getSysName();
        }
        actionList.add(new DefaultConditionalAction(Conditional.ACTION_OPTION_ON_CHANGE_TO_TRUE, Conditional.ACTION_SET_TURNOUT, name, rTurnout.getState(), ""));
    }
    String file = soundFile.getText();
    if (file.length() > 0) {
        actionList.add(new DefaultConditionalAction(Conditional.ACTION_OPTION_ON_CHANGE_TO_TRUE, Conditional.ACTION_RUN_SCRIPT, "", -1, file));
    }
    file = scriptFile.getText();
    if (file.length() > 0) {
        actionList.add(new DefaultConditionalAction(Conditional.ACTION_OPTION_ON_CHANGE_TO_TRUE, Conditional.ACTION_PLAY_SOUND, "", -1, file));
    }
    ///// Construct 'AND' clause from 'VETO' controls ////////
    ArrayList<ConditionalVariable> vetoList = new ArrayList<>();
    // String andClause = null;
    ConditionalVariable cVar = makeCtrlSensorVar(sensor1, sensor1mode, true, false);
    if (cVar != null) {
        vetoList.add(cVar);
    }
    cVar = makeCtrlSensorVar(sensor2, sensor2mode, true, false);
    if (cVar != null) {
        vetoList.add(cVar);
    }
    cVar = makeCtrlSensorVar(sensor3, sensor3mode, true, false);
    if (cVar != null) {
        vetoList.add(cVar);
    }
    cVar = makeCtrlTurnoutVar(cTurnout, cTurnoutStateBox, true, false);
    if (cVar != null) {
        vetoList.add(cVar);
    }
    // remove old Conditionals for actions (ver 2.5.2 only -remove a bad idea)
    char[] ch = sName.toCharArray();
    int hash = 0;
    for (int i = 0; i < ch.length; i++) {
        hash += ch[i];
    }
    String cSystemName = CONDITIONAL_SYS_PREFIX + "T" + hash;
    removeConditionals(cSystemName, logix);
    cSystemName = CONDITIONAL_SYS_PREFIX + "F" + hash;
    removeConditionals(cSystemName, logix);
    cSystemName = CONDITIONAL_SYS_PREFIX + "A" + hash;
    removeConditionals(cSystemName, logix);
    cSystemName = CONDITIONAL_SYS_PREFIX + "L" + hash;
    removeConditionals(cSystemName, logix);
    int n = 0;
    do {
        n++;
        cSystemName = logixSystemName + n + "A";
    } while (removeConditionals(cSystemName, logix));
    n = 0;
    do {
        n++;
        cSystemName = logixSystemName + n + "T";
    } while (removeConditionals(cSystemName, logix));
    cSystemName = logixSystemName + "L";
    removeConditionals(cSystemName, logix);
    String cUserName;
    ///////////////// Make Trigger Conditionals //////////////////////
    //ArrayList <ConditionalVariable> onChangeList = new ArrayList<ConditionalVariable>();
    // passed through all these, with new value returned each time
    int numConds = 1;
    numConds = makeSensorConditional(sensor1, sensor1mode, numConds, false, actionList, vetoList, logix, logixSystemName, uName);
    numConds = makeSensorConditional(sensor2, sensor2mode, numConds, false, actionList, vetoList, logix, logixSystemName, uName);
    numConds = makeSensorConditional(sensor3, sensor3mode, numConds, false, actionList, vetoList, logix, logixSystemName, uName);
    numConds = makeTurnoutConditional(cTurnout, cTurnoutStateBox, numConds, false, actionList, vetoList, logix, logixSystemName, uName);
    ////// Construct actions for false from the 'any change' controls ////////////
    numConds = makeSensorConditional(sensor1, sensor1mode, numConds, true, actionList, vetoList, logix, logixSystemName, uName);
    numConds = makeSensorConditional(sensor2, sensor2mode, numConds, true, actionList, vetoList, logix, logixSystemName, uName);
    numConds = makeSensorConditional(sensor3, sensor3mode, numConds, true, actionList, vetoList, logix, logixSystemName, uName);
    numConds = makeTurnoutConditional(cTurnout, cTurnoutStateBox, numConds, true, actionList, vetoList, logix, logixSystemName, uName);
    log.debug("Final number of conditionals: {}", numConds);
    //String sensorSystemName = turnoutsAlignedSensor.getText();
    if (turnoutsAlignedSensor.getSelectedBean() != null) {
        // verify name (logix doesn't use "provideXXX") 
        //Sensor s = turnoutsAlignedSensor.getSelectedBean();
        /*if (s == null) {
             s = InstanceManager.sensorManagerInstance().getBySystemName(sensorSystemName);
             }*/
        //if (s != null) {
        String sensorSystemName = turnoutsAlignedSensor.getSelectedDisplayName();
        // NOI18N
        cSystemName = logixSystemName + "1A";
        // NOI18N
        cUserName = turnoutsAlignedSensor.getSelectedDisplayName() + "A " + uName;
        ArrayList<ConditionalVariable> variableList = new ArrayList<>();
        for (int i = 0; i < _includedTurnoutList.size(); i++) {
            RouteTurnout rTurnout = _includedTurnoutList.get(i);
            String name = rTurnout.getUserName();
            if (name == null || name.length() == 0) {
                name = rTurnout.getSysName();
            }
            // exclude toggled outputs
            switch(rTurnout.getState()) {
                case Turnout.CLOSED:
                    variableList.add(new ConditionalVariable(false, Conditional.OPERATOR_AND, Conditional.TYPE_TURNOUT_CLOSED, name, true));
                    break;
                case Turnout.THROWN:
                    variableList.add(new ConditionalVariable(false, Conditional.OPERATOR_AND, Conditional.TYPE_TURNOUT_THROWN, name, true));
                    break;
                default:
                    // NOI18N
                    log.warn("Turnout {} was {}, neither CLOSED nor THROWN; not handled", name, rTurnout.getState());
            }
        }
        actionList = new ArrayList<>();
        actionList.add(new DefaultConditionalAction(Conditional.ACTION_OPTION_ON_CHANGE_TO_TRUE, Conditional.ACTION_SET_SENSOR, sensorSystemName, Sensor.ACTIVE, ""));
        actionList.add(new DefaultConditionalAction(Conditional.ACTION_OPTION_ON_CHANGE_TO_FALSE, Conditional.ACTION_SET_SENSOR, sensorSystemName, Sensor.INACTIVE, ""));
        Conditional c = InstanceManager.getDefault(jmri.ConditionalManager.class).createNewConditional(cSystemName, cUserName);
        c.setStateVariables(variableList);
        c.setLogicType(Conditional.ALL_AND, "");
        c.setAction(actionList);
        logix.addConditional(cSystemName, 0);
        c.calculate(true, null);
    //}
    }
    ///////////////// Set lock turnout information if there is any //////////////////////////
    if (cLockTurnout.getSelectedBean() != null) {
        String turnoutLockSystemName = cLockTurnout.getSelectedDisplayName();
        // verify name (logix doesn't use "provideXXX") 
        // NOI18N
        cSystemName = logixSystemName + "1L";
        // NOI18N
        cUserName = turnoutLockSystemName + "L " + uName;
        ArrayList<ConditionalVariable> variableList = new ArrayList<>();
        //String devName = cTurnout.getText();
        int mode = turnoutModeFromBox(cTurnoutStateBox);
        int type = Conditional.TYPE_TURNOUT_CLOSED;
        if (mode == Route.ONTHROWN) {
            type = Conditional.TYPE_TURNOUT_THROWN;
        }
        variableList.add(new ConditionalVariable(false, Conditional.OPERATOR_NONE, type, turnoutLockSystemName, true));
        actionList = new ArrayList<>();
        int option = Conditional.ACTION_OPTION_ON_CHANGE_TO_TRUE;
        type = Turnout.LOCKED;
        if (mode == Route.ONCHANGE) {
            option = Conditional.ACTION_OPTION_ON_CHANGE;
            type = Route.TOGGLE;
        }
        for (int i = 0; i < _includedTurnoutList.size(); i++) {
            RouteTurnout rTurnout = _includedTurnoutList.get(i);
            String name = rTurnout.getUserName();
            if (name == null || name.length() == 0) {
                name = rTurnout.getSysName();
            }
            actionList.add(new DefaultConditionalAction(option, Conditional.ACTION_LOCK_TURNOUT, name, type, ""));
        }
        if (mode != Route.ONCHANGE) {
            // add non-toggle actions on
            option = Conditional.ACTION_OPTION_ON_CHANGE_TO_FALSE;
            type = Turnout.UNLOCKED;
            for (int i = 0; i < _includedTurnoutList.size(); i++) {
                RouteTurnout rTurnout = _includedTurnoutList.get(i);
                String name = rTurnout.getUserName();
                if (name == null || name.length() == 0) {
                    name = rTurnout.getSysName();
                }
                actionList.add(new DefaultConditionalAction(option, Conditional.ACTION_LOCK_TURNOUT, name, type, ""));
            }
        }
        // add new Conditionals for action on 'locks'
        Conditional c = InstanceManager.getDefault(jmri.ConditionalManager.class).createNewConditional(cSystemName, cUserName);
        c.setStateVariables(variableList);
        c.setLogicType(Conditional.ALL_AND, "");
        c.setAction(actionList);
        logix.addConditional(cSystemName, 0);
        c.calculate(true, null);
    }
    logix.activateLogix();
    if (curRoute != null) {
        jmri.InstanceManager.getDefault(jmri.RouteManager.class).deleteRoute(curRoute);
        curRoute = null;
    }
    status1.setText(Bundle.getMessage("BeanNameRoute") + "\"" + uName + "\" " + Bundle.getMessage("RouteAddStatusExported") + " (" + _includedTurnoutList.size() + Bundle.getMessage("Turnouts") + ", " + _includedSensorList.size() + " " + Bundle.getMessage("Sensors") + ")");
    finishUpdate();
}
Also used : DefaultConditionalAction(jmri.implementation.DefaultConditionalAction) ArrayList(java.util.ArrayList) Conditional(jmri.Conditional) ConditionalVariable(jmri.ConditionalVariable) Logix(jmri.Logix) ConditionalAction(jmri.ConditionalAction) DefaultConditionalAction(jmri.implementation.DefaultConditionalAction)

Aggregations

ConditionalAction (jmri.ConditionalAction)19 DefaultConditionalAction (jmri.implementation.DefaultConditionalAction)14 Conditional (jmri.Conditional)10 ConditionalVariable (jmri.ConditionalVariable)10 ArrayList (java.util.ArrayList)8 Logix (jmri.Logix)7 ConditionalManager (jmri.ConditionalManager)3 Sensor (jmri.Sensor)3 Audio (jmri.Audio)2 JmriException (jmri.JmriException)2 DefaultConditional (jmri.implementation.DefaultConditional)2 DefaultConditionalManager (jmri.managers.DefaultConditionalManager)2 Element (org.jdom2.Element)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 File (java.io.File)1 Date (java.util.Date)1 ScriptException (javax.script.ScriptException)1 DefaultListModel (javax.swing.DefaultListModel)1 JFileChooser (javax.swing.JFileChooser)1 Timer (javax.swing.Timer)1