Search in sources :

Example 1 with AcelaNode

use of jmri.jmrix.acela.AcelaNode in project JMRI by JMRI.

the class SignalHeadTableAction method updatePressed.

@SuppressWarnings("fallthrough")
@SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH")
void updatePressed(ActionEvent e) {
    String nam = eUserName.getText();
    // check if user name changed
    String uname = curS.getUserName();
    // TODO: not sure this if statement is right. I think (uname != null && !uname.equals(nam))
    if (!((uname != null) && (uname.equals(nam)))) {
        if (checkUserName(nam)) {
            curS.setUserName(nam);
        } else {
            return;
        }
    }
    // update according to class of signal head
    if (className.equals("jmri.implementation.QuadOutputSignalHead")) {
        Turnout t1 = updateTurnoutFromPanel(eto1, "SignalHead:" + eSysNameLabel.getText() + ":Green", ((QuadOutputSignalHead) curS).getGreen().getBean(), ev1Border.getTitle());
        if (t1 == null) {
            return;
        } else {
            ((QuadOutputSignalHead) curS).setGreen(nbhm.getNamedBeanHandle(eto1.getDisplayName(), t1));
        }
        Turnout t2 = updateTurnoutFromPanel(eto2, "SignalHead:" + eSysNameLabel.getText() + ":Yellow", ((QuadOutputSignalHead) curS).getYellow().getBean(), ev2Border.getTitle());
        if (t2 == null) {
            return;
        } else {
            ((QuadOutputSignalHead) curS).setYellow(nbhm.getNamedBeanHandle(eto2.getDisplayName(), t2));
        }
        Turnout t3 = updateTurnoutFromPanel(eto3, "SignalHead:" + eSysNameLabel.getText() + ":Red", ((QuadOutputSignalHead) curS).getRed().getBean(), ev3Border.getTitle());
        if (t3 == null) {
            return;
        } else {
            ((QuadOutputSignalHead) curS).setRed(nbhm.getNamedBeanHandle(eto3.getDisplayName(), t3));
        }
        Turnout t4 = updateTurnoutFromPanel(eto4, "SignalHead:" + eSysNameLabel.getText() + ":Lunar", ((QuadOutputSignalHead) curS).getLunar().getBean(), ev4Border.getTitle());
        if (t4 == null) {
            return;
        } else {
            ((QuadOutputSignalHead) curS).setLunar(nbhm.getNamedBeanHandle(eto4.getDisplayName(), t4));
        }
    } else if (className.equals("jmri.implementation.TripleTurnoutSignalHead")) {
        Turnout t1 = updateTurnoutFromPanel(eto1, "SignalHead:" + eSysNameLabel.getText() + ":Green", ((TripleTurnoutSignalHead) curS).getGreen().getBean(), ev1Border.getTitle());
        if (t1 == null) {
            return;
        } else {
            ((TripleTurnoutSignalHead) curS).setGreen(nbhm.getNamedBeanHandle(eto1.getDisplayName(), t1));
        }
        Turnout t2 = updateTurnoutFromPanel(eto2, "SignalHead:" + eSysNameLabel.getText() + ":Yellow", ((TripleTurnoutSignalHead) curS).getYellow().getBean(), ev2Border.getTitle());
        if (t2 == null) {
            return;
        } else {
            ((TripleTurnoutSignalHead) curS).setYellow(nbhm.getNamedBeanHandle(eto2.getDisplayName(), t2));
        }
        Turnout t3 = updateTurnoutFromPanel(eto3, "SignalHead:" + eSysNameLabel.getText() + ":Red", ((TripleTurnoutSignalHead) curS).getRed().getBean(), ev3Border.getTitle());
        if (t3 == null) {
            return;
        } else {
            ((TripleTurnoutSignalHead) curS).setRed(nbhm.getNamedBeanHandle(eto3.getDisplayName(), t3));
        }
    } else if (className.equals("jmri.implementation.TripleOutputSignalHead")) {
        Turnout t1 = updateTurnoutFromPanel(eto1, "SignalHead:" + eSysNameLabel.getText() + ":Green", ((TripleOutputSignalHead) curS).getGreen().getBean(), ev1Border.getTitle());
        if (t1 == null) {
            return;
        } else {
            ((TripleOutputSignalHead) curS).setGreen(nbhm.getNamedBeanHandle(eto1.getDisplayName(), t1));
        }
        Turnout t2 = updateTurnoutFromPanel(eto2, "SignalHead:" + eSysNameLabel.getText() + ":Blue", ((TripleOutputSignalHead) curS).getBlue().getBean(), ev2Border.getTitle());
        if (t2 == null) {
            return;
        } else {
            ((TripleOutputSignalHead) curS).setBlue(nbhm.getNamedBeanHandle(eto2.getDisplayName(), t2));
        }
        Turnout t3 = updateTurnoutFromPanel(eto3, "SignalHead:" + eSysNameLabel.getText() + ":Red", ((TripleOutputSignalHead) curS).getRed().getBean(), ev3Border.getTitle());
        if (t3 == null) {
            return;
        } else {
            ((TripleOutputSignalHead) curS).setRed(nbhm.getNamedBeanHandle(eto3.getDisplayName(), t3));
        }
    } else if (className.equals("jmri.implementation.DoubleTurnoutSignalHead")) {
        Turnout t1 = updateTurnoutFromPanel(eto1, "SignalHead:" + eSysNameLabel.getText() + ":Green", ((DoubleTurnoutSignalHead) curS).getGreen().getBean(), ev1Border.getTitle());
        Turnout t2 = updateTurnoutFromPanel(eto2, "SignalHead:" + eSysNameLabel.getText() + ":Red", ((DoubleTurnoutSignalHead) curS).getRed().getBean(), ev2Border.getTitle());
        if (t1 == null) {
            return;
        } else {
            ((DoubleTurnoutSignalHead) curS).setGreen(nbhm.getNamedBeanHandle(eto1.getDisplayName(), t1));
        }
        if (t2 == null) {
            return;
        } else {
            ((DoubleTurnoutSignalHead) curS).setRed(nbhm.getNamedBeanHandle(eto2.getDisplayName(), t2));
        }
    } else if (className.equals("jmri.implementation.SingleTurnoutSignalHead")) {
        Turnout t1 = updateTurnoutFromPanel(eto1, "SignalHead:" + eSysNameLabel.getText() + ":" + (String) es2aBox.getSelectedItem() + ":" + (String) es3aBox.getSelectedItem(), ((SingleTurnoutSignalHead) curS).getOutput().getBean(), ev1Border.getTitle());
        if (t1 == null) {
            noTurnoutMessage(ev1Border.getTitle(), eto1.getDisplayName());
            return;
        }
        ((SingleTurnoutSignalHead) curS).setOutput(nbhm.getNamedBeanHandle(eto1.getDisplayName(), t1));
        ((SingleTurnoutSignalHead) curS).setOnAppearance(signalStateFromBox(es2aBox));
        ((SingleTurnoutSignalHead) curS).setOffAppearance(signalStateFromBox(es3aBox));
    } else if (className.equals("jmri.implementation.LsDecSignalHead")) {
        Turnout t1 = updateTurnoutFromPanel(eto1, "SignalHead:" + eSysNameLabel.getText() + ":Green", ((jmri.implementation.LsDecSignalHead) curS).getGreen().getBean(), ev1Border.getTitle());
        if (t1 == null) {
            return;
        } else {
            ((jmri.implementation.LsDecSignalHead) curS).setGreen(nbhm.getNamedBeanHandle(eto1.getDisplayName(), t1));
            ((jmri.implementation.LsDecSignalHead) curS).setGreenState(turnoutStateFromBox(es1Box));
        }
        Turnout t2 = updateTurnoutFromPanel(eto2, "SignalHead:" + eSysNameLabel.getText() + ":Yellow", ((jmri.implementation.LsDecSignalHead) curS).getYellow().getBean(), ev2Border.getTitle());
        if (t2 == null) {
            return;
        } else {
            ((jmri.implementation.LsDecSignalHead) curS).setYellow(nbhm.getNamedBeanHandle(eto2.getDisplayName(), t2));
            ((jmri.implementation.LsDecSignalHead) curS).setYellowState(turnoutStateFromBox(es2Box));
        }
        Turnout t3 = updateTurnoutFromPanel(eto3, "SignalHead:" + eSysNameLabel.getText() + ":Red", ((jmri.implementation.LsDecSignalHead) curS).getRed().getBean(), ev3Border.getTitle());
        if (t3 == null) {
            return;
        } else {
            ((jmri.implementation.LsDecSignalHead) curS).setRed(nbhm.getNamedBeanHandle(eto3.getDisplayName(), t3));
            ((jmri.implementation.LsDecSignalHead) curS).setRedState(turnoutStateFromBox(es3Box));
        }
        Turnout t4 = updateTurnoutFromPanel(eto4, "SignalHead:" + eSysNameLabel.getText() + ":FlashGreen", ((jmri.implementation.LsDecSignalHead) curS).getFlashGreen().getBean(), ev4Border.getTitle());
        if (t4 == null) {
            return;
        } else {
            ((jmri.implementation.LsDecSignalHead) curS).setFlashGreen(nbhm.getNamedBeanHandle(eto4.getDisplayName(), t4));
            ((jmri.implementation.LsDecSignalHead) curS).setFlashGreenState(turnoutStateFromBox(es4Box));
        }
        Turnout t5 = updateTurnoutFromPanel(eto5, "SignalHead:" + eSysNameLabel.getText() + ":FlashYellow", ((jmri.implementation.LsDecSignalHead) curS).getFlashYellow().getBean(), ev5Border.getTitle());
        if (t5 == null) {
            return;
        } else {
            ((jmri.implementation.LsDecSignalHead) curS).setFlashYellow(nbhm.getNamedBeanHandle(eto5.getDisplayName(), t5));
            ((jmri.implementation.LsDecSignalHead) curS).setFlashYellowState(turnoutStateFromBox(es5Box));
        }
        Turnout t6 = updateTurnoutFromPanel(eto6, "SignalHead:" + eSysNameLabel.getText() + ":FlashRed", ((jmri.implementation.LsDecSignalHead) curS).getFlashRed().getBean(), ev6Border.getTitle());
        if (t6 == null) {
            return;
        } else {
            ((jmri.implementation.LsDecSignalHead) curS).setFlashRed(nbhm.getNamedBeanHandle(eto6.getDisplayName(), t6));
            ((jmri.implementation.LsDecSignalHead) curS).setFlashRedState(turnoutStateFromBox(es6Box));
        }
        Turnout t7 = updateTurnoutFromPanel(eto7, "SignalHead:" + eSysNameLabel.getText() + ":Dark", ((jmri.implementation.LsDecSignalHead) curS).getDark().getBean(), ev7Border.getTitle());
        if (t7 == null) {
            return;
        } else {
            ((jmri.implementation.LsDecSignalHead) curS).setDark(nbhm.getNamedBeanHandle(eto7.getDisplayName(), t7));
            ((jmri.implementation.LsDecSignalHead) curS).setDarkState(turnoutStateFromBox(es7Box));
        }
    } else if (className.equals("jmri.implementation.SE8cSignalHead")) {
        handleSE8cUpdatePressed();
    } else if (className.equals("jmri.jmrix.grapevine.SerialSignalHead")) {
    /*String nam = eUserName.getText();
             // check if user name changed
             if (!((curS.getUserName()!=null) && (curS.getUserName().equals(nam)))) {
             if(checkUserName(nam))
             curS.setUserName(nam);
             }*/
    } else if (className.equals("jmri.jmrix.acela.AcelaSignalHead")) {
        /*String nam = eUserName.getText();
             // check if user name changed
             if (!((curS.getUserName()!=null) && (curS.getUserName().equals(nam)))) {
             if(checkUserName(nam))
             curS.setUserName(nam);

             }*/
        AcelaNode tNode = AcelaAddress.getNodeFromSystemName(curS.getSystemName(), jmri.InstanceManager.getDefault(jmri.jmrix.acela.AcelaSystemConnectionMemo.class));
        if (tNode == null) {
            // node does not exist, ignore call
            log.error("Can't find new Acela Signal with name '{}'", curS.getSystemName());
            return;
        }
        int headnumber = Integer.parseInt(curS.getSystemName().substring(2, curS.getSystemName().length()));
        tNode.setOutputSignalHeadTypeString(headnumber, estBox.getSelectedItem().toString());
    //          setSignalheadTypeInBox(estBox, tNode.getOutputSignalHeadType(headnumber), signalheadTypeValues);
    //          ((jmri.AcelaSignalHead)curS).setDarkState(signalheadTypeFromBox(estBox));
    } else if (className.equals("jmri.implementation.MergSD2SignalHead")) {
        switch(ukSignalAspectsFromBox(emsaBox)) {
            case 4:
                Turnout t3 = updateTurnoutFromPanel(eto5, (Bundle.getMessage("OutputComment", Bundle.getMessage("BeanNameSignalHead"), eSysNameLabel.getText(), Bundle.getMessage("InputNum", "3"))), ((jmri.implementation.MergSD2SignalHead) curS).getInput3().getBean(), ev5Border.getTitle());
                if (t3 == null) {
                    return;
                } else {
                    ((jmri.implementation.MergSD2SignalHead) curS).setInput3(nbhm.getNamedBeanHandle(eto5.getDisplayName(), t3));
                }
            // fall through
            case 3:
                Turnout t2 = updateTurnoutFromPanel(eto4, (Bundle.getMessage("OutputComment", Bundle.getMessage("BeanNameSignalHead"), eSysNameLabel.getText(), Bundle.getMessage("InputNum", "2"))), ((jmri.implementation.MergSD2SignalHead) curS).getInput2().getBean(), ev4Border.getTitle());
                if (t2 == null) {
                    return;
                } else {
                    ((jmri.implementation.MergSD2SignalHead) curS).setInput2(nbhm.getNamedBeanHandle(eto4.getDisplayName(), t2));
                }
            // fall through
            case 2:
                Turnout t1 = updateTurnoutFromPanel(eto3, (Bundle.getMessage("OutputComment", Bundle.getMessage("BeanNameSignalHead"), eSysNameLabel.getText(), Bundle.getMessage("InputNum", "1"))), ((jmri.implementation.MergSD2SignalHead) curS).getInput1().getBean(), ev3Border.getTitle());
                if (t1 == null) {
                    return;
                } else {
                    ((jmri.implementation.MergSD2SignalHead) curS).setInput1(nbhm.getNamedBeanHandle(eto3.getDisplayName(), t1));
                }
                ((jmri.implementation.MergSD2SignalHead) curS).setAspects(ukSignalAspectsFromBox(emsaBox));
                if (ukSignalTypeFromBox(emstBox).equals("Distant")) {
                    ((jmri.implementation.MergSD2SignalHead) curS).setHome(false);
                } else {
                    ((jmri.implementation.MergSD2SignalHead) curS).setHome(true);
                }
            default:
                break;
        }
    //Need to add the code here for update!
    } else if (className.equals("jmri.implementation.DccSignalHead")) {
        for (int i = 0; i < dccAspectEdt.length; i++) {
            int number = (Integer) dccAspectEdt[i].getValue();
            try {
                ((DccSignalHead) curS).setOutputForAppearance(((DccSignalHead) curS).getValidStates()[i], number);
            } catch (Exception ex) {
                //in theory JSpinner should already have caught a number conversion error.
                log.error(ex.toString());
            }
        }
        ((DccSignalHead) curS).useAddressOffSet(dccOffSetAddressEdt.isSelected());
    } else {
        log.error("Internal error - cannot update signal of type " + className);
    }
    // successful
    editFrame.setVisible(false);
    editingHead = false;
}
Also used : AcelaNode(jmri.jmrix.acela.AcelaNode) TripleOutputSignalHead(jmri.implementation.TripleOutputSignalHead) SingleTurnoutSignalHead(jmri.implementation.SingleTurnoutSignalHead) QuadOutputSignalHead(jmri.implementation.QuadOutputSignalHead) Turnout(jmri.Turnout) DccSignalHead(jmri.implementation.DccSignalHead) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 2 with AcelaNode

