From e6fd4def78e7553537584b4de148b3d634e38686 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 3 Dec 2010 13:54:25 +0000 Subject: [PATCH] exposing the last mouse clicked mote, skins may use this to view additional information about the mote --- tools/cooja/java/se/sics/cooja/plugins/Visualizer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java b/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java index e652675e3..3c4ba64aa 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java +++ b/tools/cooja/java/se/sics/cooja/plugins/Visualizer.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: Visualizer.java,v 1.17 2010/10/25 13:53:02 nifi Exp $ + * $Id: Visualizer.java,v 1.18 2010/12/03 13:54:25 fros4943 Exp $ */ package se.sics.cooja.plugins; @@ -145,6 +145,7 @@ public class Visualizer extends VisPlugin { private Point zoomingPixel = null; /* Zooming center pixel */ private boolean moving = false; private Mote movedMote = null; + public Mote clickedMote = null; private long moveStartTime = -1; private boolean moveConfirm; private Cursor moveCursor = new Cursor(Cursor.MOVE_CURSOR); @@ -672,6 +673,7 @@ public class Visualizer extends VisPlugin { private void handleMousePress(MouseEvent mouseEvent) { int x = mouseEvent.getX(); int y = mouseEvent.getY(); + clickedMote = null; if (mouseEvent.isControlDown()) { /* Zoom */ @@ -693,6 +695,7 @@ public class Visualizer extends VisPlugin { if (motes != null && motes.length > 0) { /* One of the clicked motes should be moved */ + clickedMote = motes[0]; beginMoveRequest(motes[0], !mouseEvent.isAltDown(), !mouseEvent.isAltDown()); } } @@ -794,6 +797,7 @@ public class Visualizer extends VisPlugin { moving = false; movedMote = null; + repaint(); } }