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);
}
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();
}
});
}
Aggregations