Search in sources :

Example 1 with SimpleNodeIdentInfoReplyMessage

use of org.openlcb.SimpleNodeIdentInfoReplyMessage in project JMRI by JMRI.

the class TreePaneDemo method testWithSelect.

@Test
public void testWithSelect() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    frame.setTitle("listener test");
    pane.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent e) {
            JTree tree = (JTree) e.getSource();
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            if (node == null) {
                return;
            }
            System.out.print("Test prints selected treenode " + node);
            if (node.getUserObject() instanceof NodeTreeRep.SelectionKey) {
                System.out.println(" and invokes");
                ((NodeTreeRep.SelectionKey) node.getUserObject()).select(node);
            } else {
                System.out.println();
            }
        }
    });
    Message msg;
    msg = new ProducerIdentifiedMessage(nid2, eventA, EventState.Unknown);
    store.put(msg, null);
    store.put(pipmsg, null);
    msg = new SimpleNodeIdentInfoReplyMessage(nid2, nid2, new byte[] { 0x01, 0x31, 0x32, 0x33, 0x41, 0x42, (byte) 0xC2, (byte) 0xA2, 0x44, 0x00 });
    store.put(msg, null);
}
Also used : JTree(javax.swing.JTree) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) SimpleNodeIdentInfoReplyMessage(org.openlcb.SimpleNodeIdentInfoReplyMessage) Message(org.openlcb.Message) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) ProtocolIdentificationReplyMessage(org.openlcb.ProtocolIdentificationReplyMessage) SimpleNodeIdentInfoReplyMessage(org.openlcb.SimpleNodeIdentInfoReplyMessage) NodeTreeRep(org.openlcb.swing.networktree.NodeTreeRep) TreeSelectionListener(javax.swing.event.TreeSelectionListener) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) Test(org.junit.Test)

Example 2 with SimpleNodeIdentInfoReplyMessage

use of org.openlcb.SimpleNodeIdentInfoReplyMessage in project JMRI by JMRI.

the class TreePaneDemo method testWith1stSNII.

@Test
public void testWith1stSNII() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    frame.setTitle("3rd has PIP && 1st SNII");
    Message msg;
    msg = new ProducerIdentifiedMessage(nid2, eventA, EventState.Unknown);
    store.put(msg, null);
    store.put(pipmsg, null);
    msg = new SimpleNodeIdentInfoReplyMessage(nid2, nid2, new byte[] { 0x01, 0x31, 0x32, 0x33, 0x41, 0x42, (byte) 0xC2, (byte) 0xA2, 0x44, 0x00 });
    store.put(msg, null);
}
Also used : SimpleNodeIdentInfoReplyMessage(org.openlcb.SimpleNodeIdentInfoReplyMessage) Message(org.openlcb.Message) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) ProtocolIdentificationReplyMessage(org.openlcb.ProtocolIdentificationReplyMessage) SimpleNodeIdentInfoReplyMessage(org.openlcb.SimpleNodeIdentInfoReplyMessage) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Message (org.openlcb.Message)2 ProducerIdentifiedMessage (org.openlcb.ProducerIdentifiedMessage)2 ProtocolIdentificationReplyMessage (org.openlcb.ProtocolIdentificationReplyMessage)2 SimpleNodeIdentInfoReplyMessage (org.openlcb.SimpleNodeIdentInfoReplyMessage)2 JTree (javax.swing.JTree)1 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)1 TreeSelectionListener (javax.swing.event.TreeSelectionListener)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 NodeTreeRep (org.openlcb.swing.networktree.NodeTreeRep)1