You can subscribe to this list here.
| 2005 |
Jan
|
Feb
(14) |
Mar
|
Apr
(4) |
May
(57) |
Jun
(14) |
Jul
(15) |
Aug
(5) |
Sep
(29) |
Oct
(13) |
Nov
(44) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(14) |
Feb
(78) |
Mar
(55) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(12) |
Dec
(9) |
| 2007 |
Jan
(21) |
Feb
(67) |
Mar
(39) |
Apr
(28) |
May
(7) |
Jun
|
Jul
(6) |
Aug
(2) |
Sep
(1) |
Oct
(18) |
Nov
(8) |
Dec
(11) |
| 2008 |
Jan
(16) |
Feb
(12) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <Jan...@us...> - 2007-02-14 15:48:45
|
Revision: 533
http://svn.sourceforge.net/magicmap/?rev=533&view=rev
Author: Jan_fride
Date: 2007-02-14 07:48:36 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
infoobjects
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java
trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-14 10:30:38 UTC (rev 532)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-14 15:48:36 UTC (rev 533)
@@ -139,21 +139,21 @@
if (!showLocations) {
return null;
}
- break;
+ //break;
// TODO: InfonodeIcon in NodeIcons behandeln
- case INodeModel.NODETYPE_INFO :
- if (((InfoObjectNode) node).getDepiction() != null) {
- ImageIcon icon;
- try {
- icon = new ImageIcon(new URL(((InfoObjectNode) node).getDepiction()), "<Depiction>");
- if (icon != null && icon.getIconHeight() > 0) {
- return icon;
- }
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+// case INodeModel.NODETYPE_INFO :
+// if (((InfoObjectNode) node).getDepiction() != null) {
+// ImageIcon icon;
+// try {
+// icon = new ImageIcon(new URL(((InfoObjectNode) node).getDepiction()), "<Depiction>");
+// if (icon != null && icon.getIconHeight() > 0) {
+// return icon;
+// }
+// } catch (MalformedURLException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
break;
}
log.debug("Nodename: " + node.getClass().getSimpleName());
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java 2007-02-14 10:30:38 UTC (rev 532)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java 2007-02-14 15:48:36 UTC (rev 533)
@@ -1,190 +0,0 @@
-/**
- *
- */
-
-package net.sf.magicmap.client.model.node;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Wir nehmen ersteinmal NUR flickr dinger....
- * @author Johannes Zapotoczky (joh...@za...), Jan Friderici
- *
- */
-public class InfoObjectNode extends Node implements InfoObject {
-
- private String infoUrl;
- private String serviceUrl;
- private String infoType;
- private String depiction;
- private String description;
- private String infoTitle;
-
- private transient boolean expanded;
- private static Object service;
-
- private java.util.Set<InfoObjectTag> tags = new TreeSet<InfoObjectTag>();
-
- private ArrayList neighbours = new ArrayList<InfoObjectNode>();
-
- public static final InfoObjectNode EMPTY_INFO_NODE = new InfoObjectNode(null);
-
- public static final int UPDATE_TAG_ADDED = 23567;
- public static final int UPDATE_TAG_CHANGED = InfoObjectNode.UPDATE_TAG_ADDED + 1;
- public static final int UPDATE_TAG_DELETED = InfoObjectNode.UPDATE_TAG_ADDED + 2;
- public static final int UPDATE_TAGS_CHANGED = InfoObjectNode.UPDATE_TAG_ADDED + 3;
-
- /**
- * @param model
- */
- public InfoObjectNode(INodeModel model) {
- super(model);
- this.expanded = false;
- }
-
- public InfoObjectNode(INodeModel model, InfoObject info) {
- super(model);
- setName(info.getInfoUrl());
- this.expanded = false;
- this.infoUrl = info.getInfoUrl();
- this.serviceUrl = info.getServiceUrl();
- this.infoType = info.getInfoType();
- this.depiction = info.getDepiction();
- this.description = info.getDepiction();
- this.infoTitle = info.getInfoTitle();
- setDisplayName(this.infoTitle);
- setPhysical(false);
- // Will call the update method in our model!
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.node.Node#getNeighbors()
- */
- @Override
- public ArrayList getNeighbors(){
- if (this.neighbours.size() == 0) {
-
- }
- return this.neighbours;
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.node.Node#getType()
- */
- @Override
- public int getType(){
- return NodeModelConstants.NODETYPE_INFO;
- }
-
- private void loadNeighbours(){
-
- }
-
- public boolean isExpanded(){
- return this.expanded;
- }
-
- public void setExpanded(boolean b) throws IOException{
- if (!this.expanded && b) explode();
- this.expanded = b;
-
- }
-
- public Set<InfoObjectTag> getTags(){
- return this.tags;
- }
-
- public void addTag(InfoObjectTag tag){
- this.tags.add(tag);
- getModel().updateNode(this, InfoObjectNode.UPDATE_TAG_ADDED, tag);
-
- }
-
- public Iterator<InfoObjectTag> iterator(){
- return this.tags.iterator();
- }
-
- protected void explode() throws IOException{
- try {
- //Controller.getInstance().getInfoProviderRegistry().expandNode(this);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public String getDepiction(){
- return this.depiction;
- }
-
- public void setDepiction(String depiction){
- this.depiction = depiction;
- }
-
- public String getDescription(){
- return this.description;
- }
-
- public void setDescription(String description){
- this.description = description;
- }
-
- public String getInfoType(){
- return this.infoType;
- }
-
- public void setInfoType(String infoType){
- this.infoType = infoType;
- }
-
- public String getInfoUrl(){
- return this.infoUrl;
- }
-
- public void setInfoUrl(String infoUrl){
- this.infoUrl = infoUrl;
- }
-
- public ArrayList getNeighbours(){
- return this.neighbours;
- }
-
- public void setNeighbours(ArrayList neighbours){
- this.neighbours = neighbours;
- this.getModel().updateNode(this, NodeModelConstants.NODETYPE_INFO, neighbours);
- }
-
- /**
- *
- * @param n
- */
- public void addNeighbours(Node n){
- this.neighbours.add(n);
- this.getModel().updateNode(this, NodeModelConstants.NODETYPE_INFO, n);
- }
-
- public String getServiceUrl(){
- return this.serviceUrl;
- }
-
- public void setServiceUrl(String serviceUrl){
- this.serviceUrl = serviceUrl;
- }
-
- public void setTags(java.util.Set<InfoObjectTag> tags){
- this.tags = tags;
- getModel().updateNode(this, InfoObjectNode.UPDATE_TAGS_CHANGED, tags);
- }
-
- @Override
- public String toString(){
- return super.toString() + " [depiction:" + getDepiction() + ", infoUrl" + this.infoUrl + "] ";
- }
-
- public String getInfoTitle(){
- return this.infoTitle;
- }
-}
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java 2007-02-14 10:30:38 UTC (rev 532)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java 2007-02-14 15:48:36 UTC (rev 533)
@@ -1,65 +0,0 @@
-
-package net.sf.magicmap.client.model.node;
-
-/**
- * Ein Tag beschreibt eine Eigenschaft eines Informationsobjektes.
- * Tags sind immutable.
- *
- */
-public abstract class InfoObjectTag implements Comparable {
-
- /**
- * Der Typ... obertyp/untertyp_1/.../untertype_n
- */
- public final String type;
- /**
- * Der Wert, eine URL, ein Schlagwort etc.
- */
- public final String value;
- /**
- * Eine Beschreibung.
- */
- public final String description;
-
- public InfoObjectTag(String type, String value, String description) {
- this.type = type;
- this.value = value;
- this.description = description;
-
- }
-
- public InfoObjectTag(String type, String value) {
- this(type, value, value);
- }
-
- /**
- * Two tags are equal if their type and theri value are equal.
- * @param other
- * @return true if other is a tag and both value und type are equal.
- */
- @Override
- public boolean equals(Object other){
- if (other instanceof InfoObjectTag) {
- InfoObjectTag otherTag = (InfoObjectTag) other;
- return (type.equals(otherTag.type) && value.equals(otherTag.value));
- } else
- return super.equals(other);
- }
-
- /**
- *
- * @param other
- * @return 0 if both value and type are equal.
- */
- public int compareTo(Object other){
- if (other instanceof InfoObjectTag) {
- InfoObjectTag otherTag = (InfoObjectTag) other;
- int i = type.compareTo(otherTag.type);
- if (i == 0) {
- return (value.compareTo(otherTag.value));
- } else
- return i;
- }
- return 0;
- }
-}
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java 2007-02-14 10:30:38 UTC (rev 532)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java 2007-02-14 15:48:36 UTC (rev 533)
@@ -1,93 +0,0 @@
-
-package net.sf.magicmap.client.model.node;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-public class SimpleInfoObject implements InfoObject {
-
- private Set<InfoObjectTag> tags = new HashSet<InfoObjectTag>();
- private String depiction;
- private String description;
- private String title;
- private String type;
- private String url;
- private String serviceUrl;
-
- public SimpleInfoObject() {
-
- }
-
- public void addTag(InfoObjectTag tag){
- tags.add(tag);
- }
-
- public String getDepiction(){
-
- return depiction;
- }
-
- public String getDescription(){
-
- return description;
- }
-
- public String getInfoTitle(){
-
- return title;
- }
-
- public String getInfoType(){
-
- return type;
- }
-
- public String getInfoUrl(){
-
- return url;
- }
-
- public String getServiceUrl(){
-
- return serviceUrl;
- }
-
- public Set<InfoObjectTag> getTags(){
-
- return tags;
- }
-
- public Iterator<InfoObjectTag> iterator(){
- return tags.iterator();
- }
-
- public void setDepiction(String depiction){
- this.depiction = depiction;
- }
-
- public void setDescription(String description){
- this.description = description;
- }
-
- public void setServiceUrl(String serviceUrl){
- this.serviceUrl = serviceUrl;
- }
-
- public void setTags(Set<InfoObjectTag> tags){
- this.tags = (tags);
- }
-
- public void setTitle(String title){
- this.title = title;
- }
-
- public void setType(String type){
- this.type = type;
- }
-
- public void setUrl(String url){
- this.url = url;
- }
-
-}
Deleted: trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java
===================================================================
--- trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java 2007-02-14 10:30:38 UTC (rev 532)
+++ trunk/magicmapclient/test/net/sf/magicmap/client/model/info/InfoObjectBuilderTest.java 2007-02-14 15:48:36 UTC (rev 533)
@@ -1,63 +0,0 @@
-package net.sf.magicmap.client.model.info;
-
-/**
- * Created by IntelliJ IDEA.
- * User: jan
- * Date: 24.09.2006
- * Time: 15:30:20
- * To change this template use File | Settings | File Templates.
- */
-
-import junit.framework.*;
-//import net.sf.magicmap.client.model.info.InfoObjectBuilder;
-import net.sf.magicmap.client.model.node.InfoObject;
-import net.sf.magicmap.client.model.node.InfoObjectTag;
-import net.sf.magicmap.client.model.node.SimpleInfoObject;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-
-public class InfoObjectBuilderTest extends TestCase {
-// InfoObjectBuilder infoObjectBuilder;
-
- /**
- * Testet ob die Suche mit Google funktioniert.
- *
- * @throws Exception
- */
- public void testCheckLinks() throws Exception {
- //URL url = new URL("http://www.google.de/search?hl=de&q=related%3Ahttp%3A%2F%2Fwww.golem.de%2F&btnG=Suche&meta=");
- URL url = new URL("http://www.golem.de");
-// infoObjectBuilder = new InfoObjectBuilder();
- InfoObject o = new SimpleInfoObject();
- //InfoObject o =infoObjectBuilder.buildNode(url);
-// infoObjectBuilder.checkLinks(o,url);
- assertTrue("Keine Related sites!", o.getTags().size() > 0);
- for (InfoObjectTag infoObjectTag : o) {
- assertNotNull("Wert darf nicht null sein", infoObjectTag.value);
- assertNotNull("Typ darf nicht null sein", infoObjectTag.type);
-
- try {
- URL relatedUrl = new URL(infoObjectTag.value);
- } catch (MalformedURLException e) {
- fail("Url nicht g\xFCltig: '" + infoObjectTag.value + "'");
- }
-
- System.out.println("Value: " + infoObjectTag.value);
- }
- assertNotNull(o);
- }
-
- /**
- *
- * @throws Exception
- */
- public void testBuildNode() throws Exception{
- URL url = new URL("http://www.golem.de");
-// infoObjectBuilder = new InfoObjectBuilder();
-// InfoObject infoObject = infoObjectBuilder.buildNode(url);
-// assertNotNull("Infoobjekt null:", infoObject);
-// assertEquals(infoObject.getInfoType(), "text/html");
-// assertEquals(infoObject.getInfoTitle(), "Golem.de: IT-News f\xFCr Profis");
- }
-}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jan...@us...> - 2007-02-14 10:31:03
|
Revision: 532
http://svn.sourceforge.net/magicmap/?rev=532&view=rev
Author: Jan_fride
Date: 2007-02-14 02:30:38 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
Metric
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2007-02-12 18:17:29 UTC (rev 531)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2007-02-14 10:30:38 UTC (rev 532)
@@ -1,6 +1,9 @@
package net.sf.magicmap.client.algorithms;
+import java.util.HashMap;
+import java.util.Map;
+
import net.sf.magicmap.client.model.node.Node;
import org.apache.commons.collections.map.MultiKeyMap;
@@ -17,7 +20,8 @@
private NodeModelMetric defaultMetric;
private final MultiKeyMap metricMap = new MultiKeyMap();
-
+ private final Map<Class<? extends Node>,NodeModelMetric> genericMetrciMap = new HashMap<Class<? extends Node>, NodeModelMetric>();
+
public NodeMetricManager(NodeModelMetric defaultMetric) {
this.defaultMetric = defaultMetric;
}
@@ -29,13 +33,33 @@
* @param clazz2 der 2. Knotentyp
* @param metric die Metric die auf die beiden Knotentypen angewant werden soll.
*/
- public final void addMetric(Class clazz1, Class clazz2, NodeModelMetric metric){
+ public final void addMetric(Class<? extends Node> clazz1, Class<? extends Node> clazz2, NodeModelMetric metric){
if (metricMap.containsKey(clazz1, clazz2)) {
throw new IllegalArgumentException("Mapping for " + clazz1 + "," + clazz2 + " exists");
}
metricMap.put(clazz1, clazz2, metric);
}
+ /**
+ * F\xFCgt eine Metric zu einem Tupel von Knoten hinzu. Diese Metric ist generischer als eine
+ * welche zwei Knotentypen ben\xF6tigt. Daher werden zuerst die speziellen mit zwei Knotentypen
+ * befragt.
+ *
+ * @param clazz1 der 1. Knotentyp
+ * @param metric die Metric die auf die beiden Knotentypen angewant werden soll.
+ */
+ public final void addMetric(Class<? extends Node> clazz1, NodeModelMetric metric){
+ if (genericMetrciMap.containsKey(clazz1)) {
+ throw new IllegalArgumentException("Mapping for " + clazz1 + " exists");
+ }
+ genericMetrciMap.put(clazz1, metric);
+ }
+
+ /**
+ * entfernt eine Metrci
+ * @param clazz1
+ * @param clazz2
+ */
public final void removeMetric(Class clazz1, Class clazz2){
metricMap.remove(clazz1, clazz2);
}
@@ -45,8 +69,12 @@
*/
public double metric(Node node1, Node node2){
NodeModelMetric delegate = (NodeModelMetric) metricMap.get(node1.getClass(), node2.getClass());
- if (delegate == null) return defaultMetric.metric(node1, node2);
- return delegate.metric(node1, node2);
+
+ if (delegate != null) return delegate.metric(node1, node2);
+ delegate = genericMetrciMap.get(node1.getClass());
+
+ if (delegate != null)return delegate.metric(node1, node2);
+ return defaultMetric.metric(node1, node2);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-12 18:18:04
|
Revision: 531
http://svn.sourceforge.net/magicmap/?rev=531&view=rev
Author: jan_fride
Date: 2007-02-12 10:17:29 -0800 (Mon, 12 Feb 2007)
Log Message:
-----------
removed Infoobjects (temporaery) and changed menu....
Modified Paths:
--------------
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/VisualizationViewer.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/InfoObjectDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/CreateInfoObjectForm.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/info/
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/InfoNodeHandler.java
Modified: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -58,7 +58,7 @@
* length function.
*/
public SpringLayout(Graph g) {
- this(g, UNITLENGTHFUNCTION);
+ this(g, UNITLENGTHFUNCTION, NoRepulsionFunction);
}
/**
@@ -70,14 +70,7 @@
* the length function
*/
public SpringLayout(Graph g, LengthFunction f) {
- super(g);
- this.lengthFunction = f;
- this.leaveFunction = new CanLeaveMapFunction() {
-
- public boolean canLeave(Vertex v){
- return false;
- }
- };
+ this(g,f,NoRepulsionFunction);
}
/**
@@ -94,7 +87,8 @@
super(g);
this.lengthFunction = f;
this.repulsionFunction = r;
- this.leaveFunction = new CanLeaveMapFunction() {
+ this.forceFunction = DefaultForceFunction;
+ this.leaveFunction = new CanLeaveMapFunction() {
public boolean canLeave(Vertex v){
return false;
@@ -369,7 +363,11 @@
public double getRepulsion(Vertex v1, Vertex v2);
}
-
+ public static RepulsionFunction NoRepulsionFunction = new RepulsionFunction(){
+ public double getRepulsion(Vertex v1, Vertex v2) {
+ return 0;
+ }
+ };
/**
* Extension for PACW: Make the Repulsion configurable.
*
@@ -394,6 +392,11 @@
public double getForce(Vertex v1, Vertex v2);
}
+ public static final ForceFunction DefaultForceFunction = new ForceFunction(){
+ public double getForce(Vertex v1, Vertex v2) {
+ return 1;
+ }
+ };
/**
* Extension for PACW: Make the Repulsion configurable.
*
Modified: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/VisualizationViewer.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/VisualizationViewer.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/VisualizationViewer.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -98,7 +98,7 @@
/**
* UNTESTED.
- * @param v
+ * @param r
*/
public void setRenderer(Renderer r){
this.renderer = r;
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,36 +0,0 @@
-
-package net.sf.magicmap.client.algorithms;
-
-import java.util.Set;
-
-import net.sf.magicmap.client.model.node.InfoObjectNode;
-import net.sf.magicmap.client.model.node.InfoObjectTag;
-import net.sf.magicmap.client.model.node.Node;
-
-public class InfoNodeMetric implements NodeModelMetric {
-
- public InfoNodeMetric() {
-
- }
-
- public double metric(Node node1, Node node2){
- if (node1 == node2) throw new IllegalArgumentException("Keine Verbindung zwischen dem selben Knoten!");
- if (node1 instanceof InfoObjectNode && node2 instanceof InfoObjectNode) {
- InfoObjectNode iNode1 = (InfoObjectNode) node1;
- InfoObjectNode iNode2 = (InfoObjectNode) node2;
- Set<InfoObjectTag> tagset = iNode2.getTags();
- int commonTags = 0;
- double tagCount = (iNode1.getTags().size() + 1) / 2;
- for (InfoObjectTag tag : iNode1)
- if (tagset.contains(tag))
- commonTags++;
- else {
-
- }
- if (commonTags == 0) return 220.0;
- return 120.0 * (tagCount / commonTags);
- }
- return Double.POSITIVE_INFINITY;
- }
-
-}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -15,7 +15,6 @@
import net.sf.magicmap.client.measurement.interfaces.AbstractScanner;
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
import net.sf.magicmap.client.meta.MapInfo;
-import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry;
import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.measurement.MeasurementModel;
import net.sf.magicmap.client.model.node.*;
@@ -75,7 +74,6 @@
private Collection<InfoObject> infoObjects;
private ScannerAllocator scannerAllocator;
- private final InfoObjectProviderRegistry infoServiceRegistry;
private final PluginManager pluginManager;
/**
@@ -105,7 +103,6 @@
// pseudo server items
this.infoObjects = new ArrayList<InfoObject>();
// initializeScanner();
- this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel);
try {
this.pluginManager = new PluginManager(new Settings(), this);
} catch (MalformedURLException e) {
@@ -554,7 +551,4 @@
this.scannerAllocator.addScanResultHandler(handler);
}
- public InfoObjectProviderRegistry getInfoProviderRegistry(){
- return this.infoServiceRegistry;
- }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -20,7 +20,6 @@
import net.sf.magicmap.client.measurement.interfaces.AbstractScanner;
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
import net.sf.magicmap.client.meta.MapInfo;
-import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry;
import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.ClientNode;
@@ -250,6 +249,4 @@
void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner);
void addScannerHandler(AbstractScannerHandler handler);
-
- InfoObjectProviderRegistry getInfoProviderRegistry();
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -7,7 +7,6 @@
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
-import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -19,7 +18,6 @@
import net.sf.magicmap.client.controller.Controller;
import net.sf.magicmap.client.gui.dialogs.GeoPosDialog;
-import net.sf.magicmap.client.gui.dialogs.InfoObjectDialog;
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
@@ -28,8 +26,6 @@
import net.sf.magicmap.client.model.node.AccessPointNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.GeoPos;
-import net.sf.magicmap.client.model.node.InfoObject;
-import net.sf.magicmap.client.model.node.InfoObjectNode;
import net.sf.magicmap.client.model.node.Node;
import net.sf.magicmap.client.model.node.NodeModelConstants;
import net.sf.magicmap.client.utils.Settings;
@@ -103,7 +99,6 @@
this.setLayout(new BorderLayout());
this.setPreferredSize(new Dimension(-1, 450));
this.mapView = null;
- this.mapMenu = buildMapMenu();
}
/**
@@ -135,18 +130,6 @@
}
};
- this.createInfoObjectAction = new AbstractAction(GUIUtils.i18n("createinfoobject")) {
-
- /**
- * serial version id
- */
- private static final long serialVersionUID = 1L;
-
- public void actionPerformed(ActionEvent e){
- createInfoObject();
- }
- };
-
this.measureLocationAction = new AbstractAction(GUIUtils.i18n("measurelocation")) {
/**
@@ -264,15 +247,6 @@
}
- /**
- * @deprecated
- * @return
- */
- @Deprecated
- private JMenu buildTestMenu(){
- JMenu menu = new JMenu(GUIUtils.i18n("test"));
- return menu;
- }
/**
*
@@ -287,7 +261,7 @@
menu.add(GUIBuilder.createMenuItem(this.createInfoObjectAction));
menu.addSeparator();
menu.add(GUIBuilder.createMenuItem(this.fetchLocationsAction));
- return menu;
+ return mapView.getMenuContainer().buildMenu(null, menu);
}
/**
@@ -359,7 +333,7 @@
this.selectedNode = null;
int ox = this.mapView.getMapOffsetX();
int oy = this.mapView.getMapOffsetY();
- this.mapMenu.show(this, x + ox, y + oy);
+ this.buildMapMenu().show(this, x + ox, y + oy);
}
/**
@@ -420,22 +394,11 @@
Controller.getInstance().getCurrentMap().name, true, this);
}
+
/**
* Create an info object for the current selected location
*
*/
- void createInfoObject(){
- // TODO \xDCber den Dialog auch die H\xF6he einlesen
- InfoObject infoObject = InfoObjectDialog.showDialog(MainGUI.getInstance());
- if (infoObject != null)
- Controller.getInstance().createInfoObject(getLastX(), getLastY(), Settings.DEFAULT_HEIGHT, infoObject,
- Controller.getInstance().getCurrentMap().name, true, this);
- }
-
- /**
- * Create an info object for the current selected location
- *
- */
protected void measureLocation(){
if (this.selectedNode != null) {
String r = this.selectedNode.getName();
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/InfoObjectDialog.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/InfoObjectDialog.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/InfoObjectDialog.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,129 +0,0 @@
-/**
- *
- */
-
-package net.sf.magicmap.client.gui.dialogs;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-
-import net.sf.magicmap.client.controller.Controller;
-import net.sf.magicmap.client.gui.utils.GUIConstants;
-import net.sf.magicmap.client.gui.utils.GUIUtils;
-import net.sf.magicmap.client.gui.utils.RelativePanelBuilder;
-import net.sf.magicmap.client.model.info.InfoObjectProvider;
-import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry;
-import net.sf.magicmap.client.model.node.InfoObject;
-
-import com.brunchboy.util.swing.relativelayout.RelativeLayout;
-
-/**
- * Shows a dialog to create a new InfoObject.
- *
- * @author Johannes Zapotoczky (joh...@za...), Jan friderici (ja...@fr...)
- *
- */
-public class InfoObjectDialog extends JDialog implements ActionListener {
-
- /**
- * serial version id
- */
- private static final long serialVersionUID = 2254415271972084477L;
-
- /**
- * the currently set geopos
- */
- private InfoObject infoObject;
-
- /**
- *
- */
- private InfoObjectProvider currentProvider;
-
- private InfoObjectProviderRegistry reg;
-
- /**
- *
- * @param owner
- * @return
- */
- public static InfoObject showDialog(JFrame owner){
-
- InfoObjectDialog dialog = new InfoObjectDialog(owner);
- GUIUtils.locateOnScreen(dialog);
- dialog.setModal(true);
- dialog.pack();
- dialog.setVisible(true);
-
- return dialog.getValues();
- }
-
- /**
- * @return the new InfoObject.
- */
- private InfoObject getValues(){
- return this.infoObject;
- }
-
- /**
- *
- * @param owner
- */
- public InfoObjectDialog(JFrame owner) {
- super(owner, GUIUtils.i18n("infoobject"));
- //this.setSize(250, 195);
- this.setResizable(false);
- this.reg = Controller.getInstance().getInfoProviderRegistry();
-
- RelativeLayout layout = new RelativeLayout();
- RelativePanelBuilder builder = new RelativePanelBuilder(layout);
-
- JButton okButton = builder.createButton(GUIUtils.i18n("set"), "OK", this);
- JButton cancelButton = builder.createButton(GUIUtils.i18n("cancel"), "CANCEL", this);
-
- // ok/cancel area
- builder.addOKCancelButtonBar(okButton, cancelButton, "okcancel");
- builder.setLeftLeftDistance("okcancel", null, 10);
- builder.setRightRightDistance("okcancel", null, -10);
- builder.setBottomBottomDistance("okcancel", null, -10);
-
- // Kopf
- builder.addDialogHeader("<html><b>" + GUIUtils.i18n("setinfoobject") + "</b><br>"
- + GUIUtils.i18n("setinfoobjecthint") + "</html>", GUIConstants.ICON_INFO, "header");
- builder.setTop("header", 0);
- builder.setLeft("header", 0);
- builder.setRightRightDistance("header", null, 0);
-
- setContentPane(builder.getPanel());
- getRootPane().setDefaultButton(okButton);
-
- JComponent contents = this.reg.visualProxy("", null); //
- builder.add(contents, "contents");
- builder.setRightRightDistance("contents", null, -20);
- builder.setTopBottomDistance("contents", "header", 20);
- }
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e){
- if ("OK".equals(e.getActionCommand())) {
- try {
- this.infoObject = this.reg.createNode();
- } catch (Exception e1) {
- this.infoObject = null;
- e1.printStackTrace();
- }
- this.setVisible(false);
- } else if ("CANCEL".equals(e.getActionCommand())) {
- this.infoObject = null;
- this.setVisible(false);
- }
-
- }
-}
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/CreateInfoObjectForm.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/CreateInfoObjectForm.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/CreateInfoObjectForm.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,43 +0,0 @@
-
-package net.sf.magicmap.client.gui.forms;
-
-import java.awt.CardLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry;
-
-import com.jgoodies.forms.layout.CellConstraints;
-
-/**
- *
- */
-public class CreateInfoObjectForm extends FormLayoutForm {
-
- private CardLayout cards;
- private JPanel panel;
-
- /**
- *
- */
- public CreateInfoObjectForm() {
- super("p,3dlu,p:grow", "p, 6dlu,p:grow");
- CellConstraints cc = new CellConstraints();
- this.addLabel("", new JLabel("Typ"), cc.xy(1, 1));
-
- }
-
- @Override
- public JComponent attatch(UserInterface ui){
- if (ui instanceof InfoObjectProviderRegistry) {
- InfoObjectProviderRegistry infoObjectProviderRegistry = (InfoObjectProviderRegistry) ui;
- CellConstraints cc = new CellConstraints();
- this.addAttribute("list", "", cc.xy(3, 1));
- return super.attatch(ui);
- } else
- throw new IllegalArgumentException("UserInterface not suported: " + ui);
-
- }
-}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,7 +1,5 @@
package net.sf.magicmap.client.gui.utils.menu;
-import net.sf.magicmap.client.model.node.Node;
-
/**
* Class ${class}
*
@@ -17,7 +15,7 @@
this.first = first;
this.second = second;
}
- public boolean show(Node node) {
- return first.show(node) && second.show(node);
+ public boolean show(Object context) {
+ return first.show(context) && second.show(context);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -19,6 +19,7 @@
private final JComponent component;
private final List<NodeMenuItem> items = new LinkedList<NodeMenuItem>();
private final Set<NodeMenuItem> seperators = new HashSet<NodeMenuItem>();
+
public NodeMenuContainer(JComponent component){
this.component = component;
}
@@ -29,9 +30,9 @@
public void addNodeMenuItem(Object owner, JMenuItem item, NodeMenuPredicate predicate){
items.add(new NodeMenuItem(item, predicate));
}
- public JPopupMenu buildMenu(Node node, JPopupMenu menu){
+ public JPopupMenu buildMenu(Object context, JPopupMenu menu){
for (NodeMenuItem item: items){
- if (item.showPredicate.show(node)){
+ if (item.showPredicate.show(context)){
menu.add(item.item);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,7 +1,5 @@
package net.sf.magicmap.client.gui.utils.menu;
-import net.sf.magicmap.client.model.node.Node;
-
/**
* Class ${class}
*
@@ -15,7 +13,7 @@
this.other = other;
}
- public boolean show(Node node) {
- return !other.show(node);
+ public boolean show(Object context) {
+ return !other.show(context);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,7 +1,5 @@
package net.sf.magicmap.client.gui.utils.menu;
-import net.sf.magicmap.client.model.node.Node;
-
/**
* Class ${class}
*
@@ -10,16 +8,16 @@
*/
public interface NodeMenuPredicate {
- public boolean show(Node node);
+ public boolean show(Object context);
static final NodeMenuPredicate TRUE = new NodeMenuPredicate() {
- public boolean show(Node node) {
+ public boolean show(Object context) {
return true;
}
};
static final NodeMenuPredicate FALSE = new NodeMenuPredicate() {
- public boolean show(Node node) {
+ public boolean show(Object context) {
return false;
}
};
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -15,7 +15,7 @@
this.type = type;
}
- public boolean show(Node node) {
- return node != null && node.getType() == type;
+ public boolean show(Object context) {
+ return context != null && (context instanceof Node) && ((Node)context).getType() == type;
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -20,7 +20,7 @@
public abstract class View extends SimpleInternalFrame {
private JComponent view;
- private final NodeMenuContainer menuCOntainer = new NodeMenuContainer(this);
+ private final NodeMenuContainer nodeMenuContainer = new NodeMenuContainer(this);
//private ViewHeader header;
@@ -56,6 +56,6 @@
}
public NodeMenuContainer getMenuContainer(){
- return menuCOntainer;
+ return nodeMenuContainer;
}
}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -133,7 +133,6 @@
addNodeUpdateHandler(new PositionUpdateHandler(this.nodeVertexMapping, this.layout));
addNodeUpdateHandler(new SeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
addNodeUpdateHandler(new NotSeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
- addNodeUpdateHandler(new InfoNodeHandler());
addNodeUpdateHandler(new AccessPointHiddenStateHandler());
}
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/InfoNodeHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/InfoNodeHandler.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/InfoNodeHandler.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,82 +0,0 @@
-
-package net.sf.magicmap.client.model.location.jung.handler;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.magicmap.client.model.location.INodePlacer;
-import net.sf.magicmap.client.model.location.NodeUpdateHandler;
-import net.sf.magicmap.client.model.node.InfoObjectNode;
-import net.sf.magicmap.client.model.node.InfoObjectTag;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModelConstants;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * K\xFCmmert sich um Infoobjekte:
- * <li> Das anlegen von Kanten
- * <li> Das l\xF6schen von Kanten.
- * @author Jan Friderici
- */
-public class InfoNodeHandler implements NodeUpdateHandler {
-
- Log log = LogFactory.getLog(InfoNodeHandler.class);
-
- private final Map<String, InfoObjectNode> infoNodes = new HashMap<String, InfoObjectNode>();
-
- public InfoNodeHandler() {
- this.log.info("Created!");
- }
-
- /**
- *
- * @param node of type InfoObjectNode
- * @param eventtype NODETYPE_INFO or UPDATE_INFO_OBJECT_TAGS
- * @return true if the node is of type InfoNode.
- */
- public boolean canHandleEvent(Node node, int eventtype){
- return (node instanceof InfoObjectNode);
- }
-
- public int getType(){
- return NodeModelConstants.NODETYPE_INFO;
- }
-
- /**
- *
- * @param node
- * @param type
- * @param data
- * @param nodePlacer
- */
- public void handleNodeUpdated(Node node, int type, Object data, INodePlacer nodePlacer){
- if (!(node instanceof InfoObjectNode)) return;
-
- InfoObjectNode infoObjectNode = (InfoObjectNode) node;
- for (InfoObjectTag tag : infoObjectNode)
- getRelatedNode(infoObjectNode, nodePlacer);
- this.infoNodes.put(infoObjectNode.getInfoUrl(), infoObjectNode);
-
- }
-
- /**
- *
- * @param node
- * @param nodePlacer
- */
- private void getRelatedNode(InfoObjectNode node, INodePlacer nodePlacer){
-
- for (InfoObjectTag tag : node)
- for (InfoObjectNode infoNode : this.infoNodes.values()) {
- this.log.info("Tag:" + tag.value);
- if (infoNode.getTags().contains(tag)) {
- nodePlacer.addEdge(node, infoNode);
- break;
- } else if (tag.type.startsWith("link") && this.infoNodes.containsKey(tag.value))
- nodePlacer.addEdge(node, infoNode);
- }
- }
-
-}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -1,6 +1,5 @@
package net.sf.magicmap.client.model.node;
-import java.util.ArrayList;
import java.util.List;
/**
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -10,30 +10,17 @@
* @author Johannes Zapotoczky (joh...@za...)
*
*/
-public interface InfoObject extends Iterable<InfoObjectTag> {
+public interface InfoObject {
- public String getInfoUrl();
+ String getInfoUrl();
- public String getServiceUrl();
+ String getServiceUrl();
- public String getInfoType();
+ String getInfoType();
- public String getDepiction();
+ String getDepiction();
- public String getDescription();
+ String getDescription();
- public String getInfoTitle();
-
- /**
- *
- * @return
- */
- public Set<InfoObjectTag> getTags();
-
- /**
- *
- * @param tag
- */
- public void addTag(InfoObjectTag tag);
-
+ String getInfoTitle();
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java 2007-02-11 14:07:44 UTC (rev 530)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java 2007-02-12 18:17:29 UTC (rev 531)
@@ -10,8 +10,6 @@
import java.util.Set;
import java.util.TreeSet;
-import net.sf.magicmap.client.controller.Controller;
-
/**
* Wir nehmen ersteinmal NUR flickr dinger....
* @author Johannes Zapotoczky (joh...@za...), Jan Friderici
@@ -61,7 +59,6 @@
setDisplayName(this.infoTitle);
setPhysical(false);
// Will call the update method in our model!
- setTags(info.getTags());
}
/* (non-Javadoc)
@@ -113,7 +110,7 @@
protected void explode() throws IOException{
try {
- Controller.getInstance().getInfoProviderRegistry().expandNode(this);
+ //Controller.getInstance().getInfoProviderRegistry().expandNode(this);
} catch (Exception e) {
e.printStackTrace();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-11 14:07:47
|
Revision: 530
http://svn.sourceforge.net/magicmap/?rev=530&view=rev
Author: jan_fride
Date: 2007-02-11 06:07:44 -0800 (Sun, 11 Feb 2007)
Log Message:
-----------
Standart functions for springlayout added
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicRepulsionFunction.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2007-02-10 16:42:26 UTC (rev 529)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2007-02-11 14:07:44 UTC (rev 530)
@@ -116,14 +116,6 @@
return desiredLength;
}
- /**
- * Bitte ausf\xFCllen....
- *
- * @param clientOrLocation
- * @param len
- * @param desiredLen
- * @param fixed
- */
private void adjustCallibration(boolean clientOrLocation, double len, double desiredLen, boolean notFixed){
if (notFixed) return;
//len and desiredLen could be 0 so we add 1
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicRepulsionFunction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicRepulsionFunction.java 2007-02-10 16:42:26 UTC (rev 529)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicRepulsionFunction.java 2007-02-11 14:07:44 UTC (rev 530)
@@ -11,7 +11,7 @@
import edu.uci.ics.jung.graph.Vertex;
import edu.uci.ics.jung.visualization.SpringLayout;
-class MagicRepulsionFunction implements SpringLayout.RepulsionFunction {
+public class MagicRepulsionFunction implements SpringLayout.RepulsionFunction {
/**
*
@@ -19,7 +19,7 @@
private final LayoutSettings setings;
/**
- * @param layout
+
*/
MagicRepulsionFunction(LayoutSettings setings) {
this.setings = setings;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-02-10 16:42:26 UTC (rev 529)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-02-11 14:07:44 UTC (rev 530)
@@ -107,6 +107,9 @@
this.controller = controller;
this.pluginLoader = null;
+ /**
+ *
+ */
controller.getMapView().addAncestorListener(new AncestorAdaptor() {
@Override
public void ancestorAdded(AncestorEvent event){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-10 16:42:30
|
Revision: 529
http://svn.sourceforge.net/magicmap/?rev=529&view=rev
Author: jan_fride
Date: 2007-02-10 08:42:26 -0800 (Sat, 10 Feb 2007)
Log Message:
-----------
Menu is dynamic
Modified Paths:
--------------
trunk/magicmapclient/magicmapclient.iml
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java
trunk/magicmapserver/magicmapserver.iml
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuItem.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java
Modified: trunk/magicmapclient/magicmapclient.iml
===================================================================
--- trunk/magicmapclient/magicmapclient.iml 2007-02-10 14:27:24 UTC (rev 528)
+++ trunk/magicmapclient/magicmapclient.iml 2007-02-10 16:42:26 UTC (rev 529)
@@ -1,300 +1,302 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
- <component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/build" />
- <exclude-output />
- <output-test url="file://$MODULE_DIR$/build-test" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/inf" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/perl" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/res" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src-gen" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
- <excludeFolder url="file://$MODULE_DIR$/.settings" />
- <excludeFolder url="file://$MODULE_DIR$/lib" />
- <excludeFolder url="file://$MODULE_DIR$/lib-dev" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Groovy from GroovyJ 0.1.8 (Demetra)" level="application" />
- <orderEntry type="library" name="magicmap-server" level="application" />
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/nekohtml.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/jaxrpc.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/concurrent.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/commons-collections-3.1.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/jaxen-1.1-beta-9.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/forms-1.0.5.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/xml-apis.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/activation.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/jung-1.5.2.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/xmlParserAPIs.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/mail.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/derby.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/foxtrot.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/commons-httpclient-3.0-rc3.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/dom4j-1.6.1.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/commons-discovery.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/RelativeLayout.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/saaj.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/log4j-1.2.8.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/commons-logging.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/xercesImpl.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/looks-1.2.2.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/axis.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/ostermillerutils_1_05_00.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/jpox-20041204.032009.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/commons-codec-1.3.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/colt.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib/wsdl4j.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib-dev/axis-ant.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar://$MODULE_DIR$/lib-dev/junit.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntryProperties />
- </component>
- <component name="VcsManagerConfiguration">
- <option name="ACTIVE_VCS_NAME" value="svn" />
- <option name="USE_PROJECT_VCS" value="false" />
- </component>
-</module>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="false" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/build" />
+ <exclude-output />
+ <output-test url="file://$MODULE_DIR$/build-test" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/res" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src-gen" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/build" />
+ <excludeFolder url="file://$MODULE_DIR$/build-test" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://X:/maven/junit/junit/3.8.1/junit-3.8.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/dom4j-1.6.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/forms-1.0.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-collections-3.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/foxtrot.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jaxrpc.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/ostermillerutils_1_05_00.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-codec-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/concurrent.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/colt.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/nekohtml.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-logging.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jung-1.5.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/saaj.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/xmlParserAPIs.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/derby.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/RelativeLayout.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/xercesImpl.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/xml-apis.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/mail.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jaxen-1.1-beta-9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-httpclient-3.0-rc3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jpox-20041204.032009.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/looks-1.2.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/log4j-1.2.8.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/axis.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/activation.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/wsdl4j.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-discovery.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib-dev/junit.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib-dev/axis-ant.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module" module-name="magicmapserver" />
+ <orderEntryProperties />
+ </component>
+</module>
+
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-10 14:27:24 UTC (rev 528)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -17,10 +17,7 @@
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.gui.utils.MagicAction;
-import net.sf.magicmap.client.gui.views.ConsoleView;
-import net.sf.magicmap.client.gui.views.MapView;
-import net.sf.magicmap.client.gui.views.MeasurementView;
-import net.sf.magicmap.client.gui.views.OutlineView;
+import net.sf.magicmap.client.gui.views.*;
import net.sf.magicmap.client.interfaces.*;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.meta.ServerConnectionInfo;
@@ -37,6 +34,10 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.rmi.RemoteException;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collection;
+import java.util.Set;
/**
* The main GUI window
@@ -69,7 +70,7 @@
if (MainGUI.mainGUI == null) MainGUI.mainGUI = new MainGUI();
return MainGUI.mainGUI;
}
-
+ private Map<String, JComponent> viewMap = new HashMap<String, JComponent>();
private JMenuBar menuBar;
private JToolBar toolBar;
private StatusPanel statusBar;
@@ -167,6 +168,12 @@
AttributeType.TOP, -5));
this.layout.addConstraint("mainpane", AttributeType.TOP, new AttributeConstraint("toolbar",
AttributeType.BOTTOM, GUIConstants.DIVIDER_SIZE));
+
+ viewMap.put("outlineView", outlineView);
+ viewMap.put("mapPanel", mapPanel);
+ viewMap.put("mapView", mapView);
+ viewMap.put("consoleView", consoleView);
+
}
/**
@@ -835,5 +842,10 @@
this.statusBar.setInvisible(Controller.getInstance().isInvisible());
Controller.getInstance().connect(MainGUI.this);
}
-
+ public JComponent getViewComponent(String name){
+ return viewMap.get(name);
+ }
+ public Set<String> getViewComponents(){
+ return viewMap.keySet();
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java 2007-02-10 14:27:24 UTC (rev 528)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -327,23 +327,9 @@
this.renameAction.setEnabled(false);
this.propertiesAction.setEnabled(false);
menu.addSeparator();
- if (node instanceof InfoObjectNode) {
- final InfoObjectNode info = (InfoObjectNode) node;
- menu.add(new AbstractAction("Expandieren") {
- public void actionPerformed(ActionEvent arg0){
- try {
- info.setExpanded(!info.isExpanded());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- });
-
- }
- return menu;
+ // aditilnal
+ return mapView.getMenuContainer().buildMenu(node, menu);
}
/*
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuAndPredicate.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -0,0 +1,23 @@
+package net.sf.magicmap.client.gui.utils.menu;
+
+import net.sf.magicmap.client.model.node.Node;
+
+/**
+ * Class ${class}
+ *
+ * @author jan
+ * @date 10.02.2007
+ */
+public class NodeMenuAndPredicate implements NodeMenuPredicate{
+ private final NodeMenuPredicate first;
+ private final NodeMenuPredicate second;
+
+ public NodeMenuAndPredicate (NodeMenuPredicate first, NodeMenuPredicate second){
+
+ this.first = first;
+ this.second = second;
+ }
+ public boolean show(Node node) {
+ return first.show(node) && second.show(node);
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuContainer.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -0,0 +1,44 @@
+package net.sf.magicmap.client.gui.utils.menu;
+
+import net.sf.magicmap.client.model.node.Node;
+
+import javax.swing.*;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * Class ${class}
+ *
+ * @author jan
+ * @date 10.02.2007
+ */
+public class NodeMenuContainer {
+
+ private final JComponent component;
+ private final List<NodeMenuItem> items = new LinkedList<NodeMenuItem>();
+ private final Set<NodeMenuItem> seperators = new HashSet<NodeMenuItem>();
+ public NodeMenuContainer(JComponent component){
+ this.component = component;
+ }
+
+ public void addNodeMenuItem(Object owner, JMenuItem item){
+ this.addNodeMenuItem(owner, item, NodeMenuPredicate.TRUE);
+ }
+ public void addNodeMenuItem(Object owner, JMenuItem item, NodeMenuPredicate predicate){
+ items.add(new NodeMenuItem(item, predicate));
+ }
+ public JPopupMenu buildMenu(Node node, JPopupMenu menu){
+ for (NodeMenuItem item: items){
+ if (item.showPredicate.show(node)){
+ menu.add(item.item);
+ }
+ }
+ return menu;
+ }
+
+ public void addSeperator() {
+ seperators.add(items.get(items.size()-1));
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuItem.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuItem.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuItem.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -0,0 +1,19 @@
+package net.sf.magicmap.client.gui.utils.menu;
+
+import javax.swing.*;
+
+/**
+ * Class ${class}
+ *
+ * @author jan
+ * @date 10.02.2007
+ */
+public class NodeMenuItem {
+ public final JMenuItem item;
+ public final NodeMenuPredicate showPredicate;
+
+ public NodeMenuItem(JMenuItem item, NodeMenuPredicate predicate){
+ this.item = item;
+ this. showPredicate = predicate;
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuNotPredicate.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -0,0 +1,21 @@
+package net.sf.magicmap.client.gui.utils.menu;
+
+import net.sf.magicmap.client.model.node.Node;
+
+/**
+ * Class ${class}
+ *
+ * @author jan
+ * @date 10.02.2007
+ */
+public class NodeMenuNotPredicate implements NodeMenuPredicate{
+ private final NodeMenuPredicate other;
+
+ public NodeMenuNotPredicate(NodeMenuPredicate other){
+
+ this.other = other;
+ }
+ public boolean show(Node node) {
+ return !other.show(node);
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuPredicate.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -0,0 +1,26 @@
+package net.sf.magicmap.client.gui.utils.menu;
+
+import net.sf.magicmap.client.model.node.Node;
+
+/**
+ * Class ${class}
+ *
+ * @author jan
+ * @date 10.02.2007
+ */
+public interface NodeMenuPredicate {
+
+ public boolean show(Node node);
+
+ static final NodeMenuPredicate TRUE = new NodeMenuPredicate() {
+ public boolean show(Node node) {
+ return true;
+ }
+ };
+
+ static final NodeMenuPredicate FALSE = new NodeMenuPredicate() {
+ public boolean show(Node node) {
+ return false;
+ }
+ };
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/menu/NodeMenuTypePredicate.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -0,0 +1,21 @@
+package net.sf.magicmap.client.gui.utils.menu;
+
+import net.sf.magicmap.client.model.node.Node;
+
+/**
+ * Class ${class}
+ *
+ * @author jan
+ * @date 10.02.2007
+ */
+public class NodeMenuTypePredicate implements NodeMenuPredicate{
+ private final int type;
+
+ public NodeMenuTypePredicate(int type){
+
+ this.type = type;
+ }
+ public boolean show(Node node) {
+ return node != null && node.getType() == type;
+ }
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java 2007-02-10 14:27:24 UTC (rev 528)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -7,6 +7,7 @@
import javax.swing.JComponent;
import com.jgoodies.uif_lite.panel.SimpleInternalFrame;
+import net.sf.magicmap.client.gui.utils.menu.NodeMenuContainer;
/**
* Beliebiger View im PACW Client. Ein View greift auf ein Modell
@@ -19,9 +20,10 @@
public abstract class View extends SimpleInternalFrame {
private JComponent view;
+ private final NodeMenuContainer menuCOntainer = new NodeMenuContainer(this);
+
+ //private ViewHeader header;
- //private ViewHeader header;
-
public View() {
super("Bla");
this.setTitle(getName());
@@ -53,4 +55,7 @@
return new ViewHeader(getName());
}
+ public NodeMenuContainer getMenuContainer(){
+ return menuCOntainer;
+ }
}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java 2007-02-10 14:27:24 UTC (rev 528)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java 2007-02-10 16:42:26 UTC (rev 529)
@@ -68,6 +68,7 @@
}
}
} catch (Exception e) {
+ log.warn("Invalid plugin directory: " + url.toString());
brokenUrlList.add(url);
}
}
Modified: trunk/magicmapserver/magicmapserver.iml
===================================================================
--- trunk/magicmapserver/magicmapserver.iml 2007-02-10 14:27:24 UTC (rev 528)
+++ trunk/magicmapserver/magicmapserver.iml 2007-02-10 16:42:26 UTC (rev 529)
@@ -1,24 +1,307 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
- <component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/web/WEB-INF/classes" />
- <exclude-output />
- <output-test url="file://$MODULE_DIR$/build-test" />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/dblayer/src" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" exported="" name="server-lib" level="project" />
- <orderEntry type="library" exported="" name="lib-dev" level="project" />
- <orderEntry type="library" name="Groovy from GroovyJ 0.1.8 (Demetra)" level="application" />
- <orderEntryProperties />
- </component>
- <component name="VcsManagerConfiguration">
- <option name="ACTIVE_VCS_NAME" value="svn" />
- <option name="USE_PROJECT_VCS" value="false" />
- </component>
-</module>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<module version="4" relativePaths="false" type="JAVA_MODULE">
+ <component name="ModuleRootManager" />
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <exclude-output />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/dblayer/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://X:/maven/junit/junit/3.8.1/junit-3.8.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib.dev/jasper-runtime.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib.dev/jsp-api.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib.dev/servlet-api.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/dom4j-1.6.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/forms-1.0.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/commons-collections-3.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/foxtrot.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/jaxrpc.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/ostermillerutils_1_05_00.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/commons-codec-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/concurrent.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/colt.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/nekohtml.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/commons-logging.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/jung-1.5.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/saaj.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/xmlParserAPIs.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/derby.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/RelativeLayout.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/xercesImpl.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/xml-apis.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/mail.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/jaxen-1.1-beta-9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/commons-httpclient-3.0-rc3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/jpox-20041204.032009.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/looks-1.2.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/log4j-1.2.8.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/axis.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/activation.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/wsdl4j.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://E:/_Projekte/_Diplomarbeit/_magicmap/magicmap/magicmapclient/lib/commons-discovery.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntryProperties />
+ </component>
+</module>
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-10 14:27:47
|
Revision: 528
http://svn.sourceforge.net/magicmap/?rev=528&view=rev
Author: jan_fride
Date: 2007-02-10 06:27:24 -0800 (Sat, 10 Feb 2007)
Log Message:
-----------
Log
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java 2007-02-08 18:41:51 UTC (rev 527)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java 2007-02-10 14:27:24 UTC (rev 528)
@@ -79,6 +79,7 @@
*/
private void loadPlugin(URL url) throws Exception{
// first. Descriptor laden.
+ log.info("Loading URL: " + url);
String jarUrl = "jar:" + url.toString() + "!/META-INF/plugin.xml";
JarURLConnection con = (JarURLConnection) new URL(jarUrl).openConnection();
net.sf.magicmap.client.plugin.util.PluginDescriptorReader descriptorReader = new net.sf.magicmap.client.plugin.util.PluginDescriptorReader(con.getInputStream());
@@ -95,7 +96,7 @@
net.sf.magicmap.client.plugin.IPlugin plugin = (IPlugin) piConstructor.newInstance(descriptor);
this.pluginList.add(plugin);
- PluginLoader.log.info("Plugin loaded");
+ PluginLoader.log.info("Plugin loaded: ");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-08 18:42:00
|
Revision: 527
http://svn.sourceforge.net/magicmap/?rev=527&view=rev
Author: jan_fride
Date: 2007-02-08 10:41:51 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
MetricManager is accassable through NodePlacer
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-08 15:34:37 UTC (rev 526)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-08 18:41:51 UTC (rev 527)
@@ -19,9 +19,6 @@
import edu.uci.ics.jung.graph.event.GraphEventType;
import edu.uci.ics.jung.graph.impl.DirectedSparseGraph;
import edu.uci.ics.jung.visualization.SpringLayout;
-import net.sf.magicmap.client.algorithms.InfoNodeMetric;
-import net.sf.magicmap.client.algorithms.MagicMetric;
-import net.sf.magicmap.client.algorithms.NodeMetricManager;
import net.sf.magicmap.client.gui.PACWGraphDraw;
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
@@ -232,18 +229,8 @@
*
*/
public void initializeGraph(){
-
- // Das Layout
- // TEST-GRAPH
- // INodeModel model = Controller.getInstance().getNodeModel();
-
- // TODO Hier kann eine andere Metrik verwendet werden
-
- MagicMetric magicMetric = new MagicMetric();
- NodeMetricManager metrics = new NodeMetricManager(magicMetric);
- metrics.addMetric(InfoObjectNode.class, InfoObjectNode.class, new InfoNodeMetric());
layoutModel = (JungNodePlacer) getModel().getNodePlacer();
- graph = layoutModel;// new DirectedSparseGraph();
+ graph = layoutModel;// new DirectedSparseGraph();
graphdraw = new PACWGraphDraw(layoutModel);
graphdraw.setVisible(false);
labeller = StringLabeller.getLabeller(graph);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2007-02-08 15:34:37 UTC (rev 526)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2007-02-08 18:41:51 UTC (rev 527)
@@ -1,6 +1,7 @@
package net.sf.magicmap.client.model.location;
+import net.sf.magicmap.client.algorithms.NodeMetricManager;
import net.sf.magicmap.client.model.node.IMagicEdge;
import net.sf.magicmap.client.model.node.Node;
@@ -87,6 +88,8 @@
*/
public void addNodeUpdateHandler(NodeUpdateHandler handler);
+ public NodeMetricManager getMetricManager();
+
public void updateNode(Node node, int type, Object data);
static final class NodeHandlerFactory {
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-08 15:34:37 UTC (rev 526)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-08 18:41:51 UTC (rev 527)
@@ -10,6 +10,7 @@
import edu.uci.ics.jung.utils.UserData;
import edu.uci.ics.jung.visualization.SpringLayout;
import net.sf.magicmap.client.algorithms.MagicMetric;
+import net.sf.magicmap.client.algorithms.NodeMetricManager;
import net.sf.magicmap.client.algorithms.NodeModelMetric;
import net.sf.magicmap.client.interfaces.NodeModelListener;
import net.sf.magicmap.client.model.location.INodePlacer;
@@ -88,21 +89,31 @@
*/
private final NodeHandlerFactory nodeHandler = new NodeHandlerFactory();
- public JungNodePlacer() {
+ private final NodeMetricManager metricManager;
+
+ public JungNodePlacer() {
this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
}
- /**
+ /**
+ *
+ * @return
+ */
+ public NodeMetricManager getMetricManager() {
+ return metricManager;
+ }
+
+ /**
*
* @param settings
* @param metric
*/
public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) {
super();
-
+ this.metricManager = new NodeMetricManager(metric);
this.clientLocationMap = new HashMap<ClientNode, HashSet<LocationNode>>();
this.locationLocationMap = new HashMap<LocationNode, HashSet<LocationNode>>();
- this.layout = new MagicLayout(this, metric, settings);
+ this.layout = new MagicLayout(this, metricManager, settings);
this.worker = new LayoutWorker(this.layout, new Dimension(800, 600));
this.workerRunning = false;
this.workerPaused = false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-02-08 15:34:43
|
Revision: 526
http://svn.sourceforge.net/magicmap/?rev=526&view=rev
Author: flederohr
Date: 2007-02-08 07:34:37 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
udpplugin is now compiled for java 1.5
Modified Paths:
--------------
trunk/magicmapclient/plugins/udpplugin-plugin.jar
Modified: trunk/magicmapclient/plugins/udpplugin-plugin.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-08 09:12:00
|
Revision: 525
http://svn.sourceforge.net/magicmap/?rev=525&view=rev
Author: jan_fride
Date: 2007-02-08 01:11:49 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
Node implements INode.
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2007-02-08 08:49:31 UTC (rev 524)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2007-02-08 09:11:49 UTC (rev 525)
@@ -12,16 +12,25 @@
*
* @author thuebner
*/
-public abstract class Node {
+public abstract class Node implements INode{
+ // Es gibt zwar die sch\xF6ne Methode Collections.emptyList() aber
+ // Da diese keine ArrayList ist m\xFCessen wir das selber machen :-/
+ private static final ArrayList emptyList = new ArrayList(){
+ public boolean add(Object o) {
+ return false;
+ }
- /**
+ public void add(int index, Object element) {
+ }
+ };
+ /**
* Ein leerer Knoten.
*/
public static final Node EMPTY_NODE = new Node(null) {
@Override
public ArrayList getNeighbors(){
- return new ArrayList();
+ return emptyList;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-08 08:49:54
|
Revision: 524
http://svn.sourceforge.net/magicmap/?rev=524&view=rev
Author: jan_fride
Date: 2007-02-08 00:49:31 -0800 (Thu, 08 Feb 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2007-02-08 08:49:31 UTC (rev 524)
@@ -0,0 +1,64 @@
+package net.sf.magicmap.client.model.node;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 08.02.2007
+ * Time: 09:22:33
+ * To change this template use File | Settings | File Templates.
+ */
+public interface INode {
+ String getDisplayName();
+
+ void setDisplayName(String displayName);
+
+ boolean isUpdate();
+
+ void setUpdate(boolean newupdate);
+
+ boolean isFix();
+
+ void setFix(boolean fix);
+
+ String getName();
+
+ void setName(String name);
+
+ int getX();
+
+ int getY();
+
+ void setPositionSilent(int x, int y, int z);
+
+ void setPosition(int x, int y, int z);
+
+ /**
+ *
+ * @return
+ */
+ //todo Die Implementation ist doch dumm, warum nicht List?
+ List<? extends Node> getNeighbors();
+
+ INodeModel getModel();
+
+ int getType();
+
+ long getId();
+
+ void setId(long id);
+
+ int getZ();
+
+ void setZ(int z);
+
+ Node getParentNode();
+
+ void setParentNode(Node parentNode);
+
+ boolean isPhysical();
+
+ void setPhysical(boolean physical);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Jan...@us...> - 2007-02-07 10:46:10
|
Revision: 523
http://svn.sourceforge.net/magicmap/?rev=523&view=rev
Author: Jan_fride
Date: 2007-02-07 02:46:01 -0800 (Wed, 07 Feb 2007)
Log Message:
-----------
undid changes...
Modified Paths:
--------------
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java
Added Paths:
-----------
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java
Modified: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java 2007-02-07 10:38:16 UTC (rev 522)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java 2007-02-07 10:46:01 UTC (rev 523)
@@ -67,7 +67,7 @@
public GraphDraw(Graph g) {
this.graph = g;
StringLabeller sl = StringLabeller.getLabeller(g);
- layout = new MagicSpringLayout(g);
+ layout = new SpringLayout(g);
originalRenderer = new SettableRenderer(sl);
r = originalRenderer;
vv = new VisualizationViewer(layout, r);
Added: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java (rev 0)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java 2007-02-07 10:46:01 UTC (rev 523)
@@ -0,0 +1,538 @@
+/*
+ * Copyright (c) 2003, the JUNG Project and the Regents of the University of
+ * California All rights reserved.
+ *
+ * This software is open-source under the BSD license; see either "license.txt"
+ * or http://jung.sourceforge.net/license.txt for a description.
+ */
+
+package edu.uci.ics.jung.visualization;
+
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+
+import javax.swing.SwingUtilities;
+
+import edu.uci.ics.jung.graph.Edge;
+import edu.uci.ics.jung.graph.Graph;
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.utils.Pair;
+import edu.uci.ics.jung.utils.UserData;
+
+/**
+ * Anegpasst an die Magicmac sachen... drum der enue Name!
+ *
+ * The SpringLayout package represents a visualization of a set of nodes. The
+ * SpringLayout, which is initialized with a Graph, assigns X/Y locations to
+ * each node. When called <code>relax()</code>, the SpringLayout moves the
+ * visualization forward one step.
+ *
+ * @author Danyel Fisher
+ * @author Joshua O'Madadhain
+ */
+public class SpringLayout extends AbstractLayout implements LayoutMutable {
+
+ private static final Object SPRING_KEY = "temp_edu.uci.ics.jung.Spring_Visualization_Key";
+ protected double stretch = 85.0; //70; // 0.70;
+
+ protected LengthFunction lengthFunction;
+ protected RepulsionFunction repulsionFunction; // TH
+ protected ForceFunction forceFunction; //TH
+ protected CanLeaveMapFunction leaveFunction;
+
+ //protected int repulsion_range = 100;
+ //protected double force_multiplier = 1.0 / 3.0;
+
+ /**
+ * Returns the status.
+ */
+ public String getStatus(){
+ return null;
+ }
+
+ /**
+ * Constructor for a SpringLayout for a raw graph with associated
+ * dimension--the input knows how big the graph is. Defaults to the unit
+ * length function.
+ */
+ public SpringLayout(Graph g) {
+ this(g, UNITLENGTHFUNCTION);
+ }
+
+ /**
+ * Constructor for a SpringLayout for a raw graph with associated component.
+ *
+ * @param g
+ * the input Graph
+ * @param f
+ * the length function
+ */
+ public SpringLayout(Graph g, LengthFunction f) {
+ super(g);
+ this.lengthFunction = f;
+ this.leaveFunction = new CanLeaveMapFunction() {
+
+ public boolean canLeave(Vertex v){
+ return false;
+ }
+ };
+ }
+
+ /**
+ * Constructor for a SpringLayout for a raw graph with associated component.
+ *
+ * @param g
+ * the input Graph
+ * @param f
+ * the length function
+ * @param r
+ * the repulsion function
+ */
+ public SpringLayout(Graph g, LengthFunction f, RepulsionFunction r) {
+ super(g);
+ this.lengthFunction = f;
+ this.repulsionFunction = r;
+ this.leaveFunction = new CanLeaveMapFunction() {
+
+ public boolean canLeave(Vertex v){
+ return false;
+ }
+ };
+ }
+
+ /**
+ * @return the current value for the stretch parameter
+ * @see #setStretch(double)
+ */
+ public double getStretch(){
+ return stretch;
+ }
+
+ /**
+ * <p>Sets the stretch parameter for this instance. This value
+ * specifies how much the degrees of an edge's incident vertices
+ * should influence how easily the endpoints of that edge
+ * can move (that is, that edge's tendency to change its length).</p>
+ *
+ * <p>The default value is 0.70. Positive values less than 1 cause
+ * high-degree vertices to move less than low-degree vertices, and
+ * values > 1 cause high-degree vertices to move more than
+ * low-degree vertices. Negative values will have unpredictable
+ * and inconsistent results.</p>
+ * @param stretch
+ */
+ public void setStretch(double stretch){
+ this.stretch = stretch;
+ }
+
+ public CanLeaveMapFunction getLeaveFunction(){
+ return leaveFunction;
+ }
+
+ public void setLeaveFunction(CanLeaveMapFunction leaveFunction){
+ this.leaveFunction = leaveFunction;
+ }
+
+ protected void initialize_local(){
+ for (Iterator iter = getGraph().getEdges().iterator(); iter.hasNext();){
+ Edge e = (Edge) iter.next();
+ SpringEdgeData sed = getSpringData(e);
+ if (sed == null){
+ sed = new SpringEdgeData(e);
+ e.addUserDatum(getSpringKey(), sed, UserData.REMOVE);
+ }
+ calcEdgeLength(sed, lengthFunction);
+ }
+ }
+
+ Object key = null;
+
+ public Object getSpringKey(){
+ if (key == null) key = new Pair(this, SPRING_KEY);
+ return key;
+ }
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see edu.uci.ics.jung.visualization.AbstractLayout#initialize_local_vertex(edu.uci.ics.jung.graph.Vertex)
+ */
+ protected void initialize_local_vertex(Vertex v){
+ SpringVertexData vud = getSpringData(v);
+ if (vud == null){
+ vud = new SpringVertexData();
+ v.addUserDatum(getSpringKey(), vud, UserData.REMOVE);
+ }
+ }
+
+ /* ------------------------- */
+
+ protected void calcEdgeLength(SpringEdgeData sed, LengthFunction f){
+ sed.length = f.getLength(sed.e);
+ }
+
+ /* ------------------------- */
+
+ /**
+ * Relaxation step. Moves all nodes a smidge.
+ */
+ public void advancePositions(){
+ for (Iterator iter = getVisibleVertices().iterator(); iter.hasNext();){
+ Vertex v = (Vertex) iter.next();
+ SpringVertexData svd = getSpringData(v);
+ if (svd == null){
+ System.out.println("How confusing!");
+ continue;
+ }
+ svd.dx /= 4;
+ svd.dy /= 4;
+ svd.edgedx = svd.edgedy = 0;
+ svd.repulsiondx = svd.repulsiondy = 0;
+ }
+
+ try{
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run(){
+ relaxEdges();
+ calculateRepulsion();
+ moveNodes();
+ }
+ });
+ } catch (InterruptedException e){
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e){
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ protected Vertex getAVertex(Edge e){
+ Vertex v = (Vertex) e.getIncidentVertices().iterator().next();
+ return v;
+ }
+
+ protected void relaxEdges(){
+ for (Iterator i = getVisibleEdges().iterator(); i.hasNext();){
+ Edge e = (Edge) i.next();
+
+ Vertex v1 = getAVertex(e);
+ Vertex v2 = e.getOpposite(v1);
+
+ double vx = getX(v1) - getX(v2);
+ double vy = getY(v1) - getY(v2);
+ double len = Math.sqrt(vx * vx + vy * vy);
+
+ double desiredLen = getLength(e);
+
+ // round from zero, if needed [zero would be Bad.].
+ len = (len == 0) ? .0001 : len;
+
+ double force_multiplier = forceFunction.getForce(v1, v2);
+
+ double f = force_multiplier * (desiredLen - len) / len;
+
+ f = f * Math.pow(stretch / 100.0, (v1.degree() + v2.degree() - 2));
+
+ // the actual movement distance 'dx' is the force multiplied by the
+ // distance to go.
+ double dx = f * vx;
+ double dy = f * vy;
+ SpringVertexData v1D, v2D;
+ v1D = getSpringData(v1);
+ v2D = getSpringData(v2);
+
+ SpringEdgeData sed = getSpringData(e);
+ sed.f = f;
+
+ v1D.edgedx += dx;
+ v1D.edgedy += dy;
+ v2D.edgedx += -dx;
+ v2D.edgedy += -dy;
+ }
+
+ }
+
+ protected void calculateRepulsion(){
+ for (Iterator iter = getGraph().getVertices().iterator(); iter.hasNext();){
+ Vertex v = (Vertex) iter.next();
+ if (dontMove(v)) continue;
+
+ SpringVertexData svd = getSpringData(v);
+ double dx = 0, dy = 0;
+
+ double repulsion_range = 0;
+
+ for (Iterator iter2 = getGraph().getVertices().iterator(); iter2.hasNext();){
+
+ Vertex v2 = (Vertex) iter2.next();
+ if (v == v2) continue;
+
+ // TH
+ repulsion_range = this.repulsionFunction.getRepulsion(v, v2);
+
+ double vx = getX(v) - getX(v2);
+ double vy = getY(v) - getY(v2);
+ double distance = vx * vx + vy * vy;
+ if (distance == 0){
+ dx += Math.random();
+ dy += Math.random();
+ } else if (distance < repulsion_range * repulsion_range){
+ double factor = 1;
+ dx += factor * vx / Math.pow(distance, 2);
+ dy += factor * vy / Math.pow(distance, 2);
+ }
+ }
+ double dlen = dx * dx + dy * dy;
+ if (dlen > 0){
+ dlen = Math.sqrt(dlen) / 2;
+ svd.repulsiondx += dx / dlen;
+ svd.repulsiondy += dy / dlen;
+ }
+ }
+ }
+
+ protected void moveNodes(){
+
+ synchronized (getCurrentSize()){
+
+ for (Iterator i = getVisibleVertices().iterator(); i.hasNext();){
+ Vertex v = (Vertex) i.next();
+ if (dontMove(v)) continue;
+ SpringVertexData vd = getSpringData(v);
+ Coordinates xyd = getCoordinates(v);
+
+ vd.dx += vd.repulsiondx + vd.edgedx;
+ vd.dy += vd.repulsiondy + vd.edgedy;
+
+ // keeps nodes from moving any faster than 5 per time unit
+ xyd.addX(Math.max(-5, Math.min(5, vd.dx)));
+ xyd.addY(Math.max(-5, Math.min(5, vd.dy)));
+
+ int width = getCurrentSize().width;
+ int height = getCurrentSize().height;
+
+ // Bestimmte Knoten sollen die Karte verlassen dr\xFCfen
+ if (!leaveFunction.canLeave(v)){
+ if (xyd.getX() < 0){
+ xyd.setX(0);
+ } else if (xyd.getX() > width){
+ xyd.setX(width);
+ }
+ if (xyd.getY() < 0){
+ xyd.setY(0);
+ } else if (xyd.getY() > height){
+ xyd.setY(height);
+ }
+ }
+
+ }
+ }
+
+ }
+
+ public SpringVertexData getSpringData(Vertex v){
+ return (SpringVertexData) (v.getUserDatum(getSpringKey()));
+ }
+
+ public SpringEdgeData getSpringData(Edge e){
+ try{
+ return (SpringEdgeData) (e.getUserDatum(getSpringKey()));
+ } catch (ClassCastException cce){
+ System.out.println(e.getUserDatum(getSpringKey()).getClass());
+ throw cce;
+ }
+ }
+
+ public double getLength(Edge e){
+ double d = ((SpringEdgeData) e.getUserDatum(getSpringKey())).length;
+ return d;
+ }
+
+ public void setLength(Edge e, double length){
+ ((SpringEdgeData) e.getUserDatum(getSpringKey())).length = length;
+ }
+
+ /* --------------- Repulsion Function------------------ */
+
+ /**
+ * Extension for PACW: Make the Repulsion configurable.
+ *
+ *
+ * @author thuebner
+ */
+ public static interface RepulsionFunction {
+
+ public double getRepulsion(Vertex v1, Vertex v2);
+ }
+
+ /**
+ * Extension for PACW: Make the Repulsion configurable.
+ *
+ *
+ * @author thuebner
+ */
+ public static interface ForceFunction {
+
+ /**
+ * Sets the force multiplier for this instance. This value is used to
+ * specify how strongly an edge "wants" to be its default length
+ * (higher values indicate a greater attraction for the default length),
+ * which affects how much its endpoints move at each timestep.
+ * The default value is 1/3. A value of 0 turns off any attempt by the
+ * layout to cause edges to conform to the default length. Negative
+ * values cause long edges to get longer and short edges to get shorter; use
+ * at your own risk.
+ * @param v1
+ * @param v2
+ */
+
+ public double getForce(Vertex v1, Vertex v2);
+ }
+
+ /**
+ * Extension for PACW: Make the Repulsion configurable.
+ *
+ *
+ * @author thuebner
+ */
+ public static interface CanLeaveMapFunction {
+
+ /**
+ * Liefert true, wenn ein Knoten die Karte verlassen darf
+ * @param v
+ * @return
+ */
+ public boolean canLeave(Vertex v);
+ }
+
+ /* ---------------Length Function------------------ */
+
+ /**
+ * If the edge is weighted, then override this method to show what the
+ * visualized length is.
+ *
+ * @author Danyel Fisher
+ */
+ public static interface LengthFunction {
+
+ public double getLength(Edge e);
+ }
+
+ /**
+ * Returns all edges as the same length: the input value
+ * @author danyelf
+ */
+ public static final class UnitLengthFunction implements LengthFunction {
+
+ int length;
+
+ public UnitLengthFunction(int length) {
+ this.length = length;
+ }
+
+ public double getLength(Edge e){
+ return length;
+ }
+ }
+
+ public static final LengthFunction UNITLENGTHFUNCTION = new UnitLengthFunction(30);
+
+ /* ---------------User Data------------------ */
+
+ protected static class SpringVertexData {
+
+ public double edgedx;
+
+ public double edgedy;
+
+ public double repulsiondx;
+
+ public double repulsiondy;
+
+ public SpringVertexData() {}
+
+ /** movement speed, x */
+ public double dx;
+
+ /** movement speed, y */
+ public double dy;
+ }
+
+ protected static class SpringEdgeData {
+
+ public double f;
+
+ public SpringEdgeData(Edge e) {
+ this.e = e;
+ }
+
+ Edge e;
+
+ double length;
+ }
+
+ /* ---------------Resize handler------------------ */
+
+ public class SpringDimensionChecker extends ComponentAdapter {
+
+ public void componentResized(ComponentEvent e){
+ resize(e.getComponent().getSize());
+ }
+ }
+
+ /**
+ * This one is an incremental visualization
+ */
+ public boolean isIncremental(){
+ return true;
+ }
+
+ /**
+ * For now, we pretend it never finishes.
+ */
+ public boolean incrementsAreDone(){
+ return false;
+ }
+
+ /**
+ * @see edu.uci.ics.jung.visualization.LayoutMutable#update()
+ */
+ public void update(){
+ for (Iterator iter = getGraph().getVertices().iterator(); iter.hasNext();){
+ Vertex v = (Vertex) iter.next();
+ Coordinates coord = (Coordinates) v.getUserDatum(getBaseKey());
+ if (coord == null){
+ coord = new Coordinates();
+ v.addUserDatum(getBaseKey(), coord, UserData.REMOVE);
+ initializeLocation(v, coord, getCurrentSize());
+ initialize_local_vertex(v);
+ }
+ }
+ initialize_local();
+ }
+
+ public RepulsionFunction getRepulsionFunction(){
+ return repulsionFunction;
+ }
+
+ public void setRepulsionFunction(RepulsionFunction repulsionFunction){
+ this.repulsionFunction = repulsionFunction;
+ }
+
+ public ForceFunction getForceFunction(){
+ return forceFunction;
+ }
+
+ public void setForceFunction(ForceFunction forceFunction){
+ this.forceFunction = forceFunction;
+ }
+
+ public LengthFunction getLengthFunction(){
+ return lengthFunction;
+ }
+}
\ No newline at end of file
Modified: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java 2007-02-07 10:38:16 UTC (rev 522)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java 2007-02-07 10:46:01 UTC (rev 523)
@@ -21,7 +21,7 @@
import edu.uci.ics.jung.graph.Vertex;
import edu.uci.ics.jung.utils.UserData;
import edu.uci.ics.jung.visualization.Coordinates;
-import edu.uci.ics.jung.visualization.MagicSpringLayout;
+import edu.uci.ics.jung.visualization.SpringLayout;
/**
* @author John Yesberg
@@ -33,11 +33,11 @@
* towards the top of the layout. Any vertex has a level one greater than the
* maximum level of all its successors.
*
- * Note: had to make minor access changes to MagicSpringLayout to make this work.
+ * Note: had to make minor access changes to SpringLayout to make this work.
* FORCE_CONSTANT, LengthFunction, SpringVertexData, and SpringEdgeData were
* all made "protected".
*/
-public class DAGLayout extends MagicSpringLayout {
+public class DAGLayout extends SpringLayout {
protected static final String MINIMUMLEVELKEY = "DAGLayout.minimumLevel";
// Simpler than the "pair" technique.
@@ -79,7 +79,7 @@
* the minimumLevel for each vertex. When we layout the graph, vertices
* cannot be drawn any higher than the minimumLevel. The graphHeight of a
* graph is the greatest minimumLevel that is used. We will modify the
- * MagicSpringLayout calculations so that nodes cannot move above their assigned
+ * SpringLayout calculations so that nodes cannot move above their assigned
* minimumLevel.
*/
@@ -178,7 +178,7 @@
}
/**
- * Override the moveNodes() method from MagicSpringLayout. The only change we
+ * Override the moveNodes() method from SpringLayout. The only change we
* need to make is to make sure that nodes don't float higher than the minY
* coordinate, as calculated by their minimumLevel.
*/
@@ -194,7 +194,7 @@
for (Iterator i = getVisibleVertices().iterator(); i.hasNext();){
Vertex v = (Vertex) i.next();
if (dontMove(v)) continue;
- MagicSpringLayout.SpringVertexData vd = getSpringData(v);
+ SpringLayout.SpringVertexData vd = getSpringData(v);
Coordinates xyd = getCoordinates(v);
int width = getCurrentSize().width;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-02-07 10:38:39
|
Revision: 522
http://svn.sourceforge.net/magicmap/?rev=522&view=rev
Author: jan_fride
Date: 2007-02-07 02:38:16 -0800 (Wed, 07 Feb 2007)
Log Message:
-----------
Renamed Springlayout as it is also in the jung1.5.2 jar
Modified Paths:
--------------
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java
Removed Paths:
-------------
trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java
Modified: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java 2007-02-06 19:33:46 UTC (rev 521)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/GraphDraw.java 2007-02-07 10:38:16 UTC (rev 522)
@@ -67,7 +67,7 @@
public GraphDraw(Graph g) {
this.graph = g;
StringLabeller sl = StringLabeller.getLabeller(g);
- layout = new SpringLayout(g);
+ layout = new MagicSpringLayout(g);
originalRenderer = new SettableRenderer(sl);
r = originalRenderer;
vv = new VisualizationViewer(layout, r);
Deleted: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java 2007-02-06 19:33:46 UTC (rev 521)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/SpringLayout.java 2007-02-07 10:38:16 UTC (rev 522)
@@ -1,535 +0,0 @@
-/*
- * Copyright (c) 2003, the JUNG Project and the Regents of the University of
- * California All rights reserved.
- *
- * This software is open-source under the BSD license; see either "license.txt"
- * or http://jung.sourceforge.net/license.txt for a description.
- */
-
-package edu.uci.ics.jung.visualization;
-
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-
-import javax.swing.SwingUtilities;
-
-import edu.uci.ics.jung.graph.Edge;
-import edu.uci.ics.jung.graph.Graph;
-import edu.uci.ics.jung.graph.Vertex;
-import edu.uci.ics.jung.utils.Pair;
-import edu.uci.ics.jung.utils.UserData;
-
-/**
- * The SpringLayout package represents a visualization of a set of nodes. The
- * SpringLayout, which is initialized with a Graph, assigns X/Y locations to
- * each node. When called <code>relax()</code>, the SpringLayout moves the
- * visualization forward one step.
- *
- * @author Danyel Fisher
- * @author Joshua O'Madadhain
- */
-public class SpringLayout extends AbstractLayout implements LayoutMutable {
-
- private static final Object SPRING_KEY = "temp_edu.uci.ics.jung.Spring_Visualization_Key";
- protected double stretch = 85.0; //70; // 0.70;
-
- protected LengthFunction lengthFunction;
- protected RepulsionFunction repulsionFunction; // TH
- protected ForceFunction forceFunction; //TH
- protected CanLeaveMapFunction leaveFunction;
-
- //protected int repulsion_range = 100;
- //protected double force_multiplier = 1.0 / 3.0;
-
- /**
- * Returns the status.
- */
- public String getStatus(){
- return null;
- }
-
- /**
- * Constructor for a SpringLayout for a raw graph with associated
- * dimension--the input knows how big the graph is. Defaults to the unit
- * length function.
- */
- public SpringLayout(Graph g) {
- this(g, UNITLENGTHFUNCTION);
- }
-
- /**
- * Constructor for a SpringLayout for a raw graph with associated component.
- *
- * @param g
- * the input Graph
- * @param f
- * the length function
- */
- public SpringLayout(Graph g, LengthFunction f) {
- super(g);
- this.lengthFunction = f;
- this.leaveFunction = new CanLeaveMapFunction() {
-
- public boolean canLeave(Vertex v){
- return false;
- }
- };
- }
-
- /**
- * Constructor for a SpringLayout for a raw graph with associated component.
- *
- * @param g
- * the input Graph
- * @param f
- * the length function
- * @param r
- * the repulsion function
- */
- public SpringLayout(Graph g, LengthFunction f, RepulsionFunction r) {
- super(g);
- this.lengthFunction = f;
- this.repulsionFunction = r;
- this.leaveFunction = new CanLeaveMapFunction() {
-
- public boolean canLeave(Vertex v){
- return false;
- }
- };
- }
-
- /**
- * @return the current value for the stretch parameter
- * @see setStretch(double)
- */
- public double getStretch(){
- return stretch;
- }
-
- /**
- * <p>Sets the stretch parameter for this instance. This value
- * specifies how much the degrees of an edge's incident vertices
- * should influence how easily the endpoints of that edge
- * can move (that is, that edge's tendency to change its length).</p>
- *
- * <p>The default value is 0.70. Positive values less than 1 cause
- * high-degree vertices to move less than low-degree vertices, and
- * values > 1 cause high-degree vertices to move more than
- * low-degree vertices. Negative values will have unpredictable
- * and inconsistent results.</p>
- * @param stretch
- */
- public void setStretch(double stretch){
- this.stretch = stretch;
- }
-
- public CanLeaveMapFunction getLeaveFunction(){
- return leaveFunction;
- }
-
- public void setLeaveFunction(CanLeaveMapFunction leaveFunction){
- this.leaveFunction = leaveFunction;
- }
-
- protected void initialize_local(){
- for (Iterator iter = getGraph().getEdges().iterator(); iter.hasNext();){
- Edge e = (Edge) iter.next();
- SpringEdgeData sed = getSpringData(e);
- if (sed == null){
- sed = new SpringEdgeData(e);
- e.addUserDatum(getSpringKey(), sed, UserData.REMOVE);
- }
- calcEdgeLength(sed, lengthFunction);
- }
- }
-
- Object key = null;
-
- public Object getSpringKey(){
- if (key == null) key = new Pair(this, SPRING_KEY);
- return key;
- }
-
- /**
- * (non-Javadoc)
- *
- * @see edu.uci.ics.jung.visualization.AbstractLayout#initialize_local_vertex(edu.uci.ics.jung.graph.Vertex)
- */
- protected void initialize_local_vertex(Vertex v){
- SpringVertexData vud = getSpringData(v);
- if (vud == null){
- vud = new SpringVertexData();
- v.addUserDatum(getSpringKey(), vud, UserData.REMOVE);
- }
- }
-
- /* ------------------------- */
-
- protected void calcEdgeLength(SpringEdgeData sed, LengthFunction f){
- sed.length = f.getLength(sed.e);
- }
-
- /* ------------------------- */
-
- /**
- * Relaxation step. Moves all nodes a smidge.
- */
- public void advancePositions(){
- for (Iterator iter = getVisibleVertices().iterator(); iter.hasNext();){
- Vertex v = (Vertex) iter.next();
- SpringVertexData svd = getSpringData(v);
- if (svd == null){
- System.out.println("How confusing!");
- continue;
- }
- svd.dx /= 4;
- svd.dy /= 4;
- svd.edgedx = svd.edgedy = 0;
- svd.repulsiondx = svd.repulsiondy = 0;
- }
-
- try{
- SwingUtilities.invokeAndWait(new Runnable() {
-
- public void run(){
- relaxEdges();
- calculateRepulsion();
- moveNodes();
- }
- });
- } catch (InterruptedException e){
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e){
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- protected Vertex getAVertex(Edge e){
- Vertex v = (Vertex) e.getIncidentVertices().iterator().next();
- return v;
- }
-
- protected void relaxEdges(){
- for (Iterator i = getVisibleEdges().iterator(); i.hasNext();){
- Edge e = (Edge) i.next();
-
- Vertex v1 = getAVertex(e);
- Vertex v2 = e.getOpposite(v1);
-
- double vx = getX(v1) - getX(v2);
- double vy = getY(v1) - getY(v2);
- double len = Math.sqrt(vx * vx + vy * vy);
-
- double desiredLen = getLength(e);
-
- // round from zero, if needed [zero would be Bad.].
- len = (len == 0) ? .0001 : len;
-
- double force_multiplier = forceFunction.getForce(v1, v2);
-
- double f = force_multiplier * (desiredLen - len) / len;
-
- f = f * Math.pow(stretch / 100.0, (v1.degree() + v2.degree() - 2));
-
- // the actual movement distance 'dx' is the force multiplied by the
- // distance to go.
- double dx = f * vx;
- double dy = f * vy;
- SpringVertexData v1D, v2D;
- v1D = getSpringData(v1);
- v2D = getSpringData(v2);
-
- SpringEdgeData sed = getSpringData(e);
- sed.f = f;
-
- v1D.edgedx += dx;
- v1D.edgedy += dy;
- v2D.edgedx += -dx;
- v2D.edgedy += -dy;
- }
-
- }
-
- protected void calculateRepulsion(){
- for (Iterator iter = getGraph().getVertices().iterator(); iter.hasNext();){
- Vertex v = (Vertex) iter.next();
- if (dontMove(v)) continue;
-
- SpringVertexData svd = getSpringData(v);
- double dx = 0, dy = 0;
-
- double repulsion_range = 0;
-
- for (Iterator iter2 = getGraph().getVertices().iterator(); iter2.hasNext();){
-
- Vertex v2 = (Vertex) iter2.next();
- if (v == v2) continue;
-
- // TH
- repulsion_range = this.repulsionFunction.getRepulsion(v, v2);
-
- double vx = getX(v) - getX(v2);
- double vy = getY(v) - getY(v2);
- double distance = vx * vx + vy * vy;
- if (distance == 0){
- dx += Math.random();
- dy += Math.random();
- } else if (distance < repulsion_range * repulsion_range){
- double factor = 1;
- dx += factor * vx / Math.pow(distance, 2);
- dy += factor * vy / Math.pow(distance, 2);
- }
- }
- double dlen = dx * dx + dy * dy;
- if (dlen > 0){
- dlen = Math.sqrt(dlen) / 2;
- svd.repulsiondx += dx / dlen;
- svd.repulsiondy += dy / dlen;
- }
- }
- }
-
- protected void moveNodes(){
-
- synchronized (getCurrentSize()){
-
- for (Iterator i = getVisibleVertices().iterator(); i.hasNext();){
- Vertex v = (Vertex) i.next();
- if (dontMove(v)) continue;
- SpringVertexData vd = getSpringData(v);
- Coordinates xyd = getCoordinates(v);
-
- vd.dx += vd.repulsiondx + vd.edgedx;
- vd.dy += vd.repulsiondy + vd.edgedy;
-
- // keeps nodes from moving any faster than 5 per time unit
- xyd.addX(Math.max(-5, Math.min(5, vd.dx)));
- xyd.addY(Math.max(-5, Math.min(5, vd.dy)));
-
- int width = getCurrentSize().width;
- int height = getCurrentSize().height;
-
- // Bestimmte Knoten sollen die Karte verlassen dr\xFCfen
- if (!leaveFunction.canLeave(v)){
- if (xyd.getX() < 0){
- xyd.setX(0);
- } else if (xyd.getX() > width){
- xyd.setX(width);
- }
- if (xyd.getY() < 0){
- xyd.setY(0);
- } else if (xyd.getY() > height){
- xyd.setY(height);
- }
- }
-
- }
- }
-
- }
-
- public SpringVertexData getSpringData(Vertex v){
- return (SpringVertexData) (v.getUserDatum(getSpringKey()));
- }
-
- public SpringEdgeData getSpringData(Edge e){
- try{
- return (SpringEdgeData) (e.getUserDatum(getSpringKey()));
- } catch (ClassCastException cce){
- System.out.println(e.getUserDatum(getSpringKey()).getClass());
- throw cce;
- }
- }
-
- public double getLength(Edge e){
- double d = ((SpringEdgeData) e.getUserDatum(getSpringKey())).length;
- return d;
- }
-
- public void setLength(Edge e, double length){
- ((SpringEdgeData) e.getUserDatum(getSpringKey())).length = length;
- }
-
- /* --------------- Repulsion Function------------------ */
-
- /**
- * Extension for PACW: Make the Repulsion configurable.
- *
- *
- * @author thuebner
- */
- public static interface RepulsionFunction {
-
- public double getRepulsion(Vertex v1, Vertex v2);
- }
-
- /**
- * Extension for PACW: Make the Repulsion configurable.
- *
- *
- * @author thuebner
- */
- public static interface ForceFunction {
-
- /**
- * Sets the force multiplier for this instance. This value is used to
- * specify how strongly an edge "wants" to be its default length
- * (higher values indicate a greater attraction for the default length),
- * which affects how much its endpoints move at each timestep.
- * The default value is 1/3. A value of 0 turns off any attempt by the
- * layout to cause edges to conform to the default length. Negative
- * values cause long edges to get longer and short edges to get shorter; use
- * at your own risk.
- * @param force
- */
-
- public double getForce(Vertex v1, Vertex v2);
- }
-
- /**
- * Extension for PACW: Make the Repulsion configurable.
- *
- *
- * @author thuebner
- */
- public static interface CanLeaveMapFunction {
-
- /**
- * Liefert true, wenn ein Knoten die Karte verlassen darf
- * @param v
- * @return
- */
- public boolean canLeave(Vertex v);
- }
-
- /* ---------------Length Function------------------ */
-
- /**
- * If the edge is weighted, then override this method to show what the
- * visualized length is.
- *
- * @author Danyel Fisher
- */
- public static interface LengthFunction {
-
- public double getLength(Edge e);
- }
-
- /**
- * Returns all edges as the same length: the input value
- * @author danyelf
- */
- public static final class UnitLengthFunction implements LengthFunction {
-
- int length;
-
- public UnitLengthFunction(int length) {
- this.length = length;
- }
-
- public double getLength(Edge e){
- return length;
- }
- }
-
- public static final LengthFunction UNITLENGTHFUNCTION = new UnitLengthFunction(30);
-
- /* ---------------User Data------------------ */
-
- protected static class SpringVertexData {
-
- public double edgedx;
-
- public double edgedy;
-
- public double repulsiondx;
-
- public double repulsiondy;
-
- public SpringVertexData() {}
-
- /** movement speed, x */
- public double dx;
-
- /** movement speed, y */
- public double dy;
- }
-
- protected static class SpringEdgeData {
-
- public double f;
-
- public SpringEdgeData(Edge e) {
- this.e = e;
- }
-
- Edge e;
-
- double length;
- }
-
- /* ---------------Resize handler------------------ */
-
- public class SpringDimensionChecker extends ComponentAdapter {
-
- public void componentResized(ComponentEvent e){
- resize(e.getComponent().getSize());
- }
- }
-
- /**
- * This one is an incremental visualization
- */
- public boolean isIncremental(){
- return true;
- }
-
- /**
- * For now, we pretend it never finishes.
- */
- public boolean incrementsAreDone(){
- return false;
- }
-
- /**
- * @see edu.uci.ics.jung.visualization.LayoutMutable#update()
- */
- public void update(){
- for (Iterator iter = getGraph().getVertices().iterator(); iter.hasNext();){
- Vertex v = (Vertex) iter.next();
- Coordinates coord = (Coordinates) v.getUserDatum(getBaseKey());
- if (coord == null){
- coord = new Coordinates();
- v.addUserDatum(getBaseKey(), coord, UserData.REMOVE);
- initializeLocation(v, coord, getCurrentSize());
- initialize_local_vertex(v);
- }
- }
- initialize_local();
- }
-
- public RepulsionFunction getRepulsionFunction(){
- return repulsionFunction;
- }
-
- public void setRepulsionFunction(RepulsionFunction repulsionFunction){
- this.repulsionFunction = repulsionFunction;
- }
-
- public ForceFunction getForceFunction(){
- return forceFunction;
- }
-
- public void setForceFunction(ForceFunction forceFunction){
- this.forceFunction = forceFunction;
- }
-
- public LengthFunction getLengthFunction(){
- return lengthFunction;
- }
-}
\ No newline at end of file
Modified: trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java
===================================================================
--- trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java 2007-02-06 19:33:46 UTC (rev 521)
+++ trunk/magicmapclient/src/edu/uci/ics/jung/visualization/contrib/DAGLayout.java 2007-02-07 10:38:16 UTC (rev 522)
@@ -21,7 +21,7 @@
import edu.uci.ics.jung.graph.Vertex;
import edu.uci.ics.jung.utils.UserData;
import edu.uci.ics.jung.visualization.Coordinates;
-import edu.uci.ics.jung.visualization.SpringLayout;
+import edu.uci.ics.jung.visualization.MagicSpringLayout;
/**
* @author John Yesberg
@@ -33,11 +33,11 @@
* towards the top of the layout. Any vertex has a level one greater than the
* maximum level of all its successors.
*
- * Note: had to make minor access changes to SpringLayout to make this work.
+ * Note: had to make minor access changes to MagicSpringLayout to make this work.
* FORCE_CONSTANT, LengthFunction, SpringVertexData, and SpringEdgeData were
* all made "protected".
*/
-public class DAGLayout extends SpringLayout {
+public class DAGLayout extends MagicSpringLayout {
protected static final String MINIMUMLEVELKEY = "DAGLayout.minimumLevel";
// Simpler than the "pair" technique.
@@ -79,7 +79,7 @@
* the minimumLevel for each vertex. When we layout the graph, vertices
* cannot be drawn any higher than the minimumLevel. The graphHeight of a
* graph is the greatest minimumLevel that is used. We will modify the
- * SpringLayout calculations so that nodes cannot move above their assigned
+ * MagicSpringLayout calculations so that nodes cannot move above their assigned
* minimumLevel.
*/
@@ -178,7 +178,7 @@
}
/**
- * Override the moveNodes() method from SpringLayout. The only change we
+ * Override the moveNodes() method from MagicSpringLayout. The only change we
* need to make is to make sure that nodes don't float higher than the minY
* coordinate, as calculated by their minimumLevel.
*/
@@ -194,7 +194,7 @@
for (Iterator i = getVisibleVertices().iterator(); i.hasNext();){
Vertex v = (Vertex) i.next();
if (dontMove(v)) continue;
- SpringLayout.SpringVertexData vd = getSpringData(v);
+ MagicSpringLayout.SpringVertexData vd = getSpringData(v);
Coordinates xyd = getCoordinates(v);
int width = getCurrentSize().width;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-02-06 19:34:21
|
Revision: 521
http://svn.sourceforge.net/magicmap/?rev=521&view=rev
Author: flederohr
Date: 2007-02-06 11:33:46 -0800 (Tue, 06 Feb 2007)
Log Message:
-----------
updated udpplugin after fixing the bug with client-node when reconnecting MagicMap to the server
Modified Paths:
--------------
trunk/magicmapclient/plugins/udpplugin-plugin.jar
Modified: trunk/magicmapclient/plugins/udpplugin-plugin.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <an...@us...> - 2007-02-02 14:49:40
|
Revision: 520
http://svn.sourceforge.net/magicmap/?rev=520&view=rev
Author: anweiss
Date: 2007-02-02 06:49:16 -0800 (Fri, 02 Feb 2007)
Log Message:
-----------
fixed and added a comment
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2007-02-02 14:48:17 UTC (rev 519)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2007-02-02 14:49:16 UTC (rev 520)
@@ -39,7 +39,7 @@
}
/**
- * Berechnet die gew\xFCnschte ENtfernung zwischen zwei Knotem
+ * Berechnet die gew\xFCnschte Entfernung zwischen zwei Knotem
* @param n1
* @param n2
* @return
@@ -126,11 +126,12 @@
*/
private void adjustCallibration(boolean clientOrLocation, double len, double desiredLen, boolean notFixed){
if (notFixed) return;
-
+ //len and desiredLen could be 0 so we add 1
double d = (len + 1) / (desiredLen + 1);
if (clientOrLocation) {
if (d < 0.95) {
+
settings.adjustLocationCalibration(-Math.max(Math.abs(len - desiredLen) / 200, 0.001));
} else if (d > 1.05) {
settings.adjustLocationCalibration(Math.max(Math.abs(len - desiredLen) / 200, 0.001));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <an...@us...> - 2007-02-02 14:48:44
|
Revision: 519
http://svn.sourceforge.net/magicmap/?rev=519&view=rev
Author: anweiss
Date: 2007-02-02 06:48:17 -0800 (Fri, 02 Feb 2007)
Log Message:
-----------
CalibrationFactors cannot become negative anymore
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutSettings.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutSettings.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutSettings.java 2007-01-29 13:20:50 UTC (rev 518)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutSettings.java 2007-02-02 14:48:17 UTC (rev 519)
@@ -1,6 +1,5 @@
package net.sf.magicmap.client.model.location.jung;
-
/**
* Contains the calibration settings for ur layout.
*
@@ -9,6 +8,7 @@
*/
public class LayoutSettings {
+
/**
* Um die Knoten in den Kanten zu finden.
*/
@@ -19,9 +19,9 @@
*/
public static final String NODE_DISTANCE_KEY = "NODE.distance";
- private double CALIBRATION_FACTOR_LC = 1.0; // Kanten zu Referenzpunkten
+ private double CALIBRATION_FACTOR_LC = 1.0; // Kanten zu Referenzpunkten
- private double CALIBRATION_FACTOR_AP = 1.0; // Kanten zu APs kalibrieren
+ private double CALIBRATION_FACTOR_AP = 1.0; // Kanten zu APs kalibrieren
private boolean calculateHeight = false;
@@ -34,12 +34,21 @@
}
public double adjustLocationCalibration(double adjustValue){
- this.CALIBRATION_FACTOR_LC += adjustValue;
+ // CF must NOT be negativ
+ if ((this.CALIBRATION_FACTOR_LC + adjustValue) <= 0) {
+ this.CALIBRATION_FACTOR_LC /= 10;
+ } else {
+ this.CALIBRATION_FACTOR_LC += adjustValue;
+ }
return adjustValue;
}
public double adjustAccessPointCalibration(double adjustValue){
- this.CALIBRATION_FACTOR_AP += adjustValue;
+ if ((this.CALIBRATION_FACTOR_AP + adjustValue) <= 0) {
+ this.CALIBRATION_FACTOR_AP /= 10;
+ } else {
+ this.CALIBRATION_FACTOR_AP += adjustValue;
+ }
return adjustValue;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <an...@us...> - 2007-01-29 13:21:01
|
Revision: 518
http://svn.sourceforge.net/magicmap/?rev=518&view=rev
Author: anweiss
Date: 2007-01-29 05:20:50 -0800 (Mon, 29 Jan 2007)
Log Message:
-----------
performance optimization in signalLevelToStrength() and MagicMetric
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java
trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-01-28 13:20:43 UTC (rev 517)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-01-29 13:20:50 UTC (rev 518)
@@ -167,8 +167,7 @@
ap = (AccessPointNode) node2;
}
// TODO: Logarithmische Skalierung
- return Math.abs(Constants.MIN_SIGNALLEVEL
- - MeasurementUtils.signalLevelToStrength(seer.getSignalLevelForAccessPoint(ap)));
+ return Math.abs(MeasurementUtils.signalLevelToStrength(seer.getSignalLevelForAccessPoint(ap)));
} else
//Wir berechnen nur Abst\xE4nde zwischen APs, Clients und Referenzpunkten
return Double.POSITIVE_INFINITY;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java 2007-01-28 13:20:43 UTC (rev 517)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java 2007-01-29 13:20:50 UTC (rev 518)
@@ -53,8 +53,8 @@
GradientPaint p2 = new GradientPaint(getWidth() / 2, 0, Color.YELLOW, getWidth(), getHeight(), Color.GREEN);
//double d = 100.0 - Math.abs(avg ? ap.getAverageSignalLevel() : ap.getLastSignalLevel());
- double d = MeasurementUtils.signalLevelToStrength(this.avg ? this.ap.getAverageSignalLevel() : this.ap
- .getLastSignalLevel());
+ double d = Math.abs(Constants.MIN_SIGNALLEVEL-MeasurementUtils.signalLevelToStrength(this.avg ? this.ap.getAverageSignalLevel() : this.ap
+ .getLastSignalLevel()));
g2.setPaint(p1);
int w = (int) (getWidth() * d / Constants.MIN_SIGNALLEVEL);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java 2007-01-28 13:20:43 UTC (rev 517)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java 2007-01-29 13:20:50 UTC (rev 518)
@@ -32,7 +32,7 @@
result = Constants.MIN_SIGNALLEVEL;
System.out.println(Constants.MIN_SIGNALLEVEL + " \xFCberschritten");
}
- return Constants.MIN_SIGNALLEVEL - result;
+ return result;
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-28 13:21:11
|
Revision: 517
http://svn.sourceforge.net/magicmap/?rev=517&view=rev
Author: jan_fride
Date: 2007-01-28 05:20:43 -0800 (Sun, 28 Jan 2007)
Log Message:
-----------
Maps now sorted.. tada!
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2007-01-25 15:58:13 UTC (rev 516)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2007-01-28 13:20:43 UTC (rev 517)
@@ -11,6 +11,9 @@
import java.awt.event.ActionListener;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
@@ -79,6 +82,7 @@
return d.getMapInfo();
}
+
public LoadMapDialog(Frame owner, String[] maps) {
super(owner, GUIUtils.i18n("loadmap", false));
setSize(500, 500);
@@ -99,10 +103,18 @@
builder.setLeft("mapslabel", 10);
builder.setTop("mapslabel", 10);
- mapModel = new DefaultComboBoxModel();
+ Vector<MapEntry> entries = new Vector<MapEntry>();
+
for (String map: maps){
- mapModel.addElement(new MapEntry(map));
+ entries.add(new MapEntry(map));
}
+ Collections.sort(entries, new Comparator<MapEntry>(){
+ public int compare(MapEntry o1, MapEntry o2){
+ return o1.name.compareTo(o2.name);
+ }
+ });
+ mapModel = new DefaultComboBoxModel(entries);
+
this.list = new JList(mapModel);
list.setCellRenderer(new DefaultListCellRenderer(){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-01-25 15:58:19
|
Revision: 516
http://svn.sourceforge.net/magicmap/?rev=516&view=rev
Author: flederohr
Date: 2007-01-25 07:58:13 -0800 (Thu, 25 Jan 2007)
Log Message:
-----------
Handling of Locations in MeasurementModel <buggy>
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-01-25 14:01:01 UTC (rev 515)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-01-25 15:58:13 UTC (rev 516)
@@ -150,6 +150,7 @@
nodeModel.addNode(ap);
// ap.setName(mac);
}
+ controller.getMeasurementModel().updateScanResult(location, mac, r.getSignalLevel());
if (!ap.isHidden())
location.seesAccessPoint(ap, r.getSignalLevel());
}
@@ -198,9 +199,11 @@
} else // AccessPoint nur aktualisieren?
if (seenAps.remove(ap)) // Nur Signallevel aktualisieren
location.setSignalLevelForAcessPoint(ap, r.getSignalLevel());
- else
+ else{
// Neu
location.seesAccessPoint(ap, r.getSignalLevel());
+ controller.getMeasurementModel().updateScanResult (location, mac, r.getSignalLevel());
+ }
}
// Alle APs aus seenAps werden demzufolge
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-01-25 14:01:26
|
Revision: 515
http://svn.sourceforge.net/magicmap/?rev=515&view=rev
Author: flederohr
Date: 2007-01-25 06:01:01 -0800 (Thu, 25 Jan 2007)
Log Message:
-----------
Fixed Bugs in Measurement
Modified Paths:
--------------
trunk/magicmapclient/plugins/udpplugin-plugin.jar
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
Modified: trunk/magicmapclient/plugins/udpplugin-plugin.jar
===================================================================
(Binary files differ)
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-21 16:35:03 UTC (rev 514)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-25 14:01:01 UTC (rev 515)
@@ -35,526 +35,526 @@
*/
public class Controller implements IController {
- private static int numCalled = 0;
+ private static int numCalled = 0;
- /**
- * Die Instanz.
- */
- private static Controller controller = null;
+ /**
+ * Die Instanz.
+ */
+ private static Controller controller = null;
- /**
- * Das Knotenmodel.
- */
- private INodeModel nodeModel; // Model f\xFCr Graphen
+ /**
+ * Das Knotenmodel.
+ */
+ private INodeModel nodeModel; // Model f\xFCr Graphen
- private IMeasurementModel measurementModel; // Model f\xFCr Messungen
+ private IMeasurementModel measurementModel; // Model f\xFCr Messungen
- private ClientNode client; // Ausgezeichneter Knoten
+ private ClientNode client; // Ausgezeichneter Knoten
- private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen
+ private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen
- private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse
+ private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse
- private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server
+ private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server
- // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt
+ // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt
- private MapInfo currentMap;
+ private MapInfo currentMap;
- private OutlineView outlineView;
+ private OutlineView outlineView;
- private ConsoleView consoleView;
+ private ConsoleView consoleView;
- private MapView mapView;
+ private MapView mapView;
- private MeasurementView measurementView;
+ private MeasurementView measurementView;
- private boolean invisble; // Invisible-Modus (keine Daten an Server)
+ private boolean invisble; // Invisible-Modus (keine Daten an Server)
- // pseudo server items
- private Collection<InfoObject> infoObjects;
+ // pseudo server items
+ private Collection<InfoObject> infoObjects;
- private ScannerAllocator scannerAllocator;
- private final InfoObjectProviderRegistry infoServiceRegistry;
- private final PluginManager pluginManager;
+ private ScannerAllocator scannerAllocator;
+ private final InfoObjectProviderRegistry infoServiceRegistry;
+ private final PluginManager pluginManager;
- /**
- * Private constructor for singleton instance
- */
- private Controller() {
- DOMConfigurator.configureAndWatch("log4j.xml");
+ /**
+ * Private constructor for singleton instance
+ */
+ private Controller() {
+ DOMConfigurator.configureAndWatch("log4j.xml");
- //
- // Das Model der Knoten.
- //
- this.nodeModel = new NodeModel();
+ //
+ // Das Model der Knoten.
+ //
+ this.nodeModel = new NodeModel();
- /**
- * Messungen f\xFCr den eigenen clienten
- */
- this.measurementModel = new MeasurementModel();
+ /**
+ * Messungen f\xFCr den eigenen clienten
+ */
+ this.measurementModel = new MeasurementModel();
+ this.scannerAllocator = new ScannerAllocator();
+ this.currentMap = null;
+ this.serverManager = null;
- this.scannerAllocator = new ScannerAllocator();
- this.currentMap = null;
- this.serverManager = null;
+ this.pollhandler = new PollHandler(this);
- this.pollhandler = new PollHandler(this);
+ buildViews();
- buildViews();
-
- // pseudo server items
- this.infoObjects = new ArrayList<InfoObject>();
- // initializeScanner();
- this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel);
- try {
- this.pluginManager = new PluginManager(new Settings(), this);
+ // pseudo server items
+ this.infoObjects = new ArrayList<InfoObject>();
+ // initializeScanner();
+ this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel);
+ try {
+ this.pluginManager = new PluginManager(new Settings(), this);
} catch (MalformedURLException e) {
- throw new RuntimeException(e.getMessage());
- }
- }
+ throw new RuntimeException(e.getMessage());
+ }
+ }
- /**
- * Getter for client node
- *
- * @return the client node
- */
- public ClientNode getClient(){
- return this.client;
- }
+ /**
+ * Getter for client node
+ *
+ * @return the client node
+ */
+ public ClientNode getClient(){
+ return this.client;
+ }
- /**
- * Erzeugt die Hauptviews der Anwendung
- */
- private void buildViews(){
- this.outlineView = new OutlineView(this.nodeModel);
- this.consoleView = new ConsoleView();
- this.mapView = new MapView(this.nodeModel, null);
- this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel);
- // registerMeasurementModelListener(measurementView);
- setMeasurementViewLocal(true);
- this.nodeModel.addNodeModelListener(this.mapView);
- //registerNodeModelListener(outlineView);
+ /**
+ * Erzeugt die Hauptviews der Anwendung
+ */
+ private void buildViews(){
+ this.outlineView = new OutlineView(this.nodeModel);
+ this.consoleView = new ConsoleView();
+ this.mapView = new MapView(this.nodeModel, null);
+ this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel);
+ // registerMeasurementModelListener(measurementView);
+ setMeasurementViewLocal(true);
+ this.nodeModel.addNodeModelListener(this.mapView);
+ //registerNodeModelListener(outlineView);
}
- /**
- * Getter for the map view
- *
- * @return the map view
- */
- public MapView getMapView(){
- return this.mapView;
- }
+ /**
+ * Getter for the map view
+ *
+ * @return the map view
+ */
+ public MapView getMapView(){
+ return this.mapView;
+ }
- /**
- * Getter for the outline view
- *
- * @return the outline view
- */
- public OutlineView getOutlineView(){
- return this.outlineView;
- }
+ /**
+ * Getter for the outline view
+ *
+ * @return the outline view
+ */
+ public OutlineView getOutlineView(){
+ return this.outlineView;
+ }
- /**
- * Getter for the console view
- *
- * @return the console view
- */
- public ConsoleView getConsoleView(){
- return this.consoleView;
- }
+ /**
+ * Getter for the console view
+ *
+ * @return the console view
+ */
+ public ConsoleView getConsoleView(){
+ return this.consoleView;
+ }
- /**
- * Getter for the measurement view
- *
- * @return the measurement view
- */
- public MeasurementView getMeasurementView(){
- return this.measurementView;
- }
+ /**
+ * Getter for the measurement view
+ *
+ * @return the measurement view
+ */
+ public MeasurementView getMeasurementView(){
+ return this.measurementView;
+ }
- /**
- * Provides the singleton controller instance (creates a new one if null)
- *
- * @return the singleton controller instance
- */
- public static Controller getInstance(){
- if (Controller.controller == null) {
- ++Controller.numCalled;
- Controller.controller = new Controller();
- }
- return Controller.controller;
- }
+ /**
+ * Provides the singleton controller instance (creates a new one if null)
+ *
+ * @return the singleton controller instance
+ */
+ public static Controller getInstance(){
+ if (Controller.controller == null) {
+ ++Controller.numCalled;
+ Controller.controller = new Controller();
+ }
+ return Controller.controller;
+ }
- /**
- * Getter for the node model
- *
- * @return the node model
- */
- public INodeModel getNodeModel(){
- return this.nodeModel;
- }
+ /**
+ * Getter for the node model
+ *
+ * @return the node model
+ */
+ public INodeModel getNodeModel(){
+ return this.nodeModel;
+ }
- /**
- * Baut das MeasurementModelOther neu auf.
- *
- * @param ap -
- * the access point seer node
- */
- public void buildOtherMeasurement(AccessPointSeerNode ap){
-// System.out.println("Building measurement model...");
-// this.measurementModelOther.clear();
-// ArrayList aes = ap.getApEdges();
-// for (int i = 0; i < aes.size(); i++) {
-// AccessPointEdge ae = (AccessPointEdge) aes.get(i);
-// SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel());
-// this.measurementModelOther.addAccessPoint(sp);
-// }
- }
+ /**
+ * Baut das MeasurementModelOther neu auf.
+ *
+ * @param ap -
+ * the access point seer node
+ */
+ public void buildOtherMeasurement(AccessPointSeerNode ap){
+ // System.out.println("Building measurement model...");
+ // this.measurementModelOther.clear();
+ // ArrayList aes = ap.getApEdges();
+ // for (int i = 0; i < aes.size(); i++) {
+ // AccessPointEdge ae = (AccessPointEdge) aes.get(i);
+ // SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel());
+ // this.measurementModelOther.addAccessPoint(sp);
+ // }
+ }
- /**
- * \xC4nndert die Anzeige des Measurement-Views
- *
- * @param local
- * true, wenn lokale St\xE4rken angezeigt werden sollen
- */
- public void setMeasurementViewLocal(boolean local){
- if (local) {
- // measurementModelOther.removeMeasurementModelListener(measurementView);
- // measurementModel.addMeasurementModelListener(measurementView);
- //measurementModel.clear();
- } else {
- // measurementModel.removeMeasurementModelListener(measurementView);
- // measurementModelOther.addMeasurementModelListener(measurementView);
- //measurementModelOther.clear();
- }
- }
+ /**
+ * \xC4nndert die Anzeige des Measurement-Views
+ *
+ * @param local
+ * true, wenn lokale St\xE4rken angezeigt werden sollen
+ */
+ public void setMeasurementViewLocal(boolean local){
+ if (local) {
+ // measurementModelOther.removeMeasurementModelListener(measurementView);
+ // measurementModel.addMeasurementModelListener(measurementView);
+ //measurementModel.clear();
+ } else {
+ // measurementModel.removeMeasurementModelListener(measurementView);
+ // measurementModelOther.addMeasurementModelListener(measurementView);
+ //measurementModelOther.clear();
+ }
+ }
- /**
- * Getter for measurement model
- *
- * @return the measurement model
- */
- public IMeasurementModel getMeasurementModel(){
- return this.measurementModel;
- }
+ /**
+ * Getter for measurement model
+ *
+ * @return the measurement model
+ */
+ public IMeasurementModel getMeasurementModel(){
+ return this.measurementModel;
+ }
- /**
- * Gibt an ob verbunden oder nicht verbunden
- *
- * @return true wenn ja, false sonst
- */
- public boolean isConnected(){
- return (this.serverManager != null && this.serverManager.isConnected());
- }
+ /**
+ * Gibt an ob verbunden oder nicht verbunden
+ *
+ * @return true wenn ja, false sonst
+ */
+ public boolean isConnected(){
+ return (this.serverManager != null && this.serverManager.isConnected());
+ }
- /**
- * Liefert Kartenbeschreibung der aktuell geladenen Karte
- *
- * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv
- */
- public MapInfo getCurrentMap(){
- return this.currentMap;
- }
+ /**
+ * Liefert Kartenbeschreibung der aktuell geladenen Karte
+ *
+ * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv
+ */
+ public MapInfo getCurrentMap(){
+ return this.currentMap;
+ }
- /**
- * Setzt aktuelle Karte und startet dabei das ServerPolling
- *
- * @param map
- */
- public void setCurrentMap(MapInfo map){
- if (isMapLoaded()) closeMap();
- this.currentMap = map;
- try {
- this.serverManager.reloadMap();
- this.nodeModel.addNode(this.client);
- this.mapView.loadMap(map);
- } catch (MalformedURLException e) {
- System.out.println("Map loading failed." + e.getMessage());
- closeMap();
- }
- if (isMapLoaded() && isConnected()) {
- this.nodeModel.addNodeModelListener(this.mapView);
- this.serverManager.resetTimestamp();
- setMeasurementViewLocal(true);
- this.poller.start();
- // initializeScanner(); // Scanner neu initialisieren
- this.scannerAllocator.startAllScanner();
+ /**
+ * Setzt aktuelle Karte und startet dabei das ServerPolling
+ *
+ * @param map
+ */
+ public void setCurrentMap(MapInfo map){
+ if (isMapLoaded()) closeMap();
+ this.currentMap = map;
+ try {
+ this.serverManager.reloadMap();
+ this.nodeModel.addNode(this.client);
+ this.mapView.loadMap(map);
+ } catch (MalformedURLException e) {
+ System.out.println("Map loading failed." + e.getMessage());
+ closeMap();
+ }
+ if (isMapLoaded() && isConnected()) {
+ this.nodeModel.addNodeModelListener(this.mapView);
+ this.serverManager.resetTimestamp();
+ setMeasurementViewLocal(true);
+ this.poller.start();
+ // initializeScanner(); // Scanner neu initialisieren
+ this.scannerAllocator.startAllScanner();
- this.pluginManager.loadMap();
- if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
- getMapView().setTitle(
- GUIUtils.i18n("map", false) + " - " + this.currentMap.name + " Gr\xF6\xDFe: "
- + this.currentMap.realwidth + " X " + this.currentMap.realheight + " cm");
- }
- }
+ this.pluginManager.loadMap();
+ if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
+ getMapView().setTitle(
+ GUIUtils.i18n("map", false) + " - " + this.currentMap.name + " Gr\xF6\xDFe: "
+ + this.currentMap.realwidth + " X " + this.currentMap.realheight + " cm");
+ }
+ }
- /**
- * Restart server poller
- */
- public void restartServerPoller(){
- if (isMapLoaded() && isConnected()) {
- this.poller.stop();
- this.poller.start();
- }
- }
+ /**
+ * Restart server poller
+ */
+ public void restartServerPoller(){
+ if (isMapLoaded() && isConnected()) {
+ this.poller.stop();
+ this.poller.start();
+ }
+ }
- /**
- * Check whether map is loaded
- *
- * @return <code>true</code> if map loaded, <code>false</code> else
- */
- public boolean isMapLoaded(){
- return this.currentMap != null;
- }
+ /**
+ * Check whether map is loaded
+ *
+ * @return <code>true</code> if map loaded, <code>false</code> else
+ */
+ public boolean isMapLoaded(){
+ return this.currentMap != null;
+ }
- /**
- * Schlie\xDFt Karte und beendet Polling vom Server
- *
- */
- public void closeMap(){
- this.scannerAllocator.stopAllScanner();
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- this.currentMap = null;
- this.mapView.unloadMap();
- this.serverManager.closeMap();
- this.poller.stop();
- this.nodeModel.clear();
- this.nodeModel.removeNodeModelListener(this.mapView);
- // nodeModel.addNode(client);
- }
+ /**
+ * Schlie\xDFt Karte und beendet Polling vom Server
+ *
+ */
+ public void closeMap(){
+ this.scannerAllocator.stopAllScanner();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ this.currentMap = null;
+ this.mapView.unloadMap();
+ this.serverManager.closeMap();
+ this.poller.stop();
+ this.measurementModel.clear();
+ this.nodeModel.clear();
+ this.nodeModel.removeNodeModelListener(this.mapView);
+ this.client = null;
+ }
- /**
- * Liefert X-Position des Clients auf der Karte
- *
- * @return client x position
- */
- public int getClientPosX(){
- return this.mapView.getX(this.client);
- }
+ /**
+ * Liefert X-Position des Clients auf der Karte
+ *
+ * @return client x position
+ */
+ public int getClientPosX(){
+ return this.mapView.getX(this.client);
+ }
- /**
- * Liefert Y-Position des Clients auf der Karte
- *
- * @return
- */
- public int getClientPosY(){
- return this.mapView.getY(this.client);
- }
+ /**
+ * Liefert Y-Position des Clients auf der Karte
+ *
+ * @return
+ */
+ public int getClientPosY(){
+ return this.mapView.getY(this.client);
+ }
- /**
- * Liefert Z-Position des Clients
- *
- * @return
- */
- public int getClientPosZ(){
- return this.mapView.getZ(this.client);
- }
+ /**
+ * Liefert Z-Position des Clients
+ *
+ * @return
+ */
+ public int getClientPosZ(){
+ return this.mapView.getZ(this.client);
+ }
- /**
- * Check for invisibility
- *
- * @return <code>true</code> if invisible, <code>false</code> else
- */
- public boolean isInvisible(){
- return this.invisble;
- }
+ /**
+ * Check for invisibility
+ *
+ * @return <code>true</code> if invisible, <code>false</code> else
+ */
+ public boolean isInvisible(){
+ return this.invisble;
+ }
- /**
- * Setter for invisibility
- *
- * @param value -
- * boolean value for invisibility
- */
- public void setInvisible(boolean value){
- this.invisble = value;
- }
+ /**
+ * Setter for invisibility
+ *
+ * @param value -
+ * boolean value for invisibility
+ */
+ public void setInvisible(boolean value){
+ this.invisble = value;
+ }
- /***************************************************************************
- *
- * API f\xFCr die GUI
- *
- **************************************************************************/
+ /***************************************************************************
+ *
+ * API f\xFCr die GUI
+ *
+ **************************************************************************/
- public void connect(ServerConnectCallback callback){
- // Wir selber...
- this.client = new ClientNode(this.nodeModel);
- this.client.setName(Settings.getClientName());
- this.client.setMacAddress(Settings.getClientMAC());
- // this.nodeModel.addNode(client);
+ public void connect(ServerConnectCallback callback){
+ // Wir selber...
+ this.client = new ClientNode(this.nodeModel);
+ this.client.setName(Settings.getClientName());
+ this.client.setMacAddress(Settings.getClientMAC());
+ // this.nodeModel.addNode(client);
- if (Settings.isStandAlone())
- this.serverManager = new VirtualServerManager(this);
- else
- this.serverManager = new SOAPServerManager(this);
- // Poller erzeugen (ben\xF6tigt ServerManager)
- this.poller = new ServerPoller(this.serverManager, this.pollhandler);
- this.serverManager.connect(callback);
+ if (Settings.isStandAlone())
+ this.serverManager = new VirtualServerManager(this);
+ else
+ this.serverManager = new SOAPServerManager(this);
+ // Poller erzeugen (ben\xF6tigt ServerManager)
+ this.poller = new ServerPoller(this.serverManager, this.pollhandler);
+ this.serverManager.connect(callback);
- this.pluginManager.connect();
- }
+ this.pluginManager.connect();
+ }
- public void disconnect(ServerDisconnectCallback callback){
- this.pluginManager.dispose();
+ public void disconnect(ServerDisconnectCallback callback){
+ this.pluginManager.dispose();
- if (isMapLoaded()) closeMap();
+ if (isMapLoaded()) closeMap();
- this.serverManager.disconnect(callback);
- }
+ this.serverManager.disconnect(callback);
+ }
- /**
- * Erzeugt einen Referenzpunkt auf der aktuellen Karte mit den aktuellen
- * Messwerten des Clients mit den angegebenen Koordinaten.
- */
- public void createLocation(int x, int y, int z, String name, boolean fixed, CreatePositionCallback callback){
- if (!isConnected() || !isMapLoaded())
- callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
- else
- this.serverManager.createLocation(x, y, z, fixed, name, callback);
- }
+ /**
+ * Erzeugt einen Referenzpunkt auf der aktuellen Karte mit den aktuellen
+ * Messwerten des Clients mit den angegebenen Koordinaten.
+ */
+ public void createLocation(int x, int y, int z, String name, boolean fixed, CreatePositionCallback callback){
+ if (!isConnected() || !isMapLoaded())
+ callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
+ else
+ this.serverManager.createLocation(x, y, z, fixed, name, callback);
+ }
- /**
- * Erzeugt eine Geokoordinate auf der aktuellen Karte mit den angegebenen
- * Koordinaten.
- */
- public void createGeoPos(int x, int y, GeoPos geoPos, String mapName, boolean fixed, CreatePositionCallback callback){
- if (!isConnected() || !isMapLoaded())
- callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
- else {
- this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback);
- this.poller.geomapTimerTask().run();
- }
- }
+ /**
+ * Erzeugt eine Geokoordinate auf der aktuellen Karte mit den angegebenen
+ * Koordinaten.
+ */
+ public void createGeoPos(int x, int y, GeoPos geoPos, String mapName, boolean fixed, CreatePositionCallback callback){
+ if (!isConnected() || !isMapLoaded())
+ callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
+ else {
+ this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback);
+ this.poller.geomapTimerTask().run();
+ }
+ }
- /**
- * Creates an InfoObject on the current map with the supplied parameters
- * @param x
- * @param y
- * @param z
- * @param infoObject
- * @param mapName
- * @param fixed
- * @param callback
- */
- public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed,
- CreatePositionCallback callback){
- if (!isConnected() || !isMapLoaded())
- callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
- else {
- // serverManager.createInfoObject(x, y, z, fixed, infoObject,
- // mapName, callback);
- INodeModel model = Controller.getInstance().getNodeModel();
- if (infoObject instanceof InfoObjectNode) {
- InfoObjectNode node = (InfoObjectNode) infoObject;
- model.addNode(node);
- node.setPosition(x, y, z);
- node.setFix(false);
- System.out.println("Added Info:\n -> " + node.toString());
- } else {
- InfoObjectNode node = new InfoObjectNode(model, infoObject);
- model.addNode(node);
- node.setPosition(x, y, z);
- node.setFix(false);
- System.out.println("Added Info:\n -> " + node.toString());
- }
+ /**
+ * Creates an InfoObject on the current map with the supplied parameters
+ * @param x
+ * @param y
+ * @param z
+ * @param infoObject
+ * @param mapName
+ * @param fixed
+ * @param callback
+ */
+ public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed,
+ CreatePositionCallback callback){
+ if (!isConnected() || !isMapLoaded())
+ callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
+ else {
+ // serverManager.createInfoObject(x, y, z, fixed, infoObject,
+ // mapName, callback);
+ INodeModel model = Controller.getInstance().getNodeModel();
+ if (infoObject instanceof InfoObjectNode) {
+ InfoObjectNode node = (InfoObjectNode) infoObject;
+ model.addNode(node);
+ node.setPosition(x, y, z);
+ node.setFix(false);
+ System.out.println("Added Info:\n -> " + node.toString());
+ } else {
+ InfoObjectNode node = new InfoObjectNode(model, infoObject);
+ model.addNode(node);
+ node.setPosition(x, y, z);
+ node.setFix(false);
+ System.out.println("Added Info:\n -> " + node.toString());
+ }
- }
- }
+ }
+ }
- /**
- *
- * @param name
- * @param mapname
- * @param callback
- */
- public void deletePosition(String name, String mapname, DeletePositionCallback callback){
- Node node = this.nodeModel.findNode(name);
- if (node != null) if (node.getId() != -1)
- this.serverManager.deletePosition(node.getId(), Controller.getInstance().getCurrentMap().name, callback);
- else
- System.out.println("Node has no positionId, so its position cannot be deleted.");
- }
+ /**
+ *
+ * @param name
+ * @param mapname
+ * @param callback
+ */
+ public void deletePosition(String name, String mapname, DeletePositionCallback callback){
+ Node node = this.nodeModel.findNode(name);
+ if (node != null) if (node.getId() != -1)
+ this.serverManager.deletePosition(node.getId(), Controller.getInstance().getCurrentMap().name, callback);
+ else
+ System.out.println("Node has no positionId, so its position cannot be deleted.");
+ }
- /**
- *
- * @param name
- * @param string
- * @param callback
- */
- public void deleteGeoPoint(String name, String string, DeletePositionCallback callback){
- Node node = this.nodeModel.findNode(name);
- if (node != null) if (node.getId() != -1)
- this.serverManager.deleteGeoPoint(node.getId(), Controller.getInstance().getCurrentMap().name, callback);
- else
- System.out.println("Node has no positionId, so its position cannot be deleted.");
- }
+ /**
+ *
+ * @param name
+ * @param string
+ * @param callback
+ */
+ public void deleteGeoPoint(String name, String string, DeletePositionCallback callback){
+ Node node = this.nodeModel.findNode(name);
+ if (node != null) if (node.getId() != -1)
+ this.serverManager.deleteGeoPoint(node.getId(), Controller.getInstance().getCurrentMap().name, callback);
+ else
+ System.out.println("Node has no positionId, so its position cannot be deleted.");
+ }
- public void setClientPosition(final int x, final int y, final int z, final boolean fixed, final String clientMac,
- final PositionCallback callback){
+ public void setClientPosition(final int x, final int y, final int z, final boolean fixed, final String clientMac,
+ final PositionCallback callback){
- this.serverManager.setClientPosition(x, y, z, fixed, clientMac, callback);
- }
+ this.serverManager.setClientPosition(x, y, z, fixed, clientMac, callback);
+ }
- public void setAccessPointPosition(final int x, final int y, final int z, boolean fixed,
- final String accessPointMac, final PositionCallback callback){
+ public void setAccessPointPosition(final int x, final int y, final int z, boolean fixed,
+ final String accessPointMac, final PositionCallback callback){
- this.serverManager.setAccessPointPosition(x, y, z, fixed, accessPointMac, callback);
- }
+ this.serverManager.setAccessPointPosition(x, y, z, fixed, accessPointMac, callback);
+ }
- public void setAccessPointHiddenStatus(String accessPointMac, boolean hidden, PositionCallback callback){
+ public void setAccessPointHiddenStatus(String accessPointMac, boolean hidden, PositionCallback callback){
- this.serverManager.setAccessPointHiddenStatus(accessPointMac, hidden, callback);
- }
+ this.serverManager.setAccessPointHiddenStatus(accessPointMac, hidden, callback);
+ }
- public void movePosition(final long positionId, final String mapname, final int x, final int y, final int z,
- boolean fixed, final MovePositionCallback callback){
+ public void movePosition(final long positionId, final String mapname, final int x, final int y, final int z,
+ boolean fixed, final MovePositionCallback callback){
- this.serverManager.movePosition(positionId, mapname, x, y, z, fixed, callback);
- }
+ this.serverManager.movePosition(positionId, mapname, x, y, z, fixed, callback);
+ }
- /**
- * Holt Karte vom Server. Ergebnis via Callback
- *
- * @param name
- * @param callback
- */
- public void retrieveMap(String name, MapCallback callback){
- this.serverManager.retrieveMap(name, callback);
- getMapView().setTitle(GUIUtils.i18n("map", false) + " - " + name);
- }
+ /**
+ * Holt Karte vom Server. Ergebnis via Callback
+ *
+ * @param name
+ * @param callback
+ */
+ public void retrieveMap(String name, MapCallback callback){
+ this.serverManager.retrieveMap(name, callback);
+ getMapView().setTitle(GUIUtils.i18n("map", false) + " - " + name);
+ }
- public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){
- this.serverManager.retrieveMapNames(callback, openMapDialog);
- }
+ public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){
+ this.serverManager.retrieveMapNames(callback, openMapDialog);
+ }
- public void createNewMap(final String name, final String URL, final int imageWidth, final int imageHeight,
- final int width, final int height, final CreateNewMapCallback callback){
+ public void createNewMap(final String name, final String URL, final int imageWidth, final int imageHeight,
+ final int width, final int height, final CreateNewMapCallback callback){
- this.serverManager.createNewMap(name, URL, imageWidth, imageHeight, width, height, callback);
- }
+ this.serverManager.createNewMap(name, URL, imageWidth, imageHeight, width, height, callback);
+ }
- public Collection<InfoObject> getInfoObjects(){
- return this.infoObjects;
- }
+ public Collection<InfoObject> getInfoObjects(){
+ return this.infoObjects;
+ }
- public void handleRoundComplete(AbstractScanner scanner){
- this.scannerAllocator.handleRoundComplete(scanner);
- }
+ public void handleRoundComplete(AbstractScanner scanner){
+ this.scannerAllocator.handleRoundComplete(scanner);
+ }
- public void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner){
- this.scannerAllocator.handleScanResult(scanResult, scanner);
- }
+ public void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner){
+ this.scannerAllocator.handleScanResult(scanResult, scanner);
+ }
- public void addScannerHandler(AbstractScannerHandler handler){
- this.scannerAllocator.addScanResultHandler(handler);
- }
+ public void addScannerHandler(AbstractScannerHandler handler){
+ this.scannerAllocator.addScanResultHandler(handler);
+ }
- public InfoObjectProviderRegistry getInfoProviderRegistry(){
- return this.infoServiceRegistry;
- }
+ public InfoObjectProviderRegistry getInfoProviderRegistry(){
+ return this.infoServiceRegistry;
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2007-01-21 16:35:03 UTC (rev 514)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2007-01-25 14:01:01 UTC (rev 515)
@@ -120,5 +120,6 @@
public NodeUpdateHandler getHandler(int type){
return this.handlerMap.get(type);
}
- };
+ }
+ public void clear();;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-01-21 16:35:03 UTC (rev 514)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-01-25 14:01:01 UTC (rev 515)
@@ -31,390 +31,396 @@
*/
public class JungNodePlacer extends DirectedSparseGraph implements INodePlacer, NodeModelConstants {
- /**
- * Logger
- */
- private static final Log log = LogFactory.getLog(JungNodePlacer.class);
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog(JungNodePlacer.class);
- /**
- *
- */
- private static final class DefaultSettings extends LayoutSettings {
+ /**
+ *
+ */
+ private static final class DefaultSettings extends LayoutSettings {
- }
+ }
- /**
- *
- */
- public static final LayoutSettings DEFAULT_SETTINGS = new DefaultSettings();
+ /**
+ *
+ */
+ public static final LayoutSettings DEFAULT_SETTINGS = new DefaultSettings();
- /**
- * Used to find the Vertex representing a node.
- */
- private final Map<Node, Vertex> nodeVertexMapping = new HashMap<Node, Vertex>();
+ /**
+ * Used to find the Vertex representing a node.
+ */
+ private final Map<Node, Vertex> nodeVertexMapping = new HashMap<Node, Vertex>();
- /**
- *
- */
- private final SpringLayout layout;
+ /**
+ *
+ */
+ private final SpringLayout layout;
- /**
- * Calculates the layout in a background thread.
- */
- private final LayoutWorker worker;
+ /**
+ * Calculates the layout in a background thread.
+ */
+ private final LayoutWorker worker;
- private boolean workerPaused;
+ private boolean workerPaused;
- private boolean workerRunning;
+ private boolean workerRunning;
- /**
- * Werden f\xFCr die Handler ben\xF6tigt
- */
- private HashMap<ClientNode, HashSet<LocationNode>> clientLocationMap;
+ /**
+ * Werden f\xFCr die Handler ben\xF6tigt
+ */
+ private HashMap<ClientNode, HashSet<LocationNode>> clientLocationMap;
- /**
- * Werden f\xFCr die Handler ben\xF6tigt
- */
- private HashMap<LocationNode, HashSet<LocationNode>> locationLocationMap;
+ /**
+ * Werden f\xFCr die Handler ben\xF6tigt
+ */
+ private HashMap<LocationNode, HashSet<LocationNode>> locationLocationMap;
- /**
- * Werden f\xFCr die Handler ben\xF6tigt
- */
- private StringLabeller labeller;
+ /**
+ * Werden f\xFCr die Handler ben\xF6tigt
+ */
+ private StringLabeller labeller;
- /**
- * A Factory for the NodeUpdateHandler.
- * @see NodeUpdateHandler
- */
- private final NodeHandlerFactory nodeHandler = new NodeHandlerFactory();
+ /**
+ * A Factory for the NodeUpdateHandler.
+ * @see NodeUpdateHandler
+ */
+ private final NodeHandlerFactory nodeHandler = new NodeHandlerFactory();
+ public JungNodePlacer() {
+ this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
+ }
- public JungNodePlacer() {
- this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
- }
+ /**
+ *
+ * @param settings
+ * @param metric
+ */
+ public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) {
+ super();
- /**
- *
- * @param settings
- * @param metric
- */
- public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) {
- super();
+ this.clientLocationMap = new HashMap<ClientNode, HashSet<LocationNode>>();
+ this.locationLocationMap = new HashMap<LocationNode, HashSet<LocationNode>>();
+ this.layout = new MagicLayout(this, metric, settings);
+ this.worker = new LayoutWorker(this.layout, new Dimension(800, 600));
+ this.workerRunning = false;
+ this.workerPaused = false;
- this.clientLocationMap = new HashMap<ClientNode, HashSet<LocationNode>>();
- this.locationLocationMap = new HashMap<LocationNode, HashSet<LocationNode>>();
- this.layout = new MagicLayout(this, metric, settings);
- this.worker = new LayoutWorker(this.layout, new Dimension(800, 600));
- this.workerRunning = false;
- this.workerPaused = false;
+ this.labeller = StringLabeller.getLabeller(this);
- this.labeller = StringLabeller.getLabeller(this);
+ initNodeHandler();
+ }
- initNodeHandler();
- }
+ /**
+ * Initilisiert die Handler
+ *
+ */
+ private void initNodeHandler(){
+ addNodeUpdateHandler(new FixStateHandler(this.nodeVertexMapping, this.layout));
+ addNodeUpdateHandler(new LabelChangeHandler(this.labeller, this.nodeVertexMapping));
+ addNodeUpdateHandler(new PositionUpdateHandler(this.nodeVertexMapping, this.layout));
+ addNodeUpdateHandler(new SeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
+ addNodeUpdateHandler(new NotSeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
+ addNodeUpdateHandler(new InfoNodeHandler());
+ addNodeUpdateHandler(new AccessPointHiddenStateHandler());
+ }
- /**
- * Initilisiert die Handler
- *
- */
- private void initNodeHandler(){
- addNodeUpdateHandler(new FixStateHandler(this.nodeVertexMapping, this.layout));
- addNodeUpdateHandler(new LabelChangeHandler(this.labeller, this.nodeVertexMapping));
- addNodeUpdateHandler(new PositionUpdateHandler(this.nodeVertexMapping, this.layout));
- addNodeUpdateHandler(new SeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
- addNodeUpdateHandler(new NotSeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
- addNodeUpdateHandler(new InfoNodeHandler());
- addNodeUpdateHandler(new AccessPointHiddenStateHandler());
- }
+ /**
+ * Den Hintergrundthread zum Berechnen der Positionen starten! ;-)
+ *
+ */
+ public void start(){
+ this.worker.init();
+ this.workerRunning = true;
+ this.workerPaused = false;
+ }
- /**
- * Den Hintergrundthread zum Berechnen der Positionen starten! ;-)
- *
- */
- public void start(){
- this.worker.init();
- this.workerRunning = true;
- this.workerPaused = false;
- }
+ /**
+ * Sets the size of our layout. should be the same as the current map.
+ * @param width shoulde be the maps width.
+ * @param height
+ */
+ public void setSize(int width, int height){
+ this.layout.resize(new Dimension(width, height));
+ }
- /**
- * Sets the size of our layout. should be the same as the current map.
- * @param width shoulde be the maps width.
- * @param height
- */
- public void setSize(int width, int height){
- this.layout.resize(new Dimension(width, height));
- }
+ /**
+ * F\xFCgt einen neuen Knoten ein.
+ */
+ public void insertNode(Node node){
+ Vertex v = null;
+ int type = node.getType();
+ // TODO das hier ist wahrlich haesslich....
- /**
- * F\xFCgt einen neuen Knoten ein.
- */
- public void insertNode(Node node){
- Vertex v = null;
- int type = node.getType();
- // TODO das hier ist wahrlich haesslich....
+ if (type == NodeModelConstants.NODETYPE_CLIENT || type == NodeModelConstants.NODETYPE_LOCATION
+ || type == NodeModelConstants.NODETYPE_ACCESSPOINT || type == NodeModelConstants.NODETYPE_GEOPOS
+ || type == NodeModelConstants.NODETYPE_INFO || type == NodeModelConstants.NODETYPE_RFID_ANTENNA)
+ v = addVertex(node);
+ if (v != null) if (node.isFix())
+ this.layout.setFix(v);
+ else
+ this.layout.unsetFix(v);
+ }
- if (type == NodeModelConstants.NODETYPE_CLIENT || type == NodeModelConstants.NODETYPE_LOCATION
- || type == NodeModelConstants.NODETYPE_ACCESSPOINT || type == NodeModelConstants.NODETYPE_GEOPOS
- || type == NodeModelConstants.NODETYPE_INFO || type == NodeModelConstants.NODETYPE_RFID_ANTENNA)
- v = addVertex(node);
- if (v != null) if (node.isFix())
- this.layout.setFix(v);
- else
- this.layout.unsetFix(v);
- }
+ public void deleteNode(Node node){
+ Vertex v = findVertex(node);
+ if (v != null) {
- public void deleteNode(Node node){
- Vertex v = findVertex(node);
- if (v != null){
+ }
+ super.removeVertex(v);
+ this.nodeVertexMapping.remove(node);
+ }
- }
- super.removeVertex(v);
- this.nodeVertexMapping.remove(node);
- }
+ public SpringLayout getLayout(){
+ return this.layout;
+ }
- public SpringLayout getLayout(){
- return this.layout;
- }
+ /**
+ * F\xFCgt den Knoten ein um seine Position etc zu berechnen.
+ *
+ * @param node der neue Knoten.
+ * @see NodeModelListener
+ */
+ public void nodeAddedEvent(Node node){
+ insertNode(node);
+ }
- /**
- * F\xFCgt den Knoten ein um seine Position etc zu berechnen.
- *
- * @param node der neue Knoten.
- * @see NodeModelListener
- */
- public void nodeAddedEvent(Node node){
- insertNode(node);
- }
+ /**
+ * Reagiert auf ver\xE4nderungen in den Knoten oder im Model.
+ * Leitet die Anfragen an einen nodeHandler weiter. Wird vom NodeModel aufgerufen.
+ *
+ * @param node der neue oder ge\xE4nderte Knoten
+ * @param type der Typ des Events. (Enum nutzen)?
+ * @param data ---?
+ * @see NodeModelListener, INodeModel, NodeModel
+ */
+ public void updateNode(Node node, int type, Object data){
+ // first try if we have a handler for this event.
+ if (!this.nodeHandler.handleNodeUpdated(node, type, data, this)) {
+ if (type == NodeModelConstants.UPDATE_CLEAR) {
+ this.worker.suspend(); // stopGraph();
+ // this.CALIBRATION_FACTOR_AP = 1.0;
+ // this.CALIBRATION_FACTOR_LC = 1.0;
+ this.clientLocationMap.clear();
+ this.removeAllEdges();
+ this.removeAllVertices();
+ this.layout.update();
+ this.nodeVertexMapping.clear();
+ this.worker.unsuspend();
+ } else if (type == NodeModelConstants.UPDATE_RESCAN)
+ this.layout.update();
+ else
+ JungNodePlacer.log.debug("Event von typ: " + type + " ist unbekannt");
+ }
+ }
- /**
- * Reagiert auf ver\xE4nderungen in den Knoten oder im Model.
- * Leitet die Anfragen an einen nodeHandler weiter. Wird vom NodeModel aufgerufen.
- *
- * @param node der neue oder ge\xE4nderte Knoten
- * @param type der Typ des Events. (Enum nutzen)?
- * @param data ---?
- * @see NodeModelListener, INodeModel, NodeModel
- */
- public void updateNode(Node node, int type, Object data){
- // first try if we have a handler for this event.
- if (!this.nodeHandler.handleNodeUpdated(node, type, data, this)) {
- if (type == NodeModelConstants.UPDATE_CLEAR) {
- this.worker.suspend(); // stopGraph();
- // this.CALIBRATION_FACTOR_AP = 1.0;
- // this.CALIBRATION_FACTOR_LC = 1.0;
- this.clientLocationMap.clear();
- this.removeAllEdges();
- this.removeAllVertices();
- this.layout.update();
- this.nodeVertexMapping.clear();
- this.worker.unsuspend();
- } else if (type == NodeModelConstants.UPDATE_RESCAN)
- this.layout.update();
- else
- JungNodePlacer.log.debug("Event von typ: " + type + " ist unbekannt");
- }
- }
+ public void nodeRemovedEvent(Node node){
+ removeVertex(node);
+ this.nodeVertexMapping.remove(node);
+ }
- public void nodeRemovedEvent(Node node){
- removeVertex(node);
- this.nodeVertexMapping.remove(node);
- }
+ public Vertex findVertex(Node node){
+ return this.nodeVertexMapping.get(node);
+ }
- public Vertex findVertex(Node node){
- return this.nodeVertexMapping.get(node);
- }
+ /**
+ * Verwandelt Node in Vertex und fuegt diesen in den Graphen ein. Es wird
+ * keine Ruecksicht auf den Typ des Knotens genommen. Eventuelle implizite
+ * Kanten muss der Aufrufer erstellen.
+ *
+ * @param node
+ * @return
+ */
+ public Vertex addVertex(Node node){
+ if (findVertex(node) == null) {
- /**
- * Verwandelt Node in Vertex und fuegt diesen in den Graphen ein. Es wird
- * keine Ruecksicht auf den Typ des Knotens genommen. Eventuelle implizite
- * Kanten muss der Aufrufer erstellen.
- *
- * @param node
- * @return
- */
- public Vertex addVertex(Node node){
- if (findVertex(node) == null) {
+ System.out.println("Adding " + node.getDisplayName());
- System.out.println("Adding " + node.getDisplayName());
+ Vertex v = new DirectedSparseVertex();
+ synchronized (this) {
+ this.worker.suspend();
+ this.nodeVertexMapping.put(node, v);
+ v.addUserDatum(LayoutSettings.NODE_KEY, node, UserData.SHARED);
- Vertex v = new DirectedSparseVertex();
- synchronized (this) {
- this.worker.suspend();
- this.nodeVertexMapping.put(node, v);
- v.addUserDatum(LayoutSettings.NODE_KEY, node, UserData.SHARED);
+ addVertex(v);
- addVertex(v);
+ ((SpringLayout) this.worker.getGraphLayout()).update();
+ if (node.getX() >= 0 && node.getY() >= 0) this.layout.forceMove(v, node.getX(), node.getY());
+ this.worker.unsuspend();
- ((SpringLayout) this.worker.getGraphLayout()).update();
- if (node.getX() >= 0 && node.getY() >= 0) this.layout.forceMove(v, node.getX(), node.getY());
- this.worker.unsuspend();
+ }
+ return v;
+ } else {
+ System.err.print("Vertex exists:");
+ return null;
+ }
- }
- return v;
- } else {
- System.err.print("Vertex exists:");
- return null;
- }
+ }
- }
+ /**
+ *
+ */
+ public void startNodePlacer(){
+ start();
+ }
- /**
- *
- */
- public void startNodePlacer(){
- start();
- }
+ /**
+ *
+ */
+ public void stopNodePlacer(){
+ this.worker.stop();
- /**
- *
- */
- public void stopNodePlacer(){
- this.worker.stop();
+ }
- }
+ /**
+ *
+ */
+ public void pauseNodePlacer(boolean pause){
+ if (pause && !isPaused()) {
+ this.worker.suspend();
+ this.workerPaused = true;
+ } else if (!pause && isPaused()) {
+ this.worker.unsuspend();
+ this.workerPaused = false;
- /**
- *
- */
- public void pauseNodePlacer(boolean pause){
- if (pause && !isPaused()) {
- this.worker.suspend();
- this.workerPaused = true;
- } else if (!pause && isPaused()) {
- this.worker.unsuspend();
- this.workerPaused = false;
+ }
+ }
- }
- }
+ public boolean isPaused(){
+ return this.workerRunning && this.workerPaused;
+ }
- public boolean isPaused(){
- return this.workerRunning && this.workerPaused;
- }
+ /**
+ * F\xFCgt eine gerichtete Kante von Knoten node1 zu node2 hinzu.
+ *
+ * Das Gewicht der Kante
+ * @param node1
+ * @param node2
+ * @return
+ */
+ public IMagicEdge addEdge(Node node1, Node node2){
+ if (node1 == node2) return null;
+ Vertex v = findVertex(node1);
+ Vertex w = findVertex(node2);
- /**
- * F\xFCgt eine gerichtete Kante von Knoten node1 zu node2 hinzu.
- *
- * Das Gewicht der Kante
- * @param node1
- * @param node2
- * @return
- */
- public IMagicEdge addEdge(Node node1, Node node2){
- if (node1 == node2) return null;
- Vertex v = findVertex(node1);
- Vertex w = findVertex(node2);
+ Edge e = v.findEdge(w);
+ if (e != null)
+ return (IMagicEdge) e;
+ else {
+ JungEdge edge = new JungEdge(v, w);
+ this.worker.suspend(); // stopGraph();
+ addEdge(edge);
+ this.layout.update();
+ this.worker.unsuspend(); // resumeGraph();
+ return edge;
+ }
+ }
- Edge e = v.findEdge(w);
- if (e != null)
- return (IMagicEdge) e;
- else {
- JungEdge edge = new JungEdge(v,w);
- this.worker.suspend(); // stopGraph();
- addEdge(edge);
- this.layout.update();
- this.worker.unsuspend(); // resumeGraph();
- return edge;
- }
- }
+ /**
+ * F\xFCgt eine Jungkante hinzu. wird intern verwendet.
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ private Edge addEdge(Vertex v1, Vertex v2){
+ if (v1 == v2) return null;
+ Edge e = v1.findEdge(v2);
+ if (e != null)
+ return e;
+ else {
+ DirectedSparseEdge edge = new DirectedSparseEdge(v1, v2);
+ this.worker.suspend(); // stopGraph();
+ addEdge(edge);
+ this.layout.update();
+ this.worker.unsuspend(); // resumeGraph();
+ return edge;
+ }
+ }
- /**
- * F\xFCgt eine Jungkante hinzu. wird intern verwendet.
- *
- * @param v1
- * @param v2
- * @return
- */
- private Edge addEdge(Vertex v1, Vertex v2){
- if (v1 == v2) return null;
- Edge e = v1.findEdge(v2);
- if (e != null)
- return e;
- else {
- DirectedSparseEdge edge = new DirectedSparseEdge(v1, v2);
- this.worker.suspend(); // stopGraph();
- addEdge(edge);
- this.layout.update();
- this.worker.unsuspend(); // resumeGraph();
- return edge;
- }
- }
+ /**
+ * L\xF6scht eine Kantew zwischen den beiden Knoten.
+ * @param node1 Quelle der Kante.
+ * @param node2 Ziel der Kante.
+ */
+ public void removeEdge(Node node1, Node node2){
+ Vertex v = findVertex(node1);
+ Vertex w = findVertex(node2);
+ if (v != null && w != null) {
+ this.worker.suspend();
+ Set edges = getEdges();
+ for (Object edge : edges) {
+ Edge e = (Edge) edge;
+ if (e.getIncidentVertices().contains(v) && e.getIncidentVertices().contains(w)) {
+ removeEdge(e);
+ break;
+ }
+ }
+ this.layout.update();
+ this.worker.unsuspend(); // resumeGraph();
+ }
+ }
- /**
- * L\xF6scht eine Kantew zwischen den beiden Knoten.
- * @param node1 Quelle der Kante.
- * @param node2 Ziel der Kante.
- */
- public void removeEdge(Node node1, Node node2){
- Vertex v = findVertex(node1);
- Vertex w = findVertex(node2);
- if (v != null && w != null) {
- this.worker.suspend();
- Set edges = getEdges();
- for (Object edge : edges) {
- Edge e = (Edge) edge;
- if (e.getIncidentVertices().contains(v) && e.getIncidentVertices().contains(w)) {
- removeEdge(e);
- break;
- }
- }
- this.layout.update();
- this.worker.unsuspend(); // resumeGraph();
- }
- }
+ /**
+ * Entfernt alle Kanten an denen der Knoten beteiligt ist.
+ *
+ * @param node
+ */
+ @SuppressWarnings("unchecked")
+ public void removeEdges(Node node){
+ Vertex v = findVertex(node);
+ if (v != null) {
+ this.worker.suspend();
+ Set edges = getEdges();
+ // Kein Iterator direkt auf die Sets des
+ // Graphen => Concurrent modification!
+ ArrayList list = new ArrayList(edges);
+ for (Object aList : list) {
+ Edge e = (Edge) aList;
+ if (e.getIncidentVertices().contains(v)) {
+ super.removeEdge(e);
+ }
+ }
+ this.layout.update();
+ this.worker.unsuspend();
+ }
+ }
- /**
- * Entfernt alle Kanten an denen der Knoten beteiligt ist.
- *
- * @param node
- */
- @SuppressWarnings("unchecked")
- public void removeEdges(Node node){
- Vertex v = findVertex(node);
- if (v != null) {
- this.worker.suspend();
- Set edges = getEdges();
- // Kein Iterator direkt auf die Sets des
- // Graphen => Concurrent modification!
- ArrayList list = new ArrayList(edges);
- for (Object aList : list) {
- Edge e = (Edge) aList;
- if (e.getIncidentVertices().contains(v)){
- super.removeEdge(e);
- }
- }
- this.layout.update();
- this.worker.unsuspend();
- }
- }
+ /**
+ * Entfernt Knoten aus dem Graph und eventuelle Kanten
+ *
+ * @param node
+ */
+ public void removeVertex(Node node){
+ removeEdges(node);
+ Vertex v = findVertex(node);
+ if (v != null) {
+ nodeVertexMapping.remove(node);
+ this.worker.suspend();
+ this.labeller.removeLabel(node.getDisplayName());
+ super.removeVertex(v);
+ this.layout.update();
+ this.worker.unsuspend();
- /**
- * Entfernt Knoten aus dem Graph und eventuelle Kanten
- *
- * @param node
- */
- public void removeVertex(Node node){
- removeEdges(node);
- Vertex v = findVertex(node);
- if (v != null) {
- nodeVertexMapping.remove(node);
- this.worker.suspend();
- this.labeller.removeLabel(node.getDisplayName());
- super.removeVertex(v);
- this.layout.update();
- this.worker.unsuspend();
+ }
+ }
- }
- }
+ /**
+ *
+ * @param handler
+ */
- /**
- *
- * @param handler
- */
+ public void addNodeUpdateHandler(NodeUpdateHandler handler){
+ this.nodeHandler.addNodeUpdateHandler(handler);
- public void addNodeUpdateHandler(NodeUpdateHandler handler){
- this.nodeHandler.addNodeUpdateHandler(handler);
+ }
- }
+ public void clear(){
+ stopNodePlacer();
+ this.removeAllEdges();
+ this.removeAllVertices();
+ nodeVertexMapping.clear();
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-01-21 16:35:03 UTC (rev 514)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-01-25 14:01:01 UTC (rev 515)
@@ -43,4 +43,10 @@
void addMeasurementModelListener(MeasurementModelListener listener);
void removeMeasurementModelListener(MeasurementModelListener listener);
+
+ /**
+ * Clears the MeasurementModel
+ *
+ */
+ public void clear();
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-21 16:35:03 UTC (rev 514)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-25 14:01:01 UTC (rev 515)
@@ -1,3 +1,4 @@
+
package net.sf.magicmap.client.model.measurement;
import net.sf.magicmap.client.interfaces.MeasurementModelListener;
@@ -18,166 +19,171 @@
*/
public class MeasurementModel implements IMeasurementModel {
- private final EventListenerList listeners = new EventListenerList();
- private final MeasurementMap apMap = new MeasurementMap();
+ private final EventListenerList listeners = new EventListenerList();
+ private final MeasurementMap apMap = new MeasurementMap();
- public MeasurementModel(){
+ public MeasurementModel() {
- }
+ }
- /**
- * Adds an access point to the list of seen ap for a
- * given client.
- *
- * @param client the client seeing the ap
- * @param ap the seen access point.
- */
- public void addAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
- if (apMap.put(client, ap)){
- fireAccessPointAdded(client,ap);
- }
- //client.getModel().updateNode(client, NodeModelConstants.UPDATE_SEESACCESSPOINT, null);
- }
+ /**
+ * Adds an access point to the list of seen ap for a
+ * given client.
+ *
+ * @param client the client seeing the ap
+ * @param ap the seen access point.
+ */
+ public void addAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap){
+ if (apMap.put(client, ap)) {
+ fireAccessPointAdded(client, ap);
+ }
+ //client.getModel().updateNode(client, NodeModelConstants.UPDATE_SEESACCESSPOINT, null);
+ }
- public void updateScanResult(AccessPointSeerNode client, String apMac, double signalLevel){
- SeenAccessPoint accessPoint = getAccessPoint(client, apMac);
- final INodeModel nodeModel = client.getModel();
+ public void updateScanResult(AccessPointSeerNode client, String apMac, double signalLevel){
+ SeenAccessPoint accessPoint = getAccessPoint(client, apMac);
+ final INodeModel nodeModel = client.getModel();
+ if (accessPoint == null) {
+ // ein toter ap.....
+ if (signalLevel <= -Constants.MIN_SIGNALLEVEL) return;
+ accessPoint = new SeenAccessPoint(apMac, signalLevel);
+ addAccessPoint(client, accessPoint);
+ AccessPointNode apNode = nodeModel.findAccessPoint(apMac);
+ if (apNode == null) {
+ nodeModel.addNode(new AccessPointNode(apMac, nodeModel));
+ apNode = nodeModel.findAccessPoint(apMac);
+ }
+ client.setSignalLevelForAcessPoint(apNode, signalLevel);
+ } else {
+ if (signalLevel > -Constants.MIN_SIGNALLEVEL) {
+ accessPoint.addSignalLevel(signalLevel);
+ } else {
+ accessPoint.addDeadSignal();
+ }
+ if (accessPoint.isTotallyDead()) {
+ removeAccessPoint(client, accessPoint);
+ client.notSeesAccessPoint(nodeModel.findAccessPoint(apMac));
+ } else {
+ updateAccessPoint(client, accessPoint);
+ client.setSignalLevelForAcessPoint(nodeModel.findAccessPoint(apMac), signalLevel);
+ }
+ }
+ }
- if (accessPoint == null) {
- // ein toter ap.....
- if (signalLevel <= -Constants.MIN_SIGNALLEVEL) return;
+ public void updateScanResult(Acce...
[truncated message content] |
|
From: <jan...@us...> - 2007-01-21 16:35:14
|
Revision: 514
http://svn.sourceforge.net/magicmap/?rev=514&view=rev
Author: jan_fride
Date: 2007-01-21 08:35:03 -0800 (Sun, 21 Jan 2007)
Log Message:
-----------
nodemodel and measurementmodel verbessert?... hoffe ich
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/NotSeeAccessPointHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-01-21 12:01:13 UTC (rev 513)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-01-21 16:35:03 UTC (rev 514)
@@ -242,8 +242,7 @@
MagicMetric magicMetric = new MagicMetric();
NodeMetricManager metrics = new NodeMetricManager(magicMetric);
metrics.addMetric(InfoObjectNode.class, InfoObjectNode.class, new InfoNodeMetric());
- layoutModel = new JungNodePlacer();
- getModel().setNodePlacer(layoutModel);
+ layoutModel = (JungNodePlacer) getModel().getNodePlacer();
graph = layoutModel;// new DirectedSparseGraph();
graphdraw = new PACWGraphDraw(layoutModel);
graphdraw.setVisible(false);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-01-21 12:01:13 UTC (rev 513)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-01-21 16:35:03 UTC (rev 514)
@@ -31,387 +31,390 @@
*/
public class JungNodePlacer extends DirectedSparseGraph implements INodePlacer, NodeModelConstants {
- /**
- * Logger
- */
- private static final Log log = LogFactory.getLog(JungNodePlacer.class);
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog(JungNodePlacer.class);
- /**
- *
- */
- private static final class DefaultSettings extends LayoutSettings {
+ /**
+ *
+ */
+ private static final class DefaultSettings extends LayoutSettings {
- }
+ }
- /**
- *
- */
- public static final LayoutSettings DEFAULT_SETTINGS = new DefaultSettings();
+ /**
+ *
+ */
+ public static final LayoutSettings DEFAULT_SETTINGS = new DefaultSettings();
- /**
- * Used to find the Vertex representing a node.
- */
- private final Map<Node, Vertex> nodeVertexMapping = new HashMap<Node, Vertex>();
+ /**
+ * Used to find the Vertex representing a node.
+ */
+ private final Map<Node, Vertex> nodeVertexMapping = new HashMap<Node, Vertex>();
- /**
- *
- */
- private final SpringLayout layout;
+ /**
+ *
+ */
+ private final SpringLayout layout;
- /**
- * Calculates the layout in a background thread.
- */
- private final LayoutWorker worker;
+ /**
+ * Calculates the layout in a background thread.
+ */
+ private final LayoutWorker worker;
- private boolean workerPaused;
+ private boolean workerPaused;
- private boolean workerRunning;
+ private boolean workerRunning;
- /**
- * Werden f\xFCr die Handler ben\xF6tigt
- */
- private HashMap<ClientNode, HashSet<LocationNode>> clientLocationMap;
+ /**
+ * Werden f\xFCr die Handler ben\xF6tigt
+ */
+ private HashMap<ClientNode, HashSet<LocationNode>> clientLocationMap;
- /**
- * Werden f\xFCr die Handler ben\xF6tigt
- */
- private HashMap<LocationNode, HashSet<LocationNode>> locationLocationMap;
+ /**
+ * Werden f\xFCr die Handler ben\xF6tigt
+ */
+ private HashMap<LocationNode, HashSet<LocationNode>> locationLocationMap;
- /**
- * Werden f\xFCr die Handler ben\xF6tigt
- */
- private StringLabeller labeller;
+ /**
+ * Werden f\xFCr die Handler ben\xF6tigt
+ */
+ private StringLabeller labeller;
- /**
- * A Factory for the NodeUpdateHandler.
- * @see NodeUpdateHandler
- */
- private final NodeHandlerFactory nodeHandler = new NodeHandlerFactory();
+ /**
+ * A Factory for the NodeUpdateHandler.
+ * @see NodeUpdateHandler
+ */
+ private final NodeHandlerFactory nodeHandler = new NodeHandlerFactory();
- /**
- * Dieser Konstruktor ist der Standart.
- *
- * @param model
- * das Knotenmodel.
- */
- public JungNodePlacer() {
- this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
- }
- /**
- *
- * @param settings
- * @param metric
- */
- public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) {
- super();
+ public JungNodePlacer() {
+ this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
+ }
- this.clientLocationMap = new HashMap<ClientNode, HashSet<LocationNode>>();
- this.locationLocationMap = new HashMap<LocationNode, HashSet<LocationNode>>();
- this.layout = new MagicLayout(this, metric, settings);
- this.worker = new LayoutWorker(this.layout, new Dimension(800, 600));
- this.workerRunning = false;
- this.workerPaused = false;
+ /**
+ *
+ * @param settings
+ * @param metric
+ */
+ public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) {
+ super();
- this.labeller = StringLabeller.getLabeller(this);
+ this.clientLocationMap = new HashMap<ClientNode, HashSet<LocationNode>>();
+ this.locationLocationMap = new HashMap<LocationNode, HashSet<LocationNode>>();
+ this.layout = new MagicLayout(this, metric, settings);
+ this.worker = new LayoutWorker(this.layout, new Dimension(800, 600));
+ this.workerRunning = false;
+ this.workerPaused = false;
- initNodeHandler();
- }
+ this.labeller = StringLabeller.getLabeller(this);
- /**
- * Initilisiert die Handler
- *
- */
- private void initNodeHandler(){
- addNodeUpdateHandler(new FixStateHandler(this.nodeVertexMapping, this.layout));
- addNodeUpdateHandler(new LabelChangeHandler(this.labeller, this.nodeVertexMapping));
- addNodeUpdateHandler(new PositionUpdateHandler(this.nodeVertexMapping, this.layout));
- addNodeUpdateHandler(new SeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
- addNodeUpdateHandler(new NotSeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
- addNodeUpdateHandler(new InfoNodeHandler());
- addNodeUpdateHandler(new AccessPointHiddenStateHandler());
- }
+ initNodeHandler();
+ }
- /**
- * Den Hintergrundthread zum Berechnen der Positionen starten! ;-)
- *
- */
- public void start(){
- this.worker.init();
- this.workerRunning = true;
- this.workerPaused = false;
- }
+ /**
+ * Initilisiert die Handler
+ *
+ */
+ private void initNodeHandler(){
+ addNodeUpdateHandler(new FixStateHandler(this.nodeVertexMapping, this.layout));
+ addNodeUpdateHandler(new LabelChangeHandler(this.labeller, this.nodeVertexMapping));
+ addNodeUpdateHandler(new PositionUpdateHandler(this.nodeVertexMapping, this.layout));
+ addNodeUpdateHandler(new SeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
+ addNodeUpdateHandler(new NotSeeAccessPointHandler(this.clientLocationMap, this.locationLocationMap));
+ addNodeUpdateHandler(new InfoNodeHandler());
+ addNodeUpdateHandler(new AccessPointHiddenStateHandler());
+ }
- /**
- * Sets the size of our layout. should be the same as the current map.
- * @param width shoulde be the maps width.
- * @param height
- */
- public void setSize(int width, int height){
- this.layout.resize(new Dimension(width, height));
- }
+ /**
+ * Den Hintergrundthread zum Berechnen der Positionen starten! ;-)
+ *
+ */
+ public void start(){
+ this.worker.init();
+ this.workerRunning = true;
+ this.workerPaused = false;
+ }
- /**
- * F\xFCgt einen neuen Knoten ein.
- */
- public void insertNode(Node node){
- Vertex v = null;
- int type = node.getType();
- // TODO das hier ist wahrlich haesslich....
+ /**
+ * Sets the size of our layout. should be the same as the current map.
+ * @param width shoulde be the maps width.
+ * @param height
+ */
+ public void setSize(int width, int height){
+ this.layout.resize(new Dimension(width, height));
+ }
- if (type == NodeModelConstants.NODETYPE_CLIENT || type == NodeModelConstants.NODETYPE_LOCATION
- || type == NodeModelConstants.NODETYPE_ACCESSPOINT || type == NodeModelConstants.NODETYPE_GEOPOS
- || type == NodeModelConstants.NODETYPE_INFO || type == NodeModelConstants.NODETYPE_RFID_ANTENNA)
- v = addVertex(node);
- if (v != null) if (node.isFix())
- this.layout.setFix(v);
- else
- this.layout.unsetFix(v);
- }
+ /**
+ * F\xFCgt einen neuen Knoten ein.
+ */
+ public void insertNode(Node node){
+ Vertex v = null;
+ int type = node.getType();
+ // TODO das hier ist wahrlich haesslich....
- public void deleteNode(Node node){
- Vertex v = findVertex(node);
- removeVertex(v);
- }
+ if (type == NodeModelConstants.NODETYPE_CLIENT || type == NodeModelConstants.NODETYPE_LOCATION
+ || type == NodeModelConstants.NODETYPE_ACCESSPOINT || type == NodeModelConstants.NODETYPE_GEOPOS
+ || type == NodeModelConstants.NODETYPE_INFO || type == NodeModelConstants.NODETYPE_RFID_ANTENNA)
+ v = addVertex(node);
+ if (v != null) if (node.isFix())
+ this.layout.setFix(v);
+ else
+ this.layout.unsetFix(v);
+ }
- public SpringLayout getLayout(){
- return this.layout;
- }
+ public void deleteNode(Node node){
+ Vertex v = findVertex(node);
+ if (v != null){
- /**
- * F\xFCgt den Knoten ein um seine Position etc zu berechnen.
- *
- * @param node der neue Knoten.
- * @see NodeModelListener
- */
- public void nodeAddedEvent(Node node){
- insertNode(node);
- }
+ }
+ super.removeVertex(v);
+ this.nodeVertexMapping.remove(node);
+ }
- /**
- * Reagiert auf ver\xE4nderungen in den Knoten oder im Model.
- * Leitet die Anfragen an einen nodeHandler weiter. Wird vom NodeModel aufgerufen.
- *
- * @param node der neue oder ge\xE4nderte Knoten
- * @param type der Typ des Events. (Enum nutzen)?
- * @param data ---?
- * @see NodeModelListener, INodeModel, NodeModel
- */
- public void updateNode(Node node, int type, Object data){
- // first try if we have a handler for this event.
- if (!this.nodeHandler.handleNodeUpdated(node, type, data, this)) if (type == NodeModelConstants.UPDATE_CLEAR) {
- this.worker.suspend(); // stopGraph();
- // this.CALIBRATION_FACTOR_AP = 1.0;
- // this.CALIBRATION_FACTOR_LC = 1.0;
- this.clientLocationMap.clear();
- this.removeAllEdges();
- this.removeAllVertices();
- this.layout.update();
- this.nodeVertexMapping.clear();
- this.worker.unsuspend();
- } else if (type == NodeModelConstants.UPDATE_RESCAN)
- this.layout.update();
- else
- JungNodePlacer.log.debug("Event von typ: " + type + " ist unbekannt");
- }
+ public SpringLayout getLayout(){
+ return this.layout;
+ }
- public void nodeRemovedEvent(Node node){
- removeVertex(node);
- this.nodeVertexMapping.remove(node);
- }
+ /**
+ * F\xFCgt den Knoten ein um seine Position etc zu berechnen.
+ *
+ * @param node der neue Knoten.
+ * @see NodeModelListener
+ */
+ public void nodeAddedEvent(Node node){
+ insertNode(node);
+ }
- public Vertex findVertex(Node node){
- return this.nodeVertexMapping.get(node);
- }
+ /**
+ * Reagiert auf ver\xE4nderungen in den Knoten oder im Model.
+ * Leitet die Anfragen an einen nodeHandler weiter. Wird vom NodeModel aufgerufen.
+ *
+ * @param node der neue oder ge\xE4nderte Knoten
+ * @param type der Typ des Events. (Enum nutzen)?
+ * @param data ---?
+ * @see NodeModelListener, INodeModel, NodeModel
+ */
+ public void updateNode(Node node, int type, Object data){
+ // first try if we have a handler for this event.
+ if (!this.nodeHandler.handleNodeUpdated(node, type, data, this)) {
+ if (type == NodeModelConstants.UPDATE_CLEAR) {
+ this.worker.suspend(); // stopGraph();
+ // this.CALIBRATION_FACTOR_AP = 1.0;
+ // this.CALIBRATION_FACTOR_LC = 1.0;
+ this.clientLocationMap.clear();
+ this.removeAllEdges();
+ this.removeAllVertices();
+ this.layout.update();
+ this.nodeVertexMapping.clear();
+ this.worker.unsuspend();
+ } else if (type == NodeModelConstants.UPDATE_RESCAN)
+ this.layout.update();
+ else
+ JungNodePlacer.log.debug("Event von typ: " + type + " ist unbekannt");
+ }
+ }
- /**
- * Verwandelt Node in Vertex und fuegt diesen in den Graphen ein. Es wird
- * keine Ruecksicht auf den Typ des Knotens genommen. Eventuelle implizite
- * Kanten muss der Aufrufer erstellen.
- *
- * @param node
- * @return
- */
- public Vertex addVertex(Node node){
- if (findVertex(node) == null) {
+ public void nodeRemovedEvent(Node node){
+ removeVertex(node);
+ this.nodeVertexMapping.remove(node);
+ }
- System.out.println("Adding " + node.getDisplayName());
+ public Vertex findVertex(Node node){
+ return this.nodeVertexMapping.get(node);
+ }
- Vertex v = new DirectedSparseVertex();
- synchronized (this) {
- this.worker.suspend();
- this.nodeVertexMapping.put(node, v);
- v.addUserDatum(LayoutSettings.NODE_KEY, node, UserData.SHARED);
+ /**
+ * Verwandelt Node in Vertex und fuegt diesen in den Graphen ein. Es wird
+ * keine Ruecksicht auf den Typ des Knotens genommen. Eventuelle implizite
+ * Kanten muss der Aufrufer erstellen.
+ *
+ * @param node
+ * @return
+ */
+ public Vertex addVertex(Node node){
+ if (findVertex(node) == null) {
- addVertex(v);
+ System.out.println("Adding " + node.getDisplayName());
- ((SpringLayout) this.worker.getGraphLayout()).update();
- if (node.getX() >= 0 && node.getY() >= 0) this.layout.forceMove(v, node.getX(), node.getY());
- this.worker.unsuspend();
+ Vertex v = new DirectedSparseVertex();
+ synchronized (this) {
+ this.worker.suspend();
+ this.nodeVertexMapping.put(node, v);
+ v.addUserDatum(LayoutSettings.NODE_KEY, node, UserData.SHARED);
- }
- return v;
- } else {
- System.err.print("Vertex exists:");
- return null;
- }
+ addVertex(v);
- }
+ ((SpringLayout) this.worker.getGraphLayout()).update();
+ if (node.getX() >= 0 && node.getY() >= 0) this.layout.forceMove(v, node.getX(), node.getY());
+ this.worker.unsuspend();
- /**
- *
- */
- public void startNodePlacer(){
- start();
- }
+ }
+ return v;
+ } else {
+ System.err.print("Vertex exists:");
+ return null;
+ }
- /**
- *
- */
- public void stopNodePlacer(){
- this.worker.stop();
+ }
- }
+ /**
+ *
+ */
+ public void startNodePlacer(){
+ start();
+ }
- /**
- *
- */
- public void pauseNodePlacer(boolean pause){
- if (pause && !isPaused()) {
- this.worker.suspend();
- this.workerPaused = true;
- } else if (!pause && isPaused()) {
- this.worker.unsuspend();
- this.workerPaused = false;
+ /**
+ *
+ */
+ public void stopNodePlacer(){
+ this.worker.stop();
- }
- }
+ }
- public boolean isPaused(){
- return this.workerRunning && this.workerPaused;
- }
+ /**
+ *
+ */
+ public void pauseNodePlacer(boolean pause){
+ if (pause && !isPaused()) {
+ this.worker.suspend();
+ this.workerPaused = true;
+ } else if (!pause && isPaused()) {
+ this.worker.unsuspend();
+ this.workerPaused = false;
- /**
- * F\xFCgt eine gerichtete Kante von Knoten node1 zu node2 hinzu.
- *
- * Das Gewicht der Kante
- * @param node1
- * @param node2
- * @return
- */
- public IMagicEdge addEdge(Node node1, Node node2){
- if (node1 == node2) return null;
- Vertex v = findVertex(node1);
- Vertex w = findVertex(node2);
+ }
+ }
- Edge e = v.findEdge(w);
- if (e != null)
- return (IMagicEdge) e;
- else {
- JungEdge edge = new JungEdge(v,w);
- this.worker.suspend(); // stopGraph();
- addEdge(edge);
- this.layout.update();
- this.worker.unsuspend(); // resumeGraph();
- return edge;
- }
- }
+ public boolean isPaused(){
+ return this.workerRunning && this.workerPaused;
+ }
- /**
- * F\xFCgt eine Jungkante hinzu. wird intern verwendet.
- *
- * @param v1
- * @param v2
- * @return
- */
- private Edge addEdge(Vertex v1, Vertex v2){
- if (v1 == v2) return null;
- Edge e = v1.findEdge(v2);
- if (e != null)
- return e;
- else {
- DirectedSparseEdge edge = new DirectedSparseEdge(v1, v2);
- this.worker.suspend(); // stopGraph();
- addEdge(edge);
- this.layout.update();
- this.worker.unsuspend(); // resumeGraph();
- return edge;
- }
- }
+ /**
+ * F\xFCgt eine gerichtete Kante von Knoten node1 zu node2 hinzu.
+ *
+ * Das Gewicht der Kante
+ * @param node1
+ * @param node2
+ * @return
+ */
+ public IMagicEdge addEdge(Node node1, Node node2){
+ if (node1 == node2) return null;
+ Vertex v = findVertex(node1);
+ Vertex w = findVertex(node2);
- /**
- * L\xF6scht eine Kantew zwischen den beiden Knoten.
- * @param node1 Quelle der Kante.
- * @param node2 Ziel der Kante.
- */
- public void removeEdge(Node node1, Node node2){
- Vertex v = findVertex(node1);
- Vertex w = findVertex(node2);
- if (v != null && w != null) {
- this.worker.suspend();
- Set edges = getEdges();
- for (Object edge : edges) {
- Edge e = (Edge) edge;
- if (e.getIncidentVertices().contains(v) && e.getIncidentVertices().contains(w)) {
- removeEdge(e);
- break;
- }
- }
- this.layout.update();
- this.worker.unsuspend(); // resumeGraph();
- }
- }
+ Edge e = v.findEdge(w);
+ if (e != null)
+ return (IMagicEdge) e;
+ else {
+ JungEdge edge = new JungEdge(v,w);
+ this.worker.suspend(); // stopGraph();
+ addEdge(edge);
+ this.layout.update();
+ this.worker.unsuspend(); // resumeGraph();
+ return edge;
+ }
+ }
- /**
- * Entfernt alle Kanten an denen der Knoten beteiligt ist.
- *
- * @param node
- */
- @SuppressWarnings("unchecked")
- public void removeEdges(Node node){
- Vertex v = findVertex(node);
- if (v != null) {
- this.worker.suspend();
- Set edges = getEdges();
- // Kein Iterator direkt auf die Sets des
- // Graphen => Concurrent modification!
- ArrayList list = new ArrayList(edges);
- for (Object aList : list) {
- Edge e = (Edge) aList;
- if (e.getIncidentVertices().contains(v)) removeEdge(e);
- }
- this.layout.update();
- this.worker.unsuspend();
- }
- }
+ /**
+ * F\xFCgt eine Jungkante hinzu. wird intern verwendet.
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ private Edge addEdge(Vertex v1, Vertex v2){
+ if (v1 == v2) return null;
+ Edge e = v1.findEdge(v2);
+ if (e != null)
+ return e;
+ else {
+ DirectedSparseEdge edge = new DirectedSparseEdge(v1, v2);
+ this.worker.suspend(); // stopGraph();
+ addEdge(edge);
+ this.layout.update();
+ this.worker.unsuspend(); // resumeGraph();
+ return edge;
+ }
+ }
- /**
- * Entfernt Knoten aus dem Graph und eventuelle Kanten
- *
- * @param node
- */
- public void removeVertex(Node node){
- removeEdges(node);
- Vertex v = findVertex(node);
- if (v != null) {
- // Finde alle Kanten die beteiligt sind
- this.worker.suspend();
- this.labeller.removeLabel(node.getDisplayName());
- removeVertex(v);
- this.layout.update();
- this.worker.unsuspend();
+ /**
+ * L\xF6scht eine Kantew zwischen den beiden Knoten.
+ * @param node1 Quelle der Kante.
+ * @param node2 Ziel der Kante.
+ */
+ public void removeEdge(Node node1, Node node2){
+ Vertex v = findVertex(node1);
+ Vertex w = findVertex(node2);
+ if (v != null && w != null) {
+ this.worker.suspend();
+ Set edges = getEdges();
+ for (Object edge : edges) {
+ Edge e = (Edge) edge;
+ if (e.getIncidentVertices().contains(v) && e.getIncidentVertices().contains(w)) {
+ removeEdge(e);
+ break;
+ }
+ }
+ this.layout.update();
+ this.worker.unsuspend(); // resumeGraph();
+ }
+ }
- }
- }
+ /**
+ * Entfernt alle Kanten an denen der Knoten beteiligt ist.
+ *
+ * @param node
+ */
+ @SuppressWarnings("unchecked")
+ public void removeEdges(Node node){
+ Vertex v = findVertex(node);
+ if (v != null) {
+ this.worker.suspend();
+ Set edges = getEdges();
+ // Kein Iterator direkt auf die Sets des
+ // Graphen => Concurrent modification!
+ ArrayList list = new ArrayList(edges);
+ for (Object aList : list) {
+ Edge e = (Edge) aList;
+ if (e.getIncidentVertices().contains(v)){
+ super.removeEdge(e);
+ }
+ }
+ this.layout.update();
+ this.worker.unsuspend();
+ }
+ }
- /**
- *
- * @param handler
- */
+ /**
+ * Entfernt Knoten aus dem Graph und eventuelle Kanten
+ *
+ * @param node
+ */
+ public void removeVertex(Node node){
+ removeEdges(node);
+ Vertex v = findVertex(node);
+ if (v != null) {
+ nodeVertexMapping.remove(node);
+ this.worker.suspend();
+ this.labeller.removeLabel(node.getDisplayName());
+ super.removeVertex(v);
+ this.layout.update();
+ this.worker.unsuspend();
- public void addNodeUpdateHandler(NodeUpdateHandler handler){
- this.nodeHandler.addNodeUpdateHandler(handler);
+ }
+ }
- }
+ /**
+ *
+ * @param handler
+ */
+ public void addNodeUpdateHandler(NodeUpdateHandler handler){
+ this.nodeHandler.addNodeUpdateHandler(handler);
+
+ }
+
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/NotSeeAccessPointHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/NotSeeAccessPointHandler.java 2007-01-21 12:01:13 UTC (rev 513)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/NotSeeAccessPointHandler.java 2007-01-21 16:35:03 UTC (rev 514)
@@ -1,18 +1,14 @@
package net.sf.magicmap.client.model.location.jung.handler;
+import net.sf.magicmap.client.model.location.INodePlacer;
+import net.sf.magicmap.client.model.node.*;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import net.sf.magicmap.client.model.location.INodePlacer;
-import net.sf.magicmap.client.model.node.AccessPointNode;
-import net.sf.magicmap.client.model.node.ClientNode;
-import net.sf.magicmap.client.model.node.LocationNode;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModelConstants;
-
public class NotSeeAccessPointHandler extends NodeWithLocationHandler {
public NotSeeAccessPointHandler(HashMap<ClientNode, HashSet<LocationNode>> clientLocationMap,
@@ -39,14 +35,14 @@
HashSet locations = getLocationsForClient(client);
Iterator it = locations.iterator();
// F\xFCr alle mit dem Client verbundenen Orte tue....
- while (it.hasNext()) {
- LocationNode l = (LocationNode) it.next();
- ArrayList intersection = getIntersection(l.getSeenAccessPoints(), client.getSeenAccessPoints());
- if (intersection.isEmpty()) // Keine gemeinsamen AccessPoints mehr.... l\xF6schen der
- // entsprechenden Kanten
- nodePlacer.removeEdge(client, l);
- }
- }
+ for (Object location : locations) {
+ LocationNode l = (LocationNode) location;
+ ArrayList intersection = getIntersection(l.getSeenAccessPoints(), client.getSeenAccessPoints());
+ if (intersection.isEmpty()) // Keine gemeinsamen AccessPoints mehr.... l\xF6schen der
+ // entsprechenden Kanten
+ nodePlacer.removeEdge(client, l);
+ }
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-21 12:01:13 UTC (rev 513)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-21 16:35:03 UTC (rev 514)
@@ -1,6 +1,7 @@
package net.sf.magicmap.client.model.measurement;
import net.sf.magicmap.client.interfaces.MeasurementModelListener;
+import net.sf.magicmap.client.measurement.Constants;
import net.sf.magicmap.client.model.node.AccessPointNode;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.INodeModel;
@@ -35,28 +36,35 @@
if (apMap.put(client, ap)){
fireAccessPointAdded(client,ap);
}
- client.getModel().updateNode(client, 1, null);
+ //client.getModel().updateNode(client, NodeModelConstants.UPDATE_SEESACCESSPOINT, null);
}
public void updateScanResult(AccessPointSeerNode client, String apMac, double signalLevel){
SeenAccessPoint accessPoint = getAccessPoint(client, apMac);
final INodeModel nodeModel = client.getModel();
+
+
+
if (accessPoint == null) {
+ // ein toter ap.....
+ if (signalLevel <= -Constants.MIN_SIGNALLEVEL) return;
+
accessPoint = new SeenAccessPoint(apMac, signalLevel);
addAccessPoint(client, accessPoint);
AccessPointNode apNode = nodeModel.findAccessPoint(apMac);
- if (apNode == null){
+ if (apNode == null ){
nodeModel.addNode(new AccessPointNode(apMac, nodeModel));
apNode = nodeModel.findAccessPoint(apMac);
}
client.setSignalLevelForAcessPoint(apNode, signalLevel);
}else{
- if (signalLevel != 0){
+ if (signalLevel > -Constants.MIN_SIGNALLEVEL){
accessPoint.addSignalLevel(signalLevel);
}else{
accessPoint.addDeadSignal();
}
if (accessPoint.isTotallyDead()){
+ removeAccessPoint(client, accessPoint);
client.notSeesAccessPoint(nodeModel.findAccessPoint(apMac));
}
else{
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-01-21 12:01:13 UTC (rev 513)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-01-21 16:35:03 UTC (rev 514)
@@ -89,6 +89,7 @@
if (apEdges.containsKey(ap.getMacAddress())){
apEdges.remove(ap.getMacAddress());
getModel().updateNode(this, NodeModelConstants.UPDATE_NOTSEESACCESSPOINT, ap);
+ getModel().removeNode(ap);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-01-21 12:01:13 UTC (rev 513)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-01-21 16:35:03 UTC (rev 514)
@@ -77,13 +77,15 @@
public void removeNode(Node node){
if (!this.nodes.containsKey(node.getName())) return;
this.nodes.remove(node.getName());
+
+ if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT){
+ this.accesspoints.remove(((AccessPointNode) node).getMacAddress());
+ }
+ // aus dem layout entfernen!
this.placer.deleteNode(node);
- if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen
- this.accesspoints.remove(((AccessPointNode) node).getMacAddress());
for (NodeModelListener listener : this.listeners) {
- NodeModelListener l = (NodeModelListener) listener;
- l.nodeRemovedEvent(node);
+ listener.nodeRemovedEvent(node);
}
}
@@ -96,6 +98,7 @@
*/
public void updateNode(Node node, int type, Object data){
this.placer.updateNode(node, type, data);
+
for (NodeModelListener listener : this.listeners) {
NodeModelListener l = (NodeModelListener) listener;
l.nodeUpdatedEvent(node, type, data);
@@ -251,6 +254,9 @@
}
public void setNodePlacer(INodePlacer placer) {
+ if (this.placer != null){
+ this.placer.stopNodePlacer();
+ }
this.placer = placer;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-01-21 12:01:13 UTC (rev 513)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-01-21 16:35:03 UTC (rev 514)
@@ -22,6 +22,7 @@
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import java.awt.*;
+import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.*;
@@ -109,11 +110,25 @@
controller.getMapView().addAncestorListener(new AncestorAdaptor() {
@Override
public void ancestorAdded(AncestorEvent event){
- MainGUI mainGUI = MainGUI.getInstance();
- JMenuBar bar = mainGUI.getJMenuBar();
- JMenu jMenu = bar.getMenu(2);
+ final MainGUI mainGUI = MainGUI.getInstance();
+ final JMenuBar bar = mainGUI.getJMenuBar();
+ final JMenu jMenu = bar.getMenu(2);
jMenu.addSeparator();
jMenu.add(new ShowPluginsAction(mainGUI, PluginManager.this));
+ jMenu.addSeparator();
+ for (IPlugin plugin: plugins.values()){
+ if (plugin instanceof UserInterface){
+ final UserInterface ui = (UserInterface)plugin;
+ jMenu.add(new AbstractAction(plugin.getPluginInfos().getName()){
+ public void actionPerformed(ActionEvent e) {
+ JDialog d = new JDialog(mainGUI);
+ d.setContentPane(ui.visualProxy("",null));
+ d.pack();
+ d.setVisible(true);
+ }
+ });
+ }
+ }
}
});
@@ -160,6 +175,7 @@
plugin.getPluginInfos().getName(),
plugin.getVersion(), plugin.getPluginInfos()}
);
+
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-21 12:01:39
|
Revision: 513
http://svn.sourceforge.net/magicmap/?rev=513&view=rev
Author: jan_fride
Date: 2007-01-21 04:01:13 -0800 (Sun, 21 Jan 2007)
Log Message:
-----------
nodemodel and measurementmodel
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ClientNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/LocationNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionEvent.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionListener.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -5,6 +5,7 @@
package net.sf.magicmap.client.controller;
import net.sf.magicmap.client.interfaces.ServerPollerListener;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.node.*;
import net.sf.magicmap.server.dto.*;
@@ -302,36 +303,15 @@
ArrayList seenAps = client.getSeenAccessPoints();
if (sr != null) {
- for (SimpleScanResultDTO r : sr) {
- String mac = r.getMacAP();
- // Gibt es ggf. einen AP mit der
- // Mac-Adresse?
- AccessPointNode ap = nodeModel.findAccessPoint(mac);
- if (ap == null) {
- // Nein
- ap = new AccessPointNode(nodeModel);
- ap.setMacAddress(mac);
- nodeModel.addNode(ap);
- // ap.setName(mac);
- } else // AccessPoint nur aktualisieren?
- if (seenAps.remove(ap)){ // Nur Signallevel aktualisieren
- client.setSignalLevelForAcessPoint(ap, r.getSignalLevel());
- Controller.getInstance().getMeasurementModel().updateScanResult(client, ap.getMacAddress(), r.getSignalLevel());
- }
- else{
- client.seesAccessPoint(ap, r.getSignalLevel());
- Controller.getInstance().getMeasurementModel().updateScanResult(client, ap.getMacAddress(), r.getSignalLevel());
- }
+ IMeasurementModel measurementModel = Controller.getInstance().getMeasurementModel();
+ double[] signalLevels = new double[sr.length];
+ String[] macs = new String[sr.length];
+ for (int i = 0; i < sr.length; ++i){
+ signalLevels[i] = sr[i].getSignalLevel();
+ macs[i] = sr[i].getMacAP();
}
+ measurementModel.updateScanResult (client, macs, signalLevels);
}
-
- // Alle APs aus seenAps werden demzufolge nicht
- // mehr gesehen und
- // dies teilen wir unserem Modell mit
- for (Object seenAp : seenAps) {
- AccessPointNode ap = (AccessPointNode) seenAp;
- client.notSeesAccessPoint(ap);
- }
}
/*
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -4,60 +4,45 @@
package net.sf.magicmap.client.gui.views;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Image;
-import java.awt.Insets;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.magicmap.client.algorithms.InfoNodeMetric;
-import net.sf.magicmap.client.algorithms.MagicMetric;
-import net.sf.magicmap.client.algorithms.NodeMetricManager;
-import net.sf.magicmap.client.gui.PACWGraphDraw;
-import net.sf.magicmap.client.gui.utils.GUIBuilder;
-import net.sf.magicmap.client.gui.utils.GUIConstants;
-import net.sf.magicmap.client.gui.utils.GUIUtils;
-import net.sf.magicmap.client.gui.utils.NodeIcons;
-import net.sf.magicmap.client.meta.MapInfo;
-import net.sf.magicmap.client.model.location.INodePlacer;
-import net.sf.magicmap.client.model.location.jung.JungNodePlacer;
-import net.sf.magicmap.client.model.location.jung.LayoutSettings;
-import net.sf.magicmap.client.model.node.INodeModel;
-import net.sf.magicmap.client.model.node.InfoObjectNode;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModelSelectionEvent;
-import net.sf.magicmap.client.model.node.NodeModelSelectionListener;
-
-import org.apache.log4j.Logger;
-
import com.brunchboy.util.swing.relativelayout.AttributeConstraint;
import com.brunchboy.util.swing.relativelayout.AttributeType;
import com.brunchboy.util.swing.relativelayout.DependencyManager;
import com.brunchboy.util.swing.relativelayout.RelativeLayout;
-
import edu.uci.ics.jung.graph.Edge;
import edu.uci.ics.jung.graph.Vertex;
import edu.uci.ics.jung.graph.decorators.EdgeColorFunction;
import edu.uci.ics.jung.graph.decorators.StringLabeller;
-import edu.uci.ics.jung.graph.decorators.VertexColorFunction;
import edu.uci.ics.jung.graph.decorators.StringLabeller.UniqueLabelException;
+import edu.uci.ics.jung.graph.decorators.VertexColorFunction;
import edu.uci.ics.jung.graph.event.GraphEvent;
import edu.uci.ics.jung.graph.event.GraphEventListener;
import edu.uci.ics.jung.graph.event.GraphEventType;
import edu.uci.ics.jung.graph.impl.DirectedSparseGraph;
import edu.uci.ics.jung.visualization.SpringLayout;
+import net.sf.magicmap.client.algorithms.InfoNodeMetric;
+import net.sf.magicmap.client.algorithms.MagicMetric;
+import net.sf.magicmap.client.algorithms.NodeMetricManager;
+import net.sf.magicmap.client.gui.PACWGraphDraw;
+import net.sf.magicmap.client.gui.utils.GUIBuilder;
+import net.sf.magicmap.client.gui.utils.GUIConstants;
+import net.sf.magicmap.client.gui.utils.GUIUtils;
+import net.sf.magicmap.client.gui.utils.NodeIcons;
+import net.sf.magicmap.client.meta.MapInfo;
+import net.sf.magicmap.client.model.location.INodePlacer;
+import net.sf.magicmap.client.model.location.jung.JungNodePlacer;
+import net.sf.magicmap.client.model.location.jung.LayoutSettings;
+import net.sf.magicmap.client.model.node.*;
+import org.apache.log4j.Logger;
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
+
/**
* Kapselt das JUNG-Framework sowie die Karte
*
@@ -122,7 +107,7 @@
ni = NodeIcons.getInstance();
initializeGraph();
- model.addNodeModelListener(this.layoutModel);
+// model.addNodeModelListener(this.layoutModel);
this.getModel().addNodeModelSelectionListener(this);
}
@@ -257,7 +242,8 @@
MagicMetric magicMetric = new MagicMetric();
NodeMetricManager metrics = new NodeMetricManager(magicMetric);
metrics.addMetric(InfoObjectNode.class, InfoObjectNode.class, new InfoNodeMetric());
- layoutModel = new JungNodePlacer(getModel(), JungNodePlacer.DEFAULT_SETTINGS, metrics);
+ layoutModel = new JungNodePlacer();
+ getModel().setNodePlacer(layoutModel);
graph = layoutModel;// new DirectedSparseGraph();
graphdraw = new PACWGraphDraw(layoutModel);
graphdraw.setVisible(false);
@@ -451,42 +437,14 @@
fireRightClicked(x, y);
}
- /**
- * Verwandelt Node in Vertex und f?gt diesen in den Graphen ein. Es wird
- * keine R?cksicht auf den Typ des Knotens genommen. Eventuelle implizite
- * Kanten mu? der Aufrufer erstellen.
- *
- * @param node
- * @return
- */
- // public Vertex addVertex(Node node){
- // if (findVertex(node) == null){
- // if (node.getType() == INodeModel.NODETYPE_INFO) {
- // System.out.println(node.getDisplayName());
- // }
- // Vertex v = new DirectedSparseVertex();
- // synchronized (this.graph){
- // stopGraph();
- // graph.addVertex(v);
- // v.addUserDatum(NODE_KEY, node, UserData.SHARED);
- // ((SpringLayout) graphdraw.getGraphLayout()).update();
- // if (node.getX() >= 0 && node.getY() >= 0){
- // ((SpringLayout) graphdraw.getGraphLayout()).forceMove(v, node.getX(),
- // node.getY());
- // }
- // resumeGraph();
- // try{
- // labeller.setLabel(v, node.getDisplayName());
- // } catch (UniqueLabelException e){
- // e.printStackTrace();
- // }
- // }
- // return v;
- // } else{
- // return null;
- // }
- // }
- public void removeEdge(Node node1, Node node2){
+ /**
+ * remove an edge
+ * @param node1 node 1
+ * @param node2 node 2
+ */
+ //@TODO PLEASE DONT PUT LOGIC IN THE VIEWS!!!!!!!!!!!!!!!!
+ @Deprecated
+ public void removeEdge(Node node1, Node node2){
Vertex v = findVertex(node1);
Vertex w = findVertex(node2);
if (v != null && w != null) {
@@ -559,30 +517,9 @@
return node;
}
- // public Edge addEdge(Node node1, Node node2){
- // Vertex v = findVertex(node1);
- // Vertex w = findVertex(node2);
- // if (v == null || w == null) return null;
- // return addEdge(v, w);
- // }
-
- // public Edge addEdge(Vertex v1, Vertex v2){
- // Edge e = v1.findEdge(v2);
- // if (e != null){
- // return e;
- // } else{
- // DirectedSparseEdge edge = new DirectedSparseEdge(v1, v2);
- // stopGraph();
- // graph.addEdge(edge);
- // ((SpringLayout) graphdraw.getGraphLayout()).update();
- // resumeGraph();
- // return edge;
- // }
- // }
-
/**
*
- * @see net.sf.magicmap.client.interfaces.NodeModelListener#nodeAddedEvent(net.sf.magicmap.client.model.Node)
+ *
*/
public void nodeAddedEvent(Node node){
// TODO auch unn\xF6tig oder?
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -4,31 +4,21 @@
package net.sf.magicmap.client.gui.views;
-import java.awt.Dimension;
-import java.awt.Insets;
-
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.TreePath;
-
+import com.brunchboy.util.swing.relativelayout.RelativeLayout;
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.gui.utils.RelativePanelBuilder;
-import net.sf.magicmap.client.model.node.INodeModel;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModelConstants;
-import net.sf.magicmap.client.model.node.NodeModelSelectionEvent;
-import net.sf.magicmap.client.model.node.NodeModelSelectionListener;
+import net.sf.magicmap.client.model.node.*;
import net.sf.magicmap.client.model.outline.OutlineModel;
import net.sf.magicmap.client.model.outline.OutlineTreeNode;
-import com.brunchboy.util.swing.relativelayout.RelativeLayout;
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.TreePath;
+import java.awt.*;
/**
* View for the outline (left side list view of the application)
@@ -161,7 +151,6 @@
/**
* Get the alphabetical index for given OutlineNode in its parent
- * @param parent - the parent OutlineNode
* @param node - the OutlineNode to find out the index
* @return the index of node in parent
*/
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -1,11 +1,11 @@
package net.sf.magicmap.client.model.location;
-import java.util.HashMap;
-
import net.sf.magicmap.client.model.node.IMagicEdge;
import net.sf.magicmap.client.model.node.Node;
+import java.util.HashMap;
+
/**
* Berechnet die Orte von Knoten. Um einem Model ein INodePlacer hinzuzfügen
* muss man nur
@@ -87,7 +87,8 @@
*/
public void addNodeUpdateHandler(NodeUpdateHandler handler);
- static final class NodeHandlerFactory {
+ public void updateNode(Node node, int type, Object data);
+ static final class NodeHandlerFactory {
public final HashMap<Integer, NodeUpdateHandler> handlerMap;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -1,35 +1,6 @@
package net.sf.magicmap.client.model.location.jung;
-import java.awt.Dimension;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.magicmap.client.algorithms.MagicMetric;
-import net.sf.magicmap.client.algorithms.NodeModelMetric;
-import net.sf.magicmap.client.interfaces.NodeModelListener;
-import net.sf.magicmap.client.model.location.INodePlacer;
-import net.sf.magicmap.client.model.location.NodeUpdateHandler;
-import net.sf.magicmap.client.model.location.jung.handler.AccessPointHiddenStateHandler;
-import net.sf.magicmap.client.model.location.jung.handler.FixStateHandler;
-import net.sf.magicmap.client.model.location.jung.handler.InfoNodeHandler;
-import net.sf.magicmap.client.model.location.jung.handler.LabelChangeHandler;
-import net.sf.magicmap.client.model.location.jung.handler.NotSeeAccessPointHandler;
-import net.sf.magicmap.client.model.location.jung.handler.PositionUpdateHandler;
-import net.sf.magicmap.client.model.location.jung.handler.SeeAccessPointHandler;
-import net.sf.magicmap.client.model.node.ClientNode;
-import net.sf.magicmap.client.model.node.IMagicEdge;
-import net.sf.magicmap.client.model.node.INodeModel;
-import net.sf.magicmap.client.model.node.LocationNode;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModelConstants;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import edu.uci.ics.jung.graph.Edge;
import edu.uci.ics.jung.graph.Vertex;
import edu.uci.ics.jung.graph.decorators.StringLabeller;
@@ -38,7 +9,19 @@
import edu.uci.ics.jung.graph.impl.DirectedSparseVertex;
import edu.uci.ics.jung.utils.UserData;
import edu.uci.ics.jung.visualization.SpringLayout;
+import net.sf.magicmap.client.algorithms.MagicMetric;
+import net.sf.magicmap.client.algorithms.NodeModelMetric;
+import net.sf.magicmap.client.interfaces.NodeModelListener;
+import net.sf.magicmap.client.model.location.INodePlacer;
+import net.sf.magicmap.client.model.location.NodeUpdateHandler;
+import net.sf.magicmap.client.model.location.jung.handler.*;
+import net.sf.magicmap.client.model.node.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import java.awt.*;
+import java.util.*;
+
/**
* Dieses Model benutzt die Layoutfunktionen von Jung und einige Angepasste
* Layoutalgorithmen um die Knotenposition zu berechnen.
@@ -46,7 +29,7 @@
* @author Jan
*
*/
-public class JungNodePlacer extends DirectedSparseGraph implements INodePlacer, NodeModelListener, NodeModelConstants {
+public class JungNodePlacer extends DirectedSparseGraph implements INodePlacer, NodeModelConstants {
/**
* Logger
@@ -111,17 +94,16 @@
* @param model
* das Knotenmodel.
*/
- public JungNodePlacer(INodeModel model) {
- this(model, JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
+ public JungNodePlacer() {
+ this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
}
/**
*
- * @param model
* @param settings
* @param metric
*/
- public JungNodePlacer(INodeModel model, LayoutSettings settings, NodeModelMetric metric) {
+ public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) {
super();
this.clientLocationMap = new HashMap<ClientNode, HashSet<LocationNode>>();
@@ -215,7 +197,7 @@
* @param data ---?
* @see NodeModelListener, INodeModel, NodeModel
*/
- public void nodeUpdatedEvent(Node node, int type, Object data){
+ public void updateNode(Node node, int type, Object data){
// first try if we have a handler for this event.
if (!this.nodeHandler.handleNodeUpdated(node, type, data, this)) if (type == NodeModelConstants.UPDATE_CLEAR) {
this.worker.suspend(); // stopGraph();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -10,11 +10,11 @@
*/
public interface IMeasurementModel {
- void addAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap);
- public void updateAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap);
- void removeAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap);
- public void addMeasurementModelListener(MeasurementModelListener l);
- public void removeMeasurementModelListener(MeasurementModelListener l);
+ /**
+ *
+ * @param forNode the node seeing the accesspoints
+ * @return a collection of nodes seen by a given client.
+ */
public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode);
/**
@@ -25,11 +25,22 @@
*/
void updateScanResult(AccessPointSeerNode client, String apMac, double signalLevel);
+
/**
+ * Batch update to avoid event overflow ;-)
+ * @param client
+ * @param apMac
+ * @param signalLevel
+ */
+ void updateScanResult(AccessPointSeerNode client, String[] apMac, double[] signalLevel);
+ /**
* Gets the SeenAccessPoint for a given seer.
* @param client the seer of the ap.
* @param mac th aps mac
* @return the SeenAccessPoint
*/
SeenAccessPoint getAccessPoint(AccessPointSeerNode client, String mac);
+
+ void addMeasurementModelListener(MeasurementModelListener listener);
+ void removeMeasurementModelListener(MeasurementModelListener listener);
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -1,16 +1,19 @@
package net.sf.magicmap.client.model.measurement;
import net.sf.magicmap.client.interfaces.MeasurementModelListener;
+import net.sf.magicmap.client.model.node.AccessPointNode;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
+import net.sf.magicmap.client.model.node.INodeModel;
import javax.swing.event.EventListenerList;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* New Model for measurements. contains all measurement made.
- *
+ *
*/
public class MeasurementModel implements IMeasurementModel {
@@ -18,7 +21,7 @@
private final MeasurementMap apMap = new MeasurementMap();
public MeasurementModel(){
-
+
}
/**
@@ -32,19 +35,58 @@
if (apMap.put(client, ap)){
fireAccessPointAdded(client,ap);
}
+ client.getModel().updateNode(client, 1, null);
}
public void updateScanResult(AccessPointSeerNode client, String apMac, double signalLevel){
SeenAccessPoint accessPoint = getAccessPoint(client, apMac);
+ final INodeModel nodeModel = client.getModel();
if (accessPoint == null) {
accessPoint = new SeenAccessPoint(apMac, signalLevel);
addAccessPoint(client, accessPoint);
+ AccessPointNode apNode = nodeModel.findAccessPoint(apMac);
+ if (apNode == null){
+ nodeModel.addNode(new AccessPointNode(apMac, nodeModel));
+ apNode = nodeModel.findAccessPoint(apMac);
+ }
+ client.setSignalLevelForAcessPoint(apNode, signalLevel);
}else{
- accessPoint.addSignalLevel(signalLevel);
- updateAccessPoint(client, accessPoint);
+ if (signalLevel != 0){
+ accessPoint.addSignalLevel(signalLevel);
+ }else{
+ accessPoint.addDeadSignal();
+ }
+ if (accessPoint.isTotallyDead()){
+ client.notSeesAccessPoint(nodeModel.findAccessPoint(apMac));
+ }
+ else{
+ updateAccessPoint(client, accessPoint);
+ client.setSignalLevelForAcessPoint(nodeModel.findAccessPoint(apMac), signalLevel);
+ }
}
+ }
+ public void updateScanResult(AccessPointSeerNode client, String[] apMac, double[] signalLevel) {
+ ArrayList<AccessPointNode> seenAps = client.getSeenAccessPoints();
+ INodeModel nodeModel = client.getModel();
+ for (int i = 0; i < apMac.length; ++i){
+ AccessPointNode ap = nodeModel.findAccessPoint(apMac[i]);
+ if (ap != null){
+ seenAps.remove(ap);
+ updateScanResult(client, apMac[i], signalLevel[i]);
+ client.setSignalLevelForAcessPoint(ap, signalLevel[i]);
+ }
+ else{
+ ap = new AccessPointNode(apMac[i], nodeModel);
+ nodeModel.addNode(ap);
+ client.seesAccessPoint(ap, signalLevel[i]);
+ }
+ }
+ for (AccessPointNode ap: seenAps){
+ client.notSeesAccessPoint(ap);
+ }
}
+
/**
* Returns a list of seen access points for a given client.
* @param forNode
@@ -53,7 +95,7 @@
public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode){
return apMap.get(forNode).values();
}
-
+
public void updateAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
fireAccessPointChanged(client, ap);
}
@@ -95,7 +137,7 @@
}
private static class MeasurementMap extends HashMap<AccessPointSeerNode, Map<String, SeenAccessPoint>>{
-
+
public boolean put(AccessPointSeerNode node, SeenAccessPoint ap){
if (containsKey(node)){
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointNode.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointNode.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -18,10 +18,14 @@
private boolean hiddenStatus;
public AccessPointNode(INodeModel model) {
+ this("", model);
+ }
+ public AccessPointNode(String mac, INodeModel model) {
super(model);
- }
+ this.macAddress = mac;
+ }
- private String macAddress;
+ private String macAddress;
public String getMacAddress(){
return this.macAddress;
@@ -36,12 +40,14 @@
return this.macAddress;
}
- // Ein AccessPoint hat von sich aus keine
- // verbindungen irgendwohin
+ /**
+ * Access points dont have neighbours..... not for now
+ *
+ * @return an empty List
+ */
@Override
- public ArrayList getNeighbors(){
- // TODO: implementieren
- return new ArrayList();
+ public ArrayList<Node> getNeighbors(){
+ return new ArrayList<Node>();
}
/*
@@ -51,7 +57,6 @@
*/
@Override
public int getType(){
- // TODO Auto-generated method stub
return NodeModelConstants.NODETYPE_ACCESSPOINT;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -4,122 +4,105 @@
package net.sf.magicmap.client.model.node;
-import java.util.ArrayList;
-import java.util.Iterator;
-
import net.sf.magicmap.client.measurement.Constants;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
/**
- * Ein Objekt was Access Points in einer Umgebung mit Signalst\xE4rken sehen kann.
- *
+ * Ein Objekt das Access Points in einer Umgebung mit Signalst\xE4rken sehen kann.
+ *
* @author thuebner
*/
public abstract class AccessPointSeerNode extends Node {
- /*
- * Alle Kanten zu AccessPoints (AccessPointEdge) mit entsprechenden
- * Informationen \xFCber die Signalst\xE4rke
- *
- */
- private ArrayList<AccessPointEdge> apEdges;
+ /*
+ * Alle Kanten zu AccessPoints (AccessPointEdge) mit entsprechenden
+ * Informationen \xFCber die Signalst\xE4rke
+ *
+ */
+ private final Map<String, AccessPointEdge> apEdges = new HashMap<String, AccessPointEdge>();
- public AccessPointSeerNode(INodeModel model) {
- super(model);
- this.apEdges = new ArrayList<AccessPointEdge>();
- }
+ public AccessPointSeerNode(INodeModel model) {
+ super(model);
+ }
- public ArrayList<AccessPointEdge> getApEdges(){
- return this.apEdges;
- }
+ public ArrayList<AccessPointEdge> getApEdges(){
+ return new ArrayList<AccessPointEdge>(this.apEdges.values());
+ }
- public ArrayList<AccessPointNode> getSeenAccessPoints(){
- ArrayList<AccessPointNode> result = new ArrayList<AccessPointNode>();
+ public ArrayList<AccessPointNode> getSeenAccessPoints(){
+ ArrayList<AccessPointNode> result = new ArrayList<AccessPointNode>();
- // Alle AccessPoints, die gesehen werden
- Iterator it = this.apEdges.iterator();
- while (it.hasNext()) {
- AccessPointEdge ae = (AccessPointEdge) it.next();
- result.add(ae.getAccessPoint());
- }
- return result;
- }
+ for (AccessPointEdge apEdge : this.apEdges.values()) {
+ result.add(apEdge.getAccessPoint());
+ }
+ return result;
+ }
- /**
- * Liefert Signalst\xE4rke eines AccessPoints zur\xFCck, die vom
- * AccessPointer-Seher gemessen wurde oder
- * net.sf.magicmap.client.measurement.Constants.MIN_SIGNALLEVEL wenn
- * AccessPoint nicht gesehen wird.
- *
- * @param ap
- * @return
- */
- public double getSignalLevelForAccessPoint(AccessPointNode ap){
- Iterator it = this.apEdges.iterator();
- while (it.hasNext()) {
- AccessPointEdge ae = (AccessPointEdge) it.next();
- if (ae.getAccessPoint() == ap) return ae.getSignalLevel();
- }
- return -Constants.MIN_SIGNALLEVEL;
- }
+ /**
+ * Liefert Signalst\xE4rke eines AccessPoints zur\xFCck, die vom
+ * AccessPointer-Seher gemessen wurde oder
+ * net.sf.magicmap.client.measurement.Constants.MIN_SIGNALLEVEL wenn
+ * AccessPoint nicht gesehen wird.
+ *
+ * @param ap
+ * @return
+ */
+ public double getSignalLevelForAccessPoint(AccessPointNode ap){
+ if (apEdges.containsKey(ap.getMacAddress()))
+ return apEdges.get(ap.getMacAddress()).getSignalLevel();
+ return -Constants.MIN_SIGNALLEVEL;
+ }
- /**
- * Setzt / Aktualisiert die Signalst\xE4rke zu einem Access Point
- *
- * @param ap
- * @param level
- */
- public void setSignalLevelForAcessPoint(AccessPointNode ap, double level){
- Iterator it = this.apEdges.iterator();
- while (it.hasNext()) {
- AccessPointEdge ae = (AccessPointEdge) it.next();
- if (ae.getAccessPoint() == ap) {
- ae.setSignalLevel(level);
- // Wichtig!
- this.getModel().fireSeesAccessPoint(this, ap);
- return;
- }
- }
- // Gibt es noch nicht
- AccessPointEdge ae = new AccessPointEdge();
- ae.setAccessPoint(ap);
- ae.setSignalLevel(level);
- this.apEdges.add(ae);
- this.getModel().fireSeesAccessPoint(this, ap);
- }
+ /**
+ * Setzt / Aktualisiert die Signalst\xE4rke zu einem Access Point
+ *
+ * @param ap the access point
+ * @param level the signal strength of the ap
+ */
+ public void setSignalLevelForAcessPoint(AccessPointNode ap, double level){
+ if (!apEdges.containsKey(ap.getMacAddress())){
+ seesAccessPoint(ap, level);
+ }
+ else{
+ AccessPointEdge ae = apEdges.get(ap.getMacAddress());
+ ae.setSignalLevel(level);
+ this.getModel().updateNode(this, NodeModelConstants.UPDATE_SEESACCESSPOINT, ap);
+ }
- public void seesAccessPoint(AccessPointNode ap, double signalStrength){
- if (!getSeenAccessPoints().contains(ap) && !ap.isHidden()) {
- AccessPointEdge ae = new AccessPointEdge();
- ae.setAccessPoint(ap);
- ae.setSignalLevel(signalStrength);
- this.apEdges.add(ae);
- getModel().fireSeesAccessPoint(this, ap);
- }
- }
+ }
- public void notSeesAccessPoint(AccessPointNode ap){
- Iterator it = this.apEdges.iterator();
- while (it.hasNext()) {
- AccessPointEdge ae = (AccessPointEdge) it.next();
- if (ae.getAccessPoint() == ap) {
- it.remove();
- break;
- }
- }
- getModel().fireNotSeesAccessPoint(this, ap);
- }
+ public void seesAccessPoint(AccessPointNode ap, double signalStrength){
+ if (!getSeenAccessPoints().contains(ap) && !ap.isHidden()) {
+ AccessPointEdge ae = new AccessPointEdge();
+ ae.setAccessPoint(ap);
+ ae.setSignalLevel(signalStrength);
+ this.apEdges.put(ap.getMacAddress(), ae);
+ getModel().updateNode(this, NodeModelConstants.UPDATE_SEESACCESSPOINT, ap);
+ }
+ }
- /**
- * Liefert alle Knoten zur\xFCck, zu denen eine gerichtete Kante gezeichnet
- * werden mu\xDF. Dies sind bei einen AccessPoint-Seher nur die AccessPoints
- * selbst.
- */
- @Override
- public ArrayList getNeighbors(){
- return getSeenAccessPoints();
- }
+ public void notSeesAccessPoint(AccessPointNode ap){
- public void clearAllEdges(){
- this.apEdges.clear();
- }
+ if (apEdges.containsKey(ap.getMacAddress())){
+ apEdges.remove(ap.getMacAddress());
+ getModel().updateNode(this, NodeModelConstants.UPDATE_NOTSEESACCESSPOINT, ap);
+ }
+ }
+
+ /**
+ * Liefert alle Knoten zur\xFCck, zu denen eine gerichtete Kante gezeichnet
+ * werden mu\xDF. Dies sind bei einen AccessPoint-Seher nur die AccessPoints
+ * selbst.
+ */
+ @Override
+ public ArrayList getNeighbors(){
+ return getSeenAccessPoints();
+ }
+
+ public void clearAllEdges(){
+ this.apEdges.clear();
+ }
}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ClientNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ClientNode.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ClientNode.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -9,7 +9,6 @@
/**
* Ein Client sieht Access Points und ist dabei in der Regel
* frei beweglich.
- * @see net.sf.magicmap.client.models#AccessPointSeerNode
* @author thuebner
*/
public class ClientNode extends AccessPointSeerNode {
@@ -44,7 +43,6 @@
*/
@Override
public int getType(){
- // TODO Auto-generated method stub
return NodeModelConstants.NODETYPE_CLIENT;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -1,11 +1,12 @@
package net.sf.magicmap.client.model.node;
+import net.sf.magicmap.client.interfaces.NodeModelListener;
+import net.sf.magicmap.client.model.location.INodePlacer;
+
import java.util.ArrayList;
import java.util.Collection;
-import net.sf.magicmap.client.interfaces.NodeModelListener;
-
/**
* Das NodeModel enth\xE4lt eine Menge von Knoten. Die Bestimmung der Position
* wird von einem anderen Objekt \xFCbernommen. Die Standart Positionsbestimmung
@@ -16,139 +17,157 @@
*/
public interface INodeModel extends NodeModelConstants {
- /**
- * Add a new node
- * @param node
- */
- public abstract void addNode(Node node);
+ /**
+ * Add a new node to the model.
+ *
+ * @param node the node to add
+ */
+ public abstract void addNode(Node node);
- /**
- * Remove a node
- * @param node
- */
- public abstract void removeNode(Node node);
+ /**
+ * Remove a node
+ * @param node removes a node from the model
+ */
+ public abstract void removeNode(Node node);
- /**
- *
- * @param node
- * @param ap
- */
- public abstract void fireSeesAccessPoint(Node node, AccessPointNode ap);
+ /**
+ * Notifies all listeners that the state of a given node
+ * has changed.
+ * Invoke this method after you've changed a node
+ *
+ * @param node the changed node
+ * @param type th type of change
+ * @param data new data, may be null.
+ * @see NodeModelListener
+ */
+ public abstract void updateNode(Node node, int type, Object data);
- /**
- *
- * @param node
- * @param ap
- */
- public abstract void fireNotSeesAccessPoint(Node node, AccessPointNode ap);
+ /**
+ * Aktualisiert den Hash-Schl\xFCssel f\xFCr einen Knoten.
+ * Unter Node.name wird der neue Hashwert erwartet.
+ *
+ * @param node Knoten der aktualisiert werden soll
+ * @param name Alter Hash-Wert
+ */
+ public abstract void rehashNode(Node node, String name);
- /**
- * Notifiziert alle Listener das sich der Zustand eines Knoten ver\xE4ndert hat.
- * TODO: should be private and only in the implementation!
- * @param node der zu \xE4ndernde Knoten
- * @param type der Typ des Knotens.
- * @param data die neuen Daten.
- * @see NodeModelListener
- */
- public abstract void updateNode(Node node, int type, Object data);
+ /**
+ * returns all neighbours for the given node.
+ *
+ * @param node the node
+ * @return all neighbours of the given node.
+ */
+ public abstract ArrayList<? extends Node> findNeighbors(Node node);
- /**
- * Aktualisiert den Hash-Schl\xFCssel f\xFCr einen Knoten.
- * Unter Node.name wird der neue Hashwert erwartet.
- *
- * @param node Knoten der aktualisiert werden soll
- * @param name Alter Hash-Wert
- */
- public abstract void rehashNode(Node node, String name);
+ /**
+ * what for?
+ * @param node
+ * @return
+ */
+ @Deprecated
+ public abstract ArrayList<? extends Node> findNonNeighbors(Node node);
- /**
- *
- * @param node
- * @return
- */
- public abstract ArrayList findNeighbors(Node node);
+ /**
+ * Adds a NodeModelListener
+ * @param nodeModelListener the list\xE9ner to add.
+ */
+ public abstract void addNodeModelListener(NodeModelListener nodeModelListener);
- /**
- *
- * @param node
- * @return
- */
- public abstract ArrayList findNonNeighbors(Node node);
+ /**
+ * remove a NodeModelListener
+ * @param l the listener to remove
+ */
+ public abstract void removeNodeModelListener(NodeModelListener l);
- /**
- *
- * @param nodeModelListener
- */
- public abstract void addNodeModelListener(NodeModelListener nodeModelListener);
+ /**
+ * returns an array of all NodeModelListener.
+ * @return an array of all NodeModelListener registered to this model.
+ */
+ public abstract NodeModelListener[] nodeModelListeners();
- /**
- *
- * @param l
- */
- public abstract void removeNodeModelListener(NodeModelListener l);
+ /**
+ *
+ * @param accesspoints
+ * @return
+ */
+ public abstract ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(
+ ArrayList<AccessPointNode> accesspoints);
- /**
- *
- * @return
- */
- public abstract NodeModelListener[] nodeModelListeners();
+ /**
+ * Gibt alle Orte/Referenzpunkte zur?ck, die mindestens einen
+ * AccessPoint mit der ?bergebenen gemeinsam haben.
+ * @param accesspoints
+ * @param exclude
+ * @return
+ */
+ public abstract ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(
+ ArrayList<AccessPointNode> accesspoints, Node exclude);
- public abstract ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(
- ArrayList<AccessPointNode> accesspoints);
+ /**
+ *
+ * @param name
+ * @return
+ */
+ public abstract Node findNode(String name);
- /**
- * Gibt alle Orte/Referenzpunkte zur?ck, die mindestens einen
- * AccessPoint mit der ?bergebenen gemeinsam haben.
- * @param accesspoints
- * @param exclude
- * @return
- */
- public abstract ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(
- ArrayList<AccessPointNode> accesspoints, Node exclude);
+ /**
+ *
+ * @param name
+ * @return
+ */
+ public abstract boolean nodeExists(String name);
- /**
- *
- * @param name
- * @return
- */
- public abstract Node findNode(String name);
+ /**
+ *
+ * @param mac
+ * @return
+ */
+ public abstract AccessPointNode findAccessPoint(String mac);
- /**
- *
- * @param name
- * @return
- */
- public abstract boolean nodeExists(String name);
+ /**
+ * Abfrage ob ein Accesspoint mit einer mac existiert.
+ * @param mac the mac address of the access point
+ * @return true if the model contains an ap with the given mac.
+ */
+ public abstract boolean accessPointExists(String mac);
- public abstract AccessPointNode findAccessPoint(String mac);
+ /**
+ * Liefert alle Knoten des Models.
+ * @return alle Knoten des Models.
+ */
+ public abstract Collection<Node> getNodes();
- /**
- * Abfrage ob ein Accesspoint mit einer mac existiert.
- * @param mac
- * @return
- */
- public abstract boolean accessPointExists(String mac);
+ /**
+ * Entfernt alles aus dem Model
+ *
+ */
+ public abstract void clear();
- /**
- * Liefert alle Knoten des Models.
- * @return alle Knoten des Models.
- */
- public abstract Collection getNodes();
+ /**
+ *
+ * @param l
+ */
+ @Deprecated
+ public abstract void addNodeModelSelectionListener(NodeModelSelectionListener l);
- /**
- * Entfernt alles aus dem Model
- *
- */
- public abstract void clear();
+ /**
+ *
+ * @param l
+ */
+ @Deprecated
+ public abstract void removeNodeModelSelectionListener(NodeModelSelectionListener l);
- public abstract void addNodeModelSelectionListener(NodeModelSelectionListener l);
+ /**
+ *
+ * @param selectedNode
+ * @return
+ */
+ @Deprecated
+ public Node selectNode(Node selectedNode);
- public abstract void removeNodeModelSelectionListener(NodeModelSelectionListener l);
+ void setNodePlacer(INodePlacer placer);
+ INodePlacer getNodePlacer();
- /**
- *
- * @param selectedNode
- * @return
- */
- public Node selectNode(Node selectedNode);
+ void setCurrentMap(MapNode map);
+ MapNode getCurrentMap();
}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/LocationNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/LocationNode.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/LocationNode.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -20,12 +20,9 @@
/**
* Liefert AccessPoints mit denen dieser Referenzpunkt
* verbunden werden soll.
+ * @return something
*/
- /*public ArrayList getNeighbors() {
- return super.getNeighbors();
- }*/
-
- public ArrayList getLocations(){
+ public ArrayList getLocations(){
ArrayList locations = getModel().getLocationsWithAtLeastOneAccessPoint(super.getNeighbors(), this);
return locations;
}
@@ -43,12 +40,12 @@
return result;
}
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.Node#getType()
+ /**
+ * the nodes type
+ * @return NodeModelConstants.NODETYPE_LOCATION
*/
@Override
public int getType(){
- // TODO Auto-generated method stub
return NodeModelConstants.NODETYPE_LOCATION;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -154,7 +154,7 @@
model.updateNode(this, NodeModel.UPDATE_POSITION, null);
}
- public abstract ArrayList getNeighbors();
+ public abstract ArrayList<? extends Node> getNeighbors();
public INodeModel getModel(){
return model;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -1,22 +1,14 @@
package net.sf.magicmap.client.model.node;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
+import net.sf.magicmap.client.interfaces.NodeModelListener;
+import net.sf.magicmap.client.model.location.INodePlacer;
+import net.sf.magicmap.client.model.location.jung.JungNodePlacer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.util.*;
-import net.sf.magicmap.client.interfaces.NodeModelListener;
-
/**
* Model zur Beschreibung des aktuellen Zustands in der
* Welt der Clients und AccessPoints. Es k\xF6nnen Anfragen
@@ -42,17 +34,19 @@
private Node selectedNode = Node.EMPTY_NODE;
private final Log log = LogFactory.getLog(NodeModel.class);
+ private INodePlacer placer;
+ private MapNode currentMap;
+
/**
* Erzeugt neues leeres Model
*
*/
public NodeModel() {
- // Collections.synchronizedMap(new HashMap<String, Double>());
-
this.nodes = Collections.synchronizedMap(new HashMap<String, Node>());
this.accesspoints = Collections.synchronizedMap(new HashMap<String, AccessPointNode>());
this.listeners = Collections.synchronizedList(new ArrayList<NodeModelListener>());
this.selectListeners = Collections.synchronizedList(new ArrayList<NodeModelSelectionListener>());
+ setNodePlacer(new JungNodePlacer());
}
/**
@@ -62,6 +56,7 @@
*/
public void addNode(Node node){
if (this.nodes.containsKey(node.getName())) return;
+ this.placer.insertNode(node);
log.info("Adding Node: " + node.getName());
this.nodes.put(node.getName(), node);
// special handling for APs
@@ -72,6 +67,7 @@
NodeModelListener l = (NodeModelListener) listener;
l.nodeAddedEvent(node);
}
+
}
/**
@@ -79,7 +75,9 @@
* @param node
*/
public void removeNode(Node node){
+ if (!this.nodes.containsKey(node.getName())) return;
this.nodes.remove(node.getName());
+ this.placer.deleteNode(node);
if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen
this.accesspoints.remove(((AccessPointNode) node).getMacAddress());
@@ -89,14 +87,6 @@
}
}
- public void fireSeesAccessPoint(Node node, AccessPointNode ap){
- updateNode(node, NodeModelConstants.UPDATE_SEESACCESSPOINT, ap);
- }
-
- public void fireNotSeesAccessPoint(Node node, AccessPointNode ap){
- updateNode(node, NodeModelConstants.UPDATE_NOTSEESACCESSPOINT, ap);
- }
-
/**
* Notofiziert alle Listener das sich ein Knoten ge\xE4ndert hat.
*
@@ -105,7 +95,7 @@
* @param data Daten, z.B. ein AccessPoint
*/
public void updateNode(Node node, int type, Object data){
-
+ this.placer.updateNode(node, type, data);
for (NodeModelListener listener : this.listeners) {
NodeModelListener l = (NodeModelListener) listener;
l.nodeUpdatedEvent(node, type, data);
@@ -141,7 +131,7 @@
public void addNodeModelListener(NodeModelListener nodeModelListener){
if (!this.listeners.contains(nodeModelListener)) {
this.listeners.add(nodeModelListener);
-
+ //TODO BUG ODER?!
for (Node node1 : this.nodes.values()) {
Node node = (Node) node1;
nodeModelListener.nodeAddedEvent(node);
@@ -195,8 +185,7 @@
* @return a node or null if node with given name exists
*/
public Node findNode(String name){
- Node node = this.nodes.get(name);
- return node;
+ return this.nodes.get(name);
}
/**
@@ -214,8 +203,7 @@
* @return an ap or null
*/
public AccessPointNode findAccessPoint(String mac){
- AccessPointNode node = (AccessPointNode) this.accesspoints.get(mac);
- return node;
+ return this.accesspoints.get(mac);
}
public boolean accessPointExists(String mac){
@@ -223,9 +211,9 @@
}
/**
- * @return
+ * @return a copied list of all nodes in this model.
*/
- public Collection getNodes(){
+ public Collection<Node> getNodes(){
return Collections.unmodifiableCollection(this.nodes.values());
}
@@ -243,22 +231,41 @@
public void addNodeModelSelectionListener(NodeModelSelectionListener l){
this.selectListeners.add(l);
-
}
public void removeNodeModelSelectionListener(NodeModelSelectionListener l){
this.selectListeners.remove(l);
}
+ /**
+ *
+ * @param newSelectedNode
+ * @return
+ */
public Node selectNode(Node newSelectedNode){
if (null == newSelectedNode) throw new IllegalArgumentException("node must not be null");
-
NodeModelSelectionEvent e = new NodeModelSelectionEvent(this, newSelectedNode, this.selectedNode);
this.selectedNode = newSelectedNode;
updateSelection(e);
return this.selectedNode;
}
+ public void setNodePlacer(INodePlacer placer) {
+ this.placer = placer;
+ }
+
+ public INodePlacer getNodePlacer() {
+ return placer;
+ }
+
+ public void setCurrentMap(MapNode map) {
+ this.currentMap = map;
+ }
+
+ public MapNode getCurrentMap() {
+ return currentMap;
+ }
+
/**
*
* @param e
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionEvent.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionEvent.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionEvent.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -22,22 +22,29 @@
/**
*
- * @param source
+ * @param source the source of the event.
* @param selectedNode the new selected node.
- * @param oldSelectedNode
+ * @param oldSelectedNode the node that was selected before the selection changed.
*/
public NodeModelSelectionEvent(Object source, Node selectedNode, Node oldSelectedNode) {
super(source);
- // TODO Auto-generated constructor stub
this.selectedNode = selectedNode;
this.oldSelectedNode = oldSelectedNode;
}
- public Node getSelectedNode(){
+ /**
+ * Get the new selected node
+ * @return
+ */
+ public Node getSelectedNode(){
return this.selectedNode;
}
- public Node getOldSelectedNode(){
+ /**
+ * Get the node that was selected before.
+ * @return
+ */
+ public Node getOldSelectedNode(){
return this.oldSelectedNode;
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionListener.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionListener.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -8,5 +8,9 @@
*/
public interface NodeModelSelectionListener {
- public void selectionChanged(NodeModelSelectionEvent selectEvent);
+ /**
+ * Called when the selection changed.
+ * @param selectEvent
+ */
+ public void selectionChanged (NodeModelSelectionEvent selectEvent);
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java 2007-01-16 14:06:27 UTC (rev 512)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java 2007-01-21 12:01:13 UTC (rev 513)
@@ -9,11 +9,16 @@
private final EventListenerList listeners;
private Node selectedNode;
+ private MapNode currentNode;
+ /**
+ *
+ */
public NodeSelectionModel(){
listeners = new EventListenerList();
selectedNode = Node.EMPTY_NODE;
}
+
public void addNodeModelSelectionListener(INodeModelSelectionListener l){
listeners.add(INodeModelSelectionListener.class, l);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-01-16 14:06:30
|
Revision: 512
http://svn.sourceforge.net/magicmap/?rev=512&view=rev
Author: flederohr
Date: 2007-01-16 06:06:27 -0800 (Tue, 16 Jan 2007)
Log Message:
-----------
standard udp plugin added
Added Paths:
-----------
trunk/magicmapclient/plugins/
trunk/magicmapclient/plugins/udpplugin-plugin.jar
Added: trunk/magicmapclient/plugins/udpplugin-plugin.jar
===================================================================
(Binary files differ)
Property changes on: trunk/magicmapclient/plugins/udpplugin-plugin.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-15 23:58:58
|
Revision: 511
http://svn.sourceforge.net/magicmap/?rev=511&view=rev
Author: jan_fride
Date: 2007-01-15 15:58:32 -0800 (Mon, 15 Jan 2007)
Log Message:
-----------
MeasurementModel show every client.
one bug: ap for all clients are shown, only after the first selection of a clint!?
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/IModelView.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/IModelView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/IModelView.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/IModelView.java 2007-01-15 23:58:32 UTC (rev 511)
@@ -0,0 +1,19 @@
+package net.sf.magicmap.client.gui.views;
+
+import net.sf.magicmap.client.model.node.INodeModel;
+import net.sf.magicmap.client.model.node.INodeModelSelectionListener;
+import net.sf.magicmap.client.model.node.INodeSelectionModel;
+
+/**
+ *
+ */
+public interface IModelView extends INodeModelSelectionListener {
+
+ void setNodeModel(INodeModel newNodeModel);
+ INodeModel getNodeModel();
+
+ void setNodeSelectionModel(INodeSelectionModel newSelectionMode);
+ INodeSelectionModel getNodeSelectionModel();
+
+ // TODO register menus etc....
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeSelectionModel.java 2007-01-15 23:58:32 UTC (rev 511)
@@ -0,0 +1,39 @@
+package net.sf.magicmap.client.model.node;
+
+import javax.swing.event.EventListenerList;
+
+/**
+ * @author Jan Friderici
+ */
+public class NodeSelectionModel implements INodeSelectionModel{
+
+ private final EventListenerList listeners;
+ private Node selectedNode;
+
+ public NodeSelectionModel(){
+ listeners = new EventListenerList();
+ selectedNode = Node.EMPTY_NODE;
+ }
+ public void addNodeModelSelectionListener(INodeModelSelectionListener l){
+ listeners.add(INodeModelSelectionListener.class, l);
+ }
+
+ public void removeNodeModelSelectionListener(INodeModelSelectionListener l){
+ listeners.remove(INodeModelSelectionListener.class, l);
+ }
+ /**
+ *
+ * @param newSelectedNode the node to select (NEVER null please)
+ * @return the selected node.
+ */
+ public Node selectNode(Node newSelectedNode){
+ Node oldNode = this.selectedNode;
+ this.selectedNode = newSelectedNode;
+ INodeModelSelectionListener[] currentListenerIs = listeners.getListeners(INodeModelSelectionListener.class);
+ NodeModelSelectionEvent event = new NodeModelSelectionEvent(this, selectedNode, oldNode);
+ for(INodeModelSelectionListener l: currentListenerIs){
+ l.selectionChanged(event);
+ }
+ return selectedNode;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-15 23:57:18
|
Revision: 510
http://svn.sourceforge.net/magicmap/?rev=510&view=rev
Author: jan_fride
Date: 2007-01-15 15:57:17 -0800 (Mon, 15 Jan 2007)
Log Message:
-----------
MeasurementModel show every client.
one bug: ap for all clients are shown, only after the first selection of a clint!?
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModelSelectionListener.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeSelectionModel.java
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModelSelectionListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModelSelectionListener.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModelSelectionListener.java 2007-01-15 23:57:17 UTC (rev 510)
@@ -0,0 +1,19 @@
+
+package net.sf.magicmap.client.model.node;
+
+import java.util.EventListener;
+
+/**
+ *
+ * @author Jan Friderici
+ *
+ */
+public interface INodeModelSelectionListener extends EventListener {
+
+ /**
+ * Indicates that the selection changed.
+ *
+ * @param selectEvent an event describing the changed selection
+ */
+ public void selectionChanged(NodeModelSelectionEvent selectEvent);
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeSelectionModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeSelectionModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeSelectionModel.java 2007-01-15 23:57:17 UTC (rev 510)
@@ -0,0 +1,21 @@
+package net.sf.magicmap.client.model.node;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jan
+ * Date: 14.01.2007
+ * Time: 16:27:48
+ * To change this template use File | Settings | File Templates.
+ */
+public interface INodeSelectionModel {
+
+ void addNodeModelSelectionListener(INodeModelSelectionListener l);
+
+ void removeNodeModelSelectionListener(INodeModelSelectionListener l);
+ /**
+ *
+ * @param selectedNode the node to select (NEVER null please)
+ * @return the selected node.
+ */
+ Node selectNode(Node selectedNode);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-15 23:51:27
|
Revision: 509
http://svn.sourceforge.net/magicmap/?rev=509&view=rev
Author: jan_fride
Date: 2007-01-15 15:51:04 -0800 (Mon, 15 Jan 2007)
Log Message:
-----------
MeasurementModel show every client.
one bug: ap for all clients are shown, only after the first selection of a clint!?
Modified Paths:
--------------
trunk/magicmapclient/magicmapclient.iml
trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java
trunk/magicmapserver/magicmapserver.iml
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java
Modified: trunk/magicmapclient/magicmapclient.iml
===================================================================
--- trunk/magicmapclient/magicmapclient.iml 2007-01-14 20:56:16 UTC (rev 508)
+++ trunk/magicmapclient/magicmapclient.iml 2007-01-15 23:51:04 UTC (rev 509)
@@ -6,13 +6,13 @@
<exclude-output />
<output-test url="file://$MODULE_DIR$/build-test" />
<content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/inf" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/perl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/res" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src-gen" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.settings" />
- <excludeFolder url="file://$MODULE_DIR$/inf" />
<excludeFolder url="file://$MODULE_DIR$/lib" />
<excludeFolder url="file://$MODULE_DIR$/lib-dev" />
</content>
@@ -290,15 +290,6 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="file://$MODULE_DIR$/build" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-01-14 20:56:16 UTC (rev 508)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-01-15 23:51:04 UTC (rev 509)
@@ -4,476 +4,459 @@
package net.sf.magicmap.client.controller;
+import net.sf.magicmap.client.interfaces.ServerPollerListener;
+import net.sf.magicmap.client.model.node.*;
+import net.sf.magicmap.server.dto.*;
+
+import javax.swing.*;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import javax.swing.SwingUtilities;
-
-import net.sf.magicmap.client.interfaces.ServerPollerListener;
-import net.sf.magicmap.client.model.node.AccessPointNode;
-import net.sf.magicmap.client.model.node.ClientNode;
-import net.sf.magicmap.client.model.node.GeoPos;
-import net.sf.magicmap.client.model.node.GeoPosNode;
-import net.sf.magicmap.client.model.node.INodeModel;
-import net.sf.magicmap.client.model.node.InfoObject;
-import net.sf.magicmap.client.model.node.LocationNode;
-import net.sf.magicmap.client.model.node.MapNode;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModelConstants;
-import net.sf.magicmap.server.dto.AccessPointDTO;
-import net.sf.magicmap.server.dto.ClientDTO;
-import net.sf.magicmap.server.dto.GeoPointDTO;
-import net.sf.magicmap.server.dto.MapDTO;
-import net.sf.magicmap.server.dto.PositionDTO;
-import net.sf.magicmap.server.dto.SignalCharacterDTO;
-import net.sf.magicmap.server.dto.SimpleScanResultDTO;
-
/**
* Wertet die Ergebnisse des Pollers aus und gibt sie in geeigneter Weise an den
* Client weiter.
- *
+ *
* @author thuebner
*/
public class PollHandler implements ServerPollerListener {
- private Controller controller;
+ private Controller controller;
- public PollHandler(Controller controller) {
- this.controller = controller;
- }
+ public PollHandler(Controller controller) {
+ this.controller = controller;
+ }
- /**
- * Werte ein PositionDTO-Objekt aus und generiert entsprechende Ergenisse
- * f\xFCr die Aktualisierung der Modelle und somit auch der Views. In dieser
- * Methode ist es wichtig alle m\xF6glichen Fehlersituation zu ber\xFCcksichtigen,
- * da stets nur Differenzen seit einem Zeitstempel \xFCbertragen werden. Also:
- * Defensiv programmieren aber nicht gleich wegen jeder Inkonsistenz
- * abbrechen.... ;-)
- *
- * @see net.sf.magicmap.client.interfaces.ServerPollerListener#positionCreatedOrUpdatedOrDeleted(java.lang.String,
- * long, net.sf.magicmap.client.delegate.dto.PositionDTO)
- */
- public void positionCreatedOrUpdatedOrDeleted(final PositionDTO position){
+ /**
+ * Werte ein PositionDTO-Objekt aus und generiert entsprechende Ergenisse
+ * f\xFCr die Aktualisierung der Modelle und somit auch der Views. In dieser
+ * Methode ist es wichtig alle m\xF6glichen Fehlersituation zu ber\xFCcksichtigen,
+ * da stets nur Differenzen seit einem Zeitstempel \xFCbertragen werden. Also:
+ * Defensiv programmieren aber nicht gleich wegen jeder Inkonsistenz
+ * abbrechen.... ;-)
+ * @see net.sf.magicmap.client.interfaces.ServerPollerListener
+ */
+ public void positionCreatedOrUpdatedOrDeleted(final PositionDTO position){
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
- public void run(){
- try {
- INodeModel nodeModel = PollHandler.this.controller.getNodeModel();
- Node node = nodeModel.findNode(position.getName());
+ public void run(){
+ try {
+ INodeModel nodeModel = PollHandler.this.controller.getNodeModel();
+ Node node = nodeModel.findNode(position.getName());
- if (position.isDeleted()) {
+ if (position.isDeleted()) {
- if (position.getClient() == null && position.getAccessPoint() == null) {
- if (node != null) {
- // Referenzpunkt wird gel\xF6scht
- if (node.getType() == NodeModelConstants.NODETYPE_LOCATION) // Aus dem lokalen Graphen entfernen das
- // Ding
- nodeModel.removeNode(node);
- else
- System.out
- .println("Position with location information deleted, but node with given name is not a location!");
- } else
- System.out
- .println("Position with location information deleted, but no node found for it.");
- return;
- }
- if (position.getClient() != null) // Node client =
- // nodeModel.findNode(position.getClient().getName());
- /*
- * if (client != null) { // Client wurde "frei"
- * gemacht if (client.getType() ==
- * NodeModel.NODETYPE_CLIENT) {
- * client.setFix(false);
- * System.out.println("Client unfixed."); } else {
- * System.out.println("Position with client
- * deleted, but node with given name is not a
- * client!"); } } else {
- * System.out.println("Position with client
- * deleted, but no node found for it."); }
- */
- return;
- if (position.getAccessPoint() != null) {
- AccessPointNode ap = nodeModel.findAccessPoint(position.getAccessPoint().getMac());
- if (ap != null) {
- // AccessPoint wurde "frei" gemacht
- ap.setFix(false);
- System.out.println("Accesspoint unfixed.");
- } else
- System.out.println("Position with accesspoint deleted, but no node found for it.");
- return;
- }
+ if (position.getClient() == null && position.getAccessPoint() == null) {
+ if (node != null) {
+ // Referenzpunkt wird gel\xF6scht
+ if (node.getType() == NodeModelConstants.NODETYPE_LOCATION) // Aus dem lokalen Graphen entfernen das
+ // Ding
+ nodeModel.removeNode(node);
+ else
+ System.out
+ .println("Position with location information deleted, but node with given name is not a location!");
+ } else
+ System.out
+ .println("Position with location information deleted, but no node found for it.");
+ return;
+ }
+ if (position.getClient() != null) // Node client =
+ return;
+ if (position.getAccessPoint() != null) {
+ AccessPointNode ap = nodeModel.findAccessPoint(position.getAccessPoint().getMac());
+ if (ap != null) {
+ // AccessPoint wurde "frei" gemacht
+ ap.setFix(false);
+ System.out.println("Accesspoint unfixed.");
+ } else
+ System.out.println("Position with accesspoint deleted, but no node found for it.");
+ return;
+ }
+ System.out.println("Position with id " + position.getId()
+ + " was deleted but not handled.");
+ return;
+ } else {
+ // Neues Positionsobjekt oder altes wurde
+ // aktualisiert (Location)
+ if (position.getClient() == null && position.getAccessPoint() == null) {
+ handlePositionXYZ(node, nodeModel, position);
+ return;
+ }
+ if (position.getAccessPoint() != null) {
+ handleAccessPointXYZ(nodeModel, position);
+ return;
+ }
+ if (position.getClient() != null && position.getCharacter() != null) {
+ handleClientXYZ(nodeModel, position);
+ return;
+ }
+ }
+ System.out.println("Unbekannte Position. Kann nix anfangen damit.");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
- System.out.println("Position with id " + position.getId().longValue()
- + " was deleted but not handled.");
- return;
- } else {
- // Neues Positionsobjekt oder altes wurde
- // aktualisiert (Location)
- if (position.getClient() == null && position.getAccessPoint() == null) {
- // Referenzpunkt angelegt oder aktualisiert
- LocationNode location;
- if (node == null) {
- // Referenzpunkt bisher unbekannt
- location = new LocationNode(nodeModel);
+ /**
+ *
+ * @param node a node
+ * @param nodeModel the model
+ * @param position the position data
+ */
+ private void handlePositionXYZ(Node node, INodeModel nodeModel, PositionDTO position) {
+ // Referenzpunkt angelegt oder aktualisiert
+ LocationNode location;
+ if (node == null) {
+ // Referenzpunkt bisher unbekannt
+ location = new LocationNode(nodeModel);
- location.setId(position.getId().longValue());
- location.setName(position.getName());
- nodeModel.addNode(location);
+ location.setId(position.getId());
+ location.setName(position.getName());
+ nodeModel.addNode(location);
- if (position.getPosX().intValue() != -1 && position.getPosY().intValue() != -1) {
- location.setPosition(position.getPosX().intValue(), position.getPosY()
- .intValue(), position.getPosZ().intValue());
- location.setFix(true);
- } else
- location.setFix(false);
- // Signalcharakteristik auswerden und
- // gesehene
- // AccessPoints ebenfalls erzeugen bzw. mit
- // ihnen Verbindungen
- // herstellen
- SignalCharacterDTO sc = position.getCharacter();
- SimpleScanResultDTO[] sr = sc.getSimpleScanResults();
- for (int i = 0; sr != null && i < sr.length; i++) {
- SimpleScanResultDTO r = sr[i];
- String mac = r.getMacAP();
- // Gibt es ggf. einen AP mit der
- // Mac-Adresse?
- AccessPointNode ap = nodeModel.findAccessPoint(mac);
- if (ap == null) {
- // Nein
- ap = new AccessPointNode(nodeModel);
- ap.setMacAddress(mac);
- nodeModel.addNode(ap);
- // ap.setName(mac);
- }
- if (!ap.isHidden())
- location.seesAccessPoint(ap, r.getSignalLevel().doubleValue());
- }
- } else {
- System.out.println("Referenzpunkt verschoben.");
- // Referenzpunkt wird nur aktualisiert, wir
- // gehen davon aus
- // das sich nur die Position ver\xE4ndern darf
- // (die Programmlogik sieht
- // es jedenfalls so vor, \xC4ndern der APs
- // geschieht \xFCber L\xF6schen und
- // Neuanlegen)
- location = (LocationNode) node;
- location.setId(position.getId().longValue()); // Falls
- // nicht
- // gesetzt
- // Nur Position von fixierten
- // Orten/Referenzpunkten beachten
- if (position.isFixed()) {
- location.setPosition(position.getPosX().intValue(), position.getPosY()
- .intValue(), position.getPosZ().intValue());
- location.setFix(true);
- } else
- location.setFix(false);
- // Signalcharakteristik auswerden und
- // gesehene
- // AccessPoints ebenfalls erzeugen bzw. mit
- // ihnen Verbindungen
- // herstellen
- SignalCharacterDTO sc = position.getCharacter();
- SimpleScanResultDTO[] sr = sc.getSimpleScanResults();
- // Alle momentan gesehenen AccessPoints
- // merken
+ if (position.getPosX() != -1 && position.getPosY() != -1) {
+ location.setPosition(position.getPosX(), position.getPosY(), position.getPosZ());
+ location.setFix(true);
+ } else
+ location.setFix(false);
+ // Signalcharakteristik auswerden und
+ // gesehene
+ // AccessPoints ebenfalls erzeugen bzw. mit
+ // ihnen Verbindungen
+ // herstellen
+ SignalCharacterDTO sc = position.getCharacter();
+ SimpleScanResultDTO[] sr = sc.getSimpleScanResults();
+ for (int i = 0; sr != null && i < sr.length; i++) {
+ SimpleScanResultDTO r = sr[i];
+ String mac = r.getMacAP();
+ // Gibt es ggf. einen AP mit der
+ // Mac-Adresse?
+ AccessPointNode ap = nodeModel.findAccessPoint(mac);
+ if (ap == null) {
+ // Nein
+ ap = new AccessPointNode(nodeModel);
+ ap.setMacAddress(mac);
+ nodeModel.addNode(ap);
+ // ap.setName(mac);
+ }
+ if (!ap.isHidden())
+ location.seesAccessPoint(ap, r.getSignalLevel());
+ }
+ } else {
+ System.out.println("Referenzpunkt verschoben.");
+ // Referenzpunkt wird nur aktualisiert, wir
+ // gehen davon aus
+ // das sich nur die Position ver\xE4ndern darf
+ // (die Programmlogik sieht
+ // es jedenfalls so vor, \xC4ndern der APs
+ // geschieht \xFCber L\xF6schen und
+ // Neuanlegen)
+ location = (LocationNode) node;
+ location.setId(position.getId()); // Falls
+ // nicht
+ // gesetzt
+ // Nur Position von fixierten
+ // Orten/Referenzpunkten beachten
+ if (position.isFixed()) {
+ location.setPosition(position.getPosX(), position.getPosY(), position.getPosZ());
+ location.setFix(true);
+ } else
+ location.setFix(false);
+ // Signalcharakteristik auswerden und
+ // gesehene
+ // AccessPoints ebenfalls erzeugen bzw. mit
+ // ihnen Verbindungen
+ // herstellen
+ SignalCharacterDTO sc = position.getCharacter();
+ SimpleScanResultDTO[] sr = sc.getSimpleScanResults();
+ // Alle momentan gesehenen AccessPoints
+ // merken
- ArrayList seenAps = location.getSeenAccessPoints();
- for (int i = 0; i < sr.length; i++) {
- SimpleScanResultDTO r = sr[i];
- String mac = r.getMacAP();
- // Gibt es ggf. einen AP mit der
- // Mac-Adresse?
- AccessPointNode ap = nodeModel.findAccessPoint(mac);
- if (ap == null) {
- // Nein
- ap = new AccessPointNode(nodeModel);
- ap.setMacAddress(mac);
- nodeModel.addNode(ap);
- // ap.setName(mac);
- } else // AccessPoint nur aktualisieren?
- if (seenAps.remove(ap)) // Nur Signallevel aktualisieren
- location.setSignalLevelForAcessPoint(ap, r.getSignalLevel().doubleValue());
- else
- // Neu
- location.seesAccessPoint(ap, r.getSignalLevel().doubleValue());
- }
+ ArrayList seenAps = location.getSeenAccessPoints();
+ for (SimpleScanResultDTO r : sr) {
+ String mac = r.getMacAP();
+ // Gibt es ggf. einen AP mit der
+ // Mac-Adresse?
+ AccessPointNode ap = nodeModel.findAccessPoint(mac);
+ if (ap == null) {
+ // Nein
+ ap = new AccessPointNode(nodeModel);
+ ap.setMacAddress(mac);
+ nodeModel.addNode(ap);
+ // ap.setName(mac);
+ } else // AccessPoint nur aktualisieren?
+ if (seenAps.remove(ap)) // Nur Signallevel aktualisieren
+ location.setSignalLevelForAcessPoint(ap, r.getSignalLevel());
+ else
+ // Neu
+ location.seesAccessPoint(ap, r.getSignalLevel());
+ }
- // Alle APs aus seenAps werden demzufolge
- // nicht mehr gesehen und
- // dies teilen wir unserem Modell mit
- for (int i = 0; i < seenAps.size(); i++) {
- AccessPointNode ap = (AccessPointNode) seenAps.get(i);
- location.notSeesAccessPoint(ap);
- }
- }
- return;
- }
- if (position.getAccessPoint() != null) {
- System.out.println("Accesspointposition erzeugt oder aktualisiert.");
- AccessPointDTO apdto = position.getAccessPoint();
- AccessPointNode ap = nodeModel.findAccessPoint(apdto.getMac());
- if (ap == null) {
- // Gibt es noch nicht in unserem Modell =>
- // Schnell erzeugen
- ap = new AccessPointNode(nodeModel);
- ap.setMacAddress(apdto.getMac());
- nodeModel.addNode(ap);
- }
- ap.setId(position.getId().longValue());
- ap.setHiddenStatus(apdto.isHidden());
- // Nur Position von fixierten AccessPoints
- // beachten
- if (position.isFixed()) {
- // AccessPoint wurde fixiert
- ap.setPosition(position.getPosX().intValue(), position.getPosY().intValue(),
- position.getPosZ().intValue());
- ap.setFix(true);
- } else {
- // Loser AccessPoint gemeldet
- ap.setFix(false);
- System.out.println("Unfix accesspoint received. This was not in our contract.");
- }
- return;
- }
- // if (position.getGeoPoint() != null) {
- // GeoPointDTO gpdto = position.getGeoPoint();
- // GeoPosNode geoNode = (GeoPosNode)
- // nodeModel.findNode(gpdto.getPath());
- // if (geoNode == null) {
- // geoNode.setPosition(position.getPosX(),
- // position.getPosY());
- // geoNode.setFix(true);
- // }
- // }
- if (position.getClient() != null && position.getCharacter() != null) {
- // System.out.println("Clientposition erzeugt
- // oder aktualisiert f\xFCr Client " +
- // position.getClient().getName());
- ClientDTO clientdto = position.getClient();
- ClientNode client = (ClientNode) nodeModel.findNode(clientdto.getName());
+ // Alle APs aus seenAps werden demzufolge
+ // nicht mehr gesehen und
+ // dies teilen wir unserem Modell mit
+ for (Object seenAp : seenAps) {
+ AccessPointNode ap = (AccessPointNode) seenAp;
+ location.notSeesAccessPoint(ap);
+ }
+ }
+ }
- // Wenn eigener Client unfixiert kommt
- // Positionsangaben ignorieren
- if (client == PollHandler.this.controller.getClient() && !position.isFixed()) {
- // Aber noch schnell unfixieren
- client.setFix(false);
- System.out.println("Eigener Client wird ignoriert");
- return;
- } else if (client == PollHandler.this.controller.getClient() && position.isFixed())
- System.out.println("Eigener Client empfangen mit fixierter Position.");
+ /**
+ * Macht irgendwass
+ * @param nodeModel
+ * @param position
+ */
+ private void handleAccessPointXYZ(INodeModel nodeModel, PositionDTO position) {
+ System.out.println("Accesspointposition erzeugt oder aktualisiert.");
+ AccessPointDTO apdto = position.getAccessPoint();
+ AccessPointNode ap = nodeModel.findAccessPoint(apdto.getMac());
+ if (ap == null) {
+ // Gibt es noch nicht in unserem Modell =>
+ // Schnell erzeugen
+ ap = new AccessPointNode(nodeModel);
+ ap.setMacAddress(apdto.getMac());
+ nodeModel.addNode(ap);
+ }
+ ap.setId(position.getId());
+ ap.setHiddenStatus(apdto.isHidden());
+ // Nur Position von fixierten AccessPoints
+ // beachten
+ if (position.isFixed()) {
+ // AccessPoint wurde fixiert
+ ap.setPosition(position.getPosX(), position.getPosY(),
+ position.getPosZ());
+ ap.setFix(true);
+ } else {
+ // Loser AccessPoint gemeldet
+ ap.setFix(false);
+ System.out.println("Unfix accesspoint received. This was not in our contract.");
+ }
+ }
- // Sonst beachten wir alle Positionen die wir
- // bekommen
- if (client == null) {
- System.out.println("Neuer Client empfangen (" + clientdto.getMac() + ", "
- + clientdto.getName() + ". F\xFCge zum Graphen hinzu.");
- client = new ClientNode(nodeModel);
- client.setMacAddress(clientdto.getMac());
- client.setName(clientdto.getName());
- nodeModel.addNode(client);
- }
+ /**
+ * Macht igrnedwass!
+ * @param nodeModel
+ * @param position
+ */
+ private void handleClientXYZ(INodeModel nodeModel, PositionDTO position) {
+ ClientDTO clientdto = position.getClient();
+ ClientNode client = (ClientNode) nodeModel.findNode(clientdto.getName());
- System.out.println("Position f\xFCr Client " + client.getName() + " empfangen. fix = "
- + position.isFixed());
- // client.setPosition(position.getPosX().intValue(),
- // position.getPosY().intValue());
+ // Wenn eigener Client unfixiert kommt
+ // Positionsangaben ignorieren
+ if (client == this.controller.getClient() && !position.isFixed()) {
+ // Aber noch schnell unfixieren
+ client.setFix(false);
+ System.out.println("Eigener Client wird ignoriert");
+ return;
+ } else if (client == this.controller.getClient() && position.isFixed())
+ System.out.println("Eigener Client empfangen mit fixierter Position.");
- if (position.isFixed()) {
- // Client wurde fixiert
- client.setFix(true);
- client.setPosition(position.getPosX().intValue(), position.getPosY().intValue(),
- position.getPosZ().intValue());
- } else
- client.setFix(false);
- client.setId(position.getId().longValue());
+ // Sonst beachten wir alle Positionen die wir
+ // bekommen
+ if (client == null) {
+ System.out.println("Neuer Client empfangen (" + clientdto.getMac() + ", "
+ + clientdto.getName() + ". F\xFCge zum Graphen hinzu.");
+ client = new ClientNode(nodeModel);
+ client.setMacAddress(clientdto.getMac());
+ client.setName(clientdto.getName());
+ nodeModel.addNode(client);
+ }
- // Signalst\xE4rken usw. verwaltet der scannende
- // Client selbst
- if (client == PollHandler.this.controller.getClient()) return;
+ System.out.println("Position f\xFCr Client " + client.getName() + " empfangen. fix = "
+ + position.isFixed());
+ // client.setPosition(position.getPosX().intValue(),
+ // position.getPosY().intValue());
- // Signalcharakteristik auswerden und gesehene
- // AccessPoints ebenfalls erzeugen bzw. mit
- // ihnen Verbindungen
- // herstellen
- SignalCharacterDTO sc = position.getCharacter();
- SimpleScanResultDTO[] sr = sc.getSimpleScanResults();
- // Alle momentan gesehenen AccessPoints merken
- ArrayList seenAps = client.getSeenAccessPoints();
+ if (position.isFixed()) {
+ // Client wurde fixiert
+ client.setFix(true);
+ client.setPosition(position.getPosX(), position.getPosY(),
+ position.getPosZ());
+ } else
+ client.setFix(false);
+ client.setId(position.getId());
- if (sr != null) for (int i = 0; i < sr.length; i++) {
- SimpleScanResultDTO r = sr[i];
- String mac = r.getMacAP();
- // Gibt es ggf. einen AP mit der
- // Mac-Adresse?
- AccessPointNode ap = nodeModel.findAccessPoint(mac);
- if (ap == null) {
- // Nein
- ap = new AccessPointNode(nodeModel);
- ap.setMacAddress(mac);
- nodeModel.addNode(ap);
- // ap.setName(mac);
- } else // AccessPoint nur aktualisieren?
- if (seenAps.remove(ap)) // Nur Signallevel aktualisieren
- client.setSignalLevelForAcessPoint(ap, r.getSignalLevel().doubleValue());
- else
- // Neu
- client.seesAccessPoint(ap, r.getSignalLevel().doubleValue());
- }
+ // Signalst\xE4rken usw. verwaltet der scannende
+ // Client selbst
+ if (client == this.controller.getClient()) return;
- // Alle APs aus seenAps werden demzufolge nicht
- // mehr gesehen und
- // dies teilen wir unserem Modell mit
- for (int i = 0; i < seenAps.size(); i++) {
- AccessPointNode ap = (AccessPointNode) seenAps.get(i);
- client.notSeesAccessPoint(ap);
- }
- return;
- }
- }
- System.out.println("Unbekannte Position. Kann nix anfangen damit.");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ // Signalcharakteristik auswerden und gesehene
+ // AccessPoints ebenfalls erzeugen bzw. mit
+ // ihnen Verbindungen
+ // herstellen
+ SignalCharacterDTO sc = position.getCharacter();
+ SimpleScanResultDTO[] sr = sc.getSimpleScanResults();
+ // Alle momentan gesehenen AccessPoints merken
+ ArrayList seenAps = client.getSeenAccessPoints();
- /*
- * (non-Javadoc)
- *
- * @see net.sf.magicmap.client.interfaces.ServerPollerListener#mapCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.MapDTO)
- */
- public void mapCreatedOrUpdatedOrDeleted(final MapDTO mapDTO){
+ if (sr != null) {
+ for (SimpleScanResultDTO r : sr) {
+ String mac = r.getMacAP();
+ // Gibt es ggf. einen AP mit der
+ // Mac-Adresse?
+ AccessPointNode ap = nodeModel.findAccessPoint(mac);
+ if (ap == null) {
+ // Nein
+ ap = new AccessPointNode(nodeModel);
+ ap.setMacAddress(mac);
+ nodeModel.addNode(ap);
+ // ap.setName(mac);
+ } else // AccessPoint nur aktualisieren?
+ if (seenAps.remove(ap)){ // Nur Signallevel aktualisieren
+ client.setSignalLevelForAcessPoint(ap, r.getSignalLevel());
+ Controller.getInstance().getMeasurementModel().updateScanResult(client, ap.getMacAddress(), r.getSignalLevel());
+ }
+ else{
+ client.seesAccessPoint(ap, r.getSignalLevel());
+ Controller.getInstance().getMeasurementModel().updateScanResult(client, ap.getMacAddress(), r.getSignalLevel());
+ }
+ }
+ }
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
+ // Alle APs aus seenAps werden demzufolge nicht
+ // mehr gesehen und
+ // dies teilen wir unserem Modell mit
+ for (Object seenAp : seenAps) {
+ AccessPointNode ap = (AccessPointNode) seenAp;
+ client.notSeesAccessPoint(ap);
+ }
+ }
- public void run(){
- try {
- INodeModel nodeModel = PollHandler.this.controller.getNodeModel();
- Node node = nodeModel.findNode(mapDTO.getName());
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.sf.magicmap.client.interfaces.ServerPollerListener#mapCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.MapDTO)
+ */
+ public void mapCreatedOrUpdatedOrDeleted(final MapDTO mapDTO){
- if (node == null) {
- MapNode mapNode = new MapNode(nodeModel);
- mapNode.setName(mapDTO.getName());
- mapNode.setMapInfo(mapDTO);
- nodeModel.addNode(mapNode);
- }
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ public void run(){
+ try {
+ INodeModel nodeModel = PollHandler.this.controller.getNodeModel();
+ Node node = nodeModel.findNode(mapDTO.getName());
- /*
- * (non-Javadoc)
- *
- * @see net.sf.magicmap.client.interfaces.ServerPollerListener#geoPosCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.GeoPointDTO)
- */
- public void geoPosCreatedOrUpdatedOrDeleted(final GeoPointDTO pointDTO){
+ if (node == null) {
+ MapNode mapNode = new MapNode(nodeModel);
+ mapNode.setName(mapDTO.getName());
+ mapNode.setMapInfo(mapDTO);
+ nodeModel.addNode(mapNode);
+ }
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
- public void run(){
- try {
- INodeModel nodeModel = PollHandler.this.controller.getNodeModel();
- Node node = nodeModel.findNode(pointDTO.toString());
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.sf.magicmap.client.interfaces.ServerPollerListener#geoPosCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.GeoPointDTO)
+ */
+ public void geoPosCreatedOrUpdatedOrDeleted(final GeoPointDTO pointDTO){
- if (node == null) {
- GeoPosNode geoNode = new GeoPosNode(nodeModel);
- GeoPos geoPos = new GeoPos(pointDTO.getGeoPointLong().intValue(), pointDTO.getGeoPointLat()
- .intValue(), pointDTO.getGeoPointAlt().intValue());
- geoNode.setName(pointDTO.toString());
- geoNode.setId(pointDTO.getId());
- System.err.println("created geo node: " + geoNode.getId());
- geoNode.setGeoPos(geoPos);
- nodeModel.addNode(geoNode);
- geoNode.setFix(true);
- geoNode.setPosition(pointDTO.getGeoPointX().intValue(), pointDTO.getGeoPointY().intValue(),
- 0);
- }
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ public void run(){
+ try {
+ INodeModel nodeModel = PollHandler.this.controller.getNodeModel();
+ Node node = nodeModel.findNode(pointDTO.toString());
- /*
- * (non-Javadoc)
- *
- * @see net.sf.magicmap.client.interfaces.ServerPollerListener#infoObjectCreatedorUpdatedOrDeleted(net.sf.magicmap.client.model.node.InfoObject)
- */
- public void infoObjectCreatedorUpdatedOrDeleted(final InfoObject infoObject){
+ if (node == null) {
+ GeoPosNode geoNode = new GeoPosNode(nodeModel);
+ GeoPos geoPos = new GeoPos(pointDTO.getGeoPointLong(), pointDTO.getGeoPointLat(), pointDTO.getGeoPointAlt());
+ geoNode.setName(pointDTO.toString());
+ geoNode.setId(pointDTO.getId());
+ System.err.println("created geo node: " + geoNode.getId());
+ geoNode.setGeoPos(geoPos);
+ nodeModel.addNode(geoNode);
+ geoNode.setFix(true);
+ geoNode.setPosition(pointDTO.getGeoPointX(), pointDTO.getGeoPointY(),
+ 0);
+ }
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
- public void run(){
- // try {
- // INodeModel nodeModel = controller.getNodeModel();
- // Node node = nodeModel.findNode(infoObject.getUrl());
- //
- // if (node == null) {
- // InfoObjectNode infoNode = new InfoObjectNode(nodeModel);
- // infoNode.setName(infoObject.getUrl());
- // infoNode.setDisplayName(infoObject.getName());
- // infoNode.setId(infoObject.hashCode());
- // String[] tags = infoObject.getUrl().split(",");
- // for (String string : tags) {
- // infoNode.addTag(string);
- // }
- // if
- // (infoObject.getMap().equals(Controller.getInstance().getCurrentMap().name))
- // {
- // nodeModel.addNode(infoNode);
- // infoNode.setFix(true);
- // infoNode.setPosition(infoObject.getX(),
- // infoObject.getY(), 0);
- // }
- // }
- //
- // } catch (Exception e){
- // e.printStackTrace();
- // }
- }
- });
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.sf.magicmap.client.interfaces.ServerPollerListener#infoObjectCreatedorUpdatedOrDeleted(net.sf.magicmap.client.model.node.InfoObject)
+ */
+ public void infoObjectCreatedorUpdatedOrDeleted(final InfoObject infoObject){
+
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run(){
+ // try {
+ // INodeModel nodeModel = controller.getNodeModel();
+ // Node node = nodeModel.findNode(infoObject.getUrl());
+ //
+ // if (node == null) {
+ // InfoObjectNode infoNode = new InfoObjectNode(nodeModel);
+ // infoNode.setName(infoObject.getUrl());
+ // infoNode.setDisplayName(infoObject.getName());
+ // infoNode.setId(infoObject.hashCode());
+ // String[] tags = infoObject.getUrl().split(",");
+ // for (String string : tags) {
+ // infoNode.addTag(string);
+ // }
+ // if
+ // (infoObject.getMap().equals(Controller.getInstance().getCurrentMap().name))
+ // {
+ // nodeModel.addNode(infoNode);
+ // infoNode.setFix(true);
+ // infoNode.setPosition(infoObject.getX(),
+ // infoObject.getY(), 0);
+ // }
+ // }
+ //
+ // } catch (Exception e){
+ // e.printStackTrace();
+ // }
+ }
+ });
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java 2007-01-15 23:51:04 UTC (rev 509)
@@ -0,0 +1,72 @@
+package net.sf.magicmap.client.gui.views;
+
+import net.sf.magicmap.client.measurement.Constants;
+import net.sf.magicmap.client.measurement.MeasurementUtils;
+import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+
+import javax.swing.*;
+import javax.swing.table.TableCellRenderer;
+import java.awt.*;
+
+/**
+ *
+ * @author Jan Friderici, thuebner
+ *
+ */
+class MeasureTableCellRenderer extends JPanel implements TableCellRenderer {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 2446093942494182395L;
+ private SeenAccessPoint ap;
+ private boolean avg;
+
+ public MeasureTableCellRenderer(boolean avg) {
+ setLayout(new BorderLayout());
+ this.avg = avg;
+ }
+
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
+ boolean hasFocus, int row, int column){
+
+ if (isSelected) {
+ super.setForeground(table.getSelectionForeground());
+ super.setBackground(table.getSelectionBackground());
+ } else {
+ super.setForeground(table.getForeground());
+ super.setBackground(table.getBackground());
+ }
+ this.ap = (SeenAccessPoint) value;
+
+ return this;
+ }
+
+ @Override
+ protected void paintComponent(Graphics g){
+
+ super.paintComponent(g);
+
+ Graphics2D g2 = (Graphics2D) g;
+ // Farbverlauf von rot nach gelb nach gr?n
+ GradientPaint p1 = new GradientPaint(0, 0, Color.RED, getWidth() / 2, getHeight(), Color.YELLOW);
+ GradientPaint p2 = new GradientPaint(getWidth() / 2, 0, Color.YELLOW, getWidth(), getHeight(), Color.GREEN);
+
+ //double d = 100.0 - Math.abs(avg ? ap.getAverageSignalLevel() : ap.getLastSignalLevel());
+ double d = MeasurementUtils.signalLevelToStrength(this.avg ? this.ap.getAverageSignalLevel() : this.ap
+ .getLastSignalLevel());
+
+ g2.setPaint(p1);
+ int w = (int) (getWidth() * d / Constants.MIN_SIGNALLEVEL);
+ g2.setClip(0, 2, w, getHeight() - 6);
+ g2.fillRect(0, 0, getWidth() / 2, getHeight());
+ g2.setPaint(p2);
+ g2.fillRect(getWidth() / 2, 0, getWidth() / 2, getHeight());
+ g2.setPaintMode();
+ g2.setClip(0, 0, getWidth(), getHeight());
+ g2.setBackground(UIManager.getColor("Button.darkShadow"));
+ g2.setColor(UIManager.getColor("Button.highlight"));
+ g2.draw3DRect(0, 2, w, getHeight() - 6, true);
+
+ }
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java 2007-01-14 20:56:16 UTC (rev 508)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java 2007-01-15 23:51:04 UTC (rev 509)
@@ -1,114 +1,46 @@
package net.sf.magicmap.client.gui.views;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.GradientPaint;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
+import net.sf.magicmap.client.model.measurement.MeasurementTableModel;
-import javax.swing.JPanel;
-import javax.swing.JTable;
-import javax.swing.UIManager;
-import javax.swing.table.TableCellRenderer;
+import javax.swing.*;
+import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
-import net.sf.magicmap.client.measurement.Constants;
-import net.sf.magicmap.client.measurement.MeasurementUtils;
-import net.sf.magicmap.client.model.measurement.MeasurementTableModel;
-import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
-import net.sf.magicmap.client.model.measurement.IMeasurementModel;
-
public class MeasurementTable extends JTable {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
- /**
- *
- * @param model
- */
- public MeasurementTable(IMeasurementModel model) {
- this(new MeasurementTableModel(model));
- }
+ /**
+ *
+ * @param model
+ */
+ public MeasurementTable(IMeasurementModel model) {
+ this(new MeasurementTableModel(model));
+ }
- public MeasurementTable(MeasurementTableModel model) {
- super(model);
- //setDefaultRenderer(SeenAccessPoint.class, new MeasureTableCellRenderer(true));
- // getColumnModel().getColumn(3).setCellRenderer(new MeasureTableCellRenderer(false));
- // getColumnModel().getColumn(4).setCellRenderer(new MeasureTableCellRenderer(true));
- }
+ public MeasurementTable(MeasurementTableModel model) {
+ super(model);
+ //
+ }
- @Override
- public void setModel(TableModel model){
- super.setModel(model);
- getColumnModel().getColumn(3).setCellRenderer(new MeasureTableCellRenderer(false));
- getColumnModel().getColumn(4).setCellRenderer(new MeasureTableCellRenderer(true));
- }
+ @Override
+ public void setModel(TableModel model){
+ super.setModel(model);
- /**
- *
- * @author Jan Friderici, thuebner
- *
- */
- private class MeasureTableCellRenderer extends JPanel implements TableCellRenderer {
+ }
+ @Override
+ public void addColumn(TableColumn aColumn) {
+ super.addColumn(aColumn);
+ if (3 == aColumn.getModelIndex()){
+ aColumn.setCellRenderer(new MeasureTableCellRenderer(false));
+ }else if (4 == aColumn.getModelIndex()){
+ aColumn.setCellRenderer(new MeasureTableCellRenderer(true));
+ }
+ }
- /**
- * serial version id
- */
- private static final long serialVersionUID = 2446093942494182395L;
- private SeenAccessPoint ap;
- private boolean avg;
-
- public MeasureTableCellRenderer(boolean avg) {
- setLayout(new BorderLayout());
- this.avg = avg;
- }
-
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
- boolean hasFocus, int row, int column){
-
- if (isSelected) {
- super.setForeground(table.getSelectionForeground());
- super.setBackground(table.getSelectionBackground());
- } else {
- super.setForeground(table.getForeground());
- super.setBackground(table.getBackground());
- }
- this.ap = (SeenAccessPoint) value;
-
- return this;
- }
-
- @Override
- protected void paintComponent(Graphics g){
-
- super.paintComponent(g);
-
- Graphics2D g2 = (Graphics2D) g;
- // Farbverlauf von rot nach gelb nach gr�n
- GradientPaint p1 = new GradientPaint(0, 0, Color.RED, getWidth() / 2, getHeight(), Color.YELLOW);
- GradientPaint p2 = new GradientPaint(getWidth() / 2, 0, Color.YELLOW, getWidth(), getHeight(), Color.GREEN);
-
- //double d = 100.0 - Math.abs(avg ? ap.getAverageSignalLevel() : ap.getLastSignalLevel());
- double d = MeasurementUtils.signalLevelToStrength(this.avg ? this.ap.getAverageSignalLevel() : this.ap
- .getLastSignalLevel());
-
- g2.setPaint(p1);
- int w = (int) (getWidth() * d / Constants.MIN_SIGNALLEVEL);
- g2.setClip(0, 2, w, getHeight() - 6);
- g2.fillRect(0, 0, getWidth() / 2, getHeight());
- g2.setPaint(p2);
- g2.fillRect(getWidth() / 2, 0, getWidth() / 2, getHeight());
- g2.setPaintMode();
- g2.setClip(0, 0, getWidth(), getHeight());
- g2.setBackground(UIManager.getColor("Button.darkShadow"));
- g2.setColor(UIManager.getColor("Button.highlight"));
- g2.draw3DRect(0, 2, w, getHeight() - 6, true);
-
- }
- }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java 2007-01-14 20:56:16 UTC (rev 508)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java 2007-01-15 23:51:04 UTC (rev 509)
@@ -4,81 +4,72 @@
package net.sf.magicmap.client.gui.views;
-import java.awt.Insets;
-
-import javax.swing.JComponent;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.magicmap.client.controller.Controller;
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
-import net.sf.magicmap.client.model.measurement.MeasurementTableModel;
import net.sf.magicmap.client.model.measurement.IMeasurementModel;
-import net.sf.magicmap.client.model.node.AccessPointSeerNode;
-import net.sf.magicmap.client.model.node.INodeModel;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModelSelectionEvent;
-import net.sf.magicmap.client.model.node.NodeModelSelectionListener;
+import net.sf.magicmap.client.model.measurement.MeasurementTableModel;
+import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+import net.sf.magicmap.client.model.node.*;
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+
/**
* @author thuebner
*/
public class MeasurementView extends View implements NodeModelSelectionListener {
- /**
- * serial version id
- */
- private static final long serialVersionUID = 7568742160250506631L;
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 7568742160250506631L;
- private JTable table;
- private MeasurementTableModel tableModel;
- private MeasurementTableModel tableModelOther;
+ private JTable table;
+ private MeasurementTableModel tableModel;
+ private MeasurementTableModel tableModelOther;
- public MeasurementView(IMeasurementModel model, INodeModel nodeModel) {
- super(GUIUtils.i18n("measurement"));
- this.setFrameIcon(GUIBuilder.getToolIcon(GUIConstants.ICON_MEASUREMENT));
+ public MeasurementView(IMeasurementModel model, INodeModel nodeModel) {
+ super(GUIUtils.i18n("measurement"));
+ this.setFrameIcon(GUIBuilder.getToolIcon(GUIConstants.ICON_MEASUREMENT));
- this.table = new MeasurementTable(new MeasurementTableModel(model));
- this.tableModel = (MeasurementTableModel) this.table.getModel();
+ this.table = new MeasurementTable(new MeasurementTableModel(model));
+ this.tableModel = (MeasurementTableModel) this.table.getModel();
+ this.table.setDefaultRenderer(SeenAccessPoint.class, new MeasureTableCellRenderer(true));
+ this.table.getColumnModel().getColumn(3).setCellRenderer(new MeasureTableCellRenderer(false));
+ this.table.getColumnModel().getColumn(4).setCellRenderer(new MeasureTableCellRenderer(true));
+
+ nodeModel.addNodeModelSelectionListener((MeasurementTableModel) this.table.getModel());
+ setContent(buildViewComponent());
+ nodeModel.addNodeModelSelectionListener(this);
+ }
- nodeModel.addNodeModelSelectionListener((MeasurementTableModel) this.table.getModel());
- setContent(buildViewComponent());
- nodeModel.addNodeModelSelectionListener(this);
- }
+ /* (non-Javadoc)
+ * @see java.awt.Component#getName()
+ */
+ @Override
+ public String getName(){
+ return GUIUtils.i18n("measurement", false);
+ }
- /* (non-Javadoc)
- * @see java.awt.Component#getName()
- */
- @Override
- public String getName(){
- return GUIUtils.i18n("measurement", false);
- }
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.views.View#buildViewComponent()
+ */
+ @Override
+ protected JComponent buildViewComponent(){
+ this.table.setBorder(new EmptyBorder(new Insets(3, 3, 3, 3)));
+ this.table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.views.View#buildViewComponent()
- */
- @Override
- protected JComponent buildViewComponent(){
- this.table.setBorder(new EmptyBorder(new Insets(3, 3, 3, 3)));
- this.table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
+ JScrollPane pane = new JScrollPane(this.table);
- JScrollPane pane = new JScrollPane(this.table);
+ return pane;
+ }
- return pane;
- }
-
- public void selectionChanged(NodeModelSelectionEvent selectEvent){
- Node selectedNode = selectEvent.getSelectedNode();
- if (selectedNode instanceof AccessPointSeerNode) {
- setTitle(selectedNode.getDisplayName());
- if (selectedNode == Controller.getInstance().getClient())
- this.table.setModel(this.tableModel);
- else
- this.table.setModel(this.tableModelOther);
- }
-
- }
+ public void selectionChanged(NodeModelSelectionEvent selectEvent){
+ Node selectedNode = selectEvent.getSelectedNode();
+ if (selectedNode instanceof AccessPointSeerNode) {
+ setTitle(selectedNode.getDisplayName());
+ }
+ }
}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-01-14 20:56:16 UTC (rev 508)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-01-15 23:51:04 UTC (rev 509)
@@ -1,17 +1,12 @@
package net.sf.magicmap.client.model.measurement;
-import net.sf.magicmap.client.model.node.ClientNode;
+import net.sf.magicmap.client.interfaces.MeasurementModelListener;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
-import net.sf.magicmap.client.interfaces.MeasurementModelListener;
import java.util.Collection;
/**
- * Created by IntelliJ IDEA.
- * User: jan
- * Date: 14.01.2007
- * Time: 18:49:41
- * To change this template use File | Settings | File Templates.
+ *
*/
public interface IMeasurementModel {
@@ -22,5 +17,19 @@
public void removeMeasurementModelListener(MeasurementModelListener l);
public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode);
- SeenAccessPoint getAccessPoint(ClientNode client, String mac);
+ /**
+ * Add a scanresult.
+ * @param client the client seeing the access point
+ * @param apMac the accesspoints mac
+ * @param signalLevel the signal level.
+ */
+ void updateScanResult(AccessPointSeerNode client, String apMac, double signalLevel);
+
+ /**
+ * Gets the SeenAccessPoint for a given seer.
+ * @param client the seer of the ap.
+ * @param mac th aps mac
+ * @return the SeenAccessPoint
+ */
+ SeenAccessPoint getAccessPoint(AccessPointSeerNode client, String mac);
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-14 20:56:16 UTC (rev 508)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-15 23:51:04 UTC (rev 509)
@@ -1,13 +1,11 @@
package net.sf.magicmap.client.model.measurement;
-import net.sf.magicmap.client.model.node.ClientNode;
+import net.sf.magicmap.client.interfaces.MeasurementModelListener;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
-import net.sf.magicmap.client.interfaces.MeasurementModelListener;
import javax.swing.event.EventListenerList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.Map;
/**
@@ -18,6 +16,7 @@
private final EventListenerList listeners = new EventListenerList();
private final MeasurementMap apMap = new MeasurementMap();
+
public MeasurementModel(){
}
@@ -35,6 +34,17 @@
}
}
+ public void updateScanResult(AccessPointSeerNode client, String apMac, double signalLevel){
+ SeenAccessPoint accessPoint = getAccessPoint(client, apMac);
+ if (accessPoint == null) {
+ accessPoint = new SeenAccessPoint(apMac, signalLevel);
+ addAccessPoint(client, accessPoint);
+ }else{
+ accessPoint.addSignalLevel(signalLevel);
+ updateAccessPoint(client, accessPoint);
+ }
+
+ }
/**
* Returns a list of seen access points for a given client.
* @param forNode
@@ -80,7 +90,7 @@
}
}
- p...
[truncated message content] |