Search in sources :

Example 1 with NodeSelector

use of org.openlcb.swing.NodeSelector in project JMRI by JMRI.

the class LoaderPane method initComponents.

@Override
public void initComponents(CanSystemConnectionMemo memo) throws Exception {
    this.memo = memo;
    this.connection = memo.get(Connection.class);
    this.mcs = memo.get(MemoryConfigurationService.class);
    this.dcs = memo.get(DatagramService.class);
    this.store = memo.get(MimicNodeStore.class);
    this.nodeSelector = new NodeSelector(store);
    this.loaderClient = memo.get(LoaderClient.class);
    this.nid = memo.get(NodeID.class);
    // We can add to GUI here
    loadButton.setText("Load");
    loadButton.setToolTipText("Start Load Process");
    JPanel p;
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel("Target Node ID: "));
    p.add(nodeSelector);
    selectorPane.add(p);
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(new JLabel("Address Space: "));
    p.add(spaceField = new JTextField("" + 0xEF));
    selectorPane.add(p);
    spaceField.setToolTipText("The decimal number of the address space, e.g. 239");
    p = new JPanel();
    p.setLayout(new FlowLayout());
    p.add(lockNode = new JCheckBox("Lock Node"));
    selectorPane.add(p);
    // Verify not an option
    verifyButton.setVisible(false);
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) MimicNodeStore(org.openlcb.MimicNodeStore) FlowLayout(java.awt.FlowLayout) LoaderClient(org.openlcb.LoaderClient) MemoryConfigurationService(org.openlcb.implementations.MemoryConfigurationService) DatagramService(org.openlcb.implementations.DatagramService) Connection(org.openlcb.Connection) NodeID(org.openlcb.NodeID) JLabel(javax.swing.JLabel) NodeSelector(org.openlcb.swing.NodeSelector) JTextField(javax.swing.JTextField)

Example 2 with NodeSelector

use of org.openlcb.swing.NodeSelector in project JMRI by JMRI.

the class OpenLcbCanSendPane method initComponents.

