From 02965e25f608e08b89a7602769ec81d7830b1c29 Mon Sep 17 00:00:00 2001 From: nifi Date: Fri, 12 Nov 2010 00:12:55 +0000 Subject: [PATCH] Clear node positions when clearing node data --- .../sics/contiki/collect/CollectServer.java | 21 ++++++++++++++++--- .../se/sics/contiki/collect/gui/MapPanel.java | 10 ++++++--- 2 files changed, 25 insertions(+), 6 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 087aee1ce..573c3e0ea 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.1 2010/11/03 14:53:05 adamdunkels Exp $ + * $Id: CollectServer.java,v 1.2 2010/11/12 00:12:55 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 3 jul 2008 - * Updated : $Date: 2010/11/03 14:53:05 $ - * $Revision: 1.1 $ + * Updated : $Date: 2010/11/12 00:12:55 $ + * $Revision: 1.2 $ */ package se.sics.contiki.collect; @@ -810,6 +810,10 @@ public class CollectServer implements SerialConnectionListener { window.setVisible(false); } + public void setUseSensorDataLog(boolean useSensorLog) { + this.isSensorLogUsed = useSensorLog; + } + public void setExitOnRequest(boolean doExit) { this.doExitOnRequest = doExit; if (exitItem != null) { @@ -888,6 +892,10 @@ public class CollectServer implements SerialConnectionListener { return configTable.getProperty(property, config.getProperty(property, defaultValue)); } + public void removeConfig(String property) { + configTable.remove(property); + } + public int getDefaultMaxItemCount() { return defaultMaxItemCount; } @@ -1231,6 +1239,13 @@ public class CollectServer implements SerialConnectionListener { v.clearNodeData(); } } + // Remove any saved node positions + for(String key: configTable.keySet().toArray(new String[0])) { + String property = key.toString(); + if (!property.startsWith("collect")) { + configTable.remove(property); + } + } } private void clearSensorDataLog() { 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 293033406..4a0e76d8f 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.1 2010/11/03 14:53:05 adamdunkels Exp $ + * $Id: MapPanel.java,v 1.2 2010/11/12 00:12:56 nifi Exp $ * * ----------------------------------------------------------------- * @@ -34,8 +34,8 @@ * * Authors : Joakim Eriksson, Niclas Finne * Created : 3 jul 2008 - * Updated : $Date: 2010/11/03 14:53:05 $ - * $Revision: 1.1 $ + * Updated : $Date: 2010/11/12 00:12:56 $ + * $Revision: 1.2 $ */ package se.sics.contiki.collect.gui; @@ -563,7 +563,11 @@ public class MapPanel extends JPanel implements Configurable, Visualizer, Action } else if (!isMap && source == lockedItem) { if (popupNode != null) { + boolean wasFixed = popupNode.hasFixedLocation; popupNode.hasFixedLocation = lockedItem.isSelected(); + if (wasFixed && !popupNode.hasFixedLocation) { + server.removeConfig("collect.map." + popupNode.node.getID()); + } repaint(); }