use of jmri.jmrix.acela.AcelaNode in project JMRI by JMRI.

the class NodeConfigFrame method initComponents.

/**
     * Initialize the config window
     */
@SuppressFBWarnings(value = "SBSC_USE_STRINGBUFFER_CONCATENATION")
// though it would be good to fix it if you're working in this area
@Override
public void initComponents() {
    setTitle(rb.getString("WindowTitle"));
    //        Container contentPane = getContentPane();
    contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    // Set up node address and node type
    JPanel panel1 = new JPanel();
    panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));
    // Copy and pasted from the info button
    String nodesstring = "";
    int tempnumnodes = _memo.getTrafficController().getNumNodes();
    for (int i = 0; i < tempnumnodes; i++) {
        AcelaNode tempnode;
        tempnode = (AcelaNode) _memo.getTrafficController().getNodeFromAddress(i);
        nodesstring = nodesstring + " " + tempnode.getNodeTypeString();
    }
    thenodesStaticC.setText(nodesstring);
    // panelthenodes displays the current node configuration and polling result
    JPanel panelthenodes = new JPanel();
    panelthenodes.setLayout(new BoxLayout(panelthenodes, BoxLayout.Y_AXIS));
    JPanel panelthenodes1 = new JPanel();
    panelthenodes1.setLayout(new FlowLayout());
    panelthenodes1.add(new JLabel("    The nodes: "));
    panelthenodes1.add(thenodesStaticH);
    panelthenodes.add(panelthenodes1);
    JPanel panelthenodes2 = new JPanel();
    panelthenodes2.setLayout(new FlowLayout());
    panelthenodes2.add(new JLabel("As Configured: "));
    panelthenodes2.add(thenodesStaticC);
    panelthenodes.add(panelthenodes2);
    JPanel panelthenodes3 = new JPanel();
    panelthenodes3.setLayout(new FlowLayout());
    panelthenodes3.add(new JLabel("    As Polled: "));
    panelthenodes3.add(thenodesStaticP);
    panelthenodes.add(panelthenodes3);
    Border panelthenodesBorder = BorderFactory.createEtchedBorder();
    Border panelthenodesTitled = BorderFactory.createTitledBorder(panelthenodesBorder, rb.getString("BoxLabelNodes"));
    panelthenodes.setBorder(panelthenodesTitled);
    contentPane.add(panelthenodes);
    // panel11 is the node address
    JPanel panel11 = new JPanel();
    panel11.setLayout(new FlowLayout());
    panel11.add(new JLabel(rb.getString("LabelNodeAddress") + " "));
    nodeAddrBox = new JComboBox<String>(AcelaNode.getNodeNames());
    nodeAddrBox.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent event) {
            infoButtonActionPerformed();
        }
    });
    panel11.add(nodeAddrBox);
    panel11.add(nodeAddrField);
    //        nodeAddrField.setToolTipText(rb.getString("TipNodeAddress"));
    nodeAddrField.setText("0");
    panel11.add(nodeAddrStatic);
    nodeAddrField.setVisible(false);
    nodeAddrStatic.setVisible(false);
    contentPane.add(panel11);
    // panelNodeInfo is the node type
    JPanel panelNodeInfo = new JPanel();
    panelNodeInfo.add(new JLabel("   " + rb.getString("LabelNodeType") + " "));
    nodeTypeBox = new JComboBox<String>(AcelaNode.getModuleNames());
    nodeTypeBox.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent event) {
            String s = (String) nodeTypeBox.getSelectedItem();
            if (s.equals("Acela")) {
                panelAcela.setVisible(true);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(false);
            } else if (s.equals("TrainBrain")) {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(true);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(false);
            } else if (s.equals("Dash-8")) {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(true);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(false);
            } else if (s.equals("Watchman")) {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(true);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(false);
            } else if (s.equals("SignalMan")) {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(true);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(false);
            } else if (s.equals("SwitchMan")) {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(true);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(false);
            } else if (s.equals("YardMaster")) {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(true);
                panelSentry.setVisible(false);
            } else if (s.equals("Sentry")) {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(true);
            } else // Add code here for other types of nodes
            {
                panelAcela.setVisible(false);
                panelTBrain.setVisible(false);
                panelDash8.setVisible(false);
                panelWatchman.setVisible(false);
                panelSignalman.setVisible(false);
                panelSwitchman.setVisible(false);
                panelYardMaster.setVisible(false);
                panelSentry.setVisible(false);
            }
        }
    });
    panelNodeInfo.add(nodeTypeBox);
    nodeTypeBox.setToolTipText(rb.getString("TipNodeType"));
    panelNodeInfo.add(nodeTypeStatic);
    nodeTypeBox.setVisible(false);
    nodeTypeStatic.setVisible(true);
    contentPane.add(panelNodeInfo);
    // Set up the Acela nodes
    panelAcela.setLayout(new BoxLayout(panelAcela, BoxLayout.Y_AXIS));
    JPanel panelAcela1 = new JPanel();
    panelAcela1.setLayout(new FlowLayout());
    statusTextAcela1.setText(stdStatusAcela1);
    statusTextAcela1.setVisible(true);
    panelAcela1.add(statusTextAcela1);
    panelAcela.add(panelAcela1);
    JPanel panelAcela2 = new JPanel();
    panelAcela2.setLayout(new FlowLayout());
    statusTextAcela2.setText(stdStatusAcela2);
    statusTextAcela2.setVisible(true);
    panelAcela2.add(statusTextAcela2);
    panelAcela.add(panelAcela2);
    JPanel panelAcela3 = new JPanel();
    panelAcela3.setLayout(new FlowLayout());
    statusTextAcela3.setText(stdStatusAcela3);
    statusTextAcela3.setVisible(true);
    panelAcela3.add(statusTextAcela3);
    panelAcela.add(panelAcela3);
    JPanel panelAcela4 = new JPanel();
    panelAcela4.setLayout(new FlowLayout());
    statusTextAcela4.setText(stdStatusAcela4);
    statusTextAcela4.setVisible(true);
    panelAcela4.add(statusTextAcela4);
    panelAcela.add(panelAcela4);
    JPanel panelAcela5 = new JPanel();
    panelAcela5.setLayout(new FlowLayout());
    statusTextAcela5.setText(stdStatusAcela5);
    statusTextAcela5.setVisible(true);
    panelAcela5.add(statusTextAcela5);
    panelAcela.add(panelAcela5);
    JPanel panelAcela6 = new JPanel();
    panelAcela6.setLayout(new FlowLayout());
    statusTextAcela6.setText(stdStatusAcela6);
    statusTextAcela6.setVisible(true);
    panelAcela6.add(statusTextAcela6);
    panelAcela.add(panelAcela6);
    JPanel panelAcela7 = new JPanel();
    panelAcela7.setLayout(new FlowLayout());
    statusTextAcela7.setText(stdStatusAcela7);
    statusTextAcela7.setVisible(true);
    panelAcela7.add(statusTextAcela7);
    panelAcela.add(panelAcela7);
    JPanel panelAcela8 = new JPanel();
    panelAcela8.setLayout(new FlowLayout());
    statusTextAcela8.setText(stdStatusAcela8);
    statusTextAcela8.setVisible(true);
    panelAcela8.add(statusTextAcela8);
    panelAcela.add(panelAcela8);
    JPanel panelAcela9 = new JPanel();
    panelAcela9.setLayout(new FlowLayout());
    statusTextAcela9.setText(stdStatusAcela9);
    statusTextAcela9.setVisible(true);
    panelAcela9.add(statusTextAcela9);
    panelAcela.add(panelAcela9);
    JPanel panelAcela10 = new JPanel();
    panelAcela10.setLayout(new FlowLayout());
    statusTextAcela10.setText(stdStatusAcela10);
    statusTextAcela10.setVisible(true);
    panelAcela10.add(statusTextAcela10);
    panelAcela.add(panelAcela10);
    JPanel panelAcela11 = new JPanel();
    panelAcela11.setLayout(new FlowLayout());
    statusTextAcela11.setText(stdStatusAcela11);
    statusTextAcela11.setVisible(true);
    panelAcela11.add(statusTextAcela11);
    panelAcela.add(panelAcela11);
    Border panelAcelaBorder = BorderFactory.createEtchedBorder();
    Border panelAcelaTitled = BorderFactory.createTitledBorder(panelAcelaBorder, rb.getString("BoxLabelNodeSpecific"));
    panelAcela.setBorder(panelAcelaTitled);
    contentPane.add(panelAcela);
    // Set up the Dash8 nodes
    panelDash8.setLayout(new BoxLayout(panelDash8, BoxLayout.Y_AXIS));
    JPanel panelDash81 = new JPanel();
    panelDash81.setLayout(new FlowLayout());
    statusTextDash81.setText(stdStatusDash81);
    statusTextDash81.setVisible(true);
    panelDash81.add(statusTextDash81);
    panelDash8.add(panelDash81);
    JPanel panelDash82 = new JPanel();
    panelDash82.setLayout(new FlowLayout());
    statusTextDash82.setText(stdStatusDash82);
    statusTextDash82.setVisible(true);
    panelDash82.add(statusTextDash82);
    panelDash8.add(panelDash82);
    JPanel panelDash83 = new JPanel();
    panelDash83.setLayout(new FlowLayout());
    statusTextDash83.setText(stdStatusDash83);
    statusTextDash83.setVisible(true);
    panelDash83.add(statusTextDash83);
    panelDash8.add(panelDash83);
    // Output circuit configuration
    d8outputConfigModel = new OutputConfigModel();
    d8outputConfigModel.setNumRows(8);
    d8outputConfigModel.setEditMode(false);
    JTable d8outputConfigTable = new JTable(d8outputConfigModel);
    d8outputConfigTable.setRowSelectionAllowed(false);
    d8outputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
    JComboBox<String> d8outputWiredCombo = new JComboBox<String>();
    d8outputWiredCombo.addItem(rb.getString("OutputWiredNC"));
    d8outputWiredCombo.addItem(rb.getString("OutputWiredNO"));
    JComboBox<String> d8initialStateCombo = new JComboBox<String>();
    d8initialStateCombo.addItem(rb.getString("InitialStateOn"));
    d8initialStateCombo.addItem(rb.getString("InitialStateOff"));
    JComboBox<String> d8outputTypeCombo = new JComboBox<String>();
    d8outputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
    d8outputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
    d8outputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
    JComboBox<String> d8outputLengthCombo = new JComboBox<String>();
    for (int t = 0; t < 255; t++) {
        d8outputLengthCombo.addItem(String.valueOf(t));
    }
    TableColumnModel d8outputColumnModel = d8outputConfigTable.getColumnModel();
    TableColumn d8outputCircuitAddressColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
    d8outputCircuitAddressColumn.setMinWidth(70);
    d8outputCircuitAddressColumn.setMaxWidth(80);
    TableColumn d8outputWiredColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
    d8outputWiredColumn.setCellEditor(new DefaultCellEditor(d8outputWiredCombo));
    d8outputWiredColumn.setResizable(false);
    d8outputWiredColumn.setMinWidth(90);
    d8outputWiredColumn.setMaxWidth(100);
    TableColumn d8initialStateColumn = d8outputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
    d8initialStateColumn.setCellEditor(new DefaultCellEditor(d8initialStateCombo));
    d8initialStateColumn.setResizable(false);
    d8initialStateColumn.setMinWidth(90);
    d8initialStateColumn.setMaxWidth(100);
    TableColumn d8outputTypeColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
    d8outputTypeColumn.setCellEditor(new DefaultCellEditor(d8outputTypeCombo));
    d8outputTypeColumn.setResizable(false);
    d8outputTypeColumn.setMinWidth(90);
    d8outputTypeColumn.setMaxWidth(100);
    TableColumn d8outputLengthColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
    d8outputLengthColumn.setCellEditor(new DefaultCellEditor(d8outputLengthCombo));
    d8outputLengthColumn.setResizable(false);
    d8outputLengthColumn.setMinWidth(90);
    d8outputLengthColumn.setMaxWidth(100);
    TableColumn d8outputaddressColumn = d8outputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
    d8outputaddressColumn.setMinWidth(110);
    d8outputaddressColumn.setMaxWidth(120);
    // Finish Set up the Dash8 nodes
    JScrollPane d8outputScrollPane = new JScrollPane(d8outputConfigTable);
    JPanel panelDash8Table = new JPanel();
    panelDash8Table.setLayout(new BoxLayout(panelDash8Table, BoxLayout.Y_AXIS));
    panelDash8Table.add(d8outputScrollPane, BorderLayout.CENTER);
    panelDash8.add(panelDash8Table, BoxLayout.Y_AXIS);
    Border panelDash8Border = BorderFactory.createEtchedBorder();
    Border panelDash8Titled = BorderFactory.createTitledBorder(panelDash8Border, rb.getString("BoxLabelNodeSpecific"));
    panelDash8.setBorder(panelDash8Titled);
    panelDash8.setVisible(false);
    contentPane.add(panelDash8);
    // Set up the TBrain nodes
    panelTBrain.setLayout(new BoxLayout(panelTBrain, BoxLayout.Y_AXIS));
    JPanel panelTBrain1 = new JPanel();
    statusTextTBrain1.setText(stdStatusTBrain1);
    statusTextTBrain1.setVisible(true);
    panelTBrain1.add(statusTextTBrain1);
    panelTBrain.add(panelTBrain1);
    JPanel panelTBrain2 = new JPanel();
    statusTextTBrain2.setText(stdStatusTBrain2);
    statusTextTBrain2.setVisible(true);
    panelTBrain2.add(statusTextTBrain2);
    panelTBrain.add(panelTBrain2);
    JPanel panelTBrain3 = new JPanel();
    statusTextTBrain3.setText(stdStatusTBrain3);
    statusTextTBrain3.setVisible(true);
    panelTBrain3.add(statusTextTBrain3);
    panelTBrain.add(panelTBrain3);
    TBoutputConfigModel = new OutputConfigModel();
    TBoutputConfigModel.setNumRows(4);
    TBoutputConfigModel.setEditMode(false);
    JTable TBoutputConfigTable = new JTable(TBoutputConfigModel);
    TBoutputConfigTable.setRowSelectionAllowed(false);
    TBoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 62));
    JComboBox<String> TBoutputWiredCombo = new JComboBox<String>();
    TBoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
    TBoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
    JComboBox<String> TBoutputTypeCombo = new JComboBox<String>();
    TBoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
    TBoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
    TBoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
    JComboBox<String> TBinitialStateCombo = new JComboBox<String>();
    TBinitialStateCombo.addItem(rb.getString("InitialStateOn"));
    TBinitialStateCombo.addItem(rb.getString("InitialStateOff"));
    JComboBox<String> TBoutputLengthCombo = new JComboBox<String>();
    for (int t = 0; t < 255; t++) {
        TBoutputLengthCombo.addItem(String.valueOf(t));
    }
    TableColumnModel TBoutputColumnModel = TBoutputConfigTable.getColumnModel();
    TableColumn TBoutputCircuitAddressColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
    TBoutputCircuitAddressColumn.setMinWidth(70);
    TBoutputCircuitAddressColumn.setMaxWidth(80);
    TableColumn TBoutputWiredColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
    TBoutputWiredColumn.setCellEditor(new DefaultCellEditor(TBoutputWiredCombo));
    TBoutputWiredColumn.setResizable(false);
    TBoutputWiredColumn.setMinWidth(90);
    TBoutputWiredColumn.setMaxWidth(100);
    TableColumn TBinitialStateColumn = TBoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
    TBinitialStateColumn.setCellEditor(new DefaultCellEditor(TBinitialStateCombo));
    TBinitialStateColumn.setResizable(false);
    TBinitialStateColumn.setMinWidth(90);
    TBinitialStateColumn.setMaxWidth(100);
    TableColumn TBoutputTypeColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
    TBoutputTypeColumn.setCellEditor(new DefaultCellEditor(TBoutputTypeCombo));
    TBoutputTypeColumn.setResizable(false);
    TBoutputTypeColumn.setMinWidth(90);
    TBoutputTypeColumn.setMaxWidth(100);
    TableColumn TBoutputLengthColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
    TBoutputLengthColumn.setCellEditor(new DefaultCellEditor(TBoutputLengthCombo));
    TBoutputLengthColumn.setResizable(false);
    TBoutputLengthColumn.setMinWidth(90);
    TBoutputLengthColumn.setMaxWidth(100);
    TableColumn TBoutputaddressColumn = TBoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
    TBoutputaddressColumn.setMinWidth(110);
    TBoutputaddressColumn.setMaxWidth(120);
    JScrollPane TBoutputScrollPane = new JScrollPane(TBoutputConfigTable);
    JPanel panelTrainBrainTable = new JPanel();
    panelTrainBrainTable.setLayout(new BoxLayout(panelTrainBrainTable, BoxLayout.Y_AXIS));
    panelTrainBrainTable.add(TBoutputScrollPane, BorderLayout.CENTER);
    panelTBrain.add(panelTrainBrainTable, BoxLayout.Y_AXIS);
    TBsensorConfigModel = new SensorConfigModel();
    TBsensorConfigModel.setNumRows(4);
    TBsensorConfigModel.setEditMode(false);
    JTable TBsensorConfigTable = new JTable(TBsensorConfigModel);
    TBsensorConfigTable.setRowSelectionAllowed(false);
    TBsensorConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 62));
    JComboBox<String> TBfilterTypeCombo = new JComboBox<String>();
    TBfilterTypeCombo.addItem(rb.getString("FilterTypeNoise"));
    TBfilterTypeCombo.addItem(rb.getString("FilterTypeDebounce"));
    TBfilterTypeCombo.addItem(rb.getString("FilterTypeCarGap"));
    TBfilterTypeCombo.addItem(rb.getString("FilterTypeDirtyTrack"));
    JComboBox<String> TBfilterPolarityCombo = new JComboBox<String>();
    TBfilterPolarityCombo.addItem(rb.getString("FilterNormalPolarity"));
    TBfilterPolarityCombo.addItem(rb.getString("FilterInversePolarity"));
    JComboBox<String> TBfilterThresholdCombo = new JComboBox<String>();
    for (int t = 0; t < 32; t++) {
        TBfilterThresholdCombo.addItem(String.valueOf(t));
    }
    TableColumnModel TBtypeColumnModel = TBsensorConfigTable.getColumnModel();
    TableColumn TBcircuitAddressColumn = TBtypeColumnModel.getColumn(SensorConfigModel.SENSORCIRCUITADDRESS_COLUMN);
    TBcircuitAddressColumn.setMinWidth(70);
    TBcircuitAddressColumn.setMaxWidth(80);
    TableColumn TBcardTypeColumn = TBtypeColumnModel.getColumn(SensorConfigModel.TYPE_COLUMN);
    TBcardTypeColumn.setCellEditor(new DefaultCellEditor(TBfilterTypeCombo));
    TBcardTypeColumn.setResizable(false);
    TBcardTypeColumn.setMinWidth(90);
    TBcardTypeColumn.setMaxWidth(100);
    TableColumn TBcardPolarityColumn = TBtypeColumnModel.getColumn(SensorConfigModel.POLARITY_COLUMN);
    TBcardPolarityColumn.setCellEditor(new DefaultCellEditor(TBfilterPolarityCombo));
    TBcardPolarityColumn.setResizable(false);
    TBcardPolarityColumn.setMinWidth(90);
    TBcardPolarityColumn.setMaxWidth(100);
    TableColumn TBcardThresholdColumn = TBtypeColumnModel.getColumn(SensorConfigModel.THRESHOLD_COLUMN);
    TBcardThresholdColumn.setCellEditor(new DefaultCellEditor(TBfilterThresholdCombo));
    TBcardThresholdColumn.setResizable(false);
    TBcardThresholdColumn.setMinWidth(90);
    TBcardThresholdColumn.setMaxWidth(100);
    TableColumn TBsensorAddressColumn = TBtypeColumnModel.getColumn(SensorConfigModel.SENSORADDRESS_COLUMN);
    TBsensorAddressColumn.setMinWidth(110);
    TBsensorAddressColumn.setMaxWidth(1200);
    JScrollPane TBsensorScrollPane = new JScrollPane(TBsensorConfigTable);
    JPanel panelTBsensortable = new JPanel();
    panelTBsensortable.setLayout(new BoxLayout(panelTBsensortable, BoxLayout.Y_AXIS));
    panelTBsensortable.add(TBsensorScrollPane, BorderLayout.CENTER);
    panelTBrain.add(panelTBsensortable, BoxLayout.Y_AXIS);
    // Finish Set up the TrainBrain nodes
    Border panelTBrainBorder = BorderFactory.createEtchedBorder();
    Border panelTBrainTitled = BorderFactory.createTitledBorder(panelTBrainBorder, rb.getString("BoxLabelNodeSpecific"));
    panelTBrain.setBorder(panelTBrainTitled);
    contentPane.add(panelTBrain);
    panelTBrain.setVisible(false);
    // Set up the Watchman nodes
    panelWatchman.setLayout(new BoxLayout(panelWatchman, BoxLayout.Y_AXIS));
    JPanel panelWatchman1 = new JPanel();
    panelWatchman1.setLayout(new FlowLayout());
    statusTextWatchman1.setText(stdStatusWatchman1);
    statusTextWatchman1.setVisible(true);
    panelWatchman1.add(statusTextWatchman1);
    panelWatchman.add(panelWatchman1);
    JPanel panelWatchman2 = new JPanel();
    panelWatchman2.setLayout(new FlowLayout());
    statusTextWatchman2.setText(stdStatusWatchman2);
    statusTextWatchman2.setVisible(true);
    panelWatchman2.add(statusTextWatchman2);
    panelWatchman.add(panelWatchman2);
    JPanel panelWatchman3 = new JPanel();
    panelWatchman3.setLayout(new FlowLayout());
    statusTextWatchman3.setText(stdStatusWatchman3);
    statusTextWatchman3.setVisible(true);
    panelWatchman3.add(statusTextWatchman3);
    panelWatchman.add(panelWatchman3);
    wmsensorConfigModel = new SensorConfigModel();
    wmsensorConfigModel.setNumRows(8);
    wmsensorConfigModel.setEditMode(false);
    JTable wmsensorConfigTable = new JTable(wmsensorConfigModel);
    wmsensorConfigTable.setRowSelectionAllowed(false);
    wmsensorConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
    JComboBox<String> wmfilterTypeCombo = new JComboBox<String>();
    wmfilterTypeCombo.addItem(rb.getString("FilterTypeNoise"));
    wmfilterTypeCombo.addItem(rb.getString("FilterTypeDebounce"));
    wmfilterTypeCombo.addItem(rb.getString("FilterTypeCarGap"));
    wmfilterTypeCombo.addItem(rb.getString("FilterTypeDirtyTrack"));
    JComboBox<String> wmfilterPolarityCombo = new JComboBox<String>();
    wmfilterPolarityCombo.addItem(rb.getString("FilterNormalPolarity"));
    wmfilterPolarityCombo.addItem(rb.getString("FilterInversePolarity"));
    JComboBox<String> wmfilterThresholdCombo = new JComboBox<String>();
    for (int t = 0; t < 32; t++) {
        wmfilterThresholdCombo.addItem(String.valueOf(t));
    }
    TableColumnModel wmtypeColumnModel = wmsensorConfigTable.getColumnModel();
    TableColumn wmcircuitAddressColumn = wmtypeColumnModel.getColumn(SensorConfigModel.SENSORCIRCUITADDRESS_COLUMN);
    wmcircuitAddressColumn.setMinWidth(70);
    wmcircuitAddressColumn.setMaxWidth(80);
    TableColumn wmcardTypeColumn = wmtypeColumnModel.getColumn(SensorConfigModel.TYPE_COLUMN);
    wmcardTypeColumn.setCellEditor(new DefaultCellEditor(wmfilterTypeCombo));
    wmcardTypeColumn.setResizable(false);
    wmcardTypeColumn.setMinWidth(90);
    wmcardTypeColumn.setMaxWidth(100);
    TableColumn wmcardPolarityColumn = wmtypeColumnModel.getColumn(SensorConfigModel.POLARITY_COLUMN);
    wmcardPolarityColumn.setCellEditor(new DefaultCellEditor(wmfilterPolarityCombo));
    wmcardPolarityColumn.setResizable(false);
    wmcardPolarityColumn.setMinWidth(90);
    wmcardPolarityColumn.setMaxWidth(100);
    TableColumn wmcardThresholdColumn = wmtypeColumnModel.getColumn(SensorConfigModel.THRESHOLD_COLUMN);
    wmcardThresholdColumn.setCellEditor(new DefaultCellEditor(wmfilterThresholdCombo));
    wmcardThresholdColumn.setResizable(false);
    wmcardThresholdColumn.setMinWidth(90);
    wmcardThresholdColumn.setMaxWidth(100);
    TableColumn wmsensorAddressColumn = wmtypeColumnModel.getColumn(SensorConfigModel.SENSORADDRESS_COLUMN);
    wmsensorAddressColumn.setMinWidth(110);
    wmsensorAddressColumn.setMaxWidth(1200);
    // Finish Set up the Watchman nodes
    JScrollPane wmsensorScrollPane = new JScrollPane(wmsensorConfigTable);
    JPanel panelWatchmantable = new JPanel();
    panelWatchmantable.setLayout(new BoxLayout(panelWatchmantable, BoxLayout.Y_AXIS));
    panelWatchmantable.add(wmsensorScrollPane, BorderLayout.CENTER);
    panelWatchman.add(panelWatchmantable, BoxLayout.Y_AXIS);
    Border panelWatchmanBorder = BorderFactory.createEtchedBorder();
    Border panelWatchmanTitled = BorderFactory.createTitledBorder(panelWatchmanBorder, rb.getString("BoxLabelNodeSpecific"));
    panelWatchman.setBorder(panelWatchmanTitled);
    contentPane.add(panelWatchman);
    panelWatchman.setVisible(false);
    // Set up the Signalman nodes
    panelSignalman.setLayout(new BoxLayout(panelSignalman, BoxLayout.Y_AXIS));
    JPanel panelSignalman1 = new JPanel();
    panelSignalman1.setLayout(new FlowLayout());
    statusTextSignalman1.setText(stdStatusSignalman1);
    statusTextSignalman1.setVisible(true);
    panelSignalman1.add(statusTextSignalman1);
    panelSignalman.add(panelSignalman1);
    JPanel panelSignalman2 = new JPanel();
    panelSignalman2.setLayout(new FlowLayout());
    statusTextSignalman2.setText(stdStatusSignalman2);
    statusTextSignalman2.setVisible(true);
    panelSignalman2.add(statusTextSignalman2);
    panelSignalman.add(panelSignalman2);
    JPanel panelSignalman3 = new JPanel();
    panelSignalman3.setLayout(new FlowLayout());
    statusTextSignalman3.setText(stdStatusSignalman3);
    statusTextSignalman3.setVisible(true);
    panelSignalman3.add(statusTextSignalman3);
    panelSignalman.add(panelSignalman3);
    // Output circuit configuration
    smoutputConfigModel = new OutputConfigModel();
    smoutputConfigModel.setNumRows(16);
    smoutputConfigModel.setEditMode(false);
    JTable smoutputConfigTable = new JTable(smoutputConfigModel);
    smoutputConfigTable.setRowSelectionAllowed(false);
    smoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
    JComboBox<String> smoutputWiredCombo = new JComboBox<String>();
    smoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
    smoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
    JComboBox<String> sminitialStateCombo = new JComboBox<String>();
    sminitialStateCombo.addItem(rb.getString("InitialStateOn"));
    sminitialStateCombo.addItem(rb.getString("InitialStateOff"));
    JComboBox<String> smoutputTypeCombo = new JComboBox<String>();
    smoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
    smoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
    smoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
    JComboBox<String> smoutputLengthCombo = new JComboBox<String>();
    for (int t = 0; t < 255; t++) {
        smoutputLengthCombo.addItem(String.valueOf(t));
    }
    TableColumnModel smoutputColumnModel = smoutputConfigTable.getColumnModel();
    TableColumn smoutputCircuitAddressColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
    smoutputCircuitAddressColumn.setMinWidth(70);
    smoutputCircuitAddressColumn.setMaxWidth(80);
    TableColumn smoutputWiredColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
    smoutputWiredColumn.setCellEditor(new DefaultCellEditor(smoutputWiredCombo));
    smoutputWiredColumn.setResizable(false);
    smoutputWiredColumn.setMinWidth(90);
    smoutputWiredColumn.setMaxWidth(100);
    TableColumn sminitialStateColumn = smoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
    sminitialStateColumn.setCellEditor(new DefaultCellEditor(sminitialStateCombo));
    sminitialStateColumn.setResizable(false);
    sminitialStateColumn.setMinWidth(90);
    sminitialStateColumn.setMaxWidth(100);
    TableColumn smoutputTypeColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
    smoutputTypeColumn.setCellEditor(new DefaultCellEditor(smoutputTypeCombo));
    smoutputTypeColumn.setResizable(false);
    smoutputTypeColumn.setMinWidth(90);
    smoutputTypeColumn.setMaxWidth(100);
    TableColumn smoutputLengthColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
    smoutputLengthColumn.setCellEditor(new DefaultCellEditor(smoutputLengthCombo));
    smoutputLengthColumn.setResizable(false);
    smoutputLengthColumn.setMinWidth(90);
    smoutputLengthColumn.setMaxWidth(100);
    TableColumn smoutputaddressColumn = smoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
    smoutputaddressColumn.setMinWidth(110);
    smoutputaddressColumn.setMaxWidth(120);
    // Finish Set up the Signalman nodes
    JScrollPane smoutputScrollPane = new JScrollPane(smoutputConfigTable);
    JPanel panelSignalmanTable = new JPanel();
    panelSignalmanTable.setLayout(new BoxLayout(panelSignalmanTable, BoxLayout.Y_AXIS));
    panelSignalmanTable.add(smoutputScrollPane, BorderLayout.CENTER);
    panelSignalman.add(panelSignalmanTable, BoxLayout.Y_AXIS);
    Border panelSignalmanBorder = BorderFactory.createEtchedBorder();
    Border panelSignalmanTitled = BorderFactory.createTitledBorder(panelSignalmanBorder, rb.getString("BoxLabelNodeSpecific"));
    panelSignalman.setBorder(panelSignalmanTitled);
    panelSignalman.setVisible(false);
    contentPane.add(panelSignalman);
    // Set up the YardMaster nodes
    panelYardMaster.setLayout(new BoxLayout(panelYardMaster, BoxLayout.Y_AXIS));
    JPanel panelYardMaster1 = new JPanel();
    panelYardMaster1.setLayout(new FlowLayout());
    statusTextYardMaster1.setText(stdStatusYardMaster1);
    statusTextYardMaster1.setVisible(true);
    panelYardMaster1.add(statusTextYardMaster1);
    panelYardMaster.add(panelYardMaster1);
    JPanel panelYardMaster2 = new JPanel();
    panelYardMaster2.setLayout(new FlowLayout());
    statusTextYardMaster2.setText(stdStatusYardMaster2);
    statusTextYardMaster2.setVisible(true);
    panelYardMaster2.add(statusTextYardMaster2);
    panelYardMaster.add(panelYardMaster2);
    JPanel panelYardMaster3 = new JPanel();
    panelYardMaster3.setLayout(new FlowLayout());
    statusTextYardMaster3.setText(stdStatusYardMaster3);
    statusTextYardMaster3.setVisible(true);
    panelYardMaster3.add(statusTextYardMaster3);
    panelYardMaster.add(panelYardMaster3);
    // Output circuit configuration
    ymoutputConfigModel = new OutputConfigModel();
    ymoutputConfigModel.setNumRows(16);
    ymoutputConfigModel.setEditMode(false);
    JTable ymoutputConfigTable = new JTable(ymoutputConfigModel);
    ymoutputConfigTable.setRowSelectionAllowed(false);
    ymoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
    JComboBox<String> ymoutputWiredCombo = new JComboBox<String>();
    ymoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
    ymoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
    JComboBox<String> yminitialStateCombo = new JComboBox<String>();
    yminitialStateCombo.addItem(rb.getString("InitialStateOn"));
    yminitialStateCombo.addItem(rb.getString("InitialStateOff"));
    JComboBox<String> ymoutputTypeCombo = new JComboBox<String>();
    ymoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
    ymoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
    ymoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
    JComboBox<String> ymoutputLengthCombo = new JComboBox<String>();
    for (int t = 0; t < 255; t++) {
        ymoutputLengthCombo.addItem(String.valueOf(t));
    }
    TableColumnModel ymoutputColumnModel = ymoutputConfigTable.getColumnModel();
    TableColumn ymoutputCircuitAddressColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
    ymoutputCircuitAddressColumn.setMinWidth(70);
    ymoutputCircuitAddressColumn.setMaxWidth(80);
    TableColumn ymoutputWiredColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
    ymoutputWiredColumn.setCellEditor(new DefaultCellEditor(ymoutputWiredCombo));
    ymoutputWiredColumn.setResizable(false);
    ymoutputWiredColumn.setMinWidth(90);
    ymoutputWiredColumn.setMaxWidth(100);
    TableColumn yminitialStateColumn = ymoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
    yminitialStateColumn.setCellEditor(new DefaultCellEditor(yminitialStateCombo));
    yminitialStateColumn.setResizable(false);
    yminitialStateColumn.setMinWidth(90);
    yminitialStateColumn.setMaxWidth(100);
    TableColumn ymoutputTypeColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
    ymoutputTypeColumn.setCellEditor(new DefaultCellEditor(ymoutputTypeCombo));
    ymoutputTypeColumn.setResizable(false);
    ymoutputTypeColumn.setMinWidth(90);
    ymoutputTypeColumn.setMaxWidth(100);
    TableColumn ymoutputLengthColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
    ymoutputLengthColumn.setCellEditor(new DefaultCellEditor(ymoutputLengthCombo));
    ymoutputLengthColumn.setResizable(false);
    ymoutputLengthColumn.setMinWidth(90);
    ymoutputLengthColumn.setMaxWidth(100);
    TableColumn ymoutputaddressColumn = ymoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
    ymoutputaddressColumn.setMinWidth(110);
    ymoutputaddressColumn.setMaxWidth(120);
    // Finish Set up the YardMaster nodes
    JScrollPane ymoutputScrollPane = new JScrollPane(ymoutputConfigTable);
    JPanel panelYardMasterTable = new JPanel();
    panelYardMasterTable.setLayout(new BoxLayout(panelYardMasterTable, BoxLayout.Y_AXIS));
    panelYardMasterTable.add(ymoutputScrollPane, BorderLayout.CENTER);
    panelYardMaster.add(panelYardMasterTable, BoxLayout.Y_AXIS);
    Border panelYardMasterBorder = BorderFactory.createEtchedBorder();
    Border panelYardMasterTitled = BorderFactory.createTitledBorder(panelYardMasterBorder, rb.getString("BoxLabelNodeSpecific"));
    panelYardMaster.setBorder(panelYardMasterTitled);
    panelYardMaster.setVisible(false);
    contentPane.add(panelYardMaster);
    // Set up the SwitchMan nodes
    panelSwitchman.setLayout(new BoxLayout(panelSwitchman, BoxLayout.Y_AXIS));
    JPanel panelSwitchman1 = new JPanel();
    panelSwitchman1.setLayout(new FlowLayout());
    statusTextSwitchman1.setText(stdStatusSwitchman1);
    statusTextSwitchman1.setVisible(true);
    panelSwitchman1.add(statusTextSwitchman1);
    panelSwitchman.add(panelSwitchman1);
    JPanel panelSwitchman2 = new JPanel();
    panelSwitchman2.setLayout(new FlowLayout());
    statusTextSwitchman2.setText(stdStatusSwitchman2);
    statusTextSwitchman2.setVisible(true);
    panelSwitchman2.add(statusTextSwitchman2);
    panelSwitchman.add(panelSwitchman2);
    JPanel panelSwitchman3 = new JPanel();
    panelSwitchman3.setLayout(new FlowLayout());
    statusTextSwitchman3.setText(stdStatusSwitchman3);
    statusTextSwitchman3.setVisible(true);
    panelSwitchman3.add(statusTextSwitchman3);
    panelSwitchman.add(panelSwitchman3);
    // Output circuit configuration
    swoutputConfigModel = new OutputConfigModel();
    swoutputConfigModel.setNumRows(16);
    swoutputConfigModel.setEditMode(false);
    JTable swoutputConfigTable = new JTable(swoutputConfigModel);
    swoutputConfigTable.setRowSelectionAllowed(false);
    swoutputConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
    JComboBox<String> swoutputWiredCombo = new JComboBox<String>();
    swoutputWiredCombo.addItem(rb.getString("OutputWiredNC"));
    swoutputWiredCombo.addItem(rb.getString("OutputWiredNO"));
    JComboBox<String> swinitialStateCombo = new JComboBox<String>();
    swinitialStateCombo.addItem(rb.getString("InitialStateOn"));
    swinitialStateCombo.addItem(rb.getString("InitialStateOff"));
    JComboBox<String> swoutputTypeCombo = new JComboBox<String>();
    swoutputTypeCombo.addItem(rb.getString("OutputTypeONOFF"));
    swoutputTypeCombo.addItem(rb.getString("OutputTypePULSE"));
    swoutputTypeCombo.addItem(rb.getString("OutputTypeBLINK"));
    JComboBox<String> swoutputLengthCombo = new JComboBox<String>();
    for (int t = 0; t < 255; t++) {
        swoutputLengthCombo.addItem(String.valueOf(t));
    }
    TableColumnModel swoutputColumnModel = swoutputConfigTable.getColumnModel();
    TableColumn swoutputCircuitAddressColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTCIRCUITADDRESS_COLUMN);
    swoutputCircuitAddressColumn.setMinWidth(70);
    swoutputCircuitAddressColumn.setMaxWidth(80);
    TableColumn swoutputWiredColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTWIRED_COLUMN);
    swoutputWiredColumn.setCellEditor(new DefaultCellEditor(swoutputWiredCombo));
    swoutputWiredColumn.setResizable(false);
    swoutputWiredColumn.setMinWidth(90);
    swoutputWiredColumn.setMaxWidth(100);
    TableColumn swinitialStateColumn = swoutputColumnModel.getColumn(OutputConfigModel.INITIALSTATE_COLUMN);
    swinitialStateColumn.setCellEditor(new DefaultCellEditor(swinitialStateCombo));
    swinitialStateColumn.setResizable(false);
    swinitialStateColumn.setMinWidth(90);
    swinitialStateColumn.setMaxWidth(100);
    TableColumn swoutputTypeColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTTYPE_COLUMN);
    swoutputTypeColumn.setCellEditor(new DefaultCellEditor(swoutputTypeCombo));
    swoutputTypeColumn.setResizable(false);
    swoutputTypeColumn.setMinWidth(90);
    swoutputTypeColumn.setMaxWidth(100);
    TableColumn swoutputLengthColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTLENGTH_COLUMN);
    swoutputLengthColumn.setCellEditor(new DefaultCellEditor(swoutputLengthCombo));
    swoutputLengthColumn.setResizable(false);
    swoutputLengthColumn.setMinWidth(90);
    swoutputLengthColumn.setMaxWidth(100);
    TableColumn swoutputaddressColumn = swoutputColumnModel.getColumn(OutputConfigModel.OUTPUTADDRESS_COLUMN);
    swoutputaddressColumn.setMinWidth(110);
    swoutputaddressColumn.setMaxWidth(120);
    // Finish Set up the Switchman nodes
    JScrollPane swoutputScrollPane = new JScrollPane(swoutputConfigTable);
    JPanel panelSwitchmanTable = new JPanel();
    panelSwitchmanTable.setLayout(new BoxLayout(panelSwitchmanTable, BoxLayout.Y_AXIS));
    panelSwitchmanTable.add(swoutputScrollPane, BorderLayout.CENTER);
    panelSwitchman.add(panelSwitchmanTable, BoxLayout.Y_AXIS);
    Border panelSwitchmanBorder = BorderFactory.createEtchedBorder();
    Border panelSwitchmanTitled = BorderFactory.createTitledBorder(panelSwitchmanBorder, rb.getString("BoxLabelNodeSpecific"));
    panelSwitchman.setBorder(panelSwitchmanTitled);
    panelSwitchman.setVisible(false);
    contentPane.add(panelSwitchman);
    // Set up the Sentry nodes
    panelSentry.setLayout(new BoxLayout(panelSentry, BoxLayout.Y_AXIS));
    JPanel panelSentry1 = new JPanel();
    panelSentry1.setLayout(new FlowLayout());
    statusTextSentry1.setText(stdStatusSentry1);
    statusTextSentry1.setVisible(true);
    panelSentry1.add(statusTextSentry1);
    panelSentry.add(panelSentry1);
    JPanel panelSentry2 = new JPanel();
    panelSentry2.setLayout(new FlowLayout());
    statusTextSentry2.setText(stdStatusSentry2);
    statusTextSentry2.setVisible(true);
    panelSentry2.add(statusTextSentry2);
    panelSentry.add(panelSentry2);
    JPanel panelSentry3 = new JPanel();
    panelSentry3.setLayout(new FlowLayout());
    statusTextSentry3.setText(stdStatusSentry3);
    statusTextSentry3.setVisible(true);
    panelSentry3.add(statusTextSentry3);
    panelSentry.add(panelSentry3);
    sysensorConfigModel = new SensorConfigModel();
    sysensorConfigModel.setNumRows(16);
    sysensorConfigModel.setEditMode(false);
    JTable sysensorConfigTable = new JTable(sysensorConfigModel);
    sysensorConfigTable.setRowSelectionAllowed(false);
    sysensorConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 125));
    JComboBox<String> syfilterTypeCombo = new JComboBox<String>();
    syfilterTypeCombo.addItem(rb.getString("FilterTypeNoise"));
    syfilterTypeCombo.addItem(rb.getString("FilterTypeDebounce"));
    syfilterTypeCombo.addItem(rb.getString("FilterTypeCarGap"));
    syfilterTypeCombo.addItem(rb.getString("FilterTypeDirtyTrack"));
    JComboBox<String> syfilterPolarityCombo = new JComboBox<String>();
    syfilterPolarityCombo.addItem(rb.getString("FilterNormalPolarity"));
    syfilterPolarityCombo.addItem(rb.getString("FilterInversePolarity"));
    JComboBox<String> syfilterThresholdCombo = new JComboBox<String>();
    for (int t = 0; t < 32; t++) {
        syfilterThresholdCombo.addItem(String.valueOf(t));
    }
    TableColumnModel sytypeColumnModel = sysensorConfigTable.getColumnModel();
    TableColumn sycircuitAddressColumn = sytypeColumnModel.getColumn(SensorConfigModel.SENSORCIRCUITADDRESS_COLUMN);
    sycircuitAddressColumn.setMinWidth(70);
    sycircuitAddressColumn.setMaxWidth(80);
    TableColumn sycardTypeColumn = sytypeColumnModel.getColumn(SensorConfigModel.TYPE_COLUMN);
    sycardTypeColumn.setCellEditor(new DefaultCellEditor(syfilterTypeCombo));
    sycardTypeColumn.setResizable(false);
    sycardTypeColumn.setMinWidth(90);
    sycardTypeColumn.setMaxWidth(100);
    TableColumn sycardPolarityColumn = sytypeColumnModel.getColumn(SensorConfigModel.POLARITY_COLUMN);
    sycardPolarityColumn.setCellEditor(new DefaultCellEditor(syfilterPolarityCombo));
    sycardPolarityColumn.setResizable(false);
    sycardPolarityColumn.setMinWidth(90);
    sycardPolarityColumn.setMaxWidth(100);
    TableColumn sycardThresholdColumn = sytypeColumnModel.getColumn(SensorConfigModel.THRESHOLD_COLUMN);
    sycardThresholdColumn.setCellEditor(new DefaultCellEditor(syfilterThresholdCombo));
    sycardThresholdColumn.setResizable(false);
    sycardThresholdColumn.setMinWidth(90);
    sycardThresholdColumn.setMaxWidth(100);
    TableColumn sysensorAddressColumn = sytypeColumnModel.getColumn(SensorConfigModel.SENSORADDRESS_COLUMN);
    sysensorAddressColumn.setMinWidth(110);
    sysensorAddressColumn.setMaxWidth(1200);
    // Finish Set up the Sentry nodes
    JScrollPane sysensorScrollPane = new JScrollPane(sysensorConfigTable);
    JPanel panelSentrytable = new JPanel();
    panelSentrytable.setLayout(new BoxLayout(panelSentrytable, BoxLayout.Y_AXIS));
    panelSentrytable.add(sysensorScrollPane, BorderLayout.CENTER);
    panelSentry.add(panelSentrytable, BoxLayout.Y_AXIS);
    Border panelSentryBorder = BorderFactory.createEtchedBorder();
    Border panelSentryTitled = BorderFactory.createTitledBorder(panelSentryBorder, rb.getString("BoxLabelNodeSpecific"));
    panelSentry.setBorder(panelSentryTitled);
    contentPane.add(panelSentry);
    panelSentry.setVisible(false);
    // Set up the notes panel
    JPanel panel3 = new JPanel();
    panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));
    JPanel panel31 = new JPanel();
    panel31.setLayout(new FlowLayout());
    statusText1.setText(stdStatus1);
    statusText1.setVisible(true);
    panel31.add(statusText1);
    JPanel panel32 = new JPanel();
    panel32.setLayout(new FlowLayout());
    statusText2.setText(stdStatus2);
    statusText2.setVisible(true);
    panel32.add(statusText2);
    JPanel panel33 = new JPanel();
    panel33.setLayout(new FlowLayout());
    statusText3.setText(stdStatus3);
    statusText3.setVisible(true);
    panel33.add(statusText3);
    panel3.add(panel31);
    panel3.add(panel32);
    panel3.add(panel33);
    Border panel3Border = BorderFactory.createEtchedBorder();
    Border panel3Titled = BorderFactory.createTitledBorder(panel3Border, rb.getString("BoxLabelNotes"));
    panel3.setBorder(panel3Titled);
    contentPane.add(panel3);
    // Set up buttons
    JPanel panel4 = new JPanel();
    panel4.setLayout(new FlowLayout());
    addButton.setText(rb.getString("ButtonAdd"));
    addButton.setVisible(true);
    addButton.setToolTipText(rb.getString("TipAddButton"));
    addButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            addButtonActionPerformed();
        }
    });
    panel4.add(addButton);
    editButton.setText(rb.getString("ButtonEdit"));
    editButton.setVisible(true);
    editButton.setToolTipText(rb.getString("TipEditButton"));
    panel4.add(editButton);
    editButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            editButtonActionPerformed();
        }
    });
    panel4.add(deleteButton);
    deleteButton.setText(rb.getString("ButtonDelete"));
    deleteButton.setVisible(true);
    deleteButton.setToolTipText(rb.getString("TipDeleteButton"));
    panel4.add(deleteButton);
    deleteButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            deleteButtonActionPerformed();
        }
    });
    panel4.add(doneButton);
    doneButton.setText(rb.getString("ButtonDone"));
    doneButton.setVisible(true);
    doneButton.setToolTipText(rb.getString("TipDoneButton"));
    panel4.add(doneButton);
    doneButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            doneButtonActionPerformed();
        }
    });
    panel4.add(updateButton);
    updateButton.setText(rb.getString("ButtonUpdate"));
    updateButton.setVisible(true);
    updateButton.setToolTipText(rb.getString("TipUpdateButton"));
    panel4.add(updateButton);
    updateButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            updateButtonActionPerformed();
        }
    });
    updateButton.setVisible(false);
    panel4.add(cancelButton);
    cancelButton.setText(rb.getString("ButtonCancel"));
    cancelButton.setVisible(true);
    cancelButton.setToolTipText(rb.getString("TipCancelButton"));
    panel4.add(cancelButton);
    cancelButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            cancelButtonActionPerformed();
        }
    });
    cancelButton.setVisible(false);
    contentPane.add(panel4);
    // add help menu to window
    addHelpMenu("package.jmri.jmrix.acela.nodeconfig.NodeConfigFrame", true);
    // pack for display
    pack();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) TableColumnModel(javax.swing.table.TableColumnModel) AcelaNode(jmri.jmrix.acela.AcelaNode) TableColumn(javax.swing.table.TableColumn) DefaultCellEditor(javax.swing.DefaultCellEditor) JTable(javax.swing.JTable) Border(javax.swing.border.Border) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 3 with AcelaNode

use of jmri.jmrix.acela.AcelaNode in project JMRI by JMRI.

the class NodeConfigFrame method infoButtonActionPerformed.

/**
     * Method to handle info state
     */
@SuppressFBWarnings(value = "SBSC_USE_STRINGBUFFER_CONCATENATION")
public // though it would be good to fix it if you're working in this area
void infoButtonActionPerformed() {
    // lookup the nodes
    String nodesstring = "";
    int tempnumnodes = _memo.getTrafficController().getNumNodes();
    for (int i = 0; i < tempnumnodes; i++) {
        AcelaNode tempnode;
        tempnode = (AcelaNode) _memo.getTrafficController().getNodeFromAddress(i);
        nodesstring = nodesstring + " " + tempnode.getNodeTypeString();
    }
    thenodesStaticC.setText(nodesstring);
    // Find Acela Node address
    nodeAddress = readNodeAddress();
    if (nodeAddress < 0) {
        return;
    }
    // get the AcelaNode corresponding to this node address
    curNode = (AcelaNode) _memo.getTrafficController().getNodeFromAddress(nodeAddress);
    if (curNode == null) {
        statusText1.setText(rb.getString("Error4"));
        statusText1.setVisible(true);
        errorInStatus1 = true;
        resetNotes2();
        return;
    }
    // Set up static node address
    nodeAddrStatic.setText(Integer.toString(nodeAddress));
    nodeAddrBox.setVisible(true);
    nodeAddrField.setVisible(false);
    nodeAddrStatic.setVisible(false);
    // get information for this node and set up combo box
    nodeType = curNode.getNodeType();
    nodeTypeBox.setSelectedIndex(nodeType);
    nodeTypeBox.setVisible(false);
    nodeTypeStatic.setText(AcelaNode.getModuleNames()[nodeType]);
    nodeTypeStatic.setVisible(true);
    // get information for this node if it is an output node
    int numoutputbits = curNode.getNumOutputBitsPerCard();
    if (numoutputbits > 0) {
        // set up output types
        for (int o = 0; o < numoutputbits; o++) {
            if (curNode.getOutputInit(o) == 0) {
                initialState[o] = rb.getString("InitialStateOff");
            } else {
                // if (curNode.getOutputInit(o) == 1) {
                initialState[o] = rb.getString("InitialStateOn");
            }
            if (curNode.getOutputWired(o) == 0) {
                outputWired[o] = rb.getString("OutputWiredNO");
            } else {
                // if (curNode.getOutputWired(o) == 1) {
                outputWired[o] = rb.getString("OutputWiredNC");
            }
            if (curNode.getOutputType(o) == 0) {
                outputType[o] = rb.getString("OutputTypeONOFF");
            } else {
                if (curNode.getOutputType(o) == 1) {
                    outputType[o] = rb.getString("OutputTypePULSE");
                } else {
                    // if (curNode.getOutputType(o) == 2) {
                    outputType[o] = rb.getString("OutputTypeBLINK");
                }
            }
            outputLength[o] = String.valueOf(curNode.getOutputLength(o));
        }
    }
    // get information for this node if it is a sensor node
    int numsensorbits = curNode.getNumSensorBitsPerCard();
    if (numsensorbits > 0) {
        // set up sensor types
        for (int i = 0; i < numsensorbits; i++) {
            if (curNode.getSensorType(i) == 0) {
                filterType[i] = rb.getString("FilterTypeNoise");
            } else if (curNode.getSensorType(i) == 1) {
                filterType[i] = rb.getString("FilterTypeDebounce");
            } else if (curNode.getSensorType(i) == 2) {
                filterType[i] = rb.getString("FilterTypeCarGap");
            } else {
                filterType[i] = rb.getString("FilterTypeDirtyTrack");
            }
            if (curNode.getSensorPolarity(i) == 0) {
                filterPolarity[i] = rb.getString("FilterNormalPolarity");
            } else {
                filterPolarity[i] = rb.getString("FilterInversePolarity");
            }
            filterThreshold[i] = String.valueOf(curNode.getSensorThreshold(i));
        }
    }
    // Switch buttons
    editMode = false;
    addButton.setVisible(true);
    editButton.setVisible(true);
    deleteButton.setVisible(true);
    doneButton.setVisible(true);
    updateButton.setVisible(false);
    cancelButton.setVisible(false);
    // Switch to edit notes
    statusText1.setText(infoStatus1);
    statusText2.setText(infoStatus2);
    statusText3.setText(infoStatus3);
    d8outputConfigModel.setEditMode(false);
    swoutputConfigModel.setEditMode(false);
    ymoutputConfigModel.setEditMode(false);
    TBoutputConfigModel.setEditMode(false);
    TBsensorConfigModel.setEditMode(false);
    smoutputConfigModel.setEditMode(false);
    wmsensorConfigModel.setEditMode(false);
    sysensorConfigModel.setEditMode(false);
    contentPane.repaint();
}
Also used : AcelaNode(jmri.jmrix.acela.AcelaNode) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 4 with AcelaNode

use of jmri.jmrix.acela.AcelaNode in project JMRI by JMRI.

the class ConnectionConfigXml method unpackElement.

@Override
protected void unpackElement(Element shared, Element perNode) {
    List<Element> l = shared.getChildren("node");
    for (int i = 0; i < l.size(); i++) {
        Element n = l.get(i);
        int addr = Integer.parseInt(n.getAttributeValue("name"));
        String nodetypestring = findParmValue(n, "nodetype");
        int type = AcelaNode.moduleTypes.lastIndexOf(nodetypestring) / 2;
        // create node (they register themselves)
        AcelaNode node = new AcelaNode(addr, type, ((jmri.jmrix.acela.serialdriver.SerialDriverAdapter) adapter).getSystemConnectionMemo().getTrafficController());
        log.info("Created a new Acela Node [" + addr + "] as a result of a configuration file of type: " + type);
        if (type == AcelaNode.TB) {
            for (int s = 0; s < 4; s++) {
                String sensortype = findParmValue(n, "sensortype" + s);
                String sensorpolarity = findParmValue(n, "sensorpolarity" + s);
                int sensorthreshold = Integer.parseInt(findParmValue(n, "sensorthreshold" + s));
                node.setSensorTypeString(s, sensortype);
                node.setSensorPolarityString(s, sensorpolarity);
                if (sensorthreshold < 0) {
                    sensorthreshold = 0;
                }
                if (sensorthreshold > 31) {
                    sensorthreshold = 31;
                }
                node.setSensorThreshold(s, sensorthreshold);
            }
            for (int o = 0; o < 4; o++) {
                String outputwired = findParmValue(n, "outputwired" + o);
                String outputinit = findParmValue(n, "outputinit" + o);
                String outputtype = findParmValue(n, "outputtype" + o);
                String outputlengths = findParmValue(n, "outputlength" + o);
                // This can be removed in June 2010:
                if (outputlengths == null) {
                    outputlengths = AcelaNode.outputLEN0;
                }
                int outputlength = Integer.parseInt(outputlengths);
                node.setOutputWiredString(o, outputwired);
                node.setOutputInitString(o, outputinit);
                // This can be removed in June 2010:
                if (outputtype == null) {
                    outputtype = AcelaNode.outputONOFF;
                }
                node.setOutputTypeString(o, outputtype);
                if (outputlength < 0) {
                    outputlength = 0;
                }
                if (outputlength > 255) {
                    outputlength = 255;
                }
                node.setOutputLength(o, outputlength);
            }
        } else if (type == AcelaNode.D8) {
            for (int o = 0; o < 8; o++) {
                String outputwired = findParmValue(n, "outputwired" + o);
                String outputinit = findParmValue(n, "outputinit" + o);
                String outputtype = findParmValue(n, "outputtype" + o);
                String outputlengths = findParmValue(n, "outputlength" + o);
                // This can be removed in June 2010:
                if (outputlengths == null) {
                    outputlengths = AcelaNode.outputLEN0;
                }
                int outputlength = Integer.parseInt(outputlengths);
                node.setOutputWiredString(o, outputwired);
                node.setOutputInitString(o, outputinit);
                // This can be removed in June 2010:
                if (outputtype == null) {
                    outputtype = AcelaNode.outputONOFF;
                }
                node.setOutputTypeString(o, outputtype);
                if (outputlength < 0) {
                    outputlength = 0;
                }
                if (outputlength > 255) {
                    outputlength = 255;
                }
                node.setOutputLength(o, outputlength);
            }
        } else if (type == AcelaNode.WM) {
            for (int s = 0; s < 8; s++) {
                String sensortype = findParmValue(n, "sensortype" + s);
                String sensorpolarity = findParmValue(n, "sensorpolarity" + s);
                int sensorthreshold = Integer.parseInt(findParmValue(n, "sensorthreshold" + s));
                node.setSensorTypeString(s, sensortype);
                node.setSensorPolarityString(s, sensorpolarity);
                if (sensorthreshold < 0) {
                    sensorthreshold = 0;
                }
                if (sensorthreshold > 31) {
                    sensorthreshold = 31;
                }
                node.setSensorThreshold(s, sensorthreshold);
            }
        } else if (type == AcelaNode.SM) {
            for (int o = 0; o < 16; o++) {
                String outputwired = findParmValue(n, "outputwired" + o);
                // This can be removed in June 2010:
                if (outputwired == null) {
                    outputwired = AcelaNode.outputNO;
                }
                String outputinit = findParmValue(n, "outputinit" + o);
                String outputtype = findParmValue(n, "outputtype" + o);
                String outputlengths = findParmValue(n, "outputlength" + o);
                // This can be removed in June 2010:
                if (outputlengths == null) {
                    outputlengths = AcelaNode.outputLEN0;
                }
                int outputlength = Integer.parseInt(outputlengths);
                node.setOutputInitString(o, outputinit);
                // This can be removed in June 2010:
                if (outputtype == null) {
                    outputtype = AcelaNode.outputONOFF;
                }
                node.setOutputTypeString(o, outputtype);
                if (outputlength < 0) {
                    outputlength = 0;
                }
                if (outputlength > 255) {
                    outputlength = 255;
                }
                node.setOutputLength(o, outputlength);
            }
        } else if (type == AcelaNode.SW) {
            for (int o = 0; o < 16; o++) {
                String outputwired = findParmValue(n, "outputwired" + o);
                // This can be removed in June 2010:
                if (outputwired == null) {
                    outputwired = AcelaNode.outputNO;
                }
                String outputinit = findParmValue(n, "outputinit" + o);
                String outputtype = findParmValue(n, "outputtype" + o);
                String outputlengths = findParmValue(n, "outputlength" + o);
                // This can be removed in June 2010:
                if (outputlengths == null) {
                    outputlengths = AcelaNode.outputLEN0;
                }
                int outputlength = Integer.parseInt(outputlengths);
                node.setOutputInitString(o, outputinit);
                // This can be removed in June 2010:
                if (outputtype == null) {
                    outputtype = AcelaNode.outputONOFF;
                }
                node.setOutputTypeString(o, outputtype);
                if (outputlength < 0) {
                    outputlength = 0;
                }
                if (outputlength > 255) {
                    outputlength = 255;
                }
                node.setOutputLength(o, outputlength);
            }
        } else if (type == AcelaNode.YM) {
            for (int o = 0; o < 16; o++) {
                String outputwired = findParmValue(n, "outputwired" + o);
                // This can be removed in June 2010:
                if (outputwired == null) {
                    outputwired = AcelaNode.outputNO;
                }
                String outputinit = findParmValue(n, "outputinit" + o);
                String outputtype = findParmValue(n, "outputtype" + o);
                String outputlengths = findParmValue(n, "outputlength" + o);
                // This can be removed in June 2010:
                if (outputlengths == null) {
                    outputlengths = AcelaNode.outputLEN0;
                }
                int outputlength = Integer.parseInt(outputlengths);
                node.setOutputInitString(o, outputinit);
                // This can be removed in June 2010:
                if (outputtype == null) {
                    outputtype = AcelaNode.outputONOFF;
                }
                node.setOutputTypeString(o, outputtype);
                if (outputlength < 0) {
                    outputlength = 0;
                }
                if (outputlength > 255) {
                    outputlength = 255;
                }
                node.setOutputLength(o, outputlength);
            }
        } else if (type == AcelaNode.SY) {
            for (int s = 0; s < 16; s++) {
                String sensortype = findParmValue(n, "sensortype" + s);
                String sensorpolarity = findParmValue(n, "sensorpolarity" + s);
                int sensorthreshold = Integer.parseInt(findParmValue(n, "sensorthreshold" + s));
                node.setSensorTypeString(s, sensortype);
                node.setSensorPolarityString(s, sensorpolarity);
                if (sensorthreshold < 0) {
                    sensorthreshold = 0;
                }
                if (sensorthreshold > 31) {
                    sensorthreshold = 31;
                }
                node.setSensorThreshold(s, sensorthreshold);
            }
        }
        // Do not poll for Acela network nodes
        AcelaTrafficController.instance().setNeedToPollNodes(false);
        // Trigger initialization of this Node to reflect these parameters
        AcelaTrafficController.instance().initializeAcelaNode(node);
    }
    // Do not let the Acela network poll until we are really ready
    ((AcelaTrafficController) adapter).setReallyReadyToPoll(true);
}
Also used : AcelaTrafficController(jmri.jmrix.acela.AcelaTrafficController) Element(org.jdom2.Element) SerialDriverAdapter(jmri.jmrix.acela.serialdriver.SerialDriverAdapter) AcelaNode(jmri.jmrix.acela.AcelaNode)

Example 5 with AcelaNode

use of jmri.jmrix.acela.AcelaNode in project JMRI by JMRI.

the class SignalHeadTableAction method makeEditSignalWindow.

void makeEditSignalWindow() {
    // keep border and label names the same as in typeChanged() above
    String eSName = _curSignal.getSystemName();
    if (editingHead) {
        if (eSName.equals(editSysName)) {
            editFrame.setVisible(true);
        } else {
            log.error("Attempt to edit two signal heads at the same time-" + editSysName + "-and-" + eSName + "-");
            String msg = Bundle.getMessage("WarningEdit", new Object[] { editSysName, eSName });
            JOptionPane.showMessageDialog(editFrame, msg, Bundle.getMessage("WarningTitle"), JOptionPane.ERROR_MESSAGE);
            editFrame.setVisible(true);
            return;
        }
    }
    // not currently editing a signal head
    editSysName = eSName;
    editingHead = true;
    curS = InstanceManager.getDefault(jmri.SignalHeadManager.class).getBySystemName(editSysName);
    if (editFrame == null) {
        dccSignalPanelEdt();
        eto1 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
        eto2 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
        eto3 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
        eto4 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
        eto5 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
        eto6 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
        eto7 = new BeanSelectCreatePanel(InstanceManager.turnoutManagerInstance(), null);
        // set up a new edit window
        editFrame = new JmriJFrame(Bundle.getMessage("TitleEditSignalHead"), false, true);
        editFrame.addHelpMenu("package.jmri.jmrit.beantable.SignalAddEdit", true);
        editFrame.getContentPane().setLayout(new BorderLayout());
        JPanel panelHeader = new JPanel();
        panelHeader.setLayout(new BoxLayout(panelHeader, BoxLayout.Y_AXIS));
        JPanel p;
        p = new JPanel();
        p.setLayout(new FlowLayout());
        p.add(signalType);
        panelHeader.add(p);
        panelHeader.add(new JSeparator());
        p = new JPanel();
        p.setLayout(new FlowLayout());
        p.add(eSystemNameLabel);
        p.add(eSystemName);
        p.add(eSysNameLabel);
        p.add(dccOffSetAddressEdt);
        dccOffSetAddressEdt.setToolTipText(Bundle.getMessage("DccOffsetTooltip"));
        panelHeader.add(p);
        p = new JPanel();
        p.setLayout(new FlowLayout());
        p.add(eUserNameLabel);
        p.add(eUserName);
        panelHeader.add(p);
        editFrame.getContentPane().add(panelHeader, BorderLayout.PAGE_START);
        // create seven boxes for input information, and put into pane
        JPanel panelCentre = new JPanel();
        panelCentre.setLayout(new BoxLayout(panelCentre, BoxLayout.Y_AXIS));
        ev1Panel = new JPanel();
        ev1Panel.setLayout(defaultFlow);
        ev1Panel.add(eto1);
        ev1Panel.add(es1Box);
        ev1Panel.add(emsaBox);
        emsaBox.setToolTipText(Bundle.getMessage("SignalHeadMergTooltip"));
        ev1Panel.setBorder(ev1Border);
        panelCentre.add(ev1Panel);
        ev2Panel = new JPanel();
        ev2Panel.setLayout(defaultFlow);
        ev2Panel.add(eto2);
        ev2Panel.add(es2Box);
        ev2Panel.add(es2aBox);
        ev2Panel.add(emstBox);
        emstBox.setToolTipText(Bundle.getMessage("SignalHeadUseTooltip"));
        ev2Panel.add(dccSignalPanelEdt);
        ev2Panel.setBorder(ev2Border);
        panelCentre.add(ev2Panel);
        ev3Panel = new JPanel();
        ev3Panel.setLayout(defaultFlow);
        ev3Panel.add(eto3);
        ev3Panel.add(es3Box);
        ev3Panel.add(es3aBox);
        ev3Panel.setBorder(ev3Border);
        panelCentre.add(ev3Panel);
        ev4Panel = new JPanel();
        ev4Panel.setLayout(defaultFlow);
        ev4Panel.add(eto4);
        ev4Panel.add(es4Box);
        ev4Panel.setBorder(ev4Border);
        panelCentre.add(ev4Panel);
        ev5Panel = new JPanel();
        ev5Panel.setLayout(defaultFlow);
        ev5Panel.add(eto5);
        ev5Panel.add(es5Box);
        ev5Panel.setBorder(ev5Border);
        panelCentre.add(ev5Panel);
        ev6Panel = new JPanel();
        ev6Panel.setLayout(defaultFlow);
        ev6Panel.add(eto6);
        ev6Panel.add(es6Box);
        ev6Panel.setBorder(ev6Border);
        panelCentre.add(ev6Panel);
        ev7Panel = new JPanel();
        ev7Panel.setLayout(defaultFlow);
        ev7Panel.add(eto7);
        ev7Panel.add(es7Box);
        ev7Panel.setBorder(ev7Border);
        panelCentre.add(ev7Panel);
        p = new JPanel();
        p.setLayout(defaultFlow);
        p.add(evtLabel);
        p.add(etot);
        p.add(estBox);
        panelCentre.add(p);
        JScrollPane scrollPane = new JScrollPane(panelCentre);
        editFrame.getContentPane().add(scrollPane, BorderLayout.CENTER);
        JPanel panelBottom = new JPanel();
        panelBottom.setLayout(new BoxLayout(panelBottom, BoxLayout.Y_AXIS));
        // add buttons
        p = new JPanel();
        p.setLayout(new FlowLayout(FlowLayout.TRAILING));
        JButton cancel;
        p.add(cancel = new JButton(Bundle.getMessage("ButtonCancel")));
        cancel.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                cancelPressed(e);
            }
        });
        JButton update;
        p.add(update = new JButton(Bundle.getMessage("ButtonUpdate")));
        update.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                updatePressed(e);
            }
        });
        panelBottom.add(p);
        editFrame.getContentPane().add(panelBottom, BorderLayout.PAGE_END);
        editFrame.addWindowListener(new java.awt.event.WindowAdapter() {

            @Override
            public void windowClosing(java.awt.event.WindowEvent e) {
                cancelPressed(null);
            }
        });
    } else {
        eto1.refresh();
        eto2.refresh();
        eto3.refresh();
        eto4.refresh();
        eto5.refresh();
        eto6.refresh();
        eto7.refresh();
    }
    // default the seven optional items to hidden, and system name to visible
    eSystemName.setVisible(false);
    eSysNameLabel.setVisible(true);
    eUserNameLabel.setVisible(true);
    eUserName.setVisible(true);
    ev1Panel.setVisible(false);
    dccOffSetAddressEdt.setVisible(false);
    eto1.setVisible(false);
    es1Box.setVisible(false);
    ev2Panel.setVisible(false);
    eto2.setVisible(false);
    es2Box.setVisible(false);
    es2aBox.setVisible(false);
    dccSignalPanelEdt.setVisible(false);
    ev3Panel.setVisible(false);
    eto3.setVisible(false);
    es3Box.setVisible(false);
    es3aBox.setVisible(false);
    ev4Panel.setVisible(false);
    eto4.setVisible(false);
    es4Box.setVisible(false);
    ev5Panel.setVisible(false);
    eto5.setVisible(false);
    es5Box.setVisible(false);
    ev6Panel.setVisible(false);
    eto6.setVisible(false);
    es6Box.setVisible(false);
    ev7Panel.setVisible(false);
    eto7.setVisible(false);
    es7Box.setVisible(false);
    evtLabel.setVisible(false);
    etot.setVisible(false);
    estBox.setVisible(false);
    emstBox.setVisible(false);
    emsaBox.setVisible(false);
    // determine class name of signal head and initialize edit panel for this class of signal
    className = curS.getClass().getName();
    if (className.equals("jmri.implementation.QuadOutputSignalHead")) {
        signalType.setText(quadOutput);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
        ev1Panel.setVisible(true);
        eto1.setVisible(true);
        et1 = ((TripleTurnoutSignalHead) curS).getGreen().getBean();
        eto1.setDefaultNamedBean(et1);
        ev2Border.setTitle(Bundle.getMessage("LabelYellowTurnoutNumber"));
        ev2Panel.setVisible(true);
        eto2.setVisible(true);
        eto2.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getYellow().getBean());
        ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
        ev3Panel.setVisible(true);
        eto3.setVisible(true);
        eto3.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getRed().getBean());
        ev4Border.setTitle(Bundle.getMessage("LabelLunarTurnoutNumber"));
        ev4Panel.setVisible(true);
        eto4.setVisible(true);
        eto4.setDefaultNamedBean(((QuadOutputSignalHead) curS).getLunar().getBean());
    } else if (className.equals("jmri.implementation.TripleTurnoutSignalHead")) {
        signalType.setText(tripleTurnout);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
        ev1Panel.setVisible(true);
        eto1.setVisible(true);
        eto1.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getGreen().getBean());
        ev2Border.setTitle(Bundle.getMessage("LabelYellowTurnoutNumber"));
        ev2Panel.setVisible(true);
        eto2.setVisible(true);
        eto2.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getYellow().getBean());
        ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
        ev3Panel.setVisible(true);
        eto3.setVisible(true);
        eto3.setDefaultNamedBean(((TripleTurnoutSignalHead) curS).getRed().getBean());
    } else if (className.equals("jmri.implementation.TripleOutputSignalHead")) {
        signalType.setText(tripleOutput);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
        ev1Panel.setVisible(true);
        eto1.setVisible(true);
        eto1.setDefaultNamedBean(((TripleOutputSignalHead) curS).getGreen().getBean());
        ev2Border.setTitle(Bundle.getMessage("LabelBlueTurnoutNumber"));
        ev2Panel.setVisible(true);
        eto2.setVisible(true);
        eto2.setDefaultNamedBean(((TripleOutputSignalHead) curS).getBlue().getBean());
        ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
        ev3Panel.setVisible(true);
        eto3.setVisible(true);
        eto3.setDefaultNamedBean(((TripleOutputSignalHead) curS).getRed().getBean());
    } else if (className.equals("jmri.implementation.DoubleTurnoutSignalHead")) {
        signalType.setText(doubleTurnout);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
        ev1Panel.setVisible(true);
        eto1.setVisible(true);
        eto1.setDefaultNamedBean(((DoubleTurnoutSignalHead) curS).getGreen().getBean());
        ev2Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
        ev2Panel.setVisible(true);
        eto2.setVisible(true);
        eto2.setDefaultNamedBean(((DoubleTurnoutSignalHead) curS).getRed().getBean());
    } else if (className.equals("jmri.implementation.SingleTurnoutSignalHead")) {
        signalType.setText(singleTurnout);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        ev1Border.setTitle(Bundle.getMessage("LabelTurnoutNumber"));
        ev1Panel.setVisible(true);
        eto1.setVisible(true);
        eto1.setDefaultNamedBean(((SingleTurnoutSignalHead) curS).getOutput().getBean());
        ev2Border.setTitle(Bundle.getMessage("LabelTurnoutClosedAppearance"));
        ev2Panel.setVisible(true);
        es2aBox.setVisible(true);
        setSignalStateInBox(es2aBox, ((SingleTurnoutSignalHead) curS).getOnAppearance());
        ev3Border.setTitle(Bundle.getMessage("LabelTurnoutThrownAppearance"));
        ev3Panel.setVisible(true);
        es3aBox.setVisible(true);
        setSignalStateInBox(es3aBox, ((SingleTurnoutSignalHead) curS).getOffAppearance());
    } else if (className.equals("jmri.implementation.VirtualSignalHead")) {
        signalType.setText(virtualHead);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
    } else if (className.equals("jmri.implementation.LsDecSignalHead")) {
        // LDT LS-DEC
        signalType.setText(lsDec);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        ev1Border.setTitle(Bundle.getMessage("LabelGreenTurnoutNumber"));
        ev1Panel.setVisible(true);
        eto1.setVisible(true);
        eto1.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getGreen().getBean());
        es1Box.setVisible(true);
        setTurnoutStateInBox(es1Box, ((jmri.implementation.LsDecSignalHead) curS).getGreenState(), turnoutStateValues);
        ev2Border.setTitle(Bundle.getMessage("LabelYellowTurnoutNumber"));
        ev2Panel.setVisible(true);
        eto2.setVisible(true);
        eto2.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getYellow().getBean());
        es2Box.setVisible(true);
        setTurnoutStateInBox(es2Box, ((jmri.implementation.LsDecSignalHead) curS).getYellowState(), turnoutStateValues);
        ev3Border.setTitle(Bundle.getMessage("LabelRedTurnoutNumber"));
        ev3Panel.setVisible(true);
        eto3.setVisible(true);
        eto3.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getRed().getBean());
        es3Box.setVisible(true);
        setTurnoutStateInBox(es3Box, ((jmri.implementation.LsDecSignalHead) curS).getRedState(), turnoutStateValues);
        ev4Border.setTitle(Bundle.getMessage("LabelFlashGreenTurnoutNumber"));
        ev4Panel.setVisible(true);
        eto4.setVisible(true);
        eto4.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getFlashGreen().getBean());
        es4Box.setVisible(true);
        setTurnoutStateInBox(es4Box, ((jmri.implementation.LsDecSignalHead) curS).getFlashGreenState(), turnoutStateValues);
        ev5Border.setTitle(Bundle.getMessage("LabelFlashYellowTurnoutNumber"));
        ev5Panel.setVisible(true);
        eto5.setVisible(true);
        eto5.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getFlashYellow().getBean());
        es5Box.setVisible(true);
        setTurnoutStateInBox(es5Box, ((jmri.implementation.LsDecSignalHead) curS).getFlashYellowState(), turnoutStateValues);
        ev6Border.setTitle(Bundle.getMessage("LabelFlashRedTurnoutNumber"));
        ev6Panel.setVisible(true);
        eto6.setVisible(true);
        eto6.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getFlashRed().getBean());
        es6Box.setVisible(true);
        setTurnoutStateInBox(es6Box, ((jmri.implementation.LsDecSignalHead) curS).getFlashRedState(), turnoutStateValues);
        ev7Border.setTitle(Bundle.getMessage("LabelDarkTurnoutNumber"));
        ev7Panel.setVisible(true);
        eto7.setVisible(true);
        eto7.setDefaultNamedBean(((jmri.implementation.LsDecSignalHead) curS).getDark().getBean());
        es7Box.setVisible(true);
        setTurnoutStateInBox(es7Box, ((jmri.implementation.LsDecSignalHead) curS).getDarkState(), turnoutStateValues);
    } else if (className.equals("jmri.implementation.SE8cSignalHead")) {
        handleSE8cEditSignal();
    } else if (className.equals("jmri.jmrix.grapevine.SerialSignalHead")) {
        signalType.setText(grapevine);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
    /*ev1Border.setTitle(Bundle.getMessage("LabelUserName"));
             ev1Panel.setVisible(true);
             eto1.setVisible(true);
             eto1.setText(curS.getUserName());*/
    } else if (className.equals("jmri.jmrix.acela.AcelaSignalHead")) {
        signalType.setText(acela);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        /*ev1Border.setTitle(Bundle.getMessage("LabelUserName"));
             ev1Panel.setVisible(true);
             eto1.setVisible(true);
             eto1.setText(curS.getUserName());*/
        evtLabel.setText(Bundle.getMessage("LabelAspectType") + ":");
        etot.setVisible(false);
        AcelaNode tNode = AcelaAddress.getNodeFromSystemName(curS.getSystemName(), jmri.InstanceManager.getDefault(jmri.jmrix.acela.AcelaSystemConnectionMemo.class));
        if (tNode == null) {
            // node does not exist, ignore call
            log.error("Can't find new Acela Signal with name '" + curS.getSystemName());
            return;
        }
        int headnumber = Integer.parseInt(curS.getSystemName().substring(2, curS.getSystemName().length()));
        estBox.setVisible(true);
        setSignalheadTypeInBox(estBox, tNode.getOutputSignalHeadType(headnumber), signalheadTypeValues);
    } else if (className.equals("jmri.implementation.DccSignalHead")) {
        signalType.setText(dccSignalDecoder);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        for (int i = 0; i < DccSignalHead.getDefaultValidStates().length; i++) {
            JSpinner tmp = dccAspectEdt[i];
            tmp.setValue(((DccSignalHead) curS).getOutputForAppearance(curS.getValidStates()[i]));
        //  tmp.setValue((Integer) DccSignalHead.getDefaultNumberForApperance(DccSignalHead.getDefaultValidStates()[i]))
        }
        dccOffSetAddressEdt.setVisible(true);
        dccOffSetAddressEdt.setSelected(((DccSignalHead) curS).useAddressOffSet());
        ev2Border.setTitle(Bundle.getMessage("LabelAspectNumbering"));
        ev2Panel.setVisible(true);
        dccSignalPanelEdt.setVisible(true);
    } else if (className.equals("jmri.implementation.MergSD2SignalHead")) {
        //Edit signal stuff to go here!
        signalType.setText(mergSignalDriver);
        eSystemNameLabel.setText(Bundle.getMessage("LabelSystemName"));
        eSysNameLabel.setText(curS.getSystemName());
        eUserNameLabel.setText(Bundle.getMessage("LabelUserName"));
        eUserName.setText(curS.getUserName());
        // same as line 1054
        ev1Border.setTitle(Bundle.getMessage("NumberOfAppearances"));
        ev1Panel.setVisible(true);
        setUkSignalAspectsFromBox(emsaBox, ((jmri.implementation.MergSD2SignalHead) curS).getAspects());
        eto1.setVisible(false);
        emsaBox.setVisible(true);
        //            emsaBox.setToolTipText(Bundle.getMessage("SignalHeadMergTooltip"));
        // same as line 1090
        ev2Border.setTitle(Bundle.getMessage("UseAs"));
        ev2Panel.setVisible(true);
        eto2.setVisible(false);
        emstBox.setVisible(true);
        if (((jmri.implementation.MergSD2SignalHead) curS).getHome()) {
            // "Home"
            setUkSignalType(emstBox, Bundle.getMessage("HomeSignal"));
        } else {
            //"Distant"
            setUkSignalType(emstBox, Bundle.getMessage("DistantSignal"));
        }
        //setUKSignalTypeFromBox(emstBox, ((jmri.implementation.MergSD2SignalHead)curS).getAspects());
        ev3Border.setTitle(Bundle.getMessage("InputNum", " 1 "));
        ev3Panel.setVisible(true);
        eto3.setVisible(true);
        eto3.setDefaultNamedBean(((jmri.implementation.MergSD2SignalHead) curS).getInput1().getBean());
        ev4Border.setTitle(Bundle.getMessage("InputNum", " 2 "));
        ev4Panel.setVisible(true);
        eto4.setVisible(true);
        if (((jmri.implementation.MergSD2SignalHead) curS).getInput2() != null) {
            eto4.setDefaultNamedBean(((jmri.implementation.MergSD2SignalHead) curS).getInput2().getBean());
        }
        ev5Border.setTitle(Bundle.getMessage("InputNum", " 3 "));
        ev5Panel.setVisible(true);
        eto5.setVisible(true);
        if (((jmri.implementation.MergSD2SignalHead) curS).getInput3() != null) {
            eto5.setDefaultNamedBean(((jmri.implementation.MergSD2SignalHead) curS).getInput3().getBean());
        }
        emsaBox.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                ukAspectChange(true);
            }
        });
        ukAspectChange(true);
    } else {
        log.error("Cannot edit SignalHead of unrecognized type: " + className);
    }
    // finish up
    editFrame.pack();
    editFrame.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) TripleTurnoutSignalHead(jmri.implementation.TripleTurnoutSignalHead) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) TripleOutputSignalHead(jmri.implementation.TripleOutputSignalHead) JSeparator(javax.swing.JSeparator) BorderLayout(java.awt.BorderLayout) BeanSelectCreatePanel(jmri.util.swing.BeanSelectCreatePanel) JScrollPane(javax.swing.JScrollPane) AcelaNode(jmri.jmrix.acela.AcelaNode) SingleTurnoutSignalHead(jmri.implementation.SingleTurnoutSignalHead) ActionListener(java.awt.event.ActionListener) JmriJFrame(jmri.util.JmriJFrame) QuadOutputSignalHead(jmri.implementation.QuadOutputSignalHead) JSpinner(javax.swing.JSpinner)

Aggregations

AcelaNode (jmri.jmrix.acela.AcelaNode)10 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)4 QuadOutputSignalHead (jmri.implementation.QuadOutputSignalHead)3 SingleTurnoutSignalHead (jmri.implementation.SingleTurnoutSignalHead)3 TripleOutputSignalHead (jmri.implementation.TripleOutputSignalHead)3 Element (org.jdom2.Element)3 FlowLayout (java.awt.FlowLayout)2 BoxLayout (javax.swing.BoxLayout)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 SignalHead (jmri.SignalHead)2 Turnout (jmri.Turnout)2 DccSignalHead (jmri.implementation.DccSignalHead)2 TripleTurnoutSignalHead (jmri.implementation.TripleTurnoutSignalHead)2 AcelaSignalHead (jmri.jmrix.acela.AcelaSignalHead)2 SerialDriverAdapter (jmri.jmrix.acela.serialdriver.SerialDriverAdapter)2 BorderLayout (java.awt.BorderLayout)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1