Search in sources :

Example 6 with Message

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

the class TreePaneDemo method setUp.

@Before
public void setUp() throws Exception {
    store = new MimicNodeStore(connection, nid1);
    Message msg = new ProducerIdentifiedMessage(nid1, eventA, EventState.Unknown);
    store.put(msg, null);
    // build the TreePane, but don't put it in a frame (yet).
    pane = new TreePane();
    pane.initComponents(store, null, null, new NodeTreeRep.SelectionKeyLoader() {

        @Override
        public NodeTreeRep.SelectionKey cdiKey(String name, NodeID node) {
            return new NodeTreeRep.SelectionKey(name, node) {

                @Override
                public void select(DefaultMutableTreeNode rep) {
                    System.out.println("Making special fuss over: " + rep + " for " + name + " on " + node);
                }
            };
        }
    });
    if (GraphicsEnvironment.isHeadless()) {
        // don't bother setting up a frame in headless.
        return;
    }
    // Test is really popping a window before doing all else
    frame = new JFrame();
    frame.setTitle("TreePane Test");
    frame.add(pane);
    frame.pack();
    frame.setMinimumSize(new java.awt.Dimension(200, 200));
    frame.setVisible(true);
}
Also used : MimicNodeStore(org.openlcb.MimicNodeStore) SimpleNodeIdentInfoReplyMessage(org.openlcb.SimpleNodeIdentInfoReplyMessage) Message(org.openlcb.Message) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) ProtocolIdentificationReplyMessage(org.openlcb.ProtocolIdentificationReplyMessage) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) TreePane(org.openlcb.swing.networktree.TreePane) JFrame(javax.swing.JFrame) NodeTreeRep(org.openlcb.swing.networktree.NodeTreeRep) NodeID(org.openlcb.NodeID) Before(org.junit.Before)

Example 7 with Message

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

the class TreePaneDemo method testAfterMessage.

@Test
public void testAfterMessage() {
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    frame.setTitle("After Message");
    Message msg = new ProducerIdentifiedMessage(nid2, eventA, EventState.Unknown);
    store.put(msg, null);
}
Also used : SimpleNodeIdentInfoReplyMessage(org.openlcb.SimpleNodeIdentInfoReplyMessage) Message(org.openlcb.Message) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) ProtocolIdentificationReplyMessage(org.openlcb.ProtocolIdentificationReplyMessage) ProducerIdentifiedMessage(org.openlcb.ProducerIdentifiedMessage) Test(org.junit.Test)

Example 8 with Message

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

the class OpenLcbCanSendPane method sendVerifyNodeGlobal.

public void sendVerifyNodeGlobal(java.awt.event.ActionEvent e) {
    Message m = new VerifyNodeIDNumberMessage(srcNodeID);
    connection.put(m, null);
}
Also used : IdentifyProducersMessage(org.openlcb.IdentifyProducersMessage) CanMessage(jmri.jmrix.can.CanMessage) DatagramMessage(org.openlcb.DatagramMessage) IdentifyEventsMessage(org.openlcb.IdentifyEventsMessage) ProducerConsumerEventReportMessage(org.openlcb.ProducerConsumerEventReportMessage) DatagramAcknowledgedMessage(org.openlcb.DatagramAcknowledgedMessage) Message(org.openlcb.Message) IdentifyConsumersMessage(org.openlcb.IdentifyConsumersMessage) VerifyNodeIDNumberMessage(org.openlcb.VerifyNodeIDNumberMessage) VerifyNodeIDNumberMessage(org.openlcb.VerifyNodeIDNumberMessage)

Example 9 with Message

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

the class OpenLcbCanSendPane method sendDatagramPerformed.

public void sendDatagramPerformed(java.awt.event.ActionEvent e) {
    Message m = new DatagramMessage(srcNodeID, destNodeID(), jmri.util.StringUtil.bytesFromHexString(datagramContentsField.getText()));
    connection.put(m, null);
}
Also used : IdentifyProducersMessage(org.openlcb.IdentifyProducersMessage) CanMessage(jmri.jmrix.can.CanMessage) DatagramMessage(org.openlcb.DatagramMessage) IdentifyEventsMessage(org.openlcb.IdentifyEventsMessage) ProducerConsumerEventReportMessage(org.openlcb.ProducerConsumerEventReportMessage) DatagramAcknowledgedMessage(org.openlcb.DatagramAcknowledgedMessage) Message(org.openlcb.Message) IdentifyConsumersMessage(org.openlcb.IdentifyConsumersMessage) VerifyNodeIDNumberMessage(org.openlcb.VerifyNodeIDNumberMessage) DatagramMessage(org.openlcb.DatagramMessage)

Example 10 with Message

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

the class OpenLcbCanSendPane method sendRequestEvents.

public void sendRequestEvents(java.awt.event.ActionEvent e) {
    Message m = new IdentifyEventsMessage(srcNodeID, destNodeID());
    connection.put(m, null);
}
Also used : IdentifyEventsMessage(org.openlcb.IdentifyEventsMessage) IdentifyProducersMessage(org.openlcb.IdentifyProducersMessage) CanMessage(jmri.jmrix.can.CanMessage) DatagramMessage(org.openlcb.DatagramMessage) IdentifyEventsMessage(org.openlcb.IdentifyEventsMessage) ProducerConsumerEventReportMessage(org.openlcb.ProducerConsumerEventReportMessage) DatagramAcknowledgedMessage(org.openlcb.DatagramAcknowledgedMessage) Message(org.openlcb.Message) IdentifyConsumersMessage(org.openlcb.IdentifyConsumersMessage) VerifyNodeIDNumberMessage(org.openlcb.VerifyNodeIDNumberMessage)

Aggregations

Message (org.openlcb.Message)14 CanMessage (jmri.jmrix.can.CanMessage)9 DatagramAcknowledgedMessage (org.openlcb.DatagramAcknowledgedMessage)8 DatagramMessage (org.openlcb.DatagramMessage)8 IdentifyConsumersMessage (org.openlcb.IdentifyConsumersMessage)8 IdentifyEventsMessage (org.openlcb.IdentifyEventsMessage)8 IdentifyProducersMessage (org.openlcb.IdentifyProducersMessage)8 ProducerConsumerEventReportMessage (org.openlcb.ProducerConsumerEventReportMessage)8 VerifyNodeIDNumberMessage (org.openlcb.VerifyNodeIDNumberMessage)8 ProducerIdentifiedMessage (org.openlcb.ProducerIdentifiedMessage)5 ProtocolIdentificationReplyMessage (org.openlcb.ProtocolIdentificationReplyMessage)5 SimpleNodeIdentInfoReplyMessage (org.openlcb.SimpleNodeIdentInfoReplyMessage)5 Test (org.junit.Test)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 NodeTreeRep (org.openlcb.swing.networktree.NodeTreeRep)2 JFrame (javax.swing.JFrame)1 JTree (javax.swing.JTree)1 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)1 TreeSelectionListener (javax.swing.event.TreeSelectionListener)1 Before (org.junit.Before)1