[cooja] plugins/VariableWatcher: Added address and and size labels
to display information about currently selected variable
This commit is contained in:
parent
c0f727e3c0
commit
a638bd5b01
|
@ -105,6 +105,9 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
|
||||||
private JComboBox varNameCombo;
|
private JComboBox varNameCombo;
|
||||||
private JComboBox varTypeCombo;
|
private JComboBox varTypeCombo;
|
||||||
private JComboBox varFormatCombo;
|
private JComboBox varFormatCombo;
|
||||||
|
private JPanel infoPane;
|
||||||
|
private JTextField varAddressField;
|
||||||
|
private JTextField varSizeField;
|
||||||
private JFormattedTextField[] varValues;
|
private JFormattedTextField[] varValues;
|
||||||
private byte[] bufferedBytes;
|
private byte[] bufferedBytes;
|
||||||
private JButton readButton;
|
private JButton readButton;
|
||||||
|
@ -265,6 +268,8 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
|
||||||
bufferedBytes = null;
|
bufferedBytes = null;
|
||||||
/* calculate number of elements required to show the value in the given size */
|
/* calculate number of elements required to show the value in the given size */
|
||||||
updateNumberOfValues();
|
updateNumberOfValues();
|
||||||
|
varAddressField.setText(String.format("0x%04x", moteMemory.getVariableAddress((String) e.getItem())));
|
||||||
|
varSizeField.setText(String.valueOf(moteMemory.getVariableSize((String) e.getItem())));
|
||||||
}
|
}
|
||||||
catch (UnknownVariableException ex) {
|
catch (UnknownVariableException ex) {
|
||||||
((JTextField) varNameCombo.getEditor().getEditorComponent()).setForeground(Color.RED);
|
((JTextField) varNameCombo.getEditor().getEditorComponent()).setForeground(Color.RED);
|
||||||
|
@ -322,6 +327,33 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
|
||||||
|
|
||||||
mainPane.add(Box.createRigidArea(new Dimension(0,5)));
|
mainPane.add(Box.createRigidArea(new Dimension(0,5)));
|
||||||
|
|
||||||
|
infoPane = new JPanel();
|
||||||
|
infoPane.setLayout(new BoxLayout(infoPane, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
|
JPanel addrInfoPane = new JPanel(new BorderLayout());
|
||||||
|
JPanel sizeInfoPane = new JPanel(new BorderLayout());
|
||||||
|
|
||||||
|
label = new JLabel("Address");
|
||||||
|
addrInfoPane.add(BorderLayout.CENTER, label);
|
||||||
|
varAddressField = new JTextField("?");
|
||||||
|
varAddressField.setEditable(false);
|
||||||
|
varAddressField.setEnabled(false);
|
||||||
|
varAddressField.setColumns(6);
|
||||||
|
addrInfoPane.add(BorderLayout.EAST, varAddressField);
|
||||||
|
|
||||||
|
infoPane.add(addrInfoPane);
|
||||||
|
|
||||||
|
label = new JLabel("Size");
|
||||||
|
sizeInfoPane.add(BorderLayout.WEST, label);
|
||||||
|
varSizeField = new JTextField("?");
|
||||||
|
varSizeField.setEditable(false);
|
||||||
|
varSizeField.setEnabled(false);
|
||||||
|
varSizeField.setColumns(6);
|
||||||
|
sizeInfoPane.add(BorderLayout.EAST, varSizeField);
|
||||||
|
|
||||||
|
infoPane.add(sizeInfoPane);
|
||||||
|
mainPane.add(infoPane);
|
||||||
|
|
||||||
// Variable value label
|
// Variable value label
|
||||||
label = new JLabel("Variable value");
|
label = new JLabel("Variable value");
|
||||||
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
||||||
|
|
Loading…
Reference in a new issue