[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
1 changed files with 32 additions and 0 deletions
|
@ -105,6 +105,9 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
|
|||
private JComboBox varNameCombo;
|
||||
private JComboBox varTypeCombo;
|
||||
private JComboBox varFormatCombo;
|
||||
private JPanel infoPane;
|
||||
private JTextField varAddressField;
|
||||
private JTextField varSizeField;
|
||||
private JFormattedTextField[] varValues;
|
||||
private byte[] bufferedBytes;
|
||||
private JButton readButton;
|
||||
|
@ -265,6 +268,8 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
|
|||
bufferedBytes = null;
|
||||
/* calculate number of elements required to show the value in the given size */
|
||||
updateNumberOfValues();
|
||||
varAddressField.setText(String.format("0x%04x", moteMemory.getVariableAddress((String) e.getItem())));
|
||||
varSizeField.setText(String.valueOf(moteMemory.getVariableSize((String) e.getItem())));
|
||||
}
|
||||
catch (UnknownVariableException ex) {
|
||||
((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)));
|
||||
|
||||
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
|
||||
label = new JLabel("Variable value");
|
||||
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
||||
|
|
Loading…
Reference in a new issue