From 3e61990312188f9edc75c84ba2432f18e633263f Mon Sep 17 00:00:00 2001 From: nifi Date: Fri, 12 Nov 2010 17:52:02 +0000 Subject: [PATCH] Updated network graph to remember fixed node locations when clearing sensor/node data. --- .../se/sics/contiki/collect/CollectServer.java | 10 +++++++--- .../src/se/sics/contiki/collect/gui/MapPanel.java | 15 ++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/collect-view/src/se/sics/contiki/collect/CollectServer.java b/tools/collect-view/src/se/sics/contiki/collect/CollectServer.java index 80419bc04..6a439cd53 100644 --- a/tools/collect-view/src/se/sics/contiki/collect/CollectServer.java +++ b/tools/collect-view/src/se/sics/contiki/collect/CollectServer.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: CollectServer.java,v 1.3 2010/11/12 17:03:43 nifi Exp $ + * $Id: CollectServer.java,v 1.4 2010/11/12 17:52:02 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 3 jul 2008 - * Updated : $Date: 2010/11/12 17:03:43 $ - * $Revision: 1.3 $ + * Updated : $Date: 2010/11/12 17:52:02 $ + * $Revision: 1.4 $ */ package se.sics.contiki.collect; @@ -892,6 +892,10 @@ public class CollectServer implements SerialConnectionListener { return configTable.getProperty(property, config.getProperty(property, defaultValue)); } + public void setConfig(String property, String value) { + configTable.setProperty(property, value); + } + public void removeConfig(String property) { configTable.remove(property); } diff --git a/tools/collect-view/src/se/sics/contiki/collect/gui/MapPanel.java b/tools/collect-view/src/se/sics/contiki/collect/gui/MapPanel.java index 4a0e76d8f..774d5a701 100644 --- a/tools/collect-view/src/se/sics/contiki/collect/gui/MapPanel.java +++ b/tools/collect-view/src/se/sics/contiki/collect/gui/MapPanel.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: MapPanel.java,v 1.2 2010/11/12 00:12:56 nifi Exp $ + * $Id: MapPanel.java,v 1.3 2010/11/12 17:52:02 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 3 jul 2008 - * Updated : $Date: 2010/11/12 00:12:56 $ - * $Revision: 1.2 $ + * Updated : $Date: 2010/11/12 17:52:02 $ + * $Revision: 1.3 $ */ package se.sics.contiki.collect.gui; @@ -567,6 +567,9 @@ public class MapPanel extends JPanel implements Configurable, Visualizer, Action popupNode.hasFixedLocation = lockedItem.isSelected(); if (wasFixed && !popupNode.hasFixedLocation) { server.removeConfig("collect.map." + popupNode.node.getID()); + } else if (!wasFixed && popupNode.hasFixedLocation) { + server.setConfig("collect.map." + popupNode.node.getID(), + "" + popupNode.x + ',' + popupNode.y); } repaint(); } @@ -838,12 +841,6 @@ public class MapPanel extends JPanel implements Configurable, Visualizer, Action for (MapNode n : getNodeList()) { config.put(n.node.getID(), "" + n.x + ',' + n.y); } - } else { - for (MapNode n : getNodeList()) { - if (n.hasFixedLocation) { - config.put("collect.map." + n.node.getID(), "" + n.x + ',' + n.y); - } - } } }