@Override
public void initComponents(CanSystemConnectionMemo memo) {
    super.initComponents(memo);
    iface = memo.get(OlcbInterface.class);
    actions = new ClientActions(iface);
    tc = memo.getTrafficController();
    tc.addCanListener(this);
    connection = memo.get(org.openlcb.Connection.class);
    srcNodeID = memo.get(org.openlcb.NodeID.class);
    aliasMap = memo.get(org.openlcb.can.AliasMap.class);
    // register request for notification
    Connection.ConnectionListener cl = new Connection.ConnectionListener() {

        @Override
        public void connectionActive(Connection c) {
            log.debug("connection active");
            // load the alias field
            srcAliasField.setText(Integer.toHexString(aliasMap.getAlias(srcNodeID)));
        }
    };
    connection.registerStartNotification(cl);
    mcs = memo.get(MemoryConfigurationService.class);
    store = memo.get(MimicNodeStore.class);
    nodeSelector = new NodeSelector(store);
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    // handle single-packet part
    {
        JPanel pane1 = new JPanel();
        pane1.setLayout(new BoxLayout(pane1, BoxLayout.Y_AXIS));
        jLabel1.setText("Single Frame:  (Raw input format is [123] 12 34 56) ");
        jLabel1.setVisible(true);
        sendButton.setText("Send");
        sendButton.setVisible(true);
        sendButton.setToolTipText("Send frame");
        packetTextField.setToolTipText("Frame as hex pairs, e.g. 82 7D; standard header in (), extended in []");
        pane1.add(jLabel1);
        pane1.add(packetTextField);
        pane1.add(sendButton);
        pane1.add(Box.createVerticalGlue());
        sendButton.addActionListener(new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
                sendButtonActionPerformed(e);
            }
        });
        add(pane1);
    }
    add(new JSeparator());
    // Configure the sequence
    add(new JLabel("Send sequence of frames:"));
    JPanel pane2 = new JPanel();
    pane2.setLayout(new GridLayout2(MAXSEQUENCE + 2, 4));
    pane2.add(new JLabel(""));
    pane2.add(new JLabel("Send"));
    pane2.add(new JLabel("packet"));
    pane2.add(new JLabel("wait (msec)"));
    for (int i = 0; i < MAXSEQUENCE; i++) {
        pane2.add(new JLabel(Integer.toString(i + 1)));
        mUseField[i] = new JCheckBox();
        mPacketField[i] = new JTextField(10);
        mDelayField[i] = new JTextField(10);
        pane2.add(mUseField[i]);
        pane2.add(mPacketField[i]);
        pane2.add(mDelayField[i]);
    }
    // starts a new row in layout
    pane2.add(mRunButton);
    add(pane2);
    mRunButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            runButtonActionPerformed(e);
        }
    });
    // special packet forms
    add(new JSeparator());
    add(new JLabel("Send special frame:"));
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    pane2.add(new JLabel("Src Node alias:"));
    pane2.add(srcAliasField);
    add(pane2);
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    JButton b;
    b = new JButton("Send CIM");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendCimPerformed(e);
        }
    });
    pane2.add(b);
    // send OpenLCB messages
    add(new JSeparator());
    add(addLineLabel("Send OpenLCB global message:"));
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    b = new JButton("Send Verify Nodes Global");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendVerifyNodeGlobal(e);
        }
    });
    pane2.add(b);
    b = new JButton("Send Verify Node Global with NodeID");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendVerifyNodeGlobalID(e);
        }
    });
    pane2.add(b);
    add(new JSeparator());
    add(addLineLabel("Send OpenLCB event message:"));
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    b = new JButton("Send Request Consumers");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendReqConsumers(e);
        }
    });
    pane2.add(b);
    b = new JButton("Send Request Producers");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendReqProducers(e);
        }
    });
    pane2.add(b);
    b = new JButton("Send Event Produced");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendEventPerformed(e);
        }
    });
    pane2.add(b);
    pane2.add(new JLabel("Event ID (8 bytes):"));
    pane2.add(sendEventField);
    add(new JSeparator());
    add(addLineLabel("Send OpenLCB addressed message to:", nodeSelector));
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    b = new JButton("Send Request Events");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendRequestEvents(e);
        }
    });
    pane2.add(b);
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    b = new JButton("Send Datagram");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendDatagramPerformed(e);
        }
    });
    pane2.add(b);
    pane2.add(new JLabel("Contents: "));
    pane2.add(datagramContentsField);
    b = new JButton("Send Datagram Reply");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendDatagramReply(e);
        }
    });
    pane2.add(b);
    // send OpenLCB Configuration message
    add(new JSeparator());
    add(addLineLabel("Send OpenLCB Configuration Command:"));
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    pane2.add(new JLabel("Memory Address: "));
    pane2.add(configAddressField);
    pane2.add(new JLabel("Address Space: "));
    pane2.add(addrSpace);
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    pane2.add(new JLabel("Byte Count: "));
    pane2.add(configNumberField);
    b = new JButton("Read");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            readPerformed(e);
        }
    });
    pane2.add(b);
    pane2.add(new JLabel("Data: "));
    pane2.add(readDataField);
    pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    add(pane2);
    b = new JButton("Write");
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            writePerformed(e);
        }
    });
    pane2.add(b);
    pane2.add(new JLabel("Data: "));
    // NOI18N
    writeDataField.setText("00 00");
    pane2.add(writeDataField);
    b = new JButton("Open CDI Config Tool");
    add(b);
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            openCdiPane();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) AliasMap(org.openlcb.can.AliasMap) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) NodeID(org.openlcb.NodeID) MimicNodeStore(org.openlcb.MimicNodeStore) GridLayout2(jmri.util.javaworld.GridLayout2) Connection(org.openlcb.Connection) JLabel(javax.swing.JLabel) OlcbInterface(org.openlcb.OlcbInterface) JCheckBox(javax.swing.JCheckBox) MemoryConfigurationService(org.openlcb.implementations.MemoryConfigurationService) NodeSelector(org.openlcb.swing.NodeSelector) ClientActions(jmri.jmrix.openlcb.swing.ClientActions)

Aggregations

FlowLayout (java.awt.FlowLayout)2 JCheckBox (javax.swing.JCheckBox)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 JTextField (javax.swing.JTextField)2 Connection (org.openlcb.Connection)2 MimicNodeStore (org.openlcb.MimicNodeStore)2 NodeID (org.openlcb.NodeID)2 MemoryConfigurationService (org.openlcb.implementations.MemoryConfigurationService)2 NodeSelector (org.openlcb.swing.NodeSelector)2 BoxLayout (javax.swing.BoxLayout)1 JButton (javax.swing.JButton)1 JSeparator (javax.swing.JSeparator)1 ClientActions (jmri.jmrix.openlcb.swing.ClientActions)1 GridLayout2 (jmri.util.javaworld.GridLayout2)1 LoaderClient (org.openlcb.LoaderClient)1 OlcbInterface (org.openlcb.OlcbInterface)1 AliasMap (org.openlcb.can.AliasMap)1 DatagramService (org.openlcb.implementations.DatagramService)1