|
From: <jan...@us...> - 2006-12-11 19:44:59
|
Revision: 491
http://svn.sourceforge.net/magicmap/?rev=491&view=rev
Author: jan_fride
Date: 2006-12-11 11:44:28 -0800 (Mon, 11 Dec 2006)
Log Message:
-----------
1) Edges, just an idea.
2) made the MapDialog nicer. maps with invalid image urls are marked as invalid.
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -39,7 +39,7 @@
/**
* Managet die Client-Server-Kommunikation sowie die Verbindung selbst.
- *
+ *
* @author thuebner
*/
public class SOAPServerManager extends ServerManager {
@@ -62,7 +62,7 @@
/**
* Stellt Verbindung zum Server her
- *
+ *
*/
@Override
public void connect(final ServerConnectCallback callback){
@@ -93,7 +93,7 @@
}
/**
- *
+ *
* @param callback
*/
@Override
@@ -123,7 +123,7 @@
}
/**
- *
+ *
* @param name
* @param URL
* @param width
@@ -164,10 +164,12 @@
/**
* Liefert die eindeutigen Namen der auf dem Server angelegten Karten
* zur\xFCck.
- *
+ *
* @param callback
* MapNamesCallback Objekt welches das MapNamesCallback
* implementiert um die Kartennamen bzw. die
+ * @param openDialog
+ * momentan unbenutzt
*/
@Override
public void retrieveMapNames(final MapNamesCallback callback, final boolean openDialog){
@@ -197,7 +199,7 @@
/**
* L\xE4dt Daten zu einer Karte vom Server. Das Ergebniss wird \xFCber eine
* Callback Funktionen geliefert.
- *
+ *
* @param name
* @param callback
*/
@@ -247,7 +249,7 @@
/**
* Erzeugt einen Referenzpunkt auf dem Server
- *
+ *
* @param node
* @param callback
*/
@@ -282,7 +284,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#createGeoPos(int,
* int, boolean, net.sf.magicmap.client.model.node.GeoPos,
* java.lang.String,
@@ -321,7 +323,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#createInfoObject(int,
* int, boolean, net.sf.magicmap.client.model.node.InfoObject,
* java.lang.String,
@@ -340,12 +342,12 @@
synchronized (SOAPServerManager.mutex) {
try {
// SOAPServerManager.this.mapDelegate.createInfoObject(
- // sessionId,
- // mapName,
- // x,
- // y,
- // z,
- // infoObject.getName(),
+ // sessionId,
+ // mapName,
+ // x,
+ // y,
+ // z,
+ // infoObject.getName(),
// infoObject.getUrl(),
// infoObject.getType()
// );
@@ -364,7 +366,7 @@
/**
* Entfernt einen Referenzpunkt oder die Positionierung eines AccessPoints
* oder Clients mit gegebener Id vom Server
- *
+ *
* @param node
* @param callback
*/
@@ -394,7 +396,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#deleteGeoPoint(long,
* java.lang.String,
* net.sf.magicmap.client.interfaces.DeletePositionCallback)
@@ -424,7 +426,7 @@
/**
* Bewegt einen Referenzpunkt oder die Positionierung eines AccessPoints
* oder Clients mit gegebener Id vom Server
- *
+ *
* @param node
* @param callback
*/
@@ -467,7 +469,7 @@
* Eine Position von (-1,-1) bedeutet, dass der Client nicht fixiert ist
* sondern frei beweglich ist. Es werden dann nur seine Signalst\xE4rken
* geupdatet.
- *
+ *
* @param x
* X-Koordinate bzgl. Map
* @param y
@@ -507,7 +509,7 @@
* Eine Position von (-1,-1) bedeutet, dass der Client nicht fixiert ist
* sondern frei beweglich ist. Es werden dann nur seine Signalst\xE4rken
* geupdatet.
- *
+ *
* @param x
* X-Koordinate bzgl. Map
* @param y
@@ -545,7 +547,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#setAccessPointHiddenStatus(long,
* java.lang.String, java.lang.String, boolean,
* net.sf.magicmap.client.interfaces.PositionCallback)
@@ -576,7 +578,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchPositionsFromServer(net.sf.magicmap.client.interfaces.FetchPositionsCallback)
*/
@Override
@@ -618,7 +620,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.ServerPollerListener#positionCreatedOrUpdatedOrDeleted(java.lang.String,
* long, net.sf.magicmap.client.delegate.dto.PositionDTO)
*/
@@ -674,7 +676,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#reloadMap()
*/
@Override
@@ -689,7 +691,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#closeMap()
*/
@Override
@@ -703,7 +705,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchGeoPointsFromServer(net.sf.magicmap.client.interfaces.FetchGeoPointsCallback)
*/
@Override
@@ -734,7 +736,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchMapsFromServer(net.sf.magicmap.client.interfaces.FetchMapsCallback)
*/
@Override
@@ -766,7 +768,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchInfoPointsFromServer(net.sf.magicmap.client.interfaces.FetchInfoPointsCallback)
*/
@Override
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -810,7 +810,8 @@
/* (non-Javadoc)
* @see net.sf.magicmap.client.interfaces.MapNamesCallback#mapNamesReceived(java.lang.String[])
*/
- public void addMapNamesToOutline(String[] names){
+ @Deprecated
+ public void addMapNamesToOutline(String[] names){
for (String element : names) {
MapNode node = new MapNode(new NodeModel());
Controller.getInstance().retrieveMap(element, node);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -4,6 +4,7 @@
package net.sf.magicmap.client.gui.dialogs;
+import java.awt.Component;
import java.awt.Cursor;
import java.awt.Frame;
import java.awt.event.ActionEvent;
@@ -11,6 +12,9 @@
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JList;
@@ -20,6 +24,7 @@
import javax.swing.border.EtchedBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
import net.sf.magicmap.client.controller.Controller;
import net.sf.magicmap.client.gui.utils.GUIUtils;
@@ -28,6 +33,8 @@
import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
import net.sf.magicmap.client.interfaces.MapCallback;
import net.sf.magicmap.client.meta.MapInfo;
+import net.sf.magicmap.client.model.node.INodeModel;
+import net.sf.magicmap.client.model.node.MapNode;
import net.sf.magicmap.server.dto.MapDTO;
import com.brunchboy.util.swing.relativelayout.RelativeLayout;
@@ -35,7 +42,7 @@
/**
* Ein Dialog zum Laden einer vorhandenen Karte
* @author thuebner
- *
+ *
* Refactored on 1.3.2006
* @author Johannes Zapotoczky <joh...@za...>
*/
@@ -54,6 +61,15 @@
private Cursor cursor;
private JButton ok;
+ private DefaultComboBoxModel mapModel;
+
+ /**
+ *
+ * @param owner used for Model Dialogs.
+ * @param maps th list of all maps on the server.
+ * @param listener ??
+ * @return the selected map.
+ */
public static MapInfo showDialog(Frame owner, String[] maps, LoadMapDialogListener listener){
LoadMapDialog d = new LoadMapDialog(owner, maps);
GUIUtils.locateOnScreen(d);
@@ -83,7 +99,32 @@
builder.setLeft("mapslabel", 10);
builder.setTop("mapslabel", 10);
- this.list = new JList(maps);
+ mapModel = new DefaultComboBoxModel();
+ for (String map: maps){
+ mapModel.addElement(new MapEntry(map));
+ }
+ this.list = new JList(mapModel);
+ list.setCellRenderer(new DefaultListCellRenderer(){
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int arg2, boolean arg3, boolean arg4){
+ Component cellRenderer = super.getListCellRendererComponent(list, value, arg2, arg3, arg4);
+ MapEntry entry = (MapEntry)value;
+ switch (entry.status){
+ case 1:
+ setText("<html><strike>"+entry.name + "</strike></html>");
+ break;
+ case 2:
+ setText("<html><b>"+entry.name + "</b></html>");
+ break;
+ default:
+ setText(entry.name);
+ break;
+ }
+ return cellRenderer;
+ }
+
+ });
JScrollPane pane = new JScrollPane(this.list);
builder.add(pane, "list");
builder.setLeft("list", 10);
@@ -135,8 +176,9 @@
}
}
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.interfaces.MapCallback#mapReceived(net.sf.magicmap.client.delegate.dto.MapDTO)
+ /**
+ * Callback. Tries to load the images map and if successfull enables th ok button and ads the
+ * map to the model.
*/
public void mapReceived(final MapDTO mapDTO){
try {
@@ -152,10 +194,25 @@
LoadMapDialog.this.info.imageURL = mapDTO.getImageURL().toString();
setCursor(new Cursor(Cursor.WAIT_CURSOR));
LoadMapDialog.this.preview.loadImage(LoadMapDialog.this.info.imageURL);
- if (LoadMapDialog.this.preview.getImageHeight() > -1)
+ if (LoadMapDialog.this.preview.getImageHeight() > -1){
LoadMapDialog.this.ok.setEnabled(true);
- else
+ INodeModel nodeModel = Controller.getInstance().getNodeModel();
+ MapNode node = new MapNode(nodeModel);
+ node.setDisplayName(mapDTO.getName());
+ node.setMapInfo(mapDTO);
+ nodeModel.addNode(node);
+ int selectedIndex = list.getSelectedIndex();
+ MapEntry defectMap = (MapEntry) mapModel.getElementAt(selectedIndex);
+ defectMap.status = 2;
+ }
+ else{
LoadMapDialog.this.ok.setEnabled(false);
+ int selectedIndex = list.getSelectedIndex();
+ MapEntry defectMap = (MapEntry) mapModel.getElementAt(selectedIndex);
+ defectMap.status = 1;
+ list.repaint();
+ }
+
setCursor(LoadMapDialog.this.cursor);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
@@ -185,8 +242,16 @@
*/
public void valueChanged(ListSelectionEvent e){
if (!e.getValueIsAdjusting()) {
- String map = (String) this.list.getSelectedValue();
+ String map = ((MapEntry) this.list.getSelectedValue()).name;
Controller.getInstance().retrieveMap(map, this);
}
}
+ private static final class MapEntry{
+ public MapEntry(String map){
+ name = map;
+ status = 0;
+ }
+ public final String name;
+ public int status;
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -3,6 +3,7 @@
import java.util.HashMap;
+import net.sf.magicmap.client.model.node.IMagicEdge;
import net.sf.magicmap.client.model.node.Node;
/**
@@ -38,7 +39,7 @@
* @param n2 das Ziel der Kante
* @return
*/
- public Object addEdge(Node n1, Node n2);
+ public IMagicEdge addEdge(Node n1, Node n2);
/**
* Löscht eine gerichtete Kante. (also nur eine Richtung).
@@ -99,7 +100,7 @@
}
/**
- *
+ *
* @param node
* @param type
* @param data
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -0,0 +1,22 @@
+package net.sf.magicmap.client.model.location.jung;
+
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.impl.DirectedSparseEdge;
+import net.sf.magicmap.client.model.node.IMagicEdge;
+import net.sf.magicmap.client.model.node.Node;
+
+
+public class JungEdge extends DirectedSparseEdge implements IMagicEdge{
+
+ public JungEdge(Vertex arg0, Vertex arg1) {
+ super(arg0, arg1);
+ }
+
+ public Node getSourceNode(){
+ return (Node) getSource().getUserDatum(LayoutSettings.NODE_KEY);
+ }
+
+ public Node getTargetNode(){
+ return (Node) getDest().getUserDatum(LayoutSettings.NODE_KEY);
+ }
+}
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 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -21,6 +21,7 @@
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;
@@ -41,9 +42,9 @@
/**
* Dieses Model benutzt die Layoutfunktionen von Jung und einige Angepasste
* Layoutalgorithmen um die Knotenposition zu berechnen.
- *
+ *
* @author Jan
- *
+ *
*/
public class JungNodePlacer extends DirectedSparseGraph implements INodePlacer, NodeModelListener, NodeModelConstants {
@@ -316,13 +317,22 @@
* @param node2
* @return
*/
- public Edge addEdge(Node node1, Node node2){
+ public IMagicEdge addEdge(Node node1, Node node2){
if (node1 == node2) return null;
Vertex v = findVertex(node1);
Vertex w = findVertex(node2);
- if (v == null || w == null) return null;
- return addEdge(v, w);
+ 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;
+ }
}
/**
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -0,0 +1,13 @@
+package net.sf.magicmap.client.model.node;
+
+
+/**
+ * An edge connects two Nodes. Used to hide the implementation (eg jung)
+ *
+ * @author jan
+ *
+ */
+public interface IMagicEdge {
+ public Node getSourceNode();
+ public Node getTargetNode();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 19:10:00
|
Revision: 503
http://svn.sourceforge.net/magicmap/?rev=503&view=rev
Author: jan_fride
Date: 2007-01-14 11:09:55 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
changed MeasurementModel as there should be only one ;-)
Modified Paths:
--------------
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/controller/ServerManager.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/plugin/udpscanner/WifiHandler.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -28,9 +28,9 @@
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.measurement.SeenAccessPoint;
-import net.sf.magicmap.client.model.node.AccessPointEdge;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.GeoPos;
@@ -45,8 +45,6 @@
import org.apache.log4j.xml.DOMConfigurator;
-import javax.swing.*;
-
/**
* Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den
* der Anwendung.
@@ -67,10 +65,8 @@
*/
private INodeModel nodeModel; // Model f\xFCr Graphen
- private MeasurementModel measurementModel; // Model f\xFCr Messungen
+ private IMeasurementModel measurementModel; // Model f\xFCr Messungen
- private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte
-
private ClientNode client; // Ausgezeichneter Knoten
private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen
@@ -116,10 +112,6 @@
*/
this.measurementModel = new MeasurementModel();
- /**
- * Messungen f\xFCr alle anderen?
- */
- this.measurementModelOther = new MeasurementModel();
this.scannerAllocator = new ScannerAllocator();
this.currentMap = null;
@@ -231,14 +223,14 @@
* 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);
- }
+// 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);
+// }
}
/**
@@ -264,7 +256,7 @@
*
* @return the measurement model
*/
- public MeasurementModel getMeasurementModel(){
+ public IMeasurementModel getMeasurementModel(){
return this.measurementModel;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -21,7 +21,7 @@
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.MeasurementModel;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.GeoPos;
@@ -96,7 +96,7 @@
*
* @return the measurement model
*/
- MeasurementModel getMeasurementModel();
+ IMeasurementModel getMeasurementModel();
/**
* Gibt an ob verbunden oder nicht verbunden
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -30,6 +30,7 @@
import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
import net.sf.magicmap.client.model.node.GeoPos;
import net.sf.magicmap.client.model.node.InfoObject;
+import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.server.dto.PositionDTO;
import net.sf.magicmap.server.dto.SignalCharacterDTO;
import net.sf.magicmap.server.dto.SimpleScanResultDTO;
@@ -69,7 +70,8 @@
*/
protected SignalCharacterDTO currentSignalCharacter(){
SignalCharacterDTO signalCharacter = new SignalCharacterDTO();
- Collection accessPoints = controller.getMeasurementModel().getAccessPoints();
+ ClientNode clientNode = controller.getClient();
+ Collection accessPoints = controller.getMeasurementModel().get(clientNode);
Iterator it = accessPoints.iterator();
while (it.hasNext()) {
SeenAccessPoint ap = (SeenAccessPoint) it.next();
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 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -16,9 +16,9 @@
import net.sf.magicmap.client.measurement.Constants;
import net.sf.magicmap.client.measurement.MeasurementUtils;
-import net.sf.magicmap.client.model.measurement.MeasurementModel;
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 {
@@ -30,9 +30,8 @@
/**
*
* @param model
- * @param otherModel
*/
- public MeasurementTable(MeasurementModel model) {
+ public MeasurementTable(IMeasurementModel model) {
this(new MeasurementTableModel(model));
}
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 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -15,8 +15,8 @@
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.MeasurementModel;
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;
@@ -37,13 +37,12 @@
private MeasurementTableModel tableModel;
private MeasurementTableModel tableModelOther;
- public MeasurementView(MeasurementModel model, INodeModel nodeModel) {
+ public MeasurementView(IMeasurementModel model, INodeModel nodeModel) {
super(GUIUtils.i18n("measurement"));
this.setFrameIcon(GUIBuilder.getToolIcon(GUIConstants.ICON_MEASUREMENT));
- this.table = new MeasurementTable(model);
+ this.table = new MeasurementTable(new MeasurementTableModel(model));
this.tableModel = (MeasurementTableModel) this.table.getModel();
- this.tableModelOther = new MeasurementTableModel(new MeasurementModel());
nodeModel.addNodeModelSelectionListener((MeasurementTableModel) this.table.getModel());
setContent(buildViewComponent());
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -1,123 +0,0 @@
-package net.sf.magicmap.client.model.measurement;
-
-import net.sf.magicmap.client.model.node.ClientNode;
-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;
-
-/**
- * New Model for measurements. contains all measurement made.
- *
- */
-public class NMeasurementModel implements IMeasurementModel {
-
- private final EventListenerList listeners = new EventListenerList();
- private final MeasurementMap apMap = new MeasurementMap();
- public NMeasurementModel(){
-
- }
-
- /**
- * 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);
- }
- }
-
- /**
- * Returns a list of seen access points for a given client.
- * @param forNode
- * @return
- */
- public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode){
- return apMap.get(forNode).values();
- }
-
- public void updateAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
- fireAccessPointChanged(client, ap);
- }
-
- public void removeAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
- if (apMap.remove(client, ap)){
- fireAccessPointRemoved(client, ap);
- }
- }
- public void addMeasurementModelListener(MeasurementModelListener l){
- listeners.add(MeasurementModelListener.class, l);
- }
-
- public void removeMeasurementModelListener(MeasurementModelListener l){
- listeners.remove(MeasurementModelListener.class, l);
- }
-
- protected final void fireAccessPointAdded(AccessPointSeerNode node, SeenAccessPoint ap){
- MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
- for (MeasurementModelListener l: modelListeners){
- l.seesAccessPoint(ap);
- }
- }
- protected final void fireAccessPointRemoved(AccessPointSeerNode node, SeenAccessPoint ap){
- MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
- for (MeasurementModelListener l: modelListeners){
- l.notseesAccessPoint(ap);
- }
- }
- protected final void fireAccessPointChanged(AccessPointSeerNode node, SeenAccessPoint ap){
- MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
- for (MeasurementModelListener l: modelListeners){
- l.updateAccessPoint(ap);
- }
- }
-
- public SeenAccessPoint getAccessPoint(ClientNode client, String mac){
- return apMap.get(client,mac);
- }
-
- private static class MeasurementMap extends HashMap<AccessPointSeerNode, Map<String, SeenAccessPoint>>{
-
- public boolean put(AccessPointSeerNode node, SeenAccessPoint ap){
- if (containsKey(node)){
-
- Map<String, SeenAccessPoint> map = get(node);
- boolean isNew =map.containsKey(ap.getMac());
- map.put(ap.getMac(), ap);
- return isNew;
- }
- else{
- HashMap<String, SeenAccessPoint> list = new HashMap<String, SeenAccessPoint>();
- list.put(ap.getMac(), ap);
- super.put(node, list);
- return true;
- }
- }
- public boolean remove(AccessPointSeerNode node, SeenAccessPoint ap){
- if (containsKey(node)){
- return get(node).remove(ap.getMac()) != null;
- }
- return false;
- }
-
-
- public Map<String, SeenAccessPoint> get(Object key) {
- Map<String, SeenAccessPoint> map = super.get(key);
- if (map == null) return new HashMap<String, SeenAccessPoint>();
- return map;
- }
- public SeenAccessPoint get(AccessPointSeerNode seer, String apMac) {
- return get(seer).get(apMac);
- }
- }
-
-
-}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -13,8 +13,8 @@
import net.sf.magicmap.client.measurement.interfaces.AbstractScanResult;
import net.sf.magicmap.client.measurement.interfaces.AbstractScanner;
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
-import net.sf.magicmap.client.model.measurement.MeasurementModel;
import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.node.AccessPointNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.INodeModel;
@@ -30,7 +30,7 @@
*/
public class WifiHandler extends AbstractScannerHandler {
- private MeasurementModel measurementModel;
+ private IMeasurementModel measurementModel;
private INodeModel nodeModel;
@@ -48,7 +48,7 @@
* @param client
* ClientNode
*/
- public WifiHandler(AbstractScanner canHandle, MeasurementModel mmodel, INodeModel nmodel, ClientNode client) {
+ public WifiHandler(AbstractScanner canHandle, IMeasurementModel mmodel, INodeModel nmodel, ClientNode client) {
super(canHandle);
this.measurementModel = mmodel;
this.nodeModel = nmodel;
@@ -65,7 +65,7 @@
*
* @return
*/
- public MeasurementModel getMeasurementModel(){
+ public IMeasurementModel getMeasurementModel(){
return this.measurementModel;
}
@@ -74,7 +74,7 @@
*
* @param model
*/
- public void setMeasurementModel(MeasurementModel model){
+ public void setMeasurementModel(IMeasurementModel model){
this.measurementModel = model;
}
@@ -92,7 +92,7 @@
public void run(){
String mac = result.getIdentifier();
double signalLevel = result.signalLevel;
- SeenAccessPoint ap = WifiHandler.this.measurementModel.getAccessPoint(mac);
+ SeenAccessPoint ap = WifiHandler.this.measurementModel.getAccessPoint(client, mac);
if (ap != null) {
WifiHandler.this.previous.remove(ap);
AccessPointNode node = WifiHandler.this.nodeModel.findAccessPoint(mac);
@@ -113,14 +113,14 @@
ap.addSignalLevel(signalLevel);
// Die St\xE4rke aber aus dem
// Durchschnittssignalableiten
- WifiHandler.this.measurementModel.updateAccessPoint(ap);
+ WifiHandler.this.measurementModel.updateAccessPoint(client, ap);
// AccessPoint ist aus der Berechnung ausgeschlossen
WifiHandler.this.client.setSignalLevelForAcessPoint(node, ap.getAverageSignalLevel());
}
} else {
// AccessPoint ist noch nicht im Model.
ap = new SeenAccessPoint(mac, signalLevel);
- WifiHandler.this.measurementModel.addAccessPoint(ap);
+ WifiHandler.this.measurementModel.addAccessPoint(client, ap);
// Schauen ob der Access Point dann evtl. im NodeModel
// schon vorhanden ist
AccessPointNode node = WifiHandler.this.nodeModel.findAccessPoint(mac);
@@ -165,7 +165,7 @@
SeenAccessPoint ap = (SeenAccessPoint) it.next();
// Den Durchschnitt dr\xFCcken...
ap.addDeadSignal();
- WifiHandler.this.measurementModel.updateAccessPoint(ap);
+ WifiHandler.this.measurementModel.updateAccessPoint(client, ap);
/*
* AccessPointNode node =
* nodeModel.findAccessPoint(ap.getMac()); if (node !=
@@ -175,7 +175,7 @@
if (ap.isTotallyDead()) {
// AP nur entfernen, wenn l\xE4ngere Zeit kein Signal
// mehr
- WifiHandler.this.measurementModel.removeAccessPoint(ap);
+ WifiHandler.this.measurementModel.removeAccessPoint(client, ap);
// NodeModel aktualisieren
AccessPointNode node = WifiHandler.this.nodeModel.findAccessPoint(ap.getMac());
if (node != null) // Kante zum Access Point vom eigenen Client
@@ -195,7 +195,7 @@
// Botschaften
// die beschreiben was sich ge\xE4ndert hat.
WifiHandler.this.previous = new HashSet<SeenAccessPoint>(WifiHandler.this.measurementModel
- .getAccessPoints());
+ .get(client));
}
});
} catch (InterruptedException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 20:56:18
|
Revision: 508
http://svn.sourceforge.net/magicmap/?rev=508&view=rev
Author: jan_fride
Date: 2007-01-14 12:56:16 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
removed old pluginsystem
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 20:54:37 UTC (rev 507)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 20:56:16 UTC (rev 508)
@@ -4,47 +4,29 @@
package net.sf.magicmap.client.controller;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-
import net.sf.magicmap.client.gui.utils.GUIUtils;
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.interfaces.CreateNewMapCallback;
-import net.sf.magicmap.client.interfaces.CreatePositionCallback;
-import net.sf.magicmap.client.interfaces.DeletePositionCallback;
-import net.sf.magicmap.client.interfaces.MapCallback;
-import net.sf.magicmap.client.interfaces.MapNamesCallback;
-import net.sf.magicmap.client.interfaces.MovePositionCallback;
-import net.sf.magicmap.client.interfaces.PositionCallback;
-import net.sf.magicmap.client.interfaces.ServerConnectCallback;
-import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
+import net.sf.magicmap.client.interfaces.*;
import net.sf.magicmap.client.measurement.ScannerAllocator;
import net.sf.magicmap.client.measurement.interfaces.AbstractScanResult;
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.AccessPointSeerNode;
-import net.sf.magicmap.client.model.node.ClientNode;
-import net.sf.magicmap.client.model.node.GeoPos;
-import net.sf.magicmap.client.model.node.INodeModel;
-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.NodeModel;
-import net.sf.magicmap.client.plugin.PluginHandler;
+import net.sf.magicmap.client.model.node.*;
+import net.sf.magicmap.client.plugin.PluginManager;
import net.sf.magicmap.client.utils.Settings;
-import net.sf.magicmap.plugin.PluginManager;
-
import org.apache.log4j.xml.DOMConfigurator;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+
/**
* Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den
* der Anwendung.
@@ -298,7 +280,7 @@
this.poller.start();
// initializeScanner(); // Scanner neu initialisieren
this.scannerAllocator.startAllScanner();
- PluginHandler.getInstance().loadMap();
+
this.pluginManager.loadMap();
if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
getMapView().setTitle(
@@ -414,14 +396,10 @@
this.poller = new ServerPoller(this.serverManager, this.pollhandler);
this.serverManager.connect(callback);
- // Start all plugins
- PluginHandler.getInstance().connect();
this.pluginManager.connect();
}
public void disconnect(ServerDisconnectCallback callback){
- // Stop all plugins
- PluginHandler.getInstance().dispose();
this.pluginManager.dispose();
if (isMapLoaded()) closeMap();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-01-14 20:54:37 UTC (rev 507)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-01-14 20:56:16 UTC (rev 508)
@@ -5,33 +5,14 @@
package net.sf.magicmap.client.gui;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.rmi.RemoteException;
-
-import javax.swing.AbstractAction;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JOptionPane;
-import javax.swing.JSplitPane;
-import javax.swing.JToolBar;
-
+import com.Ostermiller.util.Browser;
+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 com.jgoodies.uif_lite.component.UIFSplitPane;
import net.sf.magicmap.client.controller.Controller;
-import net.sf.magicmap.client.gui.dialogs.AboutDialog;
-import net.sf.magicmap.client.gui.dialogs.ConnectServerDialog;
-import net.sf.magicmap.client.gui.dialogs.LoadMapDialog;
-import net.sf.magicmap.client.gui.dialogs.NewMapDialog;
-import net.sf.magicmap.client.gui.dialogs.SetProxyDialog;
-import net.sf.magicmap.client.gui.dialogs.ViewOptionsDialog;
+import net.sf.magicmap.client.gui.dialogs.*;
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
@@ -40,27 +21,22 @@
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.interfaces.CreateNewMapCallback;
-import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
-import net.sf.magicmap.client.interfaces.MapNamesCallback;
-import net.sf.magicmap.client.interfaces.ServerConnectCallback;
-import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
+import net.sf.magicmap.client.interfaces.*;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.meta.ServerConnectionInfo;
import net.sf.magicmap.client.model.node.MapNode;
import net.sf.magicmap.client.model.node.NodeModel;
import net.sf.magicmap.client.utils.Settings;
import net.sf.magicmap.client.utils.Version;
-import net.sf.magicmap.plugin.action.ShowPluginsAction;
-
import org.apache.axis.AxisFault;
-import com.Ostermiller.util.Browser;
-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 com.jgoodies.uif_lite.component.UIFSplitPane;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.rmi.RemoteException;
/**
* The main GUI window
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2007-01-14 20:54:37 UTC (rev 507)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2007-01-14 20:56:16 UTC (rev 508)
@@ -1,24 +1,19 @@
package net.sf.magicmap.client.gui.forms;
+import com.jgoodies.forms.layout.CellConstraints;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.io.SAXReader;
+
+import javax.swing.*;
import java.beans.Statement;
import java.net.URL;
import java.util.Enumeration;
-import java.util.LinkedList;
import java.util.List;
import java.util.ResourceBundle;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-
-import net.sf.magicmap.plugin.SimplePluginDescriptor;
-
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.Node;
-import org.dom4j.io.SAXReader;
-import com.jgoodies.forms.layout.CellConstraints;
-
/**
*/
public class FormLayoutReader {
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-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{
+...
[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
============...
[truncated message content] |
|
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-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: <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: <fle...@us...> - 2007-02-16 20:47:08
|
Revision: 540
http://svn.sourceforge.net/magicmap/?rev=540&view=rev
Author: flederohr
Date: 2007-02-16 12:47:06 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
changed behavior of measurement table model
now only updates for selected node
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java
trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java 2007-02-16 19:36:24 UTC (rev 539)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java 2007-02-16 20:47:06 UTC (rev 540)
@@ -5,6 +5,7 @@
package net.sf.magicmap.client.interfaces;
import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import java.util.EventListener;
@@ -13,11 +14,11 @@
*/
public interface MeasurementModelListener extends EventListener {
- public void seesAccessPoint(SeenAccessPoint ap);
+ public void seesAccessPoint(AccessPointSeerNode node, SeenAccessPoint ap);
- public void notseesAccessPoint(SeenAccessPoint ap);
+ public void notseesAccessPoint(AccessPointSeerNode node, SeenAccessPoint ap);
- public void updateAccessPoint(SeenAccessPoint ap);
+ public void updateAccessPoint(AccessPointSeerNode node, SeenAccessPoint ap);
public void updateAccessPoints();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java 2007-02-16 19:36:24 UTC (rev 539)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java 2007-02-16 20:47:06 UTC (rev 540)
@@ -30,7 +30,6 @@
result = result * Constants.MIN_SIGNALLEVEL / (Constants.MIN_SIGNALLEVEL - Constants.MAX_SIGNALLEVEL);
if (result > Constants.MIN_SIGNALLEVEL) {
result = Constants.MIN_SIGNALLEVEL;
- System.out.println(Constants.MIN_SIGNALLEVEL + " \xFCberschritten");
}
return result;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-02-16 19:36:24 UTC (rev 539)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-02-16 20:47:06 UTC (rev 540)
@@ -122,21 +122,21 @@
protected final void fireAccessPointAdded(AccessPointSeerNode node, SeenAccessPoint ap){
MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
for (MeasurementModelListener l : modelListeners) {
- l.seesAccessPoint(ap);
+ l.seesAccessPoint(node, ap);
}
}
protected final void fireAccessPointRemoved(AccessPointSeerNode node, SeenAccessPoint ap){
MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
for (MeasurementModelListener l : modelListeners) {
- l.notseesAccessPoint(ap);
+ l.notseesAccessPoint(node, ap);
}
}
protected final void fireAccessPointChanged(AccessPointSeerNode node, SeenAccessPoint ap){
MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
for (MeasurementModelListener l : modelListeners) {
- l.updateAccessPoint(ap);
+ l.updateAccessPoint(node, ap);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2007-02-16 19:36:24 UTC (rev 539)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2007-02-16 20:47:06 UTC (rev 540)
@@ -84,7 +84,7 @@
* Removes an accespoint from this model.
* @param ap the accesspoint to remove
*/
- public void notseesAccessPoint(SeenAccessPoint ap){
+ public void notseesAccessPoint(AccessPointSeerNode node, SeenAccessPoint ap){
MeasurementTableModel.log.info("notseesAccessPoint");
if (null == this.seerNode) return;
String key = ap.getMac().toLowerCase();
@@ -105,9 +105,9 @@
/**
* Adds an accesspoint to this model.
*/
- public void seesAccessPoint(SeenAccessPoint ap){
+ public void seesAccessPoint(AccessPointSeerNode node, SeenAccessPoint ap){
MeasurementTableModel.log.info("seesAccessPoint");
- if (null == this.seerNode) return;
+ if (null == this.seerNode || this.seerNode != node) return;
//ArrayList<AccessPointNode> seenAccessPoints = this.seerNode.getSeenAccessPoints();
// if (seenAccessPoints.contains(ap)) {
String key = ap.getMac().toLowerCase();
@@ -125,9 +125,9 @@
*
* @param ap the changed access point
*/
- public void updateAccessPoint(SeenAccessPoint ap){
+ public void updateAccessPoint(AccessPointSeerNode node, SeenAccessPoint ap){
// We have no seer.
- if (this.seerNode == null){
+ if (this.seerNode == null || this.seerNode != node){
return;
}
@@ -138,7 +138,7 @@
// should not happen? but does from time to time ;-)
if (row >= getRowCount()){
log.error("Row: " + row + ": RowCount: " + getRowCount());
- seesAccessPoint(ap);
+ seesAccessPoint(node, ap);
}
else if (row >= 0) {
setValueAt(ap.isDead() ? "-" : new Double(ap.getLastSignalLevel()) + " dB", row, 1);
@@ -147,7 +147,10 @@
setValueAt(ap, row, 4);
fireTableRowsUpdated(row, row);
}
- }
+ } else {
+ seesAccessPoint(node, ap);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-02-17 00:06:57
|
Revision: 541
http://svn.sourceforge.net/magicmap/?rev=541&view=rev
Author: flederohr
Date: 2007-02-16 16:06:55 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
refractoring and cleaning the source
lots of changes in model behavior
fixed some bugs
Modified Paths:
--------------
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/controller/PollHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/AbstractMapView.java
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/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/NodeModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-16 20:47:06 UTC (rev 540)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-17 00:06:55 UTC (rev 541)
@@ -4,12 +4,24 @@
package net.sf.magicmap.client.controller;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+
import net.sf.magicmap.client.gui.utils.GUIUtils;
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.interfaces.*;
+import net.sf.magicmap.client.interfaces.CreateNewMapCallback;
+import net.sf.magicmap.client.interfaces.CreatePositionCallback;
+import net.sf.magicmap.client.interfaces.DeletePositionCallback;
+import net.sf.magicmap.client.interfaces.MapCallback;
+import net.sf.magicmap.client.interfaces.MapNamesCallback;
+import net.sf.magicmap.client.interfaces.MovePositionCallback;
+import net.sf.magicmap.client.interfaces.PositionCallback;
+import net.sf.magicmap.client.interfaces.ServerConnectCallback;
+import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
import net.sf.magicmap.client.measurement.ScannerAllocator;
import net.sf.magicmap.client.measurement.interfaces.AbstractScanResult;
import net.sf.magicmap.client.measurement.interfaces.AbstractScanner;
@@ -17,15 +29,17 @@
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.measurement.MeasurementModel;
-import net.sf.magicmap.client.model.node.*;
+import net.sf.magicmap.client.model.node.ClientNode;
+import net.sf.magicmap.client.model.node.GeoPos;
+import net.sf.magicmap.client.model.node.INodeModel;
+import net.sf.magicmap.client.model.node.InfoObject;
+import net.sf.magicmap.client.model.node.Node;
+import net.sf.magicmap.client.model.node.NodeModel;
import net.sf.magicmap.client.plugin.PluginManager;
import net.sf.magicmap.client.utils.Settings;
+
import org.apache.log4j.xml.DOMConfigurator;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-
/**
* Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den
* der Anwendung.
@@ -34,47 +48,47 @@
*/
public class Controller implements IController {
- private static int numCalled = 0;
+ private static int numCalled = 0;
/**
* Die Instanz.
*/
- private static Controller controller = null;
+ private static Controller controller = null;
/**
* Das Knotenmodel.
*/
- private INodeModel nodeModel; // Model f\xFCr Graphen
+ 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 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;
+ private Collection<InfoObject> infoObjects;
- private ScannerAllocator scannerAllocator;
- private final PluginManager pluginManager;
+ private ScannerAllocator scannerAllocator;
+ private final PluginManager pluginManager;
/**
* Private constructor for singleton instance
@@ -129,7 +143,6 @@
this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel);
// registerMeasurementModelListener(measurementView);
setMeasurementViewLocal(true);
- this.nodeModel.addNodeModelListener(this.mapView);
//registerNodeModelListener(outlineView);
}
@@ -192,23 +205,6 @@
}
/**
- * 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
@@ -270,7 +266,6 @@
closeMap();
}
if (isMapLoaded() && isConnected()) {
- this.nodeModel.addNodeModelListener(this.mapView);
this.serverManager.resetTimestamp();
setMeasurementViewLocal(true);
this.poller.start();
@@ -322,7 +317,6 @@
this.poller.stop();
this.measurementModel.clear();
this.nodeModel.clear();
- this.nodeModel.removeNodeModelListener(this.mapView);
this.client = null;
}
@@ -428,40 +422,40 @@
}
}
-// /**
-// * 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());
+ // }
+ //
+ // }
+ // }
/**
*
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-16 20:47:06 UTC (rev 540)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-17 00:06:55 UTC (rev 541)
@@ -21,7 +21,6 @@
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.model.measurement.IMeasurementModel;
-import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.GeoPos;
import net.sf.magicmap.client.model.node.INodeModel;
@@ -74,13 +73,6 @@
*/
INodeModel getNodeModel();
- /**
- * Baut das MeasurementModelOther neu auf.
- *
- * @param ap -
- * the access point seer node
- */
- void buildOtherMeasurement(AccessPointSeerNode ap);
/**
* \xC4nndert die Anzeige des Measurement-Views
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-02-16 20:47:06 UTC (rev 540)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-02-17 00:06:55 UTC (rev 541)
@@ -4,15 +4,31 @@
package net.sf.magicmap.client.controller;
+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.measurement.IMeasurementModel;
-import net.sf.magicmap.client.model.node.*;
-import net.sf.magicmap.server.dto.*;
+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;
-import javax.swing.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-
/**
* Wertet die Ergebnisse des Pollers aus und gibt sie in geeigneter Weise an den
* Client weiter.
@@ -21,425 +37,422 @@
*/
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
- */
- 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 =
- 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();
- }
- }
+ 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
+ controller.getMeasurementModel().removeAccessPointSeerNode((LocationNode) node);
+ 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();
+ }
+ }
- /**
- *
- * @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);
+ /**
+ *
+ * @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());
- location.setName(position.getName());
- nodeModel.addNode(location);
+ location.setId(position.getId());
+ location.setName(position.getName());
+ nodeModel.addNode(location);
- 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 (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);
+ }
controller.getMeasurementModel().updateScanResult(location, mac, r.getSignalLevel());
- 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
+ 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 (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());
- controller.getMeasurementModel().updateScanResult (location, mac, r.getSignalLevel());
- }
- }
+ 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());
+ controller.getMeasurementModel().updateScanResult(location, mac, r.getSignalLevel());
+ }
+ }
- // 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);
- }
- }
- }
+ // Alle APs aus seenAps werden demzufolge
+ // nicht mehr gesehen und
+ // dies teile...
[truncated message content] |
|
From: <fle...@us...> - 2007-02-23 17:26:35
|
Revision: 557
http://svn.sourceforge.net/magicmap/?rev=557&view=rev
Author: flederohr
Date: 2007-02-23 09:26:24 -0800 (Fri, 23 Feb 2007)
Log Message:
-----------
Use of NodeSelectionModel in MainGUI
Modified Paths:
--------------
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/core/MagicMapApplication.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/ViewOptionsDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.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/gui/views/OutlineTree.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionListener.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-23 15:27:57 UTC (rev 556)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-23 17:26:24 UTC (rev 557)
@@ -8,11 +8,9 @@
import java.util.ArrayList;
import java.util.Collection;
+import net.sf.magicmap.client.gui.MainGUI;
import net.sf.magicmap.client.gui.utils.GUIUtils;
-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.interfaces.CreateNewMapCallback;
import net.sf.magicmap.client.interfaces.CreatePositionCallback;
import net.sf.magicmap.client.interfaces.DeletePositionCallback;
@@ -74,21 +72,13 @@
private MapInfo currentMap;
- private OutlineView outlineView;
-
- private ConsoleView consoleView;
-
- private MapView mapView;
-
- private MeasurementView measurementView;
-
private boolean invisble; // Invisible-Modus (keine Daten an Server)
// pseudo server items
private Collection<InfoObject> infoObjects;
private ScannerAllocator scannerAllocator;
- private final PluginManager pluginManager;
+ private PluginManager pluginManager;
/**
* Private constructor for singleton instance
@@ -112,16 +102,9 @@
this.pollhandler = new PollHandler(this);
- buildViews();
-
// pseudo server items
this.infoObjects = new ArrayList<InfoObject>();
// initializeScanner();
- try {
- this.pluginManager = new PluginManager(new Settings(), this);
- } catch (MalformedURLException e) {
- throw new RuntimeException(e.getMessage());
- }
}
/**
@@ -134,55 +117,6 @@
}
/**
- * 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);
- //registerNodeModelListener(outlineView);
- }
-
- /**
- * 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 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;
- }
-
- /**
* Provides the singleton controller instance (creates a new one if null)
*
* @return the singleton controller instance
@@ -205,24 +139,6 @@
}
/**
- * \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
@@ -262,23 +178,25 @@
this.nodeModel.setCurrentMap(map);
this.nodeModel.addNode(this.client);
- this.mapView.loadMap(map);
+ // TODO: Interface f\xFCr GUI mit methode loadMap()
+ ((MapView) MainGUI.getInstance().getViewComponent("mapView")).loadMap(map);
} catch (MalformedURLException e) {
System.out.println("Map loading failed." + e.getMessage());
closeMap();
}
if (isMapLoaded() && isConnected()) {
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");
+
+ // TODO: Interface f\xFCr GUI mit methode setMapTitle()
+ ((MapView) MainGUI.getInstance().getViewComponent("mapView")).setTitle(GUIUtils.i18n("map", false)
+ + " - " + this.currentMap.name + " Gr\xF6\xDFe: " + this.currentMap.realwidth + " X "
+ + this.currentMap.realheight + " cm");
}
}
@@ -314,7 +232,8 @@
e1.printStackTrace();
}
this.currentMap = null;
- this.mapView.unloadMap();
+ // TODO: Interface f\xFCr GUI mit methode unloadMap()
+ ((MapView) MainGUI.getInstance().getViewComponent("mapView")).unloadMap();
this.serverManager.closeMap();
this.poller.stop();
this.measurementModel.clear();
@@ -330,7 +249,7 @@
* @return client x position
*/
public int getClientPosX(){
- return this.mapView.getX(this.client);
+ return client.getX();
}
/**
@@ -339,7 +258,7 @@
* @return
*/
public int getClientPosY(){
- return this.mapView.getY(this.client);
+ return client.getY();
}
/**
@@ -348,7 +267,7 @@
* @return
*/
public int getClientPosZ(){
- return this.mapView.getZ(this.client);
+ return client.getZ();
}
/**
@@ -520,7 +439,9 @@
*/
public void retrieveMap(String name, MapCallback callback){
this.serverManager.retrieveMap(name, callback);
- getMapView().setTitle(GUIUtils.i18n("map", false) + " - " + name);
+ // TODO: Interface f\xFCr GUI mit methode setMapTitle()
+ ((MapView) MainGUI.getInstance().getViewComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ + name);
}
public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){
@@ -549,4 +470,13 @@
this.scannerAllocator.addScanResultHandler(handler);
}
+ public void initializePlugins(){
+ try {
+ this.pluginManager = new PluginManager(new Settings(), this);
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e.getMessage());
+ }
+
+ }
+
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-23 15:27:57 UTC (rev 556)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-23 17:26:24 UTC (rev 557)
@@ -39,50 +39,13 @@
ClientNode getClient();
/**
- * Getter for the map view
- *
- * @return the map view
- */
- MapView getMapView();
-
- /**
- * Getter for the outline view
- *
- * @return the outline view
- */
- OutlineView getOutlineView();
-
- /**
- * Getter for the console view
- *
- * @return the console view
- */
- ConsoleView getConsoleView();
-
- /**
- * Getter for the measurement view
- *
- * @return the measurement view
- */
- MeasurementView getMeasurementView();
-
- /**
* Getter for the node model
*
* @return the node model
*/
INodeModel getNodeModel();
-
/**
- * \xC4nndert die Anzeige des Measurement-Views
- *
- * @param local
- * true, wenn lokale St\xE4rken angezeigt werden sollen
- */
- void setMeasurementViewLocal(boolean local);
-
- /**
* Getter for measurement model
*
* @return the measurement model
@@ -186,18 +149,18 @@
*/
void createGeoPos(int x, int y, GeoPos geoPos, String mapName, boolean fixed, CreatePositionCallback callback);
-// /**
-// * Creates an InfoObject on the current map with the supplied parameters
-// *
-// * @param lastX
-// * @param lastY
-// * @param infoObject
-// * @param string
-// * @param b
-// * @param panel
-// */
-// void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed,
-// CreatePositionCallback callback);
+ // /**
+ // * Creates an InfoObject on the current map with the supplied parameters
+ // *
+ // * @param lastX
+ // * @param lastY
+ // * @param infoObject
+ // * @param string
+ // * @param b
+ // * @param panel
+ // */
+ // void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed,
+ // CreatePositionCallback callback);
/**
* Entfernt einen
@@ -241,4 +204,10 @@
void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner);
void addScannerHandler(AbstractScannerHandler handler);
+
+ /**
+ * Initialisiert die Plugins
+ *
+ */
+ void initializePlugins();
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java 2007-02-23 15:27:57 UTC (rev 556)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java 2007-02-23 17:26:24 UTC (rev 557)
@@ -12,6 +12,7 @@
import javax.swing.JLabel;
import javax.swing.JWindow;
+import net.sf.magicmap.client.controller.Controller;
import net.sf.magicmap.client.gui.MainGUI;
import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.utils.Settings;
@@ -55,17 +56,17 @@
GUIUtils.setPlasticLookAndFeel();
GUIUtils.setLocale(Locale.getDefault());
- // GUIUtils.setLocale(Locale.US);
+
JFrame frame = MainGUI.getInstance();
GUIUtils.locateOnScreen(frame);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ // plugins laden.
+ Controller.getInstance().initializePlugins();
+
splashScreen.setVisible(false);
splashScreen.dispose();
- // plugins laden.
- //PluginManager pm = new PluginManager(new Settings(), Controller.getInstance());
-
frame.setVisible(true);
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-23 15:27:57 UTC (rev 556)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-23 17:26:24 UTC (rev 557)
@@ -5,39 +5,66 @@
package net.sf.magicmap.client.gui;
-import com.Ostermiller.util.Browser;
-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 com.jgoodies.uif_lite.component.UIFSplitPane;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.rmi.RemoteException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JOptionPane;
+import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
+
import net.sf.magicmap.client.controller.Controller;
-import net.sf.magicmap.client.gui.dialogs.*;
+import net.sf.magicmap.client.gui.dialogs.AboutDialog;
+import net.sf.magicmap.client.gui.dialogs.ConnectServerDialog;
+import net.sf.magicmap.client.gui.dialogs.LoadMapDialog;
+import net.sf.magicmap.client.gui.dialogs.NewMapDialog;
+import net.sf.magicmap.client.gui.dialogs.SetProxyDialog;
+import net.sf.magicmap.client.gui.dialogs.ViewOptionsDialog;
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.MagicAction;
-import net.sf.magicmap.client.gui.views.*;
-import net.sf.magicmap.client.interfaces.*;
+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.interfaces.CreateNewMapCallback;
+import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
+import net.sf.magicmap.client.interfaces.MapNamesCallback;
+import net.sf.magicmap.client.interfaces.ServerConnectCallback;
+import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.meta.ServerConnectionInfo;
+import net.sf.magicmap.client.model.node.INodeSelectionModel;
import net.sf.magicmap.client.model.node.MapNode;
import net.sf.magicmap.client.model.node.NodeModel;
+import net.sf.magicmap.client.model.node.NodeSelectionModel;
import net.sf.magicmap.client.utils.Settings;
import net.sf.magicmap.client.utils.Version;
+
import org.apache.axis.AxisFault;
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-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;
+import com.Ostermiller.util.Browser;
+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 com.jgoodies.uif_lite.component.UIFSplitPane;
/**
* The main GUI window
@@ -45,808 +72,830 @@
*/
@SuppressWarnings({"JavadocReference"})
public class MainGUI extends JFrame
- implements
- ServerConnectCallback,
- ServerDisconnectCallback,
- CreateNewMapCallback,
- MapNamesCallback,
- LoadMapDialogListener {
+ implements
+ ServerConnectCallback,
+ ServerDisconnectCallback,
+ CreateNewMapCallback,
+ MapNamesCallback,
+ LoadMapDialogListener {
- /**
- * serial version id
- */
- private static final long serialVersionUID = -3842976532877305041L;
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = -3842976532877305041L;
- /**
- * singleton instance of the main GUI
- */
- private static MainGUI mainGUI = null;
+ /**
+ * singleton instance of the main GUI
+ */
+ private static MainGUI mainGUI = null;
- /**
- * Getter for the singleton instance of the main GUI
- * @return the main GUI (creates a new one if none exists)
- */
- public static MainGUI getInstance(){
- 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;
- private OutlineView outlineView;
- private MapPanel mapPanel;
- private ConsoleView consoleView;
- private MeasurementView measurementView;
- private ViewTabPanel bottomRightTabPanel;
- private RelativeLayout layout;
- private AbstractAction connectAction;
- private AbstractAction setProxyAction;
- private AbstractAction disconnectAction;
- private AbstractAction newMapAction;
- private AbstractAction loadMapAction;
- private AbstractAction exitAction;
- private AbstractAction aboutAction;
- private AbstractAction onlineHelp;
- private MapView mapView;
- private MagicAction invisibleAction;
- private MagicAction simpleView;
- private MagicAction normalView;
- private MagicAction expertView;
- private MagicAction userDefinedView;
+ /**
+ * Getter for the singleton instance of the main GUI
+ * @return the main GUI (creates a new one if none exists)
+ */
+ public static MainGUI getInstance(){
+ 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;
+ private MapPanel mapPanel;
+ private OutlineView outlineView;
+ private ConsoleView consoleView;
+ private MapView mapView;
+ private MeasurementView measurementView;
+ private ViewTabPanel bottomRightTabPanel;
+ private RelativeLayout layout;
+ private AbstractAction connectAction;
+ private AbstractAction setProxyAction;
+ private AbstractAction disconnectAction;
+ private AbstractAction newMapAction;
+ private AbstractAction loadMapAction;
+ private AbstractAction exitAction;
+ private AbstractAction aboutAction;
+ private AbstractAction onlineHelp;
+ private MagicAction invisibleAction;
+ private MagicAction simpleView;
+ private MagicAction normalView;
+ private MagicAction expertView;
+ private MagicAction userDefinedView;
+ private INodeSelectionModel nodeSelectionModel;
- private static final int numberOfdataInvocationRateAction = 10;
- private MagicAction[] dataInvocationRateAction;
+ private static final int numberOfdataInvocationRateAction = 10;
+ private MagicAction[] dataInvocationRateAction;
- /**
- * Erzeugt Hauptfenster der Anwendung.
- * Private constructor, only used by getInstance() to fulfill singleton pattern
- */
- private MainGUI() {
+ /**
+ * Erzeugt Hauptfenster der Anwendung.
+ * Private constructor, only used by getInstance() to fulfill singleton pattern
+ */
+ private MainGUI() {
- // Aktionen erstellen
- buildActions();
+ // NodeSelectionModel
+ nodeSelectionModel = new NodeSelectionModel();
+
+ // Aktionen erstellen
+ buildActions();
- // Layout vorbereiten
- this.layout = new RelativeLayout();
- Container pane = this.getContentPane();
- pane.setLayout(this.layout);
+ // Layout vorbereiten
+ this.layout = new RelativeLayout();
+ Container pane = this.getContentPane();
+ pane.setLayout(this.layout);
- // Hauptfenstereigenschaften setzen
- this.setSize(new Dimension(1024, 768));
- this.setTitle("MagicMap - Version " + Version.getVersion());
- this.setIconImage(new ImageIcon(this.getClass().getClassLoader().getResource("MagicMap.png")).getImage());
+ // Hauptfenstereigenschaften setzen
+ this.setSize(new Dimension(1024, 768));
+ this.setTitle("MagicMap - Version " + Version.getVersion());
+ this.setIconImage(new ImageIcon(this.getClass().getClassLoader().getResource("MagicMap.png")).getImage());
- //Menu erstellen
- this.menuBar = new JMenuBar();
- this.setJMenuBar(this.menuBar);
- this.menuBar.add(buildFileMenu());
- this.menuBar.add(buildViewMenu());
- this.menuBar.add(buildOptionsMenu());
- this.menuBar.add(buildHelpMenu());
+ //Menu erstellen
+ this.menuBar = new JMenuBar();
+ this.setJMenuBar(this.menuBar);
+ this.menuBar.add(buildFileMenu());
+ this.menuBar.add(buildViewMenu());
+ this.menuBar.add(buildOptionsMenu());
+ this.menuBar.add(buildHelpMenu());
- // Statusleiste erstelelen
- this.statusBar = new StatusPanel();
- this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+ // Statusleiste erstelelen
+ this.statusBar = new StatusPanel();
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
- // ToolBar erstellen
- this.toolBar = new JToolBar();
- this.toolBar.setRollover(true);
- // toolBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
- // menuBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
- addMainToolBarButtons(this.toolBar);
+ // ToolBar erstellen
+ this.toolBar = new JToolBar();
+ this.toolBar.setRollover(true);
+ // toolBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
+ // menuBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
+ addMainToolBarButtons(this.toolBar);
- // Komponenten einf\xFCgen in das ContentPane
- pane.add(this.toolBar, "toolbar");
- pane.add(buildMainPane(), "mainpane");
- pane.add(this.statusBar, "status");
+ // Komponenten einf\xFCgen in das ContentPane
+ pane.add(this.toolBar, "toolbar");
+ pane.add(buildMainPane(), "mainpane");
+ pane.add(this.statusBar, "status");
- // Einige Constrains bzgl. Layout definieren:
+ // Einige Constrains bzgl. Layout definieren:
- // ToolBar ganz oben
- this.layout.addConstraint("toolbar", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.RIGHT, 0));
- this.layout.addConstraint("toolbar", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.LEFT, 0));
- this.layout.addConstraint("toolbar", AttributeType.TOP, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.TOP, 0));
+ // ToolBar ganz oben
+ this.layout.addConstraint("toolbar", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, 0));
+ this.layout.addConstraint("toolbar", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, 0));
+ this.layout.addConstraint("toolbar", AttributeType.TOP, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.TOP, 0));
- // StatusBar ganz unten
- this.layout.addConstraint("status", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.RIGHT, -2));
- this.layout.addConstraint("status", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.LEFT, 2));
- this.layout.addConstraint("status", AttributeType.BOTTOM, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.BOTTOM, -2));
+ // StatusBar ganz unten
+ this.layout.addConstraint("status", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, -2));
+ this.layout.addConstraint("status", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, 2));
+ this.layout.addConstraint("status", AttributeType.BOTTOM, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.BOTTOM, -2));
- // Hauptpanel dazwischen mit gewissem Abstand zum ToolBar
- this.layout.addConstraint("mainpane", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.RIGHT, -GUIConstants.WINDOW_MARGIN));
- this.layout.addConstraint("mainpane", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.LEFT, GUIConstants.WINDOW_MARGIN));
- this.layout.addConstraint("mainpane", AttributeType.BOTTOM, new AttributeConstraint("status",
- 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);
- viewMap.put("bottomRightTabPanel", bottomRightTabPanel);
+ // Hauptpanel dazwischen mit gewissem Abstand zum ToolBar
+ this.layout.addConstraint("mainpane", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, -GUIConstants.WINDOW_MARGIN));
+ this.layout.addConstraint("mainpane", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, GUIConstants.WINDOW_MARGIN));
+ this.layout.addConstraint("mainpane", AttributeType.BOTTOM, new AttributeConstraint("status",
+ AttributeType.TOP, -5));
+ this.layout.addConstraint("mainpane", AttributeType.TOP, new AttributeConstraint("toolbar",
+ AttributeType.BOTTOM, GUIConstants.DIVIDER_SIZE));
+ }
- }
+ /**
+ * Action builder for the action of the GUI
+ *
+ */
+ public void buildActions(){
- /**
- * Action builder for the action of the GUI
- *
- */
- public void buildActions(){
+ this.connectAction = new MagicAction("connect", GUIConstants.ICON_CONNECT, "connecttooltip") {
- this.connectAction = new MagicAction("connect", GUIConstants.ICON_CONNECT, "connecttooltip") {
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 8256739041910656216L;
- /**
- * serial version id
- */
- private static final long serialVersionUID = 8256739041910656216L;
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
+ public void actionPerformed(ActionEvent e){
+ ServerConnectionInfo info = new ServerConnectionInfo();
+ info.hostname = Settings.getHostname();
+ info.port = Settings.getPort();
+ info.name = Settings.getClientName();
+ info.password = Settings.getClientPassword();
+ info.useNoServer = Settings.isStandAlone();
+ info = ConnectServerDialog.showDialog(MainGUI.this, info);
+ if (info != null) {
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- @Override
- public void actionPerformed(ActionEvent e){
- ServerConnectionInfo info = new ServerConnectionInfo();
- info.hostname = Settings.getHostname();
- info.port = Settings.getPort();
- info.name = Settings.getClientName();
- info.password = Settings.getClientPassword();
- info.useNoServer = Settings.isStandAlone();
- info = ConnectServerDialog.showDialog(MainGUI.this, info);
- if (info != null) {
+ Settings.setClientName(info.name);
+ Settings.setClientPassword(info.password);
+ Settings.setServerURL(info.hostname, info.port);
+ Settings.setStandAlone(info.useNoServer);
+ connect();
+ }
+ //TOD...
[truncated message content] |
|
From: <fle...@us...> - 2007-02-25 15:50:59
|
Revision: 572
http://svn.sourceforge.net/magicmap/?rev=572&view=rev
Author: flederohr
Date: 2007-02-25 07:50:28 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
Reconstructed the GUI Components
MainGUI is no longer a JFrame itself but provides a JFrame(MainFrame) as a field
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java
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/ViewTabPanel.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/ConnectServerDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/ViewOptionsDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIConstants.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/ConsoleView.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapNamesCallback.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -179,7 +179,7 @@
this.nodeModel.addNode(this.client);
// TODO: Interface f\xFCr GUI mit methode loadMap()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).loadMap(map);
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).loadMap(map);
} catch (MalformedURLException e) {
System.out.println("Map loading failed." + e.getMessage());
closeMap();
@@ -194,7 +194,7 @@
if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
// TODO: Interface f\xFCr GUI mit methode setMapTitle()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).setTitle(GUIUtils.i18n("map", false)
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false)
+ " - " + this.currentMap.name + " Gr\xF6\xDFe: " + this.currentMap.realwidth + " X "
+ this.currentMap.realheight + " cm");
}
@@ -233,7 +233,7 @@
}
this.currentMap = null;
// TODO: Interface f\xFCr GUI mit methode unloadMap()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).unloadMap();
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).unloadMap();
this.serverManager.closeMap();
this.poller.stop();
this.measurementModel.clear();
@@ -341,7 +341,6 @@
callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
else {
this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback);
- this.poller.geomapTimerTask().run();
}
}
@@ -440,7 +439,7 @@
public void retrieveMap(String name, MapCallback callback){
this.serverManager.retrieveMap(name, callback);
// TODO: Interface f\xFCr GUI mit methode setMapTitle()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ name);
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -183,8 +183,6 @@
String[] names = SOAPServerManager.this.mapDelegate.getMapNames();
if (openDialog)
callback.openMapDialog(names);
- else
- callback.addMapNamesToOutline(names);
} catch (Exception e) {
e.printStackTrace();
callback.getMapNamesError(e);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -11,7 +11,6 @@
import net.sf.magicmap.client.interfaces.FetchGeoPointsCallback;
import net.sf.magicmap.client.interfaces.FetchInfoPointsCallback;
-import net.sf.magicmap.client.interfaces.FetchMapsCallback;
import net.sf.magicmap.client.interfaces.FetchPositionsCallback;
import net.sf.magicmap.client.interfaces.ServerPollerListener;
import net.sf.magicmap.client.model.node.InfoObject;
@@ -26,12 +25,7 @@
* oder vom Anwender erzeugte Referenzpunkte.
* @author thuebner
*/
-public class ServerPoller
- implements
- FetchPositionsCallback,
- FetchGeoPointsCallback,
- FetchMapsCallback,
- FetchInfoPointsCallback {
+public class ServerPoller implements FetchPositionsCallback, FetchGeoPointsCallback, FetchInfoPointsCallback {
private static String syncObj = "TEST";
@@ -48,7 +42,7 @@
public void start(){
this.timer.scheduleAtFixedRate(builderTimerTask(), Settings.POLL_DELAY, Settings.getPollIntevall());
- this.timer.scheduleAtFixedRate(geomapTimerTask(), Settings.POLL_DELAY + 1000, 120000);
+ this.timer.scheduleAtFixedRate(geoPointsTimerTask(), Settings.POLL_DELAY + 1000, 120000);
}
public void stop(){
@@ -80,7 +74,7 @@
};
}
- public TimerTask geomapTimerTask(){
+ public TimerTask geoPointsTimerTask(){
return new TimerTask() {
@Override
@@ -89,7 +83,6 @@
if (!ServerPoller.this.isFetching) {
ServerPoller.this.isFetching = true;
ServerPoller.this.serverManager.fetchGeoPointsFromServer(ServerPoller.this);
- ServerPoller.this.serverManager.fetchMapsFromServer(ServerPoller.this);
}
}
}
@@ -168,16 +161,6 @@
}
/* (non-Javadoc)
- * @see net.sf.magicmap.client.interfaces.FetchMapsCallback#mapFetchError(java.lang.Exception)
- */
- public void mapFetchError(Exception e){
- e.printStackTrace();
- synchronized (ServerPoller.syncObj) {
- this.isFetching = false;
- }
- }
-
- /* (non-Javadoc)
* @see net.sf.magicmap.client.interfaces.FetchInfoPointsCallback#infoPointFetchError(java.lang.Exception)
*/
public void infoPointFetchError(Exception e){
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -185,8 +185,6 @@
if (openDialog) {
callback.openMapDialog(names);
- } else {
- callback.addMapNamesToOutline(names);
}
} catch (Exception e) {
e.printStackTrace();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -57,7 +57,7 @@
GUIUtils.setPlasticLookAndFeel();
GUIUtils.setLocale(Locale.getDefault());
- JFrame frame = MainGUI.getInstance();
+ JFrame frame = MainGUI.getInstance().getMainFrame();
GUIUtils.locateOnScreen(frame);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -0,0 +1,755 @@
+
+package net.sf.magicmap.client.gui;
+
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.HeadlessException;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.rmi.RemoteException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JOptionPane;
+import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
+
+import net.sf.magicmap.client.controller.Controller;
+import net.sf.magicmap.client.gui.dialogs.AboutDialog;
+import net.sf.magicmap.client.gui.dialogs.ConnectServerDialog;
+import net.sf.magicmap.client.gui.dialogs.LoadMapDialog;
+import net.sf.magicmap.client.gui.dialogs.NewMapDialog;
+import net.sf.magicmap.client.gui.dialogs.SetProxyDialog;
+import net.sf.magicmap.client.gui.dialogs.ViewOptionsDialog;
+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.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.interfaces.CreateNewMapCallback;
+import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
+import net.sf.magicmap.client.interfaces.MapNamesCallback;
+import net.sf.magicmap.client.interfaces.ServerConnectCallback;
+import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
+import net.sf.magicmap.client.meta.MapInfo;
+import net.sf.magicmap.client.meta.ServerConnectionInfo;
+import net.sf.magicmap.client.utils.Settings;
+import net.sf.magicmap.client.utils.Version;
+
+import org.apache.axis.AxisFault;
+
+import com.Ostermiller.util.Browser;
+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 com.jgoodies.uif_lite.component.UIFSplitPane;
+
+public class MainFrame extends JFrame
+implements
+ServerConnectCallback,
+ServerDisconnectCallback,
+CreateNewMapCallback,
+MapNamesCallback,
+LoadMapDialogListener {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = -3842976532877305041L;
+ private JMenuBar menuBar;
+ private JToolBar toolBar;
+ private StatusPanel statusBar;
+ private MapPanel mapPanel;
+ private OutlineView outlineView;
+ private ConsoleView consoleView;
+ private MapView mapView;
+ private MeasurementView measurementView;
+ private ViewTabPanel bottomRightTabPanel;
+ private RelativeLayout layout;
+ private AbstractAction connectAction;
+ private AbstractAction setProxyAction;
+ private AbstractAction disconnectAction;
+ private AbstractAction newMapAction;
+ private AbstractAction loadMapAction;
+ private AbstractAction exitAction;
+ private AbstractAction aboutAction;
+ private AbstractAction onlineHelp;
+ private MagicAction invisibleAction;
+ private MagicAction simpleView;
+ private MagicAction normalView;
+ private MagicAction expertView;
+ private MagicAction userDefinedView;
+ private static final int numberOfdataInvocationRateAction = 10;
+ private MagicAction[] dataInvocationRateAction;
+
+ public MainFrame() throws HeadlessException {
+ super();
+
+ // Aktionen erstellen
+ buildActions();
+
+ // Layout vorbereiten
+ this.layout = new RelativeLayout();
+ Container pane = this.getContentPane();
+ pane.setLayout(this.layout);
+
+ // Hauptfenstereigenschaften setzen
+ this.setSize(new Dimension(1024, 768));
+ this.setTitle("MagicMap - Version " + Version.getVersion());
+ this.setIconImage(GUIBuilder.getToolIcon("MagicMap.png", ".").getImage());
+
+ //Menu erstellen
+ this.menuBar = new JMenuBar();
+ this.setJMenuBar(this.menuBar);
+ this.menuBar.add(buildFileMenu());
+ this.menuBar.add(buildViewMenu());
+ this.menuBar.add(buildOptionsMenu());
+ this.menuBar.add(buildHelpMenu());
+ MainGUI.getInstance().registerJComponent(menuBar, "menuBar");
+
+ // Statusleiste erstelelen
+ this.statusBar = new StatusPanel();
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+
+ // ToolBar erstellen
+ this.toolBar = new JToolBar();
+ this.toolBar.setRollover(true);
+ // toolBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
+ // menuBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
+ addMainToolBarButtons(this.toolBar);
+
+ // Komponenten einf\xFCgen in das ContentPane
+ pane.add(this.toolBar, "toolbar");
+ pane.add(buildMainPane(), "mainpane");
+ pane.add(this.statusBar, "status");
+
+ // Einige Constrains bzgl. Layout definieren:
+
+ // ToolBar ganz oben
+ this.layout.addConstraint("toolbar", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, 0));
+ this.layout.addConstraint("toolbar", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, 0));
+ this.layout.addConstraint("toolbar", AttributeType.TOP, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.TOP, 0));
+
+ // StatusBar ganz unten
+ this.layout.addConstraint("status", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, -2));
+ this.layout.addConstraint("status", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, 2));
+ this.layout.addConstraint("status", AttributeType.BOTTOM, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.BOTTOM, -2));
+
+ // Hauptpanel dazwischen mit gewissem Abstand zum ToolBar
+ this.layout.addConstraint("mainpane", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, -GUIConstants.WINDOW_MARGIN));
+ this.layout.addConstraint("mainpane", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, GUIConstants.WINDOW_MARGIN));
+ this.layout.addConstraint("mainpane", AttributeType.BOTTOM, new AttributeConstraint("status",
+ AttributeType.TOP, -5));
+ this.layout.addConstraint("mainpane", AttributeType.TOP, new AttributeConstraint("toolbar",
+ AttributeType.BOTTOM, GUIConstants.DIVIDER_SIZE));
+
+ }
+
+ /**
+ * Build the main panel
+ * @return the main panel
+ */
+ public JComponent buildMainPane(){
+ buildViews();
+
+ UIFSplitPane pane2;
+
+ this.bottomRightTabPanel = new ViewTabPanel("bottomRightTabPanel");
+ this.bottomRightTabPanel.addView(this.measurementView);
+ this.bottomRightTabPanel.addView(this.consoleView);
+ this.bottomRightTabPanel.selectView(this.measurementView);
+
+ UIFSplitPane pane = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.outlineView,
+ (pane2 = UIFSplitPane.createStrippedSplitPane(JSplitPane.VERTICAL_SPLIT, this.mapPanel,
+ this.bottomRightTabPanel)));
+ pane.setDividerSize(GUIConstants.DIVIDER_SIZE);
+ pane.setDividerBorderVisible(false);
+ pane2.setDividerSize(GUIConstants.DIVIDER_SIZE);
+ pane2.setDividerBorderVisible(false);
+ pane2.setDividerLocation(1.0);
+ return pane;
+ }
+
+ /**
+ * Build the file menu
+ * @return the file menu
+ */
+ private JMenu buildFileMenu(){
+ JMenu menu = GUIBuilder.createMenu("file");
+ menu.add(GUIBuilder.createMenuItem(this.connectAction));
+ menu.add(GUIBuilder.createMenuItem(this.disconnectAction));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createMenuItem(this.newMapAction));
+ menu.add(GUIBuilder.createMenuItem(this.loadMapAction));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createMenuItem(this.exitAction));
+ return menu;
+ }
+
+ /**
+ * Sets the userDefinedView selected
+ *
+ */
+ public void setUserDefinedView(){
+ this.simpleView.setSelected(false);
+ this.normalView.setSelected(false);
+ this.expertView.setSelected(false);
+ this.userDefinedView.setSelected(true);
+ }
+
+ /**
+ * Build the map menu
+ * @return the map menu
+ */
+ public JMenu buildMapMenu(){
+ JMenu menu = GUIBuilder.createMenu("map");
+ menu.add(GUIBuilder.createMenuItem(this.exitAction));
+ return menu;
+ }
+
+ /**
+ * Build the view menu
+ * @return the view menu
+ */
+ public JMenu buildViewMenu(){
+ JMenu menu = GUIBuilder.createMenu("view");
+ /* menu.add(GUIBuilder.createCheckBoxMenuItem(showAccessPoints, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showClients, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showLocations, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showEdges, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showEdgesBetweenLocations, true));
+ */
+
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.simpleView, false));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.normalView, false));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.expertView, false));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.userDefinedView, false));
+ this.normalView.setSelected(true);
+ return menu;
+ }
+
+ /**
+ * Build the options menu
+ * @return the options menu
+ */
+ public JMenu buildOptionsMenu(){
+ JMenu menu = GUIBuilder.createMenu("options");
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.invisibleAction, Controller.getInstance().isInvisible()));
+ menu.add(GUIBuilder.createMenuItem(this.setProxyAction));
+ JMenu dataInvocationRate = GUIBuilder.createMenu("datainvocationrate");
+ menu.add(dataInvocationRate);
+ for (int i = 0; i < MainFrame.numberOfdataInvocationRateAction; i++)
+ dataInvocationRate.add(GUIBuilder.createCheckBoxMenuItem(this.dataInvocationRateAction[i], false));
+ this.dataInvocationRateAction[4].setSelected(true);
+
+ return menu;
+ }
+
+ /**
+ * Build the help menu
+ * @return the help menu
+ */
+ public JMenu buildHelpMenu(){
+ Browser.init();
+ JMenu menu = GUIBuilder.createMenu("help");
+ menu.add(GUIBuilder.createMenuItem(this.onlineHelp));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createMenuItem(this.aboutAction));
+ return menu;
+ }
+
+ /**
+ * Erzeugt die Hauptviews der Anwendung
+ */
+ private void buildViews(){
+ this.outlineView = new OutlineView(Controller.getInstance().getNodeModel(), "outlineView");
+ this.consoleView = new ConsoleView("consoleView");
+ this.mapView = new MapView(Controller.getInstance().getNodeModel(), null, "mapView");
+ this.measurementView = new MeasurementView(Controller.getInstance().getMeasurementModel(), Controller
+ .getInstance().getNodeModel(), "measurementView");
+ this.mapPanel = new MapPanel("mapPanel");
+ this.mapPanel.setMapView(this.mapView);
+ }
+
+ /**
+ * Add buttons to main toolbar
+ * @param bar - the toolbar
+ */
+ public void addMainToolBarButtons(JToolBar bar){
+ JButton button = null;
+ button = GUIBuilder.createToolButton(this.connectAction);
+ bar.add(button);
+ button = GUIBuilder.createToolButton(this.disconnectAction);
+ bar.add(button);
+ bar.addSeparator();
+ button = GUIBuilder.createToolButton(this.newMapAction);
+ bar.add(button);
+ button = GUIBuilder.createToolButton(this.loadMapAction);
+ bar.add(button);
+ bar.addSeparator();
+ bar.add(GUIBuilder.createToolToggleButton(this.invisibleAction));
+
+ // bar.addSeparator();
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerConnectCallback#connected(long)
+ */
+ public void connected(long sesssionId){
+
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_CONNECTED));
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.connectAction.setEnabled(false);
+ this.disconnectAction.setEnabled(true);
+ this.newMapAction.setEnabled(true);
+ this.loadMapAction.setEnabled(true);
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ // Controller.getInstance().retrieveMapNames(MainGUI.this, false);
+
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerConnectCallback#connectionError(java.lang.Exception)
+ */
+ public void connectionError(Exception e){
+ this.connectAction.setEnabled(true);
+ this.disconnectAction.setEnabled(false);
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+
+ if (e instanceof AxisFault) {
+ AxisFault f = (AxisFault) e;
+ if (GUIUtils.showAuthentificationError(f.getFaultString()))
+ connect();
+ else
+ this.connectAction.actionPerformed(new ActionEvent(this, 0, ""));
+ } else if (e instanceof RemoteException) if (GUIUtils.showConnectError())
+ connect();
+ else
+ this.connectAction.actionPerformed(new ActionEvent(this, 0, ""));
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerDisconnectCallback#disconnected()
+ */
+ public void disconnected(){
+ this.connectAction.setEnabled(true);
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.disconnectAction.setEnabled(false);
+ this.newMapAction.setEnabled(false);
+ this.loadMapAction.setEnabled(false);
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerDisconnectCallback#disconnectionError(java.lang.Exception)
+ */
+ public void disconnectionError(Exception e){
+ this.connectAction.setEnabled(true);
+ this.disconnectAction.setEnabled(false);
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+ //JOptionPane.showMessageDialog(this, "Fehler beim Trennen der Verbindung:\n\n " + e.getMessage());
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.CreateNewMapCallback#newMapCreated()
+ */
+ public void newMapCreated(MapInfo map){
+ Controller.getInstance().setCurrentMap(map);
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.CreateNewMapCallback#createNewMapError(java.lang.Exception)
+ */
+ public void createNewMapError(Exception e){
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ JOptionPane.showMessageDialog(this, "Fehler beim Erzeugen der Karte\n\n " + e.getMessage() + "\n"
+ + sw.toString());
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.MapNamesCallback#mapNamesReceived(java.lang.String[])
+ */
+ public void openMapDialog(String[] names){
+ LoadMapDialog.showDialog(this, names, this);
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.MapNamesCallback#getMapNamesError(java.lang.Exception)
+ */
+ public void getMapNamesError(Exception e){
+ // currently no implementation
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.LoadMapDialogListener#loadMap(net.sf.magicmap.client.meta.MapInfo)
+ */
+ public synchronized void loadMap(MapInfo info){
+ Controller.getInstance().setCurrentMap(info);
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.invisibleAction.setEnabled(true);
+ this.simpleView.setEnabled(true);
+ this.normalView.setEnabled(true);
+ this.expertView.setEnabled(true);
+ this.userDefinedView.setEnabled(true);
+
+ }
+
+ /**
+ * Wechselt zwischen Sichtbar und Unsichtbar
+ *
+ */
+ protected void toogleInvisible(){
+ Controller.getInstance().setInvisible(!Controller.getInstance().isInvisible());
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ }
+
+ /**
+ * Connect to server
+ */
+ protected void connect(){
+ setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_CONNECTING));
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ Controller.getInstance().connect(this);
+ }
+
+
+ /**
+ * Action builder for the action of the GUI
+ *
+ */
+ public void buildActions(){
+
+ this.connectAction = new MagicAction("connect", GUIConstants.ICON_CONNECT, "connecttooltip") {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 8256739041910656216L;
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
+ public void actionPerformed(ActionEvent e){
+ ServerConnectionInfo info = new ServerConnectionInfo();
+ info.hostname = Settings.getHostname();
+ info.port = Settings.getPort();
+ info.name = Settings.getClientName();
+ info.password = Settings.getClientPassword();
+ info.useNoServer = Settings.isStandAlone();
+ info = ConnectServerDialog.showDialog(MainFrame.this, info);
+ if (info != null) {
+
+ Settings.setClientName(info.name);
+ Settings.setClientPassword(info.password);
+ Settings.setServerURL(info.hostname, info.port);
+ Settings.setStandAlone(info.useNoServer);
+ connect();
+ }
+ //TODO: hier die Mapnamen einlesen und im Tree
+ }
+ };
+
+ this.setProxyAction = new MagicAction("setproxy", GUIConstants.ICON_CONNECT, "setproxytooltip") {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 8620117054998094069L;
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
+ public void actionPerformed(ActionEvent e){
+ SetProxyDialog.showDialog(MainFrame.this);
+ }
+ };
+
+ this.disconnectAction = new MagicAction("disconnect", GUIConstants.ICON_DISCONNECT, "disconnecttooltip") {
+
+ /**
+ * serial version id
+ ...
[truncated message content] |
|
From: <rad...@us...> - 2007-03-14 20:18:50
|
Revision: 600
http://svn.sourceforge.net/magicmap/?rev=600&view=rev
Author: radetzki09
Date: 2007-03-14 13:18:46 -0700 (Wed, 14 Mar 2007)
Log Message:
-----------
The MeasureTableCellRenderer displays only SeenAccessPoints - why? Therefore the SeenAccessPoint implements now the ISeenNode.
Second Change is a getter-methode in the MeasurementView for the measurementTable. Now its possible to add new AbstractMeasurementTableModels for new Nodes.
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.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/SeenAccessPoint.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/ISeenNode.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java 2007-03-14 19:39:17 UTC (rev 599)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasureTableCellRenderer.java 2007-03-14 20:18:46 UTC (rev 600)
@@ -14,7 +14,7 @@
import net.sf.magicmap.client.measurement.Constants;
import net.sf.magicmap.client.measurement.MeasurementUtils;
-import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+import net.sf.magicmap.client.model.measurement.ISeenNode;
/**
*
@@ -27,7 +27,7 @@
* serial version id
*/
private static final long serialVersionUID = 2446093942494182395L;
- private SeenAccessPoint ap;
+ private ISeenNode ap;
private boolean avg;
public MeasureTableCellRenderer(boolean avg) {
@@ -45,7 +45,7 @@
super.setForeground(table.getForeground());
super.setBackground(table.getBackground());
}
- this.ap = (SeenAccessPoint) value;
+ this.ap = (ISeenNode) value;
return this;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java 2007-03-14 19:39:17 UTC (rev 599)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java 2007-03-14 20:18:46 UTC (rev 600)
@@ -5,30 +5,29 @@
import java.util.Map;
import javax.swing.JTable;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
-import javax.swing.table.TableColumnModel;
-import javax.swing.table.TableModel;
import net.sf.magicmap.client.gui.MainGUI;
import net.sf.magicmap.client.model.measurement.AbstractMeasurementTableModel;
-import net.sf.magicmap.client.model.measurement.MeasurementTableModel;
-import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
-import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.INodeModelSelectionListener;
import net.sf.magicmap.client.model.node.Node;
import net.sf.magicmap.client.model.node.NodeModelSelectionEvent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
public class MeasurementTable extends JTable implements INodeModelSelectionListener {
private final Map<Class, AbstractMeasurementTableModel> tableModelMap;
-
+
+ private static final Log log = LogFactory
+ .getLog(MeasurementTable.class);
+
/**
*
*/
- private static final long serialVersionUID = 1L;
- private static final AbstractMeasurementTableModel EMPTY_TABLE_MODEL = new EmptyTableModel();
+ private static final long serialVersionUID = 1L;
+ private static final AbstractMeasurementTableModel EMPTY_TABLE_MODEL = new EmptyTableModel();
private static class EmptyTableModel extends AbstractMeasurementTableModel {
@@ -45,14 +44,19 @@
}
public void addTableModelForNode(Class node, AbstractMeasurementTableModel model){
+ MeasurementTable.log.debug("addTableModelForNode: " + node.getSimpleName() + " "
+ + model.getClass().getSimpleName());
tableModelMap.put(node, model);
}
public AbstractMeasurementTableModel getTableModelForNode(Class node){
- if (tableModelMap.containsKey(node))
+ if (tableModelMap.containsKey(node)) {
+ MeasurementTable.log.debug("getTableModelForNode: found TableModel for " + node.getSimpleName());
return tableModelMap.get(node);
- else
+ } else {
+ MeasurementTable.log.debug("getTableModelForNode: empty TableModel for " + node.getSimpleName());
return EMPTY_TABLE_MODEL;
+ }
}
@Override
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java 2007-03-14 19:39:17 UTC (rev 599)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java 2007-03-14 20:18:46 UTC (rev 600)
@@ -10,16 +10,13 @@
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableColumnModel;
import net.sf.magicmap.client.gui.MainGUI;
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.SeenAccessPoint;
-import net.sf.magicmap.client.model.node.AccessPointSeerNode;
+import net.sf.magicmap.client.model.measurement.ISeenNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.INodeModel;
import net.sf.magicmap.client.model.node.INodeModelSelectionListener;
@@ -37,18 +34,18 @@
*/
private static final long serialVersionUID = 7568742160250506631L;
- private MeasurementTable table;
+ private MeasurementTable measurementTable;
public MeasurementView(INodeModel nodeModel, String name) {
super(GUIUtils.i18n("measurement"));
this.setFrameIcon(GUIBuilder.getToolIcon(GUIConstants.ICON_MEASUREMENT));
- this.table = new MeasurementTable();
- this.table.setDefaultRenderer(SeenAccessPoint.class, new MeasureTableCellRenderer(true));
+ this.measurementTable = new MeasurementTable();
+ this.measurementTable.setDefaultRenderer(ISeenNode.class, new MeasureTableCellRenderer(true));
MeasurementTableModel tableModel = new MeasurementTableModel();
- this.table.addTableModelForNode(ClientNode.class, tableModel);
- this.table.addTableModelForNode(LocationNode.class, tableModel);
+ this.measurementTable.addTableModelForNode(ClientNode.class, tableModel);
+ this.measurementTable.addTableModelForNode(LocationNode.class, tableModel);
setContent(buildViewComponent());
@@ -69,10 +66,10 @@
*/
@Override
protected JComponent buildViewComponent(){
- this.table.setBorder(new EmptyBorder(new Insets(3, 3, 3, 3)));
- this.table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
+ this.measurementTable.setBorder(new EmptyBorder(new Insets(3, 3, 3, 3)));
+ this.measurementTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- JScrollPane pane = new JScrollPane(this.table);
+ JScrollPane pane = new JScrollPane(this.measurementTable);
return pane;
}
@@ -85,4 +82,9 @@
setTitle(getName());
}
}
+
+
+ public MeasurementTable getMeasurementTable(){
+ return measurementTable;
+ }
}
\ No newline at end of file
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/ISeenNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/ISeenNode.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/ISeenNode.java 2007-03-14 20:18:46 UTC (rev 600)
@@ -0,0 +1,27 @@
+
+package net.sf.magicmap.client.model.measurement;
+
+public interface ISeenNode {
+
+ public static final int SCAN_COUNT = 10;
+
+ public abstract String getMac();
+
+ /**
+ * Wenn AccessPoint nicht sichtbar. Ist ein starker AP nicht sichtbar wird
+ * dies verziehen, bei schwachen werden Nullwerte eingef\xFCgt.
+ *
+ */
+ public abstract void addDeadSignal();
+
+ public abstract void addSignalLevel(double signalLevel);
+
+ public abstract double getAverageSignalLevel();
+
+ public abstract boolean isDead();
+
+ public abstract boolean isTotallyDead();
+
+ public abstract double getLastSignalLevel();
+
+}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/SeenAccessPoint.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/SeenAccessPoint.java 2007-03-14 19:39:17 UTC (rev 599)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/SeenAccessPoint.java 2007-03-14 20:18:46 UTC (rev 600)
@@ -11,10 +11,8 @@
*
* @author thuebner
*/
-public class SeenAccessPoint {
+public class SeenAccessPoint implements ISeenNode {
- public static final int SCAN_COUNT = 10;
-
private double[] signalLevels; // Echter Signallevel (- xxx dB)
private double avgSignalLevel;
private String mac;
@@ -23,9 +21,9 @@
public SeenAccessPoint(String mac, double signalLevel) {
this.mac = mac;
this.deadCounter = 0;
- this.signalLevels = new double[SeenAccessPoint.SCAN_COUNT];
+ this.signalLevels = new double[ISeenNode.SCAN_COUNT];
// Beim initialisieren alle Felder vorbelegen
- for (int i = 0; i < SeenAccessPoint.SCAN_COUNT; i++)
+ for (int i = 0; i < ISeenNode.SCAN_COUNT; i++)
this.signalLevels[i] = signalLevel;
this.avgSignalLevel = signalLevel;
}
@@ -70,12 +68,12 @@
* @param signalLevel
*/
private void addSignalLevelIntern(double signalLevel){
- double[] n = new double[SeenAccessPoint.SCAN_COUNT];
- this.avgSignalLevel -= this.signalLevels[0] / SeenAccessPoint.SCAN_COUNT;
- System.arraycopy(this.signalLevels, 1, n, 0, SeenAccessPoint.SCAN_COUNT - 1);
+ double[] n = new double[ISeenNode.SCAN_COUNT];
+ this.avgSignalLevel -= this.signalLevels[0] / ISeenNode.SCAN_COUNT;
+ System.arraycopy(this.signalLevels, 1, n, 0, ISeenNode.SCAN_COUNT - 1);
this.signalLevels = n;
- this.signalLevels[SeenAccessPoint.SCAN_COUNT - 1] = signalLevel;
- this.avgSignalLevel += this.signalLevels[SeenAccessPoint.SCAN_COUNT - 1] / SeenAccessPoint.SCAN_COUNT;
+ this.signalLevels[ISeenNode.SCAN_COUNT - 1] = signalLevel;
+ this.avgSignalLevel += this.signalLevels[ISeenNode.SCAN_COUNT - 1] / ISeenNode.SCAN_COUNT;
}
public double getAverageSignalLevel(){
@@ -87,11 +85,11 @@
}
public boolean isTotallyDead(){
- return (this.deadCounter >= SeenAccessPoint.SCAN_COUNT);
+ return (this.deadCounter >= ISeenNode.SCAN_COUNT);
}
public double getLastSignalLevel(){
- return this.signalLevels[SeenAccessPoint.SCAN_COUNT - 1];
+ return this.signalLevels[ISeenNode.SCAN_COUNT - 1];
}
}
\ 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: <an...@us...> - 2007-03-19 15:34:45
|
Revision: 605
http://svn.sourceforge.net/magicmap/?rev=605&view=rev
Author: anweiss
Date: 2007-03-19 08:18:24 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
fixed bug 1683705 (exceptions on disconect) and moved all communication callbacks from the MainFrame to the controller
Modified Paths:
--------------
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/controller/PollHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-03-19 15:14:34 UTC (rev 604)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-03-19 15:18:24 UTC (rev 605)
@@ -5,6 +5,8 @@
package net.sf.magicmap.client.controller;
import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
+import java.rmi.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
@@ -42,36 +44,43 @@
*
* @author thuebner
*/
-public class Controller implements IController {
+public class Controller
+ implements
+ IController,
+ ServerDisconnectCallback,
+ ServerConnectCallback,
+ CreateNewMapCallback,
+ MapNamesCallback {
- private static int numCalled = 0;
+ private static int numCalled = 0;
+ private static int disconnectAttempts = 0;
/**
* Die Instanz.
*/
- private static Controller controller = null;
+ private static Controller controller = null;
/**
* Das Knotenmodel.
*/
- private INodeModel nodeModel; // Model f\xFCr Graphen
+ private INodeModel nodeModel; // Model f\xFCr Graphen
- 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 MapInfo currentMap;
+ private MapInfo currentMap;
- private boolean invisble; // Invisible-Modus (keine Daten an Server)
+ private boolean invisble; // Invisible-Modus (keine Daten an Server)
- private ScannerAllocator scannerAllocator;
- private PluginManager pluginManager;
+ private ScannerAllocator scannerAllocator;
+ private PluginManager pluginManager;
/**
* Private constructor for singleton instance
@@ -169,8 +178,8 @@
if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
// TODO: Interface f\xFCr GUI mit methode setMapTitle()
- ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false)
- + " - " + this.currentMap.name + " Gr\xF6\xDFe: " + this.currentMap.realwidth + " X "
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ + this.currentMap.name + " Gr\xF6\xDFe: " + this.currentMap.realwidth + " X "
+ this.currentMap.realheight + " cm");
}
}
@@ -288,12 +297,8 @@
this.pluginManager.connect();
}
- public void disconnect(ServerDisconnectCallback callback){
- this.pluginManager.dispose();
-
- if (isMapLoaded()) closeMap();
- this.serverManager.disconnect(callback);
- this.client = null;
+ public void disconnect(){
+ this.serverManager.disconnect(this);
}
/**
@@ -414,8 +419,7 @@
public void retrieveMap(String name, MapCallback callback){
this.serverManager.retrieveMap(name, callback);
// TODO: Interface f\xFCr GUI mit methode setMapTitle()
- ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
- + name);
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - " + name);
}
public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){
@@ -446,7 +450,52 @@
} catch (MalformedURLException e) {
throw new RuntimeException(e.getMessage());
}
+ }
+ public void disconnected(){
+ disconnectAttempts = 0;
+ if (isMapLoaded()) closeMap();
+ this.pluginManager.dispose();
+ this.client = null;
+ MainGUI.getInstance().getMainFrame().disconnected();
}
+ public void disconnectionError(Exception e){
+ if (++disconnectAttempts < 4) {
+ disconnect();
+ } else {
+ disconnectAttempts = 0;
+ if (isMapLoaded()) closeMap();
+ this.pluginManager.dispose();
+ this.client = null;
+ MainGUI.getInstance().getMainFrame().disconnectionError(e);
+ }
+ }
+
+ public void connected(long sesssionId){
+ MainGUI.getInstance().getMainFrame().connected(sesssionId);
+ }
+
+ public void connectionError(Exception e){
+ e.printStackTrace();
+ MainGUI.getInstance().getMainFrame().connectionError(e);
+ }
+
+ public void createNewMapError(Exception e){
+ e.printStackTrace();
+ MainGUI.getInstance().getMainFrame().createNewMapError(e);
+ }
+
+ public void newMapCreated(MapInfo map){
+ MainGUI.getInstance().getMainFrame().newMapCreated(map);
+ }
+
+ public void getMapNamesError(Exception e){
+ e.printStackTrace();
+ MainGUI.getInstance().getMainFrame().getMapNamesError(e);
+ }
+
+ public void openMapDialog(String[] names){
+ MainGUI.getInstance().getMainFrame().openMapDialog(names);
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-03-19 15:14:34 UTC (rev 604)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-03-19 15:18:24 UTC (rev 605)
@@ -120,7 +120,7 @@
void connect(ServerConnectCallback callback);
- void disconnect(ServerDisconnectCallback callback);
+ void disconnect();
/**
* Erzeugt einen Referenzpunkt auf der aktuellen Karte mit den aktuellen
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-03-19 15:14:34 UTC (rev 604)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-03-19 15:18:24 UTC (rev 605)
@@ -58,6 +58,9 @@
public void run(){
try {
+ if (!controller.isConnected()){
+ return;
+ }
INodeModel nodeModel = PollHandler.this.controller.getNodeModel();
Node node = nodeModel.findNode(position.getName());
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-03-19 15:14:34 UTC (rev 604)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-03-19 15:18:24 UTC (rev 605)
@@ -103,6 +103,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.sessionDelegate.disconnect(Settings.getClientName(), Settings
.getClientMAC(), Settings.getClientPassword(), SOAPServerManager.this.sessionId);
@@ -110,10 +111,10 @@
SOAPServerManager.this.mapDelegate = null;
SOAPServerManager.this.sessionDelegate = null;
callback.disconnected();
+ SOAPServerManager.this.sessionId = -1;
} catch (Exception e) {
callback.disconnectionError(e);
}
- SOAPServerManager.this.sessionId = -1;
}
}
};
@@ -138,6 +139,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.mapDelegate.createNewMap(SOAPServerManager.this.sessionId, name,
URL, imageWidth, imageHeight, width, height);
@@ -178,6 +180,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
String[] names = SOAPServerManager.this.mapDelegate.getMapNames();
if (openDialog)
@@ -208,6 +211,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
MapDTO mapDTO = SOAPServerManager.this.mapDelegate.getMap(name);
callback.mapReceived(mapDTO);
@@ -262,6 +266,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.positionDelgate.createOrUpdatePosition(
SOAPServerManager.this.sessionId,
@@ -303,6 +308,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.mapDelegate.createGeoPoint(SOAPServerManager.this.sessionId,
mapName, x, y, geoPos.getLongitude(), geoPos.getLatitude(), geoPos.getAltitude());
@@ -335,6 +341,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.positionDelgate.deletePosition(SOAPServerManager.this.sessionId,
mapname, positionId);
@@ -366,6 +373,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.mapDelegate.deleteGeoPoint(SOAPServerManager.this.sessionId, id);
callback.positionDeleted(id);
@@ -396,6 +404,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.positionDelgate.movePosition(SOAPServerManager.this.sessionId,
mapname, positionId, x, y, z, fixed);
@@ -445,6 +454,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.positionDelgate.createOrUpdateClientPosition(
SOAPServerManager.this.sessionId,
@@ -485,6 +495,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.positionDelgate.createOrUpdateAccessPosition(
SOAPServerManager.this.sessionId,
@@ -518,6 +529,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
SOAPServerManager.this.positionDelgate.setAccessPointHiddenStatus(
SOAPServerManager.this.sessionId,
@@ -546,6 +558,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
// retrieve and communicate common positions (WLAN, i.e.
// APs,
// clients,...)
@@ -598,6 +611,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
int x = SOAPServerManager.this.controller.getClientPosX();
int y = SOAPServerManager.this.controller.getClientPosY();
@@ -675,6 +689,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
// retrieve geo points
GeoPointDTO[] geoPoses = SOAPServerManager.this.mapDelegate.getGeoPointsForMap(
@@ -706,6 +721,7 @@
@Override
public void run(){
synchronized (SOAPServerManager.mutex) {
+ if (!isConnected()) return;
try {
// retrieve maps
String[] names = SOAPServerManager.this.mapDelegate.getMapNames();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-03-19 15:14:34 UTC (rev 604)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-03-19 15:18:24 UTC (rev 605)
@@ -123,8 +123,6 @@
}
-
-
/**
* Wird aufgerufen wenn beim \xDCbermitteln der Position irgendwelche Fehler auftreten.
* @see net.sf.magicmap.client.interfaces.FetchPositionsCallback#positionFetchError(java.lang.Exception)
@@ -145,15 +143,4 @@
this.isFetching = false;
}
}
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.interfaces.FetchInfoPointsCallback#infoPointFetchError(java.lang.Exception)
- */
- public void infoPointFetchError(Exception e){
- e.printStackTrace();
- synchronized (ServerPoller.syncObj) {
- this.isFetching = false;
- }
- }
-
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-03-19 15:14:34 UTC (rev 604)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-03-19 15:18:24 UTC (rev 605)
@@ -483,6 +483,7 @@
public void run(){
synchronized (mutex) {
+ if (!isConnected()) return;
try {
int x = controller.getClientPosX();
int y = controller.getClientPosY();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java 2007-03-19 15:14:34 UTC (rev 604)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java 2007-03-19 15:18:24 UTC (rev 605)
@@ -55,13 +55,7 @@
import com.brunchboy.util.swing.relativelayout.RelativeLayout;
import com.jgoodies.uif_lite.component.UIFSplitPane;
-public class MainFrame extends JFrame
- implements
- ServerConnectCallback,
- ServerDisconnectCallback,
- CreateNewMapCallback,
- MapNamesCallback,
- LoadMapDialogListener {
+public class MainFrame extends JFrame implements LoadMapDialogListener {
/**
* serial version id
@@ -285,8 +279,7 @@
this.outlineView = new OutlineView(Controller.getInstance().getNodeModel(), "outlineView");
this.consoleView = new ConsoleView("consoleView");
this.mapView = new MapView(Controller.getInstance().getNodeModel(), null, "mapView");
- this.measurementView = new MeasurementView(Controller
- .getInstance().getNodeModel(), "measurementView");
+ this.measurementView = new MeasurementView(Controller.getInstance().getNodeModel(), "measurementView");
this.mapPanel = new MapPanel("mapPanel");
this.mapPanel.setMapView(this.mapView);
}
@@ -366,10 +359,11 @@
*/
public void disconnectionError(Exception e){
this.connectAction.setEnabled(true);
- this.disconnectAction.setEnabled(false);
this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.disconnectAction.setEnabled(false);
+ this.newMapAction.setEnabled(false);
+ this.loadMapAction.setEnabled(false);
this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
- //JOptionPane.showMessageDialog(this, "Fehler beim Trennen der Verbindung:\n\n " + e.getMessage());
}
/* (non-Javadoc)
@@ -433,7 +427,7 @@
setCursor(new Cursor(Cursor.WAIT_CURSOR));
this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_CONNECTING));
this.statusBar.setInvisible(Controller.getInstance().isInvisible());
- Controller.getInstance().connect(this);
+ Controller.getInstance().connect(Controller.getInstance());
}
/**
@@ -501,7 +495,7 @@
*/
@Override
public void actionPerformed(ActionEvent e){
- Controller.getInstance().disconnect(MainFrame.this);
+ Controller.getInstance().disconnect();
}
};
@@ -520,7 +514,7 @@
MapInfo info = NewMapDialog.showDialog(MainFrame.this);
if (info != null)
Controller.getInstance().createNewMap(info.name, info.imageURL, info.width, info.height,
- info.realwidth, info.realheight, MainFrame.this);
+ info.realwidth, info.realheight, Controller.getInstance());
}
};
@@ -536,7 +530,7 @@
*/
@Override
public void actionPerformed(ActionEvent e){
- Controller.getInstance().retrieveMapNames(MainFrame.this, true);
+ Controller.getInstance().retrieveMapNames(Controller.getInstance(), true);
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-03-23 16:01:12
|
Revision: 618
http://svn.sourceforge.net/magicmap/?rev=618&view=rev
Author: flederohr
Date: 2007-03-23 09:01:06 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
use of i18n strings
plugin name not editable anymore
bug in display of name plugin fixed
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/DocumentUtils.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/DocumentUtils.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/DocumentUtils.java 2007-03-23 15:59:48 UTC (rev 617)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/DocumentUtils.java 2007-03-23 16:01:06 UTC (rev 618)
@@ -14,7 +14,7 @@
public String setString(Document document, String newText){
try {
- document.remove(0, document.getLength()-1);
+ document.remove(0, document.getLength());
document.insertString(0, newText, null);
} catch (BadLocationException e) {
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-03-23 15:59:48 UTC (rev 617)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-03-23 16:01:06 UTC (rev 618)
@@ -47,6 +47,7 @@
import net.sf.magicmap.client.gui.MainFrame;
import net.sf.magicmap.client.gui.MainGUI;
import net.sf.magicmap.client.gui.forms.UserInterface;
+import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.gui.utils.table.FilteredTableModel;
import net.sf.magicmap.client.gui.utils.table.NotFilter;
import net.sf.magicmap.client.gui.views.MapView;
@@ -167,8 +168,8 @@
repository = new PluginRepository(new URL("http://phl.informatik.hu-berlin.de/magicmap-plugins/"));
tableModel = new DefaultTableModel();
- tableModel.addColumn("Name");
- tableModel.addColumn("Version");
+ tableModel.addColumn(GUIUtils.i18n("plugins.name"));
+ tableModel.addColumn(GUIUtils.i18n("plugins.version"));
tableModel.addColumn("--");
installedModel = new FilteredTableModel(tableModel);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java 2007-03-23 15:59:48 UTC (rev 617)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java 2007-03-23 16:01:06 UTC (rev 618)
@@ -6,7 +6,6 @@
import javax.swing.JDialog;
import javax.swing.JFrame;
-import net.sf.magicmap.client.gui.MainGUI;
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.gui.utils.MagicAction;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java 2007-03-23 15:59:48 UTC (rev 617)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java 2007-03-23 16:01:06 UTC (rev 618)
@@ -1,6 +1,7 @@
package net.sf.magicmap.client.plugin.ui;
+import java.awt.Color;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@@ -44,7 +45,7 @@
public PluginDescriptorModel(){
-
+
}
public final Document name = new PlainDocument();
public final Document description = new PlainDocument();
@@ -92,10 +93,14 @@
JComponent proxy;
if ("PLUGIN_NAME".equals(attributeName)){
JTextField tf = new JTextField(name,name.toString(), 6);
+ tf.setEditable(false);
+ tf.setBackground(Color.white);
proxy = tf;
}
else if ("PLUGIN_DESCRIPTION".equals(attributeName)){
JTextArea tf = new JTextArea(description,description.toString(), 6,6);
+ tf.setEditable(false);
+ tf.setBackground(Color.white);
proxy = tf;
}
else if (Attributes.PluginDependencies.getName().equals(attributeName)){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-03-26 11:49:35
|
Revision: 619
http://svn.sourceforge.net/magicmap/?rev=619&view=rev
Author: flederohr
Date: 2007-03-26 04:48:48 -0700 (Mon, 26 Mar 2007)
Log Message:
-----------
made Table Cells uneditable
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/AbstractMeasurementTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/AbstractMeasurementTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/AbstractMeasurementTableModel.java 2007-03-23 16:01:06 UTC (rev 618)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/AbstractMeasurementTableModel.java 2007-03-26 11:48:48 UTC (rev 619)
@@ -11,6 +11,11 @@
super();
}
+ @Override
+ public boolean isCellEditable(int row, int column){
+ return false;
+ }
+
public abstract void setSelectedNode(Node selectedNode);
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-03-23 16:01:06 UTC (rev 618)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-03-26 11:48:48 UTC (rev 619)
@@ -154,6 +154,8 @@
final UserInterface ui = (UserInterface) plugin;
jMenu.add(new AbstractAction(plugin.getPluginInfos().getName()) {
+ private static final long serialVersionUID = 1L;
+
public void actionPerformed(ActionEvent e){
JDialog d = new JDialog(mainFrame);
d.setContentPane(ui.visualProxy("", null));
@@ -167,7 +169,15 @@
});
repository = new PluginRepository(new URL("http://phl.informatik.hu-berlin.de/magicmap-plugins/"));
- tableModel = new DefaultTableModel();
+ tableModel = new DefaultTableModel() {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isCellEditable(int row, int column){
+ return false;
+ }
+ };
tableModel.addColumn(GUIUtils.i18n("plugins.name"));
tableModel.addColumn(GUIUtils.i18n("plugins.version"));
tableModel.addColumn("--");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-03-27 14:51:18
|
Revision: 621
http://svn.sourceforge.net/magicmap/?rev=621&view=rev
Author: flederohr
Date: 2007-03-27 07:50:51 -0700 (Tue, 27 Mar 2007)
Log Message:
-----------
moved calibrationfactor into MagicMetric
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-03-26 14:55:19 UTC (rev 620)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-03-27 14:50:51 UTC (rev 621)
@@ -12,6 +12,7 @@
import net.sf.magicmap.client.algorithms.distance.MagicDistanceAlgorithm;
import net.sf.magicmap.client.measurement.Constants;
import net.sf.magicmap.client.measurement.MeasurementUtils;
+import net.sf.magicmap.client.model.location.jung.LayoutSettings;
import net.sf.magicmap.client.model.node.AccessPointNode;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.Node;
@@ -85,7 +86,7 @@
*
* @see net.sf.magicmap.client.algorithms.NodeModelMetric#metric(net.sf.magicmap.client.model.node.Node, net.sf.magicmap.client.model.node.Node)
*/
- public double metric(Node node1, Node node2){
+ public double metric(LayoutSettings settings, Node node1, Node node2){
boolean a1 = (node1.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT);
boolean a2 = (node2.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT);
@@ -96,6 +97,10 @@
boolean rc1 = (c1 || r1);
boolean rc2 = (c2 || r2);
+ // Calibreirung auf AP oder LC.
+ double calibration = (rc1 && rc2) ? settings.getCalibrationFactorLocation() : settings
+ .getCalibrationFactorAccessPoint();
+
if (a1 && a2) // Zwei AccessPoints
return Double.POSITIVE_INFINITY;
@@ -108,11 +113,11 @@
findAccessPoints(ap1, ap2, same, diff);
// Kein gemeinsamer Access Point
- if (same.size() == 0) return 1000.0;
+ if (same.size() == 0) return 1000.0 * calibration;
if (same.size() == 1) {
if (diff.size() == 0) return 0.0;
- return 1000.0;
+ return 1000.0 * calibration;
}
// Basteln von Vektoren f\xFCr die Distance-Funktion
@@ -154,7 +159,7 @@
penalty += (Constants.MIN_SIGNALLEVEL + ap1.getSignalLevelForAccessPoint(ap)); // 0.0 wenn ap1 nicht ap sieht
penalty += (Constants.MIN_SIGNALLEVEL + ap2.getSignalLevelForAccessPoint(ap)); // 0.0 wenn ap2 nicht ap sieht
}
- return (distance + penalty * Constants.PENALTY_FACTOR) * 10.0;
+ return (distance + penalty * Constants.PENALTY_FACTOR) * 10.0 * calibration;
} else if ((rc1 && a2) || (a1 && rc2)) {
// Zwischen Ort/Client und AccessPoint
AccessPointSeerNode seer;
@@ -167,7 +172,8 @@
ap = (AccessPointNode) node2;
}
// TODO: Logarithmische Skalierung
- return Math.abs(MeasurementUtils.signalLevelToStrength(seer.getSignalLevelForAccessPoint(ap)));
+ return Math.abs(MeasurementUtils.signalLevelToStrength(seer.getSignalLevelForAccessPoint(ap)))
+ * calibration;
//return Math.abs(0.3 * Math.pow(10,(-0.026 * seer.getSignalLevelForAccessPoint(ap)))-0.5);
} else
//Wir berechnen nur Abst\xE4nde zwischen APs, Clients und Referenzpunkten
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2007-03-26 14:55:19 UTC (rev 620)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2007-03-27 14:50:51 UTC (rev 621)
@@ -4,6 +4,7 @@
import java.util.HashMap;
import java.util.Map;
+import net.sf.magicmap.client.model.location.jung.LayoutSettings;
import net.sf.magicmap.client.model.node.Node;
import org.apache.commons.collections.map.MultiKeyMap;
@@ -67,14 +68,14 @@
/**
*
*/
- public double metric(Node node1, Node node2){
+ public double metric(LayoutSettings settings, Node node1, Node node2){
NodeModelMetric delegate = (NodeModelMetric) metricMap.get(node1.getClass(), node2.getClass());
- if (delegate != null) return delegate.metric(node1, node2);
+ if (delegate != null) return delegate.metric(settings, node1, node2);
delegate = genericMetrciMap.get(node1.getClass());
- if (delegate != null)return delegate.metric(node1, node2);
- return defaultMetric.metric(node1, node2);
+ if (delegate != null)return delegate.metric(settings, node1, node2);
+ return defaultMetric.metric(settings, node1, node2);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java 2007-03-26 14:55:19 UTC (rev 620)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java 2007-03-27 14:50:51 UTC (rev 621)
@@ -4,6 +4,7 @@
package net.sf.magicmap.client.algorithms;
+import net.sf.magicmap.client.model.location.jung.LayoutSettings;
import net.sf.magicmap.client.model.node.Node;
/**
@@ -21,6 +22,6 @@
* @param node2 zweiter Knoten.
* @return den Abstand zwischen den beiden Knoten.
*/
- public abstract double metric(Node node1, Node node2);
+ public abstract double metric(LayoutSettings settings, Node node1, Node node2);
}
\ No newline at end of file
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-03-26 14:55:19 UTC (rev 620)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2007-03-27 14:50:51 UTC (rev 621)
@@ -44,10 +44,7 @@
* @param n2
* @return
*/
- private double calculateLength(Node n1, Node n2, boolean c1, boolean c2){
- // Calibreirung auf AP oder LC.
- double c = (c1 && c2) ? settings.getCalibrationFactorLocation() : settings.getCalibrationFactorAccessPoint();
-
+ private double calculateLength(Node n1, Node n2){
if (settings.isCalculateHeight() && Controller.getInstance().getCurrentMap().realwidth > 0
&& Controller.getInstance().getCurrentMap().realwidth > 0) {
int diff = n1.getZ() - n2.getZ();
@@ -64,7 +61,7 @@
// b in pixel umrechnen
b = b * scale;
// System.out.println(b);
- double a = metric.metric(n1, n2) * c;
+ double a = metric.metric(settings, n1, n2);
// System.out.println("Unangepasster Wert: " + a + "
// angepasster
// Wert: " + Math.sqrt(a*a - b*b));
@@ -81,10 +78,10 @@
// System.out.println("Wert angepasst!");
return Math.sqrt(a * a - b * b);
} else {
- return metric.metric(n1, n2) * c;
+ return metric.metric(settings, n1, n2);
}
} else {
- return metric.metric(n1, n2) * c;
+ return metric.metric(settings, n1, n2);
}
}
@@ -103,7 +100,7 @@
boolean c2 = (t2 == INodeModel.NODETYPE_CLIENT || t2 == INodeModel.NODETYPE_LOCATION);
boolean clientOrLocation = (c1 && c2);
- double desiredLength = calculateLength(n1, n2, c1, c2);
+ double desiredLength = calculateLength(n1, n2);
double vx = getX(v1) - getX(v2);
double vy = getY(v1) - getY(v2);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-03-28 14:35:09
|
Revision: 623
http://svn.sourceforge.net/magicmap/?rev=623&view=rev
Author: flederohr
Date: 2007-03-28 07:35:06 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
changed access of LayoutSettings to a static way
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutSettings.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLayout.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicRepulsionFunction.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -86,7 +86,7 @@
*
* @see net.sf.magicmap.client.algorithms.NodeModelMetric#metric(net.sf.magicmap.client.model.node.Node, net.sf.magicmap.client.model.node.Node)
*/
- public double metric(LayoutSettings settings, Node node1, Node node2){
+ public double metric(Node node1, Node node2){
boolean a1 = (node1.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT);
boolean a2 = (node2.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT);
@@ -98,7 +98,7 @@
boolean rc2 = (c2 || r2);
// Calibreirung auf AP oder LC.
- double calibration = (rc1 && rc2) ? settings.getCalibrationFactorLocation() : settings
+ double calibration = (rc1 && rc2) ? LayoutSettings.getCalibrationFactorLocation() : LayoutSettings
.getCalibrationFactorAccessPoint();
if (a1 && a2) // Zwei AccessPoints
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2007-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -4,7 +4,6 @@
import java.util.HashMap;
import java.util.Map;
-import net.sf.magicmap.client.model.location.jung.LayoutSettings;
import net.sf.magicmap.client.model.node.Node;
import org.apache.commons.collections.map.MultiKeyMap;
@@ -19,10 +18,10 @@
*/
public class NodeMetricManager implements NodeModelMetric {
- private NodeModelMetric defaultMetric;
- private final MultiKeyMap metricMap = new MultiKeyMap();
- private final Map<Class<? extends Node>,NodeModelMetric> genericMetricMap = new HashMap<Class<? extends Node>, NodeModelMetric>();
-
+ private NodeModelMetric defaultMetric;
+ private final MultiKeyMap metricMap = new MultiKeyMap();
+ private final Map<Class<? extends Node>, NodeModelMetric> genericMetricMap = new HashMap<Class<? extends Node>, NodeModelMetric>();
+
public NodeMetricManager(NodeModelMetric defaultMetric) {
this.defaultMetric = defaultMetric;
}
@@ -42,20 +41,20 @@
}
/**
- * 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 (genericMetricMap.containsKey(clazz1)) {
- throw new IllegalArgumentException("Mapping for " + clazz1 + " exists");
- }
- genericMetricMap.put(clazz1, 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 (genericMetricMap.containsKey(clazz1)) {
+ throw new IllegalArgumentException("Mapping for " + clazz1 + " exists");
+ }
+ genericMetricMap.put(clazz1, metric);
+ }
+
/**
* entfernt eine Metrci
* @param clazz1
@@ -68,14 +67,14 @@
/**
*
*/
- public double metric(LayoutSettings settings, Node node1, Node node2){
+ public double metric(Node node1, Node node2){
NodeModelMetric delegate = (NodeModelMetric) metricMap.get(node1.getClass(), node2.getClass());
-
- if (delegate != null) return delegate.metric(settings, node1, node2);
+
+ if (delegate != null) return delegate.metric(node1, node2);
delegate = genericMetricMap.get(node1.getClass());
-
- if (delegate != null)return delegate.metric(settings, node1, node2);
- return defaultMetric.metric(settings, node1, node2);
+
+ if (delegate != null) return delegate.metric(node1, node2);
+ return defaultMetric.metric(node1, node2);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java 2007-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -4,7 +4,6 @@
package net.sf.magicmap.client.algorithms;
-import net.sf.magicmap.client.model.location.jung.LayoutSettings;
import net.sf.magicmap.client.model.node.Node;
/**
@@ -22,6 +21,6 @@
* @param node2 zweiter Knoten.
* @return den Abstand zwischen den beiden Knoten.
*/
- public abstract double metric(LayoutSettings settings, Node node1, Node node2);
+ public abstract double metric(Node node1, Node node2);
}
\ 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-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -1,4 +1,4 @@
-
+
package net.sf.magicmap.client.model.location.jung;
import java.awt.Dimension;
@@ -49,21 +49,9 @@
/**
* Logger
*/
- private static final Log log = LogFactory.getLog(JungNodePlacer.class);
+ private static final Log log = LogFactory.getLog(JungNodePlacer.class);
/**
- *
- */
- private static final class DefaultSettings extends LayoutSettings {
-
- }
-
- /**
- *
- */
- 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>();
@@ -105,12 +93,11 @@
private final NodeMetricManager metricManager;
- private final Object edgeLock = new Object();
- private final Object vertexLock = new Object();
+ private final Object edgeLock = new Object();
+ private final Object vertexLock = new Object();
-
public JungNodePlacer() {
- this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric());
+ this(new MagicMetric());
}
/**
@@ -126,12 +113,12 @@
* @param settings
* @param metric
*/
- public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) {
+ public JungNodePlacer(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, metricManager, settings);
+ this.layout = new MagicLayout(this, metricManager);
this.worker = new LayoutWorker(this.layout, new Dimension(800, 600));
this.workerRunning = false;
this.workerPaused = false;
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-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutSettings.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -1,5 +1,6 @@
package net.sf.magicmap.client.model.location.jung;
+
/**
* Contains the calibration settings for ur layout.
*
@@ -8,7 +9,6 @@
*/
public class LayoutSettings {
-
/**
* Um die Knoten in den Kanten zu finden.
*/
@@ -19,61 +19,55 @@
*/
public static final String NODE_DISTANCE_KEY = "NODE.distance";
- private double CALIBRATION_FACTOR_LC = 1.0; // Kanten zu Referenzpunkten
+ private static double CALIBRATION_FACTOR_LC = 1.0; // Kanten zu Referenzpunkten
- private double CALIBRATION_FACTOR_AP = 1.0; // Kanten zu APs kalibrieren
+ private static double CALIBRATION_FACTOR_AP = 1.0; // Kanten zu APs kalibrieren
- private boolean calculateHeight = false;
+ private static boolean calculateHeight = false;
- /**
- *
- *
- */
- public LayoutSettings() {
-
- }
-
- public double adjustLocationCalibration(double adjustValue){
+ public static double adjustLocationCalibration(double adjustValue){
// CF must NOT be negativ
- if ((this.CALIBRATION_FACTOR_LC + adjustValue) <= 0) {
- this.CALIBRATION_FACTOR_LC /= 10;
+ if ((CALIBRATION_FACTOR_LC + adjustValue) <= 0) {
+ CALIBRATION_FACTOR_LC /= 10;
} else {
- this.CALIBRATION_FACTOR_LC += adjustValue;
+ CALIBRATION_FACTOR_LC += adjustValue;
}
return adjustValue;
}
- public double adjustAccessPointCalibration(double adjustValue){
- if ((this.CALIBRATION_FACTOR_AP + adjustValue) <= 0) {
- this.CALIBRATION_FACTOR_AP /= 10;
+ private LayoutSettings() {};
+
+ public static double adjustAccessPointCalibration(double adjustValue){
+ if ((CALIBRATION_FACTOR_AP + adjustValue) <= 0) {
+ CALIBRATION_FACTOR_AP /= 10;
} else {
- this.CALIBRATION_FACTOR_AP += adjustValue;
+ CALIBRATION_FACTOR_AP += adjustValue;
}
return adjustValue;
}
- public boolean isCalculateHeight(){
- return this.calculateHeight;
+ public static boolean isCalculateHeight(){
+ return calculateHeight;
}
- public void setCalculateHeight(boolean calcHeight){
- this.calculateHeight = calcHeight;
+ public static void setCalculateHeight(boolean calcHeight){
+ calculateHeight = calcHeight;
}
- public double getCalibrationFactorAccessPoint(){
- return this.CALIBRATION_FACTOR_AP;
+ public static double getCalibrationFactorAccessPoint(){
+ return CALIBRATION_FACTOR_AP;
}
- public void setCalibrationFactorAccessPoint(double calibration_factor_ap){
- this.CALIBRATION_FACTOR_AP = calibration_factor_ap;
+ public static void setCalibrationFactorAccessPoint(double calibration_factor_ap){
+ CALIBRATION_FACTOR_AP = calibration_factor_ap;
}
- public double getCalibrationFactorLocation(){
- return this.CALIBRATION_FACTOR_LC;
+ public static double getCalibrationFactorLocation(){
+ return CALIBRATION_FACTOR_LC;
}
- public void setCalibrationFactorLocation(double calibration_factor_lc){
- this.CALIBRATION_FACTOR_LC = calibration_factor_lc;
+ public static void setCalibrationFactorLocation(double calibration_factor_lc){
+ CALIBRATION_FACTOR_LC = calibration_factor_lc;
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLayout.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLayout.java 2007-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLayout.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -21,9 +21,8 @@
*/
public class MagicLayout extends SpringLayout {
- NodeModelMetric metric;
- private final LayoutSettings settings;
- private final Graph graph;
+ NodeModelMetric metric;
+ private final Graph graph;
/**
*
@@ -31,13 +30,12 @@
* @param metric
* @param settings
*/
- public MagicLayout(Graph g, NodeModelMetric metric, LayoutSettings settings) {
- super(g, new MagicLengthFunction(settings, metric));
+ public MagicLayout(Graph g, NodeModelMetric metric) {
+ super(g, new MagicLengthFunction(metric));
this.graph = g;
this.metric = metric;
- this.settings = settings;
setLeaveFunction(new LeaveFunction());
- setRepulsionFunction(new MagicRepulsionFunction(settings));
+ setRepulsionFunction(new MagicRepulsionFunction());
setForceFunction(new MagicForceFunction(this.lengthFunction));
((MagicLengthFunction) getLengthFunction()).setBaseKey(getBaseKey());
}
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-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -19,7 +19,6 @@
class MagicLengthFunction implements SpringLayout.LengthFunction {
- private final LayoutSettings settings;
private final NodeModelMetric metric;
private static final Logger log = Logger.getLogger(MagicLengthFunction.class);
@@ -28,8 +27,7 @@
*/
private Object baseKey;
- public MagicLengthFunction(LayoutSettings setings, NodeModelMetric metric) {
- this.settings = setings;
+ public MagicLengthFunction(NodeModelMetric metric) {
this.metric = metric;
}
@@ -45,7 +43,7 @@
* @return
*/
private double calculateLength(Node n1, Node n2){
- if (settings.isCalculateHeight() && Controller.getInstance().getCurrentMap().realwidth > 0
+ if (LayoutSettings.isCalculateHeight() && Controller.getInstance().getCurrentMap().realwidth > 0
&& Controller.getInstance().getCurrentMap().realwidth > 0) {
int diff = n1.getZ() - n2.getZ();
if (diff != 0) {
@@ -61,7 +59,7 @@
// b in pixel umrechnen
b = b * scale;
// System.out.println(b);
- double a = metric.metric(settings, n1, n2);
+ double a = metric.metric(n1, n2);
// System.out.println("Unangepasster Wert: " + a + "
// angepasster
// Wert: " + Math.sqrt(a*a - b*b));
@@ -78,10 +76,10 @@
// System.out.println("Wert angepasst!");
return Math.sqrt(a * a - b * b);
} else {
- return metric.metric(settings, n1, n2);
+ return metric.metric(n1, n2);
}
} else {
- return metric.metric(settings, n1, n2);
+ return metric.metric(n1, n2);
}
}
@@ -121,17 +119,17 @@
if (clientOrLocation) {
if (d < 0.95) {
- settings.adjustLocationCalibration(-Math.max(Math.abs(len - desiredLen) / 200, 0.001));
+ LayoutSettings.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));
+ LayoutSettings.adjustLocationCalibration(Math.max(Math.abs(len - desiredLen) / 200, 0.001));
}
} else {
if (d < 0.95) {
- settings.adjustAccessPointCalibration(-Math.max(Math.abs(len - desiredLen) / 200, 0.001));
+ LayoutSettings.adjustAccessPointCalibration(-Math.max(Math.abs(len - desiredLen) / 200, 0.001));
} else if (d > 1.05) {
- settings.adjustAccessPointCalibration(Math.max(Math.abs(len - desiredLen) / 200, 0.001));
+ LayoutSettings.adjustAccessPointCalibration(Math.max(Math.abs(len - desiredLen) / 200, 0.001));
}
}
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-03-28 12:57:03 UTC (rev 622)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicRepulsionFunction.java 2007-03-28 14:35:06 UTC (rev 623)
@@ -13,18 +13,6 @@
public class MagicRepulsionFunction implements SpringLayout.RepulsionFunction {
- /**
- *
- */
- private final LayoutSettings setings;
-
- /**
-
- */
- MagicRepulsionFunction(LayoutSettings setings) {
- this.setings = setings;
- }
-
public double getRepulsion(Vertex v1, Vertex v2){
Node node1 = this.findNode(v1);
Node node2 = this.findNode(v2);
@@ -32,7 +20,7 @@
if (node1 instanceof AccessPointNode && ((AccessPointNode) node1).isHidden()) return 0;
if (node2 instanceof AccessPointNode && ((AccessPointNode) node2).isHidden()) return 0;
if (node1 instanceof AccessPointNode && node2 instanceof AccessPointNode)
- return 20 * setings.getCalibrationFactorAccessPoint();
+ return 20 * LayoutSettings.getCalibrationFactorAccessPoint();
// Orte und Clients stossen sich nicht ab
if ((node1 instanceof ClientNode || node1 instanceof LocationNode)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-04-26 15:53:47
|
Revision: 651
http://svn.sourceforge.net/magicmap/?rev=651&view=rev
Author: flederohr
Date: 2007-04-26 08:52:26 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
added direct updatesignalstrength method (without use of average signalstrength) to measurementmodel
for updating the measurements that comes from the server.
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-04-26 13:06:54 UTC (rev 650)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2007-04-26 15:52:26 UTC (rev 651)
@@ -169,7 +169,7 @@
nodeModel.addNode(ap);
// ap.setName(mac);
}
- location.getMeasurementModel().updateScanResult(mac, r.getSignalLevel());
+ location.getMeasurementModel().directUpdateScanResult(mac, r.getSignalLevel());
if (!ap.isHidden()) location.seesAccessPoint(ap, r.getSignalLevel());
}
} else {
@@ -220,7 +220,7 @@
else {
// Neu
location.seesAccessPoint(ap, r.getSignalLevel());
- location.getMeasurementModel().updateScanResult(mac, r.getSignalLevel());
+ location.getMeasurementModel().directUpdateScanResult(mac, r.getSignalLevel());
}
}
@@ -327,7 +327,7 @@
signalLevels[i] = Math.round(10 * sr[i].getSignalLevel()) / 10;
macs[i] = sr[i].getMacAP();
}
- client.getMeasurementModel().updateScanResult(macs, signalLevels);
+ client.getMeasurementModel().directUpdateScanResult(macs, signalLevels);
}
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-04-26 13:06:54 UTC (rev 650)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-04-26 15:52:26 UTC (rev 651)
@@ -23,6 +23,13 @@
* @param signalLevel the signal level.
*/
void updateScanResult(String apMac, double signalLevel);
+
+ /**
+ * Add a scanresult without using average calculation.
+ * @param apMac the accesspoints mac
+ * @param signalLevel the signal level.
+ */
+ void directUpdateScanResult(String apMac, double signalLevel);
/**
* Batch update to avoid event overflow ;-)
@@ -30,6 +37,13 @@
* @param signalLevel
*/
void updateScanResult(String[] apMac, double[] signalLevel);
+
+ /**
+ * Batch update to avoid event overflow ;-)
+ * @param apMac
+ * @param signalLevel
+ */
+ void directUpdateScanResult(String[] apMac, double[] signalLevel);
/**
* Gets the SeenAccessPoint for a given seer.
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-04-26 13:06:54 UTC (rev 650)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-04-26 15:52:26 UTC (rev 651)
@@ -199,7 +199,41 @@
}
}
}
+
+ public void directUpdateScanResult(String apMac, double signalLevel){
+ SeenAccessPoint accessPoint = getAccessPoint(apMac);
+ final INodeModel nodeModel = AccessPointSeerNode.this.getModel();
+ if (accessPoint == null) {
+ // ein toter ap.....
+ if (signalLevel <= -Constants.MIN_SIGNALLEVEL) return;
+
+ accessPoint = new SeenAccessPoint(apMac, signalLevel);
+ addAccessPoint(accessPoint);
+ AccessPointNode apNode = nodeModel.findAccessPoint(apMac);
+ if (apNode == null) {
+ nodeModel.addNode(new AccessPointNode(apMac, nodeModel));
+ apNode = nodeModel.findAccessPoint(apMac);
+ }
+ AccessPointSeerNode.this.setSignalLevelForAcessPoint(apNode, signalLevel);
+ } else {
+ if (signalLevel > -Constants.MIN_SIGNALLEVEL) {
+ accessPoint.addSignalLevel(signalLevel);
+ } else {
+ accessPoint.addDeadSignal();
+ }
+ if (accessPoint.isTotallyDead()) {
+ removeSeenAccessPoint(accessPoint);
+ AccessPointSeerNode.this.notSeesAccessPoint(nodeModel.findAccessPoint(apMac));
+ } else {
+ updateAccessPoint(accessPoint);
+ AccessPointSeerNode.this.setSignalLevelForAcessPoint(nodeModel.findAccessPoint(apMac), accessPoint
+ .getLastSignalLevel());
+ }
+ }
+ }
+
+
public void updateScanResult(String[] apMac, double[] signalLevel){
HashSet<String> seenAps = new HashSet<String>();
for (SeenAccessPoint sap : this.get()) {
@@ -213,6 +247,20 @@
updateScanResult(mac, Double.NEGATIVE_INFINITY);
}
}
+
+ public void directUpdateScanResult(String[] apMac, double[] signalLevel){
+ HashSet<String> seenAps = new HashSet<String>();
+ for (SeenAccessPoint sap : this.get()) {
+ seenAps.add(sap.getMac());
+ }
+ for (int i = 0; i < apMac.length; ++i) {
+ seenAps.remove(apMac[i]);
+ directUpdateScanResult(apMac[i], signalLevel[i]);
+ }
+ for (String mac : seenAps) {
+ directUpdateScanResult(mac, Double.NEGATIVE_INFINITY);
+ }
+ }
/**
* Returns a list of seen access points for a given client.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <an...@us...> - 2007-05-30 14:54:41
|
Revision: 659
http://svn.sourceforge.net/magicmap/?rev=659&view=rev
Author: anweiss
Date: 2007-05-30 07:54:26 -0700 (Wed, 30 May 2007)
Log Message:
-----------
added the possibility to add listeners to the pollhandler
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-05-30 14:50:55 UTC (rev 658)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -128,6 +128,7 @@
* @see net.sf.magicmap.client.interfaces.FetchPositionsCallback#positionFetchError(java.lang.Exception)
*/
public void positionFetchError(Exception e){
+ this.listener.positionFetchError(e);
e.printStackTrace();
synchronized (ServerPoller.syncObj) {
this.isFetching = false;
@@ -138,6 +139,7 @@
* @see net.sf.magicmap.client.interfaces.FetchGeoPointsCallback#geoPointFetchError(java.lang.Exception)
*/
public void geoPointFetchError(Exception e){
+ this.listener.geoPositionFetchError(e);
e.printStackTrace();
synchronized (ServerPoller.syncObj) {
this.isFetching = false;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java 2007-05-30 14:50:55 UTC (rev 658)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -136,21 +136,33 @@
}
public static boolean showConnectError(){
- return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("cantconnectretry"), GUIUtils
- .i18n("cantconnect"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null, new String[]{
- GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("cantconnectretry"),
+ GUIUtils.i18n("cantconnect"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null,
+ new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
}
+ public static boolean showConnectError(String cause){
+ if (cause == "UnknownHost") {
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(),
+ GUIUtils.i18n("cantconnectretry"), GUIUtils.i18n("cantconnect"), JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE, null, new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")},
+ GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
+ }
+ else return showConnectionError();
+ }
+
public static boolean showAuthentificationError(String message){
- return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("serverresponse") + "\n" + message,
- GUIUtils.i18n("authentificationerror"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null,
- new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("serverresponse")
+ + "\n" + message, GUIUtils.i18n("authentificationerror"), JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE, null, new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils
+ .i18n("retry")) == JOptionPane.YES_OPTION;
}
public static boolean showConnectionError(){
- return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("connectionsproblemsreconnect"),
- GUIUtils.i18n("connectionproblems"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null,
- new String[]{GUIUtils.i18n("yes"), GUIUtils.i18n("no")}, GUIUtils.i18n("yes")) == JOptionPane.YES_OPTION;
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils
+ .i18n("connectionsproblemsreconnect"), GUIUtils.i18n("connectionproblems"),
+ JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null, new String[]{GUIUtils.i18n("yes"),
+ GUIUtils.i18n("no")}, GUIUtils.i18n("yes")) == JOptionPane.YES_OPTION;
}
public static void showErrorDialog(String message){
Added: trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -0,0 +1,35 @@
+/*
+ * created on 17.04.2007
+ */
+package net.sf.magicmap.client.interfaces;
+
+
+
+/**
+ * @author Andreas Wei\xDF
+ *
+ */
+public interface PollHandlerListener {
+
+ public void positionCreatedOrUpdatedOrDeleted();
+
+ public void mapCreatedOrUpdatedOrDeleted();
+
+
+ public void geoPosCreatedOrUpdatedOrDeleted();
+
+ /**
+ *
+ * @param e
+ */
+ public void positionFetchError(Exception e);
+
+ /**
+ *
+ * @param e
+ */
+ public void geoPositionFetchError(Exception e);
+
+
+ public void mapCreatedOrUpdatedOrDeletedError(Exception e);
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java 2007-05-30 14:50:55 UTC (rev 658)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -44,4 +44,16 @@
*/
public void geoPosCreatedOrUpdatedOrDeleted(GeoPointDTO pointDTO);
+ /**
+ *
+ * @param e
+ */
+ public void positionFetchError(Exception e);
+
+ /**
+ *
+ * @param e
+ */
+ public void geoPositionFetchError(Exception e);
+
}
\ 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: <an...@us...> - 2007-08-01 13:11:01
|
Revision: 666
http://magicmap.svn.sourceforge.net/magicmap/?rev=666&view=rev
Author: anweiss
Date: 2007-08-01 06:10:38 -0700 (Wed, 01 Aug 2007)
Log Message:
-----------
added remove functions
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/measurement/ScannerAllocator.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-07-26 14:23:14 UTC (rev 665)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-08-01 13:10:38 UTC (rev 666)
@@ -444,7 +444,11 @@
public void addScannerHandler(AbstractScannerHandler handler){
this.scannerAllocator.addScanResultHandler(handler);
}
-
+
+ public void removeScannerHandler(AbstractScannerHandler handler){
+ this.scannerAllocator.removeScanResultHandler(handler);
+ }
+
public void initializePlugins(){
try {
this.pluginManager = new PluginManager(new Settings(), this);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/measurement/ScannerAllocator.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/measurement/ScannerAllocator.java 2007-07-26 14:23:14 UTC (rev 665)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/measurement/ScannerAllocator.java 2007-08-01 13:10:38 UTC (rev 666)
@@ -24,6 +24,9 @@
public void addScanResultHandler(AbstractScannerHandler handler){
this.handlerMap.put(handler.canHandle(), handler);
}
+ public void removeScanResultHandler(AbstractScannerHandler handler){
+ this.handlerMap.remove(handler.canHandle());
+ }
public AbstractScannerHandler getHandler(AbstractScanner canHandleScanner){
if (this.stopped) return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2007-10-08 14:58:25
|
Revision: 672
http://magicmap.svn.sourceforge.net/magicmap/?rev=672&view=rev
Author: flederohr
Date: 2007-10-08 07:58:23 -0700 (Mon, 08 Oct 2007)
Log Message:
-----------
Handle maploading:
double left-click on MapNodes in OutlineView opens Map
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapNamesCallback.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-10-08 12:17:52 UTC (rev 671)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-10-08 14:58:23 UTC (rev 672)
@@ -4,8 +4,10 @@
package net.sf.magicmap.client.controller;
+import java.io.IOException;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
+import java.net.URL;
import java.rmi.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
@@ -31,10 +33,12 @@
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.GeoPos;
import net.sf.magicmap.client.model.node.INodeModel;
+import net.sf.magicmap.client.model.node.MapNode;
import net.sf.magicmap.client.model.node.Node;
import net.sf.magicmap.client.model.node.NodeModel;
import net.sf.magicmap.client.plugin.PluginManager;
import net.sf.magicmap.client.utils.Settings;
+import net.sf.magicmap.server.dto.MapDTO;
import net.sf.magicmap.server.exception.SessionException;
import org.apache.log4j.xml.DOMConfigurator;
@@ -51,7 +55,8 @@
ServerDisconnectCallback,
ServerConnectCallback,
CreateNewMapCallback,
- MapNamesCallback {
+ MapNamesCallback,
+ MapCallback {
private static int numCalled = 0;
private static int disconnectAttempts = 0;
@@ -170,6 +175,9 @@
closeMap();
}
if (isMapLoaded() && isConnected()) {
+ // TODO: Interface f\xFCr GUI mit methode setMapTitle()
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ + currentMap.name);
this.serverManager.resetTimestamp();
this.poller.start();
// initializeScanner(); // Scanner neu initialisieren
@@ -179,6 +187,7 @@
if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
// TODO: Interface f\xFCr GUI mit methode setMapTitle()
+
((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ this.currentMap.name + " Gr\xF6\xDFe: " + this.currentMap.realwidth + " X "
+ this.currentMap.realheight + " cm");
@@ -226,6 +235,9 @@
this.client.setPosition(0, 0, 0);
this.client.setFix(false);
this.nodeModel.clear();
+
+ // TODO: move this to right click menu
+ this.retrieveMapNames(this, false);
}
/**
@@ -419,8 +431,6 @@
*/
public void retrieveMap(String name, MapCallback callback){
this.serverManager.retrieveMap(name, callback);
- // TODO: Interface f\xFCr GUI mit methode setMapTitle()
- ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - " + name);
}
public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){
@@ -444,11 +454,11 @@
public void addScannerHandler(AbstractScannerHandler handler){
this.scannerAllocator.addScanResultHandler(handler);
}
-
+
public void removeScannerHandler(AbstractScannerHandler handler){
this.scannerAllocator.removeScanResultHandler(handler);
}
-
+
public void initializePlugins(){
try {
this.pluginManager = new PluginManager(new Settings(), this);
@@ -503,4 +513,32 @@
public void openMapDialog(String[] names){
MainGUI.getInstance().getMainFrame().openMapDialog(names);
}
+
+ public void retrievedMapNames(final String[] names){
+ for (String string : names) {
+ retrieveMap(string, this);
+ }
+ }
+
+ public void getMapError(Exception e){
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mapReceived(MapDTO mapDTO){
+ try {
+ URL imageURL = new URL(mapDTO.getImageURL());
+ // check if map image is accessible
+ imageURL.openStream();
+
+ INodeModel nodeModel = Controller.getInstance().getNodeModel();
+ MapNode node = new MapNode(nodeModel);
+ node.setName(mapDTO.getName());
+ node.setDisplayName(mapDTO.getName());
+ node.setMapInfo(mapDTO);
+ nodeModel.addNode(node);
+ } catch (MalformedURLException e) {
+ } catch (IOException e) {
+ }
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-10-08 12:17:52 UTC (rev 671)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-10-08 14:58:23 UTC (rev 672)
@@ -183,8 +183,11 @@
if (!isConnected()) return;
try {
String[] names = SOAPServerManager.this.mapDelegate.getMapNames();
- if (openDialog)
+ if (openDialog) {
callback.openMapDialog(names);
+ } else {
+ callback.retrievedMapNames(names);
+ }
} catch (Exception e) {
e.printStackTrace();
callback.getMapNamesError(e);
@@ -324,8 +327,6 @@
}
}
-
-
/**
* Entfernt einen Referenzpunkt oder die Positionierung eines AccessPoints
* oder Clients mit gegebener Id vom Server
@@ -739,5 +740,4 @@
}
}
-
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-10-08 12:17:52 UTC (rev 671)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-10-08 14:58:23 UTC (rev 672)
@@ -1,6 +1,5 @@
/*
* Created on 10.05.2005
- *
*/
package net.sf.magicmap.client.controller;
@@ -184,6 +183,8 @@
if (openDialog) {
callback.openMapDialog(names);
+ } else {
+ callback.retrievedMapNames(names);
}
} catch (Exception e) {
e.printStackTrace();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-10-08 12:17:52 UTC (rev 671)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-10-08 14:58:23 UTC (rev 672)
@@ -6,6 +6,8 @@
import java.awt.Dimension;
import java.awt.Insets;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
import javax.swing.JComponent;
import javax.swing.JPanel;
@@ -16,6 +18,7 @@
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreePath;
+import net.sf.magicmap.client.controller.Controller;
import net.sf.magicmap.client.gui.MainGUI;
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
@@ -23,6 +26,7 @@
import net.sf.magicmap.client.gui.utils.RelativePanelBuilder;
import net.sf.magicmap.client.model.node.INodeModel;
import net.sf.magicmap.client.model.node.INodeModelSelectionListener;
+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.client.model.node.NodeModelSelectionEvent;
@@ -36,7 +40,7 @@
*
* @author thuebner
*/
-public class OutlineView extends View implements TreeSelectionListener, INodeModelSelectionListener {
+public class OutlineView extends View implements TreeSelectionListener, INodeModelSelectionListener, MouseListener {
/**
* serial version id
@@ -74,6 +78,8 @@
tree.addTreeSelectionListener(this);
+ tree.addMouseListener(this);
+
JComponent pane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
pane.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
@@ -249,4 +255,45 @@
public OutlineModel getOutlineModel(){
return this.outlineModel;
}
+
+ public void mouseClicked(MouseEvent e){
+
+ switch (e.getButton()) {
+ case MouseEvent.BUTTON1 :
+ if (e.getClickCount() == 2) {
+ Node node;
+ // check if MapNode is selected
+ if ((node = ((OutlineTreeNode) ((OutlineTree) e.getSource()).getSelectionPath()
+ .getLastPathComponent()).getNode()) instanceof MapNode)
+ Controller.getInstance().setCurrentMap(((MapNode) node).getMapInfo());
+ }
+ break;
+ case MouseEvent.BUTTON2 :
+ break;
+ case MouseEvent.BUTTON3 :
+ // TODO: right-click-menu
+ break;
+ }
+
+ }
+
+ public void mouseEntered(MouseEvent e){
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mouseExited(MouseEvent e){
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mousePressed(MouseEvent e){
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mouseReleased(MouseEvent e){
+ // TODO Auto-generated method stub
+
+ }
}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapNamesCallback.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapNamesCallback.java 2007-10-08 12:17:52 UTC (rev 671)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapNamesCallback.java 2007-10-08 14:58:23 UTC (rev 672)
@@ -15,6 +15,12 @@
* @param names - the names of the maps
*/
public void openMapDialog(String[] names);
+
+ /**
+ * Get the retrieved map names
+ * @param names - the names of the maps
+ */
+ public void retrievedMapNames(String[] names);
/**
* Get the error msg of the failed map names retrievement
@@ -22,4 +28,5 @@
*/
public void getMapNamesError(Exception e);
+
}
\ 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: <fle...@us...> - 2007-10-25 13:11:30
|
Revision: 681
http://magicmap.svn.sourceforge.net/magicmap/?rev=681&view=rev
Author: flederohr
Date: 2007-10-25 06:11:26 -0700 (Thu, 25 Oct 2007)
Log Message:
-----------
fixed bug no. 1768459 : Alg: Misbehaviour of edge-length-calculation
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-10-25 10:29:38 UTC (rev 680)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2007-10-25 13:11:26 UTC (rev 681)
@@ -115,10 +115,10 @@
// Kein gemeinsamer Access Point
//if (same.size() == 0) return 1000.0 * calibration;
-// if (same.size() == 1) {
-// if (diff.size() == 0) return 1.0;
-// return 1000.0 * calibration;
-// }
+ if (same.size() == 1) {
+ // if (diff.size() == 0) return 1.0;
+ return 200.0 * calibration;
+ }
// Basteln von Vektoren f\xFCr die Distance-Funktion
Iterator it = same.iterator();
@@ -174,7 +174,7 @@
// TODO: Logarithmische Skalierung
return Math.abs(MeasurementUtils.signalLevelToStrength(seer.getSignalLevelForAccessPoint(ap)))
* calibration;
-// return Math.abs(0.3 * Math.pow(10,(-0.026 * seer.getSignalLevelForAccessPoint(ap)))-0.5);
+ // return Math.abs(0.3 * Math.pow(10,(-0.026 * seer.getSignalLevelForAccessPoint(ap)))-0.5);
} else
//Wir berechnen nur Abst\xE4nde zwischen APs, Clients und Referenzpunkten
return Double.POSITIVE_INFINITY;
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-10-25 10:29:38 UTC (rev 680)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2007-10-25 13:11:26 UTC (rev 681)
@@ -118,20 +118,18 @@
if (clientOrLocation) {
if (d < 0.95) {
-
LayoutSettings.adjustLocationCalibration(-Math.max(Math.abs(len - desiredLen) / 200, 0.001));
} else if (d > 1.05) {
LayoutSettings.adjustLocationCalibration(Math.max(Math.abs(len - desiredLen) / 200, 0.001));
-
}
-
+ log.debug("Calibration Location: " + LayoutSettings.getCalibrationFactorLocation());
} else {
if (d < 0.95) {
LayoutSettings.adjustAccessPointCalibration(-Math.max(Math.abs(len - desiredLen) / 200, 0.001));
} else if (d > 1.05) {
LayoutSettings.adjustAccessPointCalibration(Math.max(Math.abs(len - desiredLen) / 200, 0.001));
-
}
+ log.debug("Calibration AccessPoint: " + LayoutSettings.getCalibrationFactorAccessPoint());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <an...@us...> - 2008-01-28 14:01:48
|
Revision: 719
http://magicmap.svn.sourceforge.net/magicmap/?rev=719&view=rev
Author: anweiss
Date: 2008-01-28 05:22:14 -0800 (Mon, 28 Jan 2008)
Log Message:
-----------
added hashmap with attributes for every node that can be stored on the server
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/net/VistaNetworkInfo.java
trunk/magicmapclient/src/net/sf/magicmap/client/utils/NodeTypes.java
Added: trunk/magicmapclient/src/net/sf/magicmap/client/net/VistaNetworkInfo.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/net/VistaNetworkInfo.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/net/VistaNetworkInfo.java 2008-01-28 13:22:14 UTC (rev 719)
@@ -0,0 +1,102 @@
+/*
+ * Created on 21.01.2008
+ */
+
+package net.sf.magicmap.client.net;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class VistaNetworkInfo extends NetworkInfo {
+
+ public static final String IPCONFIG_COMMAND = "netsh wlan show interfaces";
+
+ @Override
+ public String parseMacAddress() throws ParseException{
+ // run command
+ String ipConfigResponse = null;
+ try {
+ ipConfigResponse = runConsoleCommand(VistaNetworkInfo.IPCONFIG_COMMAND);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new ParseException(e.getMessage(), 0);
+ }
+
+ java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(ipConfigResponse, "\n");
+ String lastMacAddress = null;
+ while (tokenizer.hasMoreTokens()) {
+ String line = tokenizer.nextToken().trim();
+
+ if (line.trim().startsWith("Status")) {
+ String[] splitString = line.split(":");
+ return lastMacAddress;
+ }
+ // see if line might contain a MAC address
+ int macAddressPosition = line.indexOf(":");
+ if (macAddressPosition <= 0) continue;
+
+ // trim the line and see if it matches the pattern
+ String macAddressCandidate = line.substring(macAddressPosition + 1).trim();
+ if (VistaNetworkInfo.isMacAddress(macAddressCandidate)) {
+ lastMacAddress = macAddressCandidate;
+ continue;
+ }
+ }
+
+ ParseException ex = new ParseException("No active connection found or cannot read MAC address from ["
+ + ipConfigResponse + "]", 0);
+ ex.printStackTrace();
+ throw ex;
+ }
+
+ @Override
+ public void collectMacAddresses() throws ParseException{
+ NetworkInfo.macAddresses.clear();
+ // run command
+ String ipConfigResponse = null;
+ try {
+ ipConfigResponse = runConsoleCommand(VistaNetworkInfo.IPCONFIG_COMMAND);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new ParseException(e.getMessage(), 0);
+ }
+
+ java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(ipConfigResponse, "\n");
+ String macAddressCandidate;
+ String lastMAC = null;
+ String[] splitLine = null;
+ boolean foundActive = false;
+ while (tokenizer.hasMoreTokens()) {
+ // split the line and take everything right from the ":"
+ splitLine = tokenizer.nextToken().trim().split(":");
+ macAddressCandidate = splitLine[1];
+ // see if line might contain a MAC address
+ if (VistaNetworkInfo.isMacAddress(macAddressCandidate)) {
+ // Ok we got something, but we better check if it's active
+ macAddressCandidate.replace(':', '-');
+ lastMAC = macAddressCandidate;
+ } else if ((lastMAC != null) && (splitLine[0].trim().equals("Status"))) {
+ // only german to test things
+ if (!splitLine[1].equals("getrennt")) {
+ NetworkInfo.macAddresses.add(lastMAC);
+ foundActive = true;
+ break;
+ }
+ }
+ }
+ // we found some wireless devices but none was active
+ if ((lastMAC != null) && !foundActive){
+ NetworkInfo.macAddresses.add(lastMAC);
+ System.out.println("Inaktives Netz");
+ }
+ }
+
+ private static boolean isMacAddress(String macAddressCandidate){
+ Pattern macPattern = Pattern.compile("([0-9A-F]{2})(([-:][0-9A-F]{2}){5})(([-:][0-9A-F]{2}){2})?");
+ // .compile("[0-9a-fA-F]{2}([-:]{1}[0-9a-fA-F]{2}[-:]{1}[0-9a-fA-F]{2}[-:]{1}[0-9a-fA-F]{2}[-:]{1}[0-9a-fA-F]{2}[-:]{1}[0-9a-fA-F]{2})");
+ Matcher m = macPattern.matcher(macAddressCandidate.toUpperCase());
+ return m.matches();
+ }
+}
\ No newline at end of file
Added: trunk/magicmapclient/src/net/sf/magicmap/client/utils/NodeTypes.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/utils/NodeTypes.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/utils/NodeTypes.java 2008-01-28 13:22:14 UTC (rev 719)
@@ -0,0 +1,9 @@
+package net.sf.magicmap.client.utils;
+
+
+public final class NodeTypes {
+ public static final String ACCESSPOINT = "ACCESSPOINT";
+ public final static String LOCATION = "POSITION";
+ public static final String CLIENT = "CLIENT";
+ public static final String SNIFFER = "SNIFFER";
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|