Buttons: Added missing @Override annotations

This commit is contained in:
Enrico Joerns 2014-10-31 01:23:50 +01:00
parent 0a63922fa2
commit b28c593776
4 changed files with 11 additions and 0 deletions

View file

@ -60,6 +60,7 @@ public class ESBButton extends Button {
mote.esbNode.setButton(true); mote.esbNode.setButton(true);
} }
@Override
public boolean isPressed() { public boolean isPressed() {
return false; return false;
} }

View file

@ -57,6 +57,7 @@ public class SkyButton extends Button {
skyMote.skyNode.setButton(false); skyMote.skyNode.setButton(false);
} }
@Override
public boolean isPressed() { public boolean isPressed() {
/* Not implemented */ /* Not implemented */
return false; return false;

View file

@ -111,6 +111,7 @@ public class ContikiButton extends Button implements ContikiMoteInterface {
} }
} }
@Override
public boolean isPressed() { public boolean isPressed() {
return moteMem.getByteValueOf("simButtonIsDown") == 1; return moteMem.getByteValueOf("simButtonIsDown") == 1;
} }

View file

@ -58,11 +58,13 @@ public abstract class Button extends MoteInterface {
sim = mote.getSimulation(); sim = mote.getSimulation();
pressButtonEvent = new MoteTimeEvent(mote, 0) { pressButtonEvent = new MoteTimeEvent(mote, 0) {
@Override
public void execute(long t) { public void execute(long t) {
doPressButton(); doPressButton();
} }
}; };
releaseButtonEvent = new MoteTimeEvent(mote, 0) { releaseButtonEvent = new MoteTimeEvent(mote, 0) {
@Override
public void execute(long t) { public void execute(long t) {
doReleaseButton(); doReleaseButton();
} }
@ -75,6 +77,7 @@ public abstract class Button extends MoteInterface {
*/ */
public void clickButton() { public void clickButton() {
sim.invokeSimulationThread(new Runnable() { sim.invokeSimulationThread(new Runnable() {
@Override
public void run() { public void run() {
sim.scheduleEvent(pressButtonEvent, sim.getSimulationTime()); sim.scheduleEvent(pressButtonEvent, sim.getSimulationTime());
sim.scheduleEvent(releaseButtonEvent, sim.getSimulationTime() + Simulation.MILLISECOND); sim.scheduleEvent(releaseButtonEvent, sim.getSimulationTime() + Simulation.MILLISECOND);
@ -87,6 +90,7 @@ public abstract class Button extends MoteInterface {
*/ */
public void pressButton() { public void pressButton() {
sim.invokeSimulationThread(new Runnable() { sim.invokeSimulationThread(new Runnable() {
@Override
public void run() { public void run() {
sim.scheduleEvent(pressButtonEvent, sim.getSimulationTime()); sim.scheduleEvent(pressButtonEvent, sim.getSimulationTime());
} }
@ -103,6 +107,7 @@ public abstract class Button extends MoteInterface {
*/ */
public void releaseButton() { public void releaseButton() {
sim.invokeSimulationThread(new Runnable() { sim.invokeSimulationThread(new Runnable() {
@Override
public void run() { public void run() {
sim.scheduleEvent(releaseButtonEvent, sim.getSimulationTime()); sim.scheduleEvent(releaseButtonEvent, sim.getSimulationTime());
} }
@ -119,6 +124,7 @@ public abstract class Button extends MoteInterface {
*/ */
public abstract boolean isPressed(); public abstract boolean isPressed();
@Override
public JPanel getInterfaceVisualizer() { public JPanel getInterfaceVisualizer() {
JPanel panel = new JPanel(); JPanel panel = new JPanel();
final JButton clickButton = new JButton("Click button"); final JButton clickButton = new JButton("Click button");
@ -126,6 +132,7 @@ public abstract class Button extends MoteInterface {
panel.add(clickButton); panel.add(clickButton);
clickButton.addActionListener(new ActionListener() { clickButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
clickButton(); clickButton();
} }
@ -134,6 +141,7 @@ public abstract class Button extends MoteInterface {
return panel; return panel;
} }
@Override
public void releaseInterfaceVisualizer(JPanel panel) { public void releaseInterfaceVisualizer(JPanel panel) {
} }