[cooja] plugins/VariableWatcher: Added @Override annotations

This commit is contained in:
Enrico Joerns 2014-08-27 00:01:46 +02:00
parent 97037763ad
commit a9f31ee662

View File

@ -152,12 +152,15 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
} }
varName.addKeyListener(new KeyListener() { varName.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
writeButton.setEnabled(false); writeButton.setEnabled(false);
} }
@Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
writeButton.setEnabled(false); writeButton.setEnabled(false);
} }
@Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
writeButton.setEnabled(false); writeButton.setEnabled(false);
} }
@ -179,6 +182,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
varType.addItem("Char array (x bytes)"); // CHAR_ARRAY_INDEX = 3 varType.addItem("Char array (x bytes)"); // CHAR_ARRAY_INDEX = 3
varType.addActionListener(new ActionListener() { varType.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
int selectedIndex = varType.getSelectedIndex(); int selectedIndex = varType.getSelectedIndex();
if (selectedIndex == ARRAY_INDEX || selectedIndex == CHAR_ARRAY_INDEX) { if (selectedIndex == ARRAY_INDEX || selectedIndex == CHAR_ARRAY_INDEX) {
@ -209,8 +213,10 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
* event doesn't work. * event doesn't work.
*/ */
jFormattedTextFocusAdapter = new FocusAdapter() { jFormattedTextFocusAdapter = new FocusAdapter() {
@Override
public void focusGained(final FocusEvent ev) { public void focusGained(final FocusEvent ev) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
JTextField jtxt = (JTextField)ev.getSource(); JTextField jtxt = (JTextField)ev.getSource();
jtxt.selectAll(); jtxt.selectAll();
@ -229,6 +235,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
varLength.setValue(new Integer(1)); varLength.setValue(new Integer(1));
varLength.setColumns(4); varLength.setColumns(4);
varLength.addPropertyChangeListener("value", new PropertyChangeListener() { varLength.addPropertyChangeListener("value", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) { public void propertyChange(PropertyChangeEvent e) {
setNumberOfValues(((Number) varLength.getValue()).intValue()); setNumberOfValues(((Number) varLength.getValue()).intValue());
if(varType.getSelectedIndex() == CHAR_ARRAY_INDEX) { if(varType.getSelectedIndex() == CHAR_ARRAY_INDEX) {
@ -391,6 +398,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
smallPane = new JPanel(new BorderLayout()); smallPane = new JPanel(new BorderLayout());
JButton button = new JButton("Read"); JButton button = new JButton("Read");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (varType.getSelectedIndex() == BYTE_INDEX) { if (varType.getSelectedIndex() == BYTE_INDEX) {
try { try {
@ -440,6 +448,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
button = new JButton("Write"); button = new JButton("Write");
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (varType.getSelectedIndex() == BYTE_INDEX) { if (varType.getSelectedIndex() == BYTE_INDEX) {
try { try {
@ -520,9 +529,11 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
pack(); pack();
} }
@Override
public void closePlugin() { public void closePlugin() {
} }
@Override
public Collection<Element> getConfigXML() { public Collection<Element> getConfigXML() {
// Return currently watched variable and type // Return currently watched variable and type
Vector<Element> config = new Vector<Element>(); Vector<Element> config = new Vector<Element>();
@ -562,6 +573,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
return config; return config;
} }
@Override
public boolean setConfigXML(Collection<Element> configXML, boolean visAvailable) { public boolean setConfigXML(Collection<Element> configXML, boolean visAvailable) {
lengthPane.setVisible(false); lengthPane.setVisible(false);
setNumberOfValues(1); setNumberOfValues(1);
@ -592,6 +604,7 @@ public class VariableWatcher extends VisPlugin implements MotePlugin {
return true; return true;
} }
@Override
public Mote getMote() { public Mote getMote() {
return mote; return mote;
} }
@ -616,6 +629,7 @@ class JTextFieldLimit extends PlainDocument {
toUppercase = upper; toUppercase = upper;
} }
@Override
public void insertString(int offset, String str, AttributeSet attr) public void insertString(int offset, String str, AttributeSet attr)
throws BadLocationException { throws BadLocationException {
if (str == null) { if (str == null) {