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-02-18 21:02:23
|
Revision: 548 http://svn.sourceforge.net/magicmap/?rev=548&view=rev Author: Jan_fride Date: 2007-02-18 13:01:59 -0800 (Sun, 18 Feb 2007) Log Message: ----------- Added handlilng for node trees. MapNodes can contains children. (still beta) Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java Added Paths: ----------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java 2007-02-18 21:01:59 UTC (rev 548) @@ -0,0 +1,38 @@ +package net.sf.magicmap.client.model.node; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import net.sf.magicmap.client.model.node.NodeContainer.Impl; + + +public abstract class ContainerNode extends Node implements NodeContainer { + + private final NodeContainer.Impl container; + + public ContainerNode(INodeModel model) { + super(model); + container = new Impl(this); + } + + public boolean addNode(Node child){ + return container.addNode(child); + } + + public Collection<Node> getChildren(){ + return container.getChildren(); + } + + public boolean removeNode(Node child){ + return container.removeNode(child); + } + + public Iterator<Node> iterator(){ + return container.iterator(); + } + + public NodeContainer getNodeContainer(){ + return this; + } +} 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-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2007-02-18 21:01:59 UTC (rev 548) @@ -60,4 +60,6 @@ boolean isPhysical(); void setPhysical(boolean physical); + + public NodeContainer getNodeContainer(); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-18 21:01:59 UTC (rev 548) @@ -2,6 +2,7 @@ package net.sf.magicmap.client.model.node; import net.sf.magicmap.client.interfaces.NodeModelListener; +import net.sf.magicmap.client.meta.MapInfo; import net.sf.magicmap.client.model.location.INodePlacer; import java.util.ArrayList; @@ -168,6 +169,6 @@ void setNodePlacer(INodePlacer placer); INodePlacer getNodePlacer(); - void setCurrentMap(MapNode map); + void setCurrentMap(MapInfo map); MapNode getCurrentMap(); } \ No newline at end of file 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-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java 2007-02-18 21:01:59 UTC (rev 548) @@ -8,19 +8,48 @@ /** * @author Johannes Zapotoczky (joh...@za...) + * @author Jan Friderici * */ public interface InfoObject { + /** + * the url this info points to. + * @return + */ String getInfoUrl(); + /** + * + * @return an url to an webservice. + */ String getServiceUrl(); + /** + * The infoobjects type. + * text/html + * @return + */ String getInfoType(); + /** + * usually the shortcut icon. + * + * @return the url to a smale image. + */ String getDepiction(); + /** + * a Description of the info. + * + * @return + */ String getDescription(); + /** + * the title of the infoobject. + * + * @return a title or "<notitle>" + */ String getInfoTitle(); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java 2007-02-18 21:01:59 UTC (rev 548) @@ -16,8 +16,9 @@ * (currently only used for the outline view) * @author Johannes Zapotoczky (joh...@za...) */ -public class MapNode extends Node implements MapCallback { +public class MapNode extends ContainerNode implements MapCallback { + private MapInfo mapInfo; /** @@ -26,6 +27,7 @@ */ public MapNode(INodeModel model) { super(model); + } /* (non-Javadoc) 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-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2007-02-18 21:01:59 UTC (rev 548) @@ -210,5 +210,8 @@ public void setPhysical(boolean physical){ this.physical = physical; } + public NodeContainer getNodeContainer(){ + return null; + } } \ No newline at end of file Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java 2007-02-18 21:01:59 UTC (rev 548) @@ -0,0 +1,76 @@ +package net.sf.magicmap.client.model.node; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeSet; + + +/** + * a container for nodes. + * + * @author Jan Friderici + * + */ +public interface NodeContainer extends Iterable<Node>{ + + boolean addNode( Node child); + boolean removeNode ( Node child); + Collection<Node> getChildren(); + + /** + * The default implementation. + * + * @author Jan + * + */ + static final class Impl{ + + private final Node myself; + + public Impl(Node myself){ + this.myself = myself; + + } + private static final Map<Node, Collection<Node>> childMap = new HashMap<Node, Collection<Node>>(); + + public boolean addNode(Node child){ + if (!childMap.containsKey(myself)) childMap.put(myself, new HashSet<Node>()); + return childMap.get(myself).add(child); + } + + boolean removeNode (Node child){ + if (!childMap.containsKey(myself)) return false; + return childMap.get(myself).remove(child); + } + + Collection<Node> getChildren(){ + if (!childMap.containsKey(myself)) return Collections.emptyList(); + return Collections.unmodifiableCollection(childMap.get(myself)); + } + Iterator<Node> iterator(){ + if (!childMap.containsKey(myself)) return new EmptyIterytor<Node>(); + return childMap.get(myself).iterator(); + } + void clear(){ + childMap.clear(); + } + } + + public static final class EmptyIterytor<T> implements Iterator<T>{ + public boolean hasNext(){ + return false; + } + + public T next(){ + return null; + } + + public void remove(){ + } + + } +} Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-18 21:01:59 UTC (rev 548) @@ -11,6 +11,7 @@ import java.util.Map; import net.sf.magicmap.client.interfaces.NodeModelListener; +import net.sf.magicmap.client.meta.MapInfo; import net.sf.magicmap.client.model.location.INodePlacer; import net.sf.magicmap.client.model.location.jung.JungNodePlacer; @@ -38,7 +39,8 @@ private final Map<String, AccessPointNode> accesspoints; private final List<NodeModelListener> listeners; private final List<NodeModelSelectionListener> selectListeners; - + private final Map<String, MapNode> mapMap; + private Node selectedNode = Node.EMPTY_NODE; private final Log log = LogFactory.getLog(NodeModel.class); @@ -54,6 +56,7 @@ this.accesspoints = Collections.synchronizedMap(new HashMap<String, AccessPointNode>()); this.listeners = Collections.synchronizedList(new ArrayList<NodeModelListener>()); this.selectListeners = Collections.synchronizedList(new ArrayList<NodeModelSelectionListener>()); + mapMap = Collections.synchronizedMap(new HashMap<String, MapNode>()); setNodePlacer(new JungNodePlacer()); } @@ -71,6 +74,14 @@ if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen this.accesspoints.put(((AccessPointNode) node).getMacAddress(), (AccessPointNode) node); + if (MapNode.class.equals(node.getClass())){ + MapNode map = (MapNode)node; + mapMap.put(map.getMapInfo().name, map); + } + if (!MapNode.class.equals(node.getClass()) && currentMap != null){ + currentMap.getNodeContainer().addNode(node); + log.info("Map has Children: " + currentMap.getChildren().size()); + } for (NodeModelListener listener : this.listeners) { NodeModelListener l = (NodeModelListener) listener; l.nodeAddedEvent(node); @@ -272,8 +283,8 @@ return placer; } - public void setCurrentMap(MapNode map){ - this.currentMap = map; + public void setCurrentMap(MapInfo map){ + this.currentMap = mapMap.get(map.name); } public MapNode getCurrentMap(){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rad...@us...> - 2007-02-27 07:21:10
|
Revision: 580 http://svn.sourceforge.net/magicmap/?rev=580&view=rev Author: radetzki09 Date: 2007-02-26 23:21:09 -0800 (Mon, 26 Feb 2007) Log Message: ----------- made the search for clients by its mac in the (I)NodeModel possible. Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-26 20:46:14 UTC (rev 579) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-27 07:21:09 UTC (rev 580) @@ -133,6 +133,20 @@ public abstract boolean accessPointExists(String mac); /** + * + * @param mac + * @return + */ + public abstract ClientNode findClient(String mac); + + /** + * Abfrage ob ein Client mit einer mac existiert. + * @param mac the mac address of the client + * @return true if the model contains client with the given mac. + */ + public abstract boolean clientExists(String mac); + + /** * Liefert alle Knoten des Models. * @return alle Knoten des Models. */ Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-26 20:46:14 UTC (rev 579) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-27 07:21:09 UTC (rev 580) @@ -38,6 +38,7 @@ private final Map<String, Node> nodes; private final Map<String, AccessPointNode> accesspoints; + private final Map<String, ClientNode> clients; private final List<NodeModelListener> listeners; private final Map<String, MapNode> mapMap; @@ -52,6 +53,7 @@ public NodeModel() { this.nodes = Collections.synchronizedMap(new HashMap<String, Node>()); this.accesspoints = Collections.synchronizedMap(new HashMap<String, AccessPointNode>()); + this.clients = Collections.synchronizedMap(new HashMap<String, ClientNode>()); this.listeners = Collections.synchronizedList(new ArrayList<NodeModelListener>()); mapMap = Collections.synchronizedMap(new HashMap<String, MapNode>()); setNodePlacer(new JungNodePlacer()); @@ -70,6 +72,9 @@ // special handling for APs if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen this.accesspoints.put(((AccessPointNode) node).getMacAddress(), (AccessPointNode) node); + // special handling for Clients + if (node.getType() == NodeModelConstants.NODETYPE_CLIENT) // Wenn Client, dann nach MAC-Adresse extra hashen + this.clients.put(((ClientNode) node).getMacAddress(), (ClientNode) node); if (MapNode.class.equals(node.getClass())) { MapNode map = (MapNode) node; @@ -97,6 +102,9 @@ if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) { this.accesspoints.remove(((AccessPointNode) node).getMacAddress()); } + if (node.getType() == NodeModelConstants.NODETYPE_CLIENT) { + this.clients.remove(((ClientNode) node).getMacAddress()); + } // aus dem layout entfernen! this.placer.deleteNode(node); @@ -215,6 +223,19 @@ } /** + * Finds client with the given mac + * @param mac the mac to search for + * @return clientNode or null + */ + public ClientNode findClient(String mac){ + return this.clients.get(mac); + } + + public boolean clientExists(String mac){ + return this.clients.containsKey(mac); + } + + /** * Finds an access point with the given mac * @param mac the mac to search for * @return an ap or null This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <an...@us...> - 2008-02-01 13:35:25
|
Revision: 727 http://magicmap.svn.sourceforge.net/magicmap/?rev=727&view=rev Author: anweiss Date: 2008-02-01 05:35:17 -0800 (Fri, 01 Feb 2008) Log Message: ----------- added interface functions to edit the attributes hashmap for every node Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2008-02-01 12:12:41 UTC (rev 726) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2008-02-01 13:35:17 UTC (rev 727) @@ -1,5 +1,6 @@ package net.sf.magicmap.client.model.node; +import java.util.HashMap; import java.util.List; /** @@ -66,4 +67,12 @@ void setPhysical(boolean physical); public NodeContainer getNodeContainer(); + + public void setAttributes(HashMap<String, String> newAttributes); + + public HashMap<String, String> getAttributes(); + + public void addAttribute(String key, String value); + + public void removeAttribute(String key); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2008-02-01 12:12:41 UTC (rev 726) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2008-02-01 13:35:17 UTC (rev 727) @@ -255,7 +255,6 @@ this.parentNode = parentNode; } - /** * Ask if this node is a physical or information node. * @return @@ -283,4 +282,11 @@ return this.attributes; } + public void addAttribute(String key, String value){ + this.attributes.put(key, value); + } + + public void removeAttribute(String key){ + this.attributes.remove(key); + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |