Search in sources :

Example 56 with JComboBox

use of javax.swing.JComboBox in project JMRI by JMRI.

the class UserMessagePreferencesPane method newMessageTab.

private synchronized void newMessageTab() {
    remove(tab);
    tab = new JTabbedPane();
    //might need to redo this so that it doesn't recreate everything all the time.
    _comboBoxes = new HashMap<>();
    _checkBoxes = new HashMap<>();
    ArrayList<String> preferenceClassList = p.getPreferencesClasses();
    for (String strClass : preferenceClassList) {
        JPanel classholder = new JPanel();
        classholder.setLayout(new BorderLayout());
        HashMap<Integer, String> options;
        boolean add = false;
        boolean addtoindependant = false;
        if (p.getPreferencesSize(strClass) > 1) {
            addtoindependant = true;
        }
        JPanel classPanel = new JPanel();
        classPanel.setLayout(new BoxLayout(classPanel, BoxLayout.Y_AXIS));
        classPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
        for (int j = 0; j < p.getMultipleChoiceSize(strClass); j++) {
            String itemName = p.getChoiceName(strClass, j);
            options = p.getChoiceOptions(strClass, itemName);
            if (options != null) {
                JComboBox<Object> optionBox = new JComboBox<>();
                ListItems li = new ListItems(strClass, itemName);
                _comboBoxes.put(optionBox, li);
                li.isIncluded(addtoindependant);
                optionBox.removeAllItems();
                for (Object value : options.values()) {
                    optionBox.addItem(value);
                }
                int current = p.getMultipleChoiceOption(strClass, itemName);
                if (options.containsKey(current)) {
                    optionBox.setSelectedItem(options.get(current));
                }
                if (addtoindependant) {
                    JPanel optionPanel = new JPanel();
                    JLabel _comboLabel = new JLabel(p.getChoiceDescription(strClass, itemName), JLabel.LEFT);
                    _comboLabel.setAlignmentX(0.5f);
                    optionPanel.add(_comboLabel);
                    optionPanel.add(optionBox);
                    add = true;
                    classPanel.add(optionPanel);
                }
            }
        }
        ArrayList<String> singleList = p.getPreferenceList(strClass);
        if (!singleList.isEmpty()) {
            for (int i = 0; i < singleList.size(); i++) {
                String itemName = p.getPreferenceItemName(strClass, i);
                String description = p.getPreferenceItemDescription(strClass, itemName);
                if ((description != null) && (!description.isEmpty())) {
                    JCheckBox check = new JCheckBox(description);
                    check.setSelected(p.getPreferenceState(strClass, itemName));
                    ListItems li = new ListItems(strClass, itemName);
                    _checkBoxes.put(check, li);
                    li.isIncluded(addtoindependant);
                    if (addtoindependant) {
                        classPanel.add(check);
                        add = true;
                    }
                }
            }
        }
        if (add) {
            classholder.add(classPanel, BorderLayout.NORTH);
            if (p.getPreferencesSize(strClass) > 1) {
                JScrollPane scrollPane = new JScrollPane(classholder);
                scrollPane.setPreferredSize(new Dimension(300, 300));
                scrollPane.setBorder(BorderFactory.createEmptyBorder());
                tab.add(scrollPane, p.getClassDescription(strClass));
            }
        }
    }
    HashMap<String, ArrayList<ListItems>> countOfItems = new HashMap<>();
    HashMap<String, ArrayList<JCheckBox>> countOfItemsCheck = new HashMap<>();
    HashMap<String, ArrayList<JComboBox<Object>>> countOfItemsCombo = new HashMap<>();
    for (JComboBox<Object> key : this._comboBoxes.keySet()) {
        if (!_comboBoxes.get(key).isIncluded()) {
            String strItem = _comboBoxes.get(key).getItem();
            if (!countOfItems.containsKey(strItem)) {
                countOfItems.put(strItem, new ArrayList<>());
                countOfItemsCombo.put(strItem, new ArrayList<>());
            }
            ArrayList<ListItems> a = countOfItems.get(strItem);
            a.add(_comboBoxes.get(key));
            ArrayList<JComboBox<Object>> acb = countOfItemsCombo.get(strItem);
            acb.add(key);
        }
    }
    for (JCheckBox key : this._checkBoxes.keySet()) {
        if (!_checkBoxes.get(key).isIncluded()) {
            String strItem = _checkBoxes.get(key).getItem();
            if (!countOfItems.containsKey(strItem)) {
                countOfItems.put(strItem, new ArrayList<>());
                countOfItemsCheck.put(strItem, new ArrayList<>());
            }
            ArrayList<ListItems> a = countOfItems.get(strItem);
            a.add(_checkBoxes.get(key));
            ArrayList<JCheckBox> acb = countOfItemsCheck.get(strItem);
            acb.add(key);
        }
    }
    JPanel miscPanel = new JPanel();
    miscPanel.setLayout(new BoxLayout(miscPanel, BoxLayout.Y_AXIS));
    JPanel mischolder = new JPanel();
    mischolder.setLayout(new BorderLayout());
    mischolder.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    for (String item : countOfItems.keySet()) {
        ArrayList<ListItems> a = countOfItems.get(item);
        ArrayList<JCheckBox> chb = countOfItemsCheck.get(item);
        ArrayList<JComboBox<Object>> cob = countOfItemsCombo.get(item);
        if (a.size() > 1) {
            JPanel tableDeleteTabPanel = new JPanel();
            tableDeleteTabPanel.setLayout(new BoxLayout(tableDeleteTabPanel, BoxLayout.Y_AXIS));
            JLabel tableDeleteInfoLabel = new JLabel(p.getChoiceDescription(a.get(0).getClassName(), a.get(0).getItem()), JLabel.CENTER);
            tableDeleteInfoLabel.setAlignmentX(0.5f);
            tableDeleteTabPanel.add(tableDeleteInfoLabel);
            JPanel inside = new JPanel();
            if (cob != null) {
                JPanel insideCombo = new JPanel();
                int gridsize = (int) (Math.ceil((cob.size() / 2.0)));
                insideCombo.setLayout(new jmri.util.javaworld.GridLayout2(gridsize, 2 * 2, 10, 2));
                for (JComboBox<Object> combo : cob) {
                    JLabel _comboLabel = new JLabel(p.getClassDescription(_comboBoxes.get(combo).getClassName()), JLabel.RIGHT);
                    _comboBoxes.get(combo).isIncluded(true);
                    insideCombo.add(_comboLabel);
                    insideCombo.add(combo);
                }
                inside.add(insideCombo);
            }
            if (chb != null) {
                JPanel insideCheck = new JPanel();
                insideCheck.setLayout(new jmri.util.javaworld.GridLayout2(chb.size(), 1));
                for (JCheckBox check : chb) {
                    JLabel _checkLabel = new JLabel(p.getClassDescription(_checkBoxes.get(check).getClassName()), JLabel.RIGHT);
                    _checkBoxes.get(check).isIncluded(true);
                    insideCheck.add(_checkLabel);
                    insideCheck.add(check);
                }
                inside.add(insideCheck);
            }
            tableDeleteTabPanel.add(inside);
            JScrollPane scrollPane = new JScrollPane(tableDeleteTabPanel);
            scrollPane.setPreferredSize(new Dimension(300, 300));
            tab.add(scrollPane, item);
        } else {
            JPanel itemPanel = new JPanel();
            JPanel subItem = new JPanel();
            subItem.setLayout(new BoxLayout(subItem, BoxLayout.Y_AXIS));
            subItem.add(new JLabel(p.getClassDescription(a.get(0).getClassName()), JLabel.CENTER));
            if (countOfItemsCheck.containsKey(item)) {
                subItem.add(countOfItemsCheck.get(item).get(0));
                itemPanel.add(subItem);
                miscPanel.add(itemPanel);
            }
        }
    }
    add(tab);
    mischolder.add(miscPanel, BorderLayout.NORTH);
    JScrollPane miscScrollPane = new JScrollPane(mischolder);
    miscScrollPane.setPreferredSize(new Dimension(300, 300));
    tab.add(miscScrollPane, "Misc items");
    revalidate();
}
Also used : JPanel(javax.swing.JPanel) HashMap(java.util.HashMap) JTabbedPane(javax.swing.JTabbedPane) BoxLayout(javax.swing.BoxLayout) ArrayList(java.util.ArrayList) BorderLayout(java.awt.BorderLayout) JScrollPane(javax.swing.JScrollPane) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JCheckBox(javax.swing.JCheckBox)

Example 57 with JComboBox

use of javax.swing.JComboBox in project JMRI by JMRI.

the class SignalMastTableDataModel method getAspectEditorBox.

// HashMaps for Editors; not used for Renderer)
/**
     * Provide a JComboBox element to display inside the JPanel CellEditor. When
     * not yet present, create, store and return a new one.
     *
     * @param row Index number (in TableDataModel)
     * @return A combobox containing the valid aspect names for this mast
     */
JComboBox getAspectEditorBox(int row) {
    JComboBox editCombo = editorMap.get(this.getValueAt(row, SYSNAMECOL));
    if (editCombo == null) {
        // create a new one with correct aspects
        editCombo = new JComboBox<>(getAspectVector(row));
        editorMap.put(this.getValueAt(row, SYSNAMECOL), editCombo);
    }
    return editCombo;
}
Also used : JComboBox(javax.swing.JComboBox)

Example 58 with JComboBox

use of javax.swing.JComboBox in project JMRI by JMRI.

the class TrainsScheduleEditFrame method initComponents.

@Override
public void initComponents() {
    try {
        comboBox = trainScheduleManager.getComboBox();
    } catch (IllegalArgumentException iae) {
        comboBox = new JComboBox<TrainSchedule>();
        trainScheduleManager.updateComboBox(comboBox);
    }
    // row 1
    addItem(addTextBox, 2, 2);
    addItem(addButton, 3, 2);
    // row 3
    addItem(comboBox, 2, 3);
    addItem(deleteButton, 3, 3);
    // row 4 
    addItem(replaceButton, 3, 4);
    // row 5
    addItem(restoreButton, 2, 5);
    addButtonAction(addButton);
    addButtonAction(deleteButton);
    addButtonAction(replaceButton);
    addButtonAction(restoreButton);
    setTitle(Bundle.getMessage("MenuItemEditSchedule"));
    initMinimumSize(new Dimension(Control.panelWidth300, Control.panelHeight200));
}
Also used : JComboBox(javax.swing.JComboBox) Dimension(java.awt.Dimension)

Example 59 with JComboBox

use of javax.swing.JComboBox 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 60 with JComboBox

use of javax.swing.JComboBox in project JMRI by JMRI.

the class SpeedoConsoleFrame method initComponents.

// FIXME: Why does the if statement in this method include a direct false?
@SuppressWarnings("unused")
@Override
public void initComponents() throws Exception {
    setTitle(title());
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    // What services do we have?
    dccServices = BASIC;
    if (InstanceManager.getNullableDefault(jmri.ProgrammerManager.class) != null && InstanceManager.getDefault(jmri.ProgrammerManager.class).isGlobalProgrammerAvailable()) {
        prog = InstanceManager.getDefault(jmri.ProgrammerManager.class).getGlobalProgrammer();
        dccServices |= PROG;
    }
    if (InstanceManager.getNullableDefault(jmri.ThrottleManager.class) != null) {
        // otherwise we'll send speed commands
        log.info("Using Throttle interface for profiling");
        dccServices |= THROTTLE;
    }
    if (InstanceManager.getNullableDefault(jmri.PowerManager.class) != null) {
        pm = InstanceManager.getDefault(jmri.PowerManager.class);
        pm.addPropertyChangeListener(this);
    }
    /*
         * Setup pane for basic operations
         */
    JPanel basicPane = new JPanel();
    basicPane.setLayout(new BoxLayout(basicPane, BoxLayout.Y_AXIS));
    // Scale panel to hold the scale selector
    JPanel scalePanel = new JPanel();
    scalePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), rb.getString("SelectScale")));
    scalePanel.setLayout(new FlowLayout());
    scaleList.setToolTipText("Select the scale");
    scaleList.setSelectedIndex(defaultScale);
    selectedScale = scales[defaultScale];
    // Listen to selection of scale
    scaleList.addActionListener(new java.awt.event.ActionListener() {

        // action semantics pass an Object that must be a JComboBox<String>
        @SuppressWarnings("unchecked")
        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            selectedScale = scales[cb.getSelectedIndex()];
        // *** check if -1 and enable text entry box
        }
    });
    scaleLabel.setText(rb.getString("Scale"));
    scaleLabel.setVisible(true);
    readerLabel.setText(rb.getString("UnknownReader"));
    readerLabel.setVisible(true);
    scalePanel.add(scaleLabel);
    scalePanel.add(scaleList);
    scalePanel.add(readerLabel);
    basicPane.add(scalePanel);
    // Mode panel for selection of profile mode
    JPanel modePanel = new JPanel();
    modePanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), rb.getString("SelectMode")));
    modePanel.setLayout(new FlowLayout());
    // Buttons to select the mode
    modeGroup.add(progButton);
    modeGroup.add(mainButton);
    progButton.setSelected(true);
    progButton.setToolTipText(rb.getString("TTProg"));
    mainButton.setToolTipText(rb.getString("TTMain"));
    modePanel.add(progButton);
    modePanel.add(mainButton);
    // Listen to change of profile mode
    progButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (((dccServices & PROG) == PROG)) {
                // Programmer is available to read back CVs
                readAddressButton.setEnabled(true);
                statusLabel.setText(rb.getString("StatProg"));
            }
        }
    });
    mainButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            // no programmer available to read back CVs
            readAddressButton.setEnabled(false);
            statusLabel.setText(rb.getString("StatMain"));
        }
    });
    basicPane.add(modePanel);
    // Speed panel for the dial or digital speed display
    JPanel speedPanel = new JPanel();
    speedPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), rb.getString("MeasuredSpeed")));
    speedPanel.setLayout(new BoxLayout(speedPanel, BoxLayout.X_AXIS));
    // Display Panel which is a card layout with cards to show
    // numeric or dial type speed display
    final JPanel displayCards = new JPanel();
    displayCards.setLayout(new CardLayout());
    // Numeric speed card
    JPanel numericSpeedPanel = new JPanel();
    numericSpeedPanel.setLayout(new BoxLayout(numericSpeedPanel, BoxLayout.X_AXIS));
    Font f = new Font("", Font.PLAIN, 96);
    speedTextField.setFont(f);
    speedTextField.setHorizontalAlignment(JTextField.RIGHT);
    speedTextField.setColumns(3);
    speedTextField.setText("0.0");
    speedTextField.setVisible(true);
    speedTextField.setToolTipText(rb.getString("SpeedHere"));
    numericSpeedPanel.add(speedTextField);
    // Dial speed card
    JPanel dialSpeedPanel = new JPanel();
    dialSpeedPanel.setLayout(new BoxLayout(dialSpeedPanel, BoxLayout.X_AXIS));
    dialSpeedPanel.add(speedoDialDisplay);
    speedoDialDisplay.update(0.0F);
    // Add cards to panel
    displayCards.add(dialSpeedPanel, "DIAL");
    displayCards.add(numericSpeedPanel, "NUMERIC");
    CardLayout cl = (CardLayout) displayCards.getLayout();
    cl.show(displayCards, "DIAL");
    // button panel
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    speedGroup.add(mphButton);
    speedGroup.add(kphButton);
    mphButton.setSelected(true);
    mphButton.setToolTipText(rb.getString("TTDisplayMPH"));
    kphButton.setToolTipText(rb.getString("TTDisplayKPH"));
    displayGroup.add(numButton);
    displayGroup.add(dialButton);
    dialButton.setSelected(true);
    numButton.setToolTipText(rb.getString("TTDisplayNumeric"));
    dialButton.setToolTipText(rb.getString("TTDisplayDial"));
    buttonPanel.add(mphButton);
    buttonPanel.add(kphButton);
    buttonPanel.add(numButton);
    buttonPanel.add(dialButton);
    speedPanel.add(displayCards);
    speedPanel.add(buttonPanel);
    // Listen to change of units, convert current average and update display
    mphButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.setUnitsMph();
            profileGraphPane.repaint();
            speedoDialDisplay.setUnitsMph();
            speedoDialDisplay.update(currentSpeed);
            speedoDialDisplay.repaint();
        }
    });
    kphButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.setUnitsKph();
            profileGraphPane.repaint();
            speedoDialDisplay.setUnitsKph();
            speedoDialDisplay.update(currentSpeed);
            speedoDialDisplay.repaint();
        }
    });
    // Listen to change of display
    numButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            display = DisplayType.NUMERIC;
            CardLayout cl = (CardLayout) displayCards.getLayout();
            cl.show(displayCards, "NUMERIC");
        }
    });
    dialButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            display = DisplayType.DIAL;
            CardLayout cl = (CardLayout) displayCards.getLayout();
            cl.show(displayCards, "DIAL");
        }
    });
    basicPane.add(speedPanel);
    /*
         * Pane for profiling loco speed curve
         */
    JPanel profilePane = new JPanel();
    profilePane.setLayout(new BorderLayout());
    JPanel addrPane = new JPanel();
    GridBagLayout gLayout = new GridBagLayout();
    GridBagConstraints gConstraints = new GridBagConstraints();
    gConstraints.insets = new Insets(3, 3, 3, 3);
    Border addrPaneBorder = javax.swing.BorderFactory.createEtchedBorder();
    TitledBorder addrPaneTitle = javax.swing.BorderFactory.createTitledBorder(addrPaneBorder, rb.getString("LocoSelection"));
    addrPane.setLayout(gLayout);
    addrPane.setBorder(addrPaneTitle);
    setButton = new JButton(rb.getString("ButtonSet"));
    setButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            changeOfAddress();
        }
    });
    addrSelector.setAddress(null);
    rosterBox = new GlobalRosterEntryComboBox();
    rosterBox.setNonSelectedItem(rb.getString("NoLocoSelected"));
    rosterBox.setToolTipText(rb.getString("TTSelectLocoFromRoster"));
    /*
         Using an ActionListener didn't select a loco from the ComboBox properly
         so changed it to a PropertyChangeListener approach modeled on the code
         in CombinedLocoSelPane class, layoutRosterSelection method, which is known to work.
         Not sure why the ActionListener didn't work properly, but this fixes the bug
         */
    rosterBox.addPropertyChangeListener(RosterEntrySelector.SELECTED_ROSTER_ENTRIES, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent pce) {
            if (!disableRosterBoxActions) {
                //Have roster box actions been disabled?
                rosterItemSelected();
            }
        }
    });
    readAddressButton.setToolTipText(rb.getString("ReadLoco"));
    addrPane.add(addrSelector.getCombinedJPanel(), gConstraints);
    addrPane.add(new JLabel(" "), gConstraints);
    addrPane.add(setButton, gConstraints);
    addrPane.add(new JLabel(" "), gConstraints);
    addrPane.add(rosterBox, gConstraints);
    addrPane.add(new JLabel(" "), gConstraints);
    addrPane.add(readAddressButton, gConstraints);
    if (((dccServices & PROG) != PROG) || (mainButton.isSelected())) {
        // No programming facility so user must enter address
        addrSelector.setEnabled(false);
        readAddressButton.setEnabled(false);
    } else {
        addrSelector.setEnabled(true);
        readAddressButton.setEnabled(true);
    }
    // Listen to read button
    readAddressButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            readAddress();
        }
    });
    profilePane.add(addrPane, BorderLayout.NORTH);
    // pane to hold the graph
    // 28 step plus step 0
    spFwd = new DccSpeedProfile(29);
    // 28 step plus step 0
    spRev = new DccSpeedProfile(29);
    // 28 step plus step 0
    spRef = new DccSpeedProfile(29);
    profileGraphPane = new GraphPane(spFwd, spRev, spRef);
    profileGraphPane.setPreferredSize(new Dimension(600, 300));
    profileGraphPane.setXLabel(rb.getString("SpeedStep"));
    profileGraphPane.setUnitsMph();
    profilePane.add(profileGraphPane, BorderLayout.CENTER);
    // pane to hold the buttons
    JPanel profileButtonPane = new JPanel();
    profileButtonPane.setLayout(new FlowLayout());
    profileButtonPane.add(trackPowerButton);
    trackPowerButton.setToolTipText(rb.getString("TTPower"));
    profileButtonPane.add(startProfileButton);
    startProfileButton.setToolTipText(rb.getString("TTStartProfile"));
    profileButtonPane.add(stopProfileButton);
    stopProfileButton.setToolTipText(rb.getString("TTStopProfile"));
    profileButtonPane.add(exportProfileButton);
    exportProfileButton.setToolTipText(rb.getString("TTSaveProfile"));
    profileButtonPane.add(printProfileButton);
    printProfileButton.setToolTipText(rb.getString("TTPrintProfile"));
    profileButtonPane.add(resetGraphButton);
    resetGraphButton.setToolTipText(rb.getString("TTResetGraph"));
    profileButtonPane.add(loadProfileButton);
    loadProfileButton.setToolTipText(rb.getString("TTLoadProfile"));
    // pane to hold the title
    JPanel profileTitlePane = new JPanel();
    profileTitlePane.setLayout(new BoxLayout(profileTitlePane, BoxLayout.X_AXIS));
    //       JTextArea profileTitle = new JTextArea("Title: ");
    //       profileTitlePane.add(profileTitle);
    printTitleText.setToolTipText(rb.getString("TTPrintTitle"));
    printTitleText.setText("Bachrus MTS-DCC profile for loco <unknown>");
    profileTitlePane.add(printTitleText);
    // pane to wrap buttons and title
    JPanel profileSouthPane = new JPanel();
    profileSouthPane.setLayout(new BoxLayout(profileSouthPane, BoxLayout.Y_AXIS));
    profileSouthPane.add(profileButtonPane);
    profileSouthPane.add(profileTitlePane);
    // Listen to track Power button
    trackPowerButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            trackPower();
        }
    });
    // Listen to start button
    startProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            startProfile();
        }
    });
    // Listen to stop button
    stopProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            stopProfile();
        }
    });
    // Listen to grid button
    toggleGridButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.showGrid(toggleGridButton.isSelected());
            profileGraphPane.repaint();
        }
    });
    // Listen to export button
    exportProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (dirFwdButton.isSelected() && dirRevButton.isSelected()) {
                DccSpeedProfile[] sp = { spFwd, spRev };
                DccSpeedProfile.export(sp, profileAddress, profileGraphPane.getUnits());
            } else if (dirFwdButton.isSelected()) {
                DccSpeedProfile.export(spFwd, profileAddress, "fwd", profileGraphPane.getUnits());
            } else if (dirRevButton.isSelected()) {
                DccSpeedProfile.export(spRev, profileAddress, "rev", profileGraphPane.getUnits());
            }
        }
    });
    // Listen to print button
    printProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            profileGraphPane.printProfile(printTitleText.getText());
        }
    });
    // Listen to reset graph button
    resetGraphButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            spFwd.clear();
            spRev.clear();
            spRef.clear();
            speedoDialDisplay.reset();
            profileGraphPane.repaint();
        }
    });
    // Listen to Load Reference button
    loadProfileButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            spRef.clear();
            int response = spRef.importDccProfile(profileGraphPane.getUnits());
            if (response == -1) {
                statusLabel.setText(rb.getString("StatFileError"));
            } else {
                statusLabel.setText(rb.getString("StatFileSuccess"));
            }
            profileGraphPane.repaint();
        }
    });
    profilePane.add(profileSouthPane, BorderLayout.SOUTH);
    // Pane to hold controls
    JPanel profileControlPane = new JPanel();
    profileControlPane.setLayout(new BoxLayout(profileControlPane, BoxLayout.Y_AXIS));
    dirFwdButton.setSelected(true);
    dirFwdButton.setToolTipText(rb.getString("TTMeasFwd"));
    dirRevButton.setToolTipText(rb.getString("TTMeasRev"));
    dirFwdButton.setForeground(Color.RED);
    dirRevButton.setForeground(Color.BLUE);
    profileControlPane.add(dirFwdButton);
    profileControlPane.add(dirRevButton);
    toggleGridButton.setSelected(true);
    profileControlPane.add(toggleGridButton);
    profileGraphPane.showGrid(toggleGridButton.isSelected());
    profilePane.add(profileControlPane, BorderLayout.EAST);
    /*
         * Create the tabbed pane and add the panes
         */
    //        JTabbedPane tabbedPane = new JTabbedPane();
    JPanel tabbedPane = new JPanel();
    tabbedPane.setLayout(new BoxLayout(tabbedPane, BoxLayout.X_AXIS));
    // make basic panel
    //        tabbedPane.addTab(rb.getString("Setup"), null, basicPane, "Basic Speedo Operation");
    tabbedPane.add(basicPane);
    if (((dccServices & THROTTLE) == THROTTLE) || ((dccServices & COMMAND) == COMMAND)) {
        //            tabbedPane.addTab(rb.getString("Profile"), null, profilePane, "Profile Loco");
        tabbedPane.add(profilePane);
    }
    // connect to TrafficController
    tc = _memo.getTrafficController();
    tc.addSpeedoListener(this);
    // add help menu to window
    addHelpMenu("package.jmri.jmrix.bachrus.SpeedoConsoleFrame", true);
    // Create a wrapper with a status line and add the main content
    JPanel statusWrapper = new JPanel();
    statusWrapper.setLayout(new BorderLayout());
    JPanel statusPanel = new JPanel();
    statusPanel.setLayout(new BorderLayout());
    statusPanel.add(statusLabel, BorderLayout.WEST);
    statusPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    statusWrapper.add(tabbedPane, BorderLayout.CENTER);
    statusWrapper.add(statusPanel, BorderLayout.SOUTH);
    getContentPane().add(statusWrapper);
    // pack for display
    pack();
    speedoDialDisplay.scaleFace();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) TitledBorder(javax.swing.border.TitledBorder) Font(java.awt.Font) PowerManager(jmri.PowerManager) BorderLayout(java.awt.BorderLayout) GlobalRosterEntryComboBox(jmri.jmrit.roster.swing.GlobalRosterEntryComboBox) CardLayout(java.awt.CardLayout) PropertyChangeEvent(java.beans.PropertyChangeEvent) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder) EtchedBorder(javax.swing.border.EtchedBorder)

Aggregations

JComboBox (javax.swing.JComboBox)226 JLabel (javax.swing.JLabel)97 JPanel (javax.swing.JPanel)88 ActionEvent (java.awt.event.ActionEvent)69 ActionListener (java.awt.event.ActionListener)66 JButton (javax.swing.JButton)55 GridBagLayout (java.awt.GridBagLayout)42 GridBagConstraints (java.awt.GridBagConstraints)41 Insets (java.awt.Insets)40 Dimension (java.awt.Dimension)39 JScrollPane (javax.swing.JScrollPane)37 JTextField (javax.swing.JTextField)36 BoxLayout (javax.swing.BoxLayout)34 JCheckBox (javax.swing.JCheckBox)33 DefaultCellEditor (javax.swing.DefaultCellEditor)27 JTable (javax.swing.JTable)26 BorderLayout (java.awt.BorderLayout)25 Component (java.awt.Component)25 TableColumn (javax.swing.table.TableColumn)23 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)22