diff --git a/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/ESBButton.java b/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/ESBButton.java index cb6b6689f..2214dce69 100644 --- a/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/ESBButton.java +++ b/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/ESBButton.java @@ -60,6 +60,7 @@ public class ESBButton extends Button { mote.esbNode.setButton(true); } + @Override public boolean isPressed() { return false; } diff --git a/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/SkyButton.java b/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/SkyButton.java index b11030ccf..502e75570 100644 --- a/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/SkyButton.java +++ b/tools/cooja/apps/mspsim/src/org/contikios/cooja/mspmote/interfaces/SkyButton.java @@ -57,6 +57,7 @@ public class SkyButton extends Button { skyMote.skyNode.setButton(false); } + @Override public boolean isPressed() { /* Not implemented */ return false; diff --git a/tools/cooja/java/org/contikios/cooja/contikimote/interfaces/ContikiButton.java b/tools/cooja/java/org/contikios/cooja/contikimote/interfaces/ContikiButton.java index 67a16c97f..dea5728a3 100644 --- a/tools/cooja/java/org/contikios/cooja/contikimote/interfaces/ContikiButton.java +++ b/tools/cooja/java/org/contikios/cooja/contikimote/interfaces/ContikiButton.java @@ -111,6 +111,7 @@ public class ContikiButton extends Button implements ContikiMoteInterface { } } + @Override public boolean isPressed() { return moteMem.getByteValueOf("simButtonIsDown") == 1; } diff --git a/tools/cooja/java/org/contikios/cooja/interfaces/Button.java b/tools/cooja/java/org/contikios/cooja/interfaces/Button.java index 02985a8e8..62e7a5eb0 100644 --- a/tools/cooja/java/org/contikios/cooja/interfaces/Button.java +++ b/tools/cooja/java/org/contikios/cooja/interfaces/Button.java @@ -58,11 +58,13 @@ public abstract class Button extends MoteInterface { sim = mote.getSimulation(); pressButtonEvent = new MoteTimeEvent(mote, 0) { + @Override public void execute(long t) { doPressButton(); } }; releaseButtonEvent = new MoteTimeEvent(mote, 0) { + @Override public void execute(long t) { doReleaseButton(); } @@ -75,6 +77,7 @@ public abstract class Button extends MoteInterface { */ public void clickButton() { sim.invokeSimulationThread(new Runnable() { + @Override public void run() { sim.scheduleEvent(pressButtonEvent, sim.getSimulationTime()); sim.scheduleEvent(releaseButtonEvent, sim.getSimulationTime() + Simulation.MILLISECOND); @@ -87,6 +90,7 @@ public abstract class Button extends MoteInterface { */ public void pressButton() { sim.invokeSimulationThread(new Runnable() { + @Override public void run() { sim.scheduleEvent(pressButtonEvent, sim.getSimulationTime()); } @@ -103,6 +107,7 @@ public abstract class Button extends MoteInterface { */ public void releaseButton() { sim.invokeSimulationThread(new Runnable() { + @Override public void run() { sim.scheduleEvent(releaseButtonEvent, sim.getSimulationTime()); } @@ -119,6 +124,7 @@ public abstract class Button extends MoteInterface { */ public abstract boolean isPressed(); + @Override public JPanel getInterfaceVisualizer() { JPanel panel = new JPanel(); final JButton clickButton = new JButton("Click button"); @@ -126,6 +132,7 @@ public abstract class Button extends MoteInterface { panel.add(clickButton); clickButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { clickButton(); } @@ -134,6 +141,7 @@ public abstract class Button extends MoteInterface { return panel; } + @Override public void releaseInterfaceVisualizer(JPanel panel) { }