You can subscribe to this list here.
2005 |
Jan
|
Feb
(14) |
Mar
|
Apr
(4) |
May
(57) |
Jun
(14) |
Jul
(15) |
Aug
(5) |
Sep
(29) |
Oct
(13) |
Nov
(44) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(14) |
Feb
(78) |
Mar
(55) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(12) |
Dec
(9) |
2007 |
Jan
(21) |
Feb
(67) |
Mar
(39) |
Apr
(28) |
May
(7) |
Jun
|
Jul
(6) |
Aug
(2) |
Sep
(1) |
Oct
(18) |
Nov
(8) |
Dec
(11) |
2008 |
Jan
(16) |
Feb
(12) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jan...@us...> - 2007-02-23 18:35:35
|
Revision: 558 http://svn.sourceforge.net/magicmap/?rev=558&view=rev Author: jan_fride Date: 2007-02-23 10:35:32 -0800 (Fri, 23 Feb 2007) Log Message: ----------- Added mutex for adding edge added mutex for adding certex Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 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-23 17:26:24 UTC (rev 557) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-23 18:35:32 UTC (rev 558) @@ -105,6 +105,10 @@ private final NodeMetricManager metricManager; + private final Object edgeLock = new Object(); + private final Object vertexLock = new Object(); + + public JungNodePlacer() { this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric()); } @@ -234,10 +238,10 @@ private Vertex addVertex(Node node){ if (findVertex(node) == null) { - System.out.println("Adding " + node.getDisplayName()); + log.info("Adding " + node.getDisplayName()); Vertex v = new DirectedSparseVertex(); - synchronized (this) { + synchronized (vertexLock) { this.worker.suspend(); this.nodeVertexMapping.put(node, v); v.addUserDatum(LayoutSettings.NODE_KEY, node, UserData.SHARED); @@ -249,6 +253,7 @@ this.worker.unsuspend(); } + log.info("Added " + node.getDisplayName()); return v; } else { System.err.print("Vertex exists:"); @@ -316,18 +321,21 @@ private IMagicEdge addEdge(Vertex v1, Vertex v2){ log.info("Adding Edge : " + v1 + " -> " + v2); if (v1 == v2) return null; - Edge e = v1.findEdge(v2); - if (e != null) - return (IMagicEdge) e; - else { - JungEdge edge = new JungEdge(v1, v2); - this.worker.suspend(); // stopGraph(); - addEdge(edge); - this.layout.update(); - ((SpringLayout) this.worker.getGraphLayout()).update(); - this.worker.unsuspend(); // resumeGraph(); - - return edge; + synchronized (edgeLock) { + Edge e = v1.findEdge(v2); + if (e != null) + return (IMagicEdge) e; + else { + JungEdge edge = new JungEdge(v1, v2); + this.worker.suspend(); // stopGraph(); + addEdge(edge); + this.layout.update(); + ((SpringLayout) this.worker.getGraphLayout()).update(); + this.worker.unsuspend(); // resumeGraph(); + + return edge; + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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(); + } + //TODO: hier die Mapnamen einlesen und im Tree + } + }; - 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") { - this.setProxyAction = new MagicAction("setproxy", GUIConstants.ICON_CONNECT, "setproxytooltip") { + /** + * serial version id + */ + private static final long serialVersionUID = 8620117054998094069L; - /** - * 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(MainGUI.this); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - SetProxyDialog.showDialog(MainGUI.this); - } - }; + this.disconnectAction = new MagicAction("disconnect", GUIConstants.ICON_DISCONNECT, "disconnecttooltip") { - this.disconnectAction = new MagicAction("disconnect", GUIConstants.ICON_DISCONNECT, "disconnecttooltip") { + /** + * serial version id + */ + private static final long serialVersionUID = 6776875394862327956L; - /** - * serial version id - */ - private static final long serialVersionUID = 6776875394862327956L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + Controller.getInstance().disconnect(MainGUI.this); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - Controller.getInstance().disconnect(MainGUI.this); - } - }; + this.newMapAction = new MagicAction("newmap", GUIConstants.ICON_NEWMAP, "newmaptooltip") { - this.newMapAction = new MagicAction("newmap", GUIConstants.ICON_NEWMAP, "newmaptooltip") { + /** + * serial version id + */ + private static final long serialVersionUID = 1585869732523539705L; - /** - * serial version id - */ - private static final long serialVersionUID = 1585869732523539705L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + MapInfo info = NewMapDialog.showDialog(MainGUI.this); + if (info != null) + Controller.getInstance().createNewMap(info.name, info.imageURL, info.width, info.height, + info.realwidth, info.realheight, MainGUI.this); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - MapInfo info = NewMapDialog.showDialog(MainGUI.this); - if (info != null) - Controller.getInstance().createNewMap(info.name, info.imageURL, info.width, info.height, - info.realwidth, info.realheight, MainGUI.this); - } - }; + this.loadMapAction = new MagicAction("loadmap", GUIConstants.ICON_LOADMAP, "loadmaptooltip") { - this.loadMapAction = new MagicAction("loadmap", GUIConstants.ICON_LOADMAP, "loadmaptooltip") { + /** + * serial version id + */ + private static final long serialVersionUID = -4200327439722944761L; - /** - * serial version id - */ - private static final long serialVersionUID = -4200327439722944761L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + Controller.getInstance().retrieveMapNames(MainGUI.this, true); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - Controller.getInstance().retrieveMapNames(MainGUI.this, true); - } - }; + this.exitAction = new MagicAction("exit", GUIConstants.ICON_EXIT, "exit") { - this.exitAction = new MagicAction("exit", GUIConstants.ICON_EXIT, "exit") { + /** + * serial version id + */ + private static final long serialVersionUID = -381509553122027326L; - /** - * serial version id - */ - private static final long serialVersionUID = -381509553122027326L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + MainGUI.this.setVisible(false); + System.exit(0); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - MainGUI.this.setVisible(false); - System.exit(0); - } - }; + this.onlineHelp = new MagicAction("onlinehelp", GUIConstants.ICON_HELP, "onlinehelptooltip") { - this.onlineHelp = new MagicAction("onlinehelp", GUIConstants.ICON_HELP, "onlinehelptooltip") { + /** + * serial version id + */ + private static final long serialVersionUID = -2931521125912428814L; - /** - * serial version id - */ - private static final long serialVersionUID = -2931521125912428814L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + try { + Browser.displayURL("http://wiki.informatik.hu-berlin.de/nomads/index.php/MagicMapHelp"); + } catch (IOException e1) { + //TODO: exception handling + } + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - try { - Browser.displayURL("http://wiki.informatik.hu-berlin.de/nomads/index.php/MagicMapHelp"); - } catch (IOException e1) { - //TODO: exception handling - } - } - }; + this.aboutAction = new MagicAction("about") { - this.aboutAction = new MagicAction("about") { + /** + * serial version id + */ + private static final long serialVersionUID = 817979541337534213L; - /** - * serial version id - */ - private static final long serialVersionUID = 817979541337534213L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + AboutDialog.showDialog(MainGUI.this); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - AboutDialog.showDialog(MainGUI.this); - } - }; + this.invisibleAction = new MagicAction("invisible", GUIConstants.ICON_INVISIBLE, "invisibletooltip") { - this.invisibleAction = new MagicAction("invisible", GUIConstants.ICON_INVISIBLE, "invisibletooltip") { + /** + * serial version id + */ + private static final long serialVersionUID = 5676607442930257839L; - /** - * serial version id - */ - private static final long serialVersionUID = 5676607442930257839L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + toogleInvisible(); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - toogleInvisible(); - } - }; + // showAccessPoints = new MagicAction("showaccesspoints") { + // + // public void actionPerformed(ActionEvent e){ + // mapView.setShowAccessPoints(showAccessPoints.isSelected()); + // } + // }; + // + // showLocations = new MagicAction("showlocations") { + // + // public void actionPerformed(ActionEvent e){ + // mapView.setShowLocations(showLocations.isSelected()); + // } + // }; + // + // showClients = new MagicAction("showclients") { + // + // public void actionPerformed(ActionEvent e){ + // mapView.setShowClients(showClients.isSelected()); + // } + // }; + // + // showEdgesBetweenLocations = new MagicAction("showedgesbetweenlocations") { + // + // public void actionPerformed(ActionEvent e){ + // mapView.setShowEdgesBetweenLocations(showEdgesBetweenLocations.isSelected()); + // + // } + // }; + // + // showEdges = new MagicAction("showedges") { + // + // public void actionPerformed(ActionEvent e){ + // mapView.setShowEdges(showEdges.isSelected()); + // + // } + // }; - // showAccessPoints = new MagicAction("showaccesspoints") { - // - // public void actionPerformed(ActionEvent e){ - // mapView.setShowAccessPoints(showAccessPoints.isSelected()); - // } - // }; - // - // showLocations = new MagicAction("showlocations") { - // - // public void actionPerformed(ActionEvent e){ - // mapView.setShowLocations(showLocations.isSelected()); - // } - // }; - // - // showClients = new MagicAction("showclients") { - // - // public void actionPerformed(ActionEvent e){ - // mapView.setShowClients(showClients.isSelected()); - // } - // }; - // - // showEdgesBetweenLocations = new MagicAction("showedgesbetweenlocations") { - // - // public void actionPerformed(ActionEvent e){ - // mapView.setShowEdgesBetweenLocations(showEdgesBetweenLocations.isSelected()); - // - // } - // }; - // - // showEdges = new MagicAction("showedges") { - // - // public void actionPerformed(ActionEvent e){ - // mapView.setShowEdges(showEdges.isSelected()); - // - // } - // }; + this.simpleView = new MagicAction("simpleview") { - this.simpleView = new MagicAction("simpleview") { + /** + * serial version id + */ + private static final long serialVersionUID = -4363039701291506753L; - /** - * serial version id - */ - private static final long serialVersionUID = -4363039701291506753L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + /*((JCheckBoxMenuItem)e.getSource()).setSelected(true); + ((JCheckBoxMenuItem)((JCheckBoxMenuItem)e.getSource()).getParent().getComponent(1)).setSelected(false); + ((JCheckBoxMenuItem)((JCheckBoxMenuItem)e.getSource()).getParent().getComponent(2)).setSelected(false); + */ + MainGUI.this.mapView.setShowAccessPoints(false); + MainGUI.this.outlineView.collapseAPs(true); + MainGUI.this.mapView.setShowClients(true); + MainGUI.this.mapView.setShowEdges(false); + MainGUI.this.mapView.setShowEdgesBetweenLocations(false); + MainGUI.this.mapView.setShowLocations(false); + MainGUI.this.outlineView.collapseRPs(true); + MainGUI.this.mapView.setShowEdgesForSelectedNode(false); - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - /*((JCheckBoxMenuItem)e.getSource()).setSelected(true); - ((JCheckBoxMenuItem)((JCheckBoxMenuItem)e.getSource()).getParent().getComponent(1)).setSelected(false); - ((JCheckBoxMenuItem)((JCheckBoxMenuItem)e.getSource()).getParent().getComponent(2)).setSelected(false); - */ - MainGUI.this.mapView.setShowAccessPoints(false); - MainGUI.this.outlineView.collapseAPs(true); - MainGUI.this.mapView.setShowClients(true); - MainGUI.this.mapView.setShowEdges(false); - MainGUI.this.mapView.setShowEdgesBetweenLocations(false); - MainGUI.this.mapView.setShowLocations(false); - MainGUI.this.outlineView.collapseRPs(true); - MainGUI.this.mapView.setShowEdgesForSelectedNode(false); + MainGUI.this.simpleView.setSelected(true); + MainGUI.this.normalView.setSelected(false); + MainGUI.this.expertView.setSelected(false); + MainGUI.this.userDefinedView.setSelected(false); + } + }; - MainGUI.this.simpleView.setSelected(true); - MainGUI.this.normalView.setSelected(false); - MainGUI.this.expertView.setSelected(false); - MainGUI.this.userDefinedView.setSelected(false); - } - }; + this.normalView = new MagicAction("normalview") { - this.normalView = new MagicAction("normalview") { + /** + * serial version id + */ + private static final long serialVersionUID = -6495547547583532292L; - /** - * serial version id - */ - private static final long serialVersionUID = -6495547547583532292L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ + MainGUI.this.mapView.setShowAccessPoints(true); + MainGUI.this.outlineView.collapseAPs(false); + MainGUI.this.mapView.setShowClients(true); + MainGUI.this.mapView.setShowEdges(true); + MainGUI.this.mapView.setShowEdgesBetweenLocations(false); + MainGUI.this.mapView.setShowLocations(true); + MainGUI.this.outlineView.collapseRPs(false); + MainGUI.this.mapView.setShowEdgesForSelectedNode(true); - MainGUI.this.mapView.setShowAccessPoints(true); - MainGUI.this.outlineView.collapseAPs(false); - MainGUI.this.mapView.setShowClients(true); - MainGUI.this.mapView.setShowEdges(true); - MainGUI.this.mapView.setShowEdgesBetweenLocations(false); - MainGUI.this.mapView.setShowLocations(true); - MainGUI.this.outlineView.collapseRPs(false); - MainGUI.this.mapView.setShowEdgesForSelectedNode(true); + MainGUI.this.simpleView.setSelected(false); + MainGUI.this.normalView.setSelected(true); + MainGUI.this.expertView.setSelected(false); + MainGUI.this.userDefinedView.setSelected(false); + } + }; - MainGUI.this.simpleView.setSelected(false); - MainGUI.this.normalView.setSelected(true); - MainGUI.this.expertView.setSelected(false); - MainGUI.this.userDefinedView.setSelected(false); - } - }; + this.expertView = new MagicAction("expertview") { - this.expertView = new MagicAction("expertview") { + /** + * serial version id + */ + private static final long serialVersionUID = 2424697947749316174L; - /** - * serial version id - */ - private static final long serialVersionUID = 2424697947749316174L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + MainGUI.this.mapView.setShowAccessPoints(true); + MainGUI.this.outlineView.collapseAPs(false); + MainGUI.this.mapView.setShowClients(true); + MainGUI.this.mapView.setShowEdges(true); + MainGUI.this.mapView.setShowEdgesBetweenLocations(true); + MainGUI.this.mapView.setShowLocations(true); + MainGUI.this.outlineView.collapseRPs(false); + MainGUI.this.mapView.setShowEdgesForSelectedNode(false); - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - MainGUI.this.mapView.setShowAccessPoints(true); - MainGUI.this.outlineView.collapseAPs(false); - MainGUI.this.mapView.setShowClients(true); - MainGUI.this.mapView.setShowEdges(true); - MainGUI.this.mapView.setShowEdgesBetweenLocations(true); - MainGUI.this.mapView.setShowLocations(true); - MainGUI.this.outlineView.collapseRPs(false); - MainGUI.this.mapView.setShowEdgesForSelectedNode(false); + MainGUI.this.simpleView.setSelected(false); + MainGUI.this.normalView.setSelected(false); + MainGUI.this.expertView.setSelected(true); + MainGUI.this.userDefinedView.setSelected(false); + } + }; - MainGUI.this.simpleView.setSelected(false); - MainGUI.this.normalView.setSelected(false); - MainGUI.this.expertView.setSelected(true); - MainGUI.this.userDefinedView.setSelected(false); - } - }; + this.userDefinedView = new MagicAction("userdefinedview") { - this.userDefinedView = new MagicAction("userdefinedview") { + /** + * serial version id + */ + private static final long serialVersionUID = 5375115309634495606L; - /** - * serial version id - */ - private static final long serialVersionUID = 5375115309634495606L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + MainGUI.this.userDefinedView.setSelected(!MainGUI.this.userDefinedView.isSelected()); + ViewOptionsDialog.showDialog(MainGUI.this); + } + }; - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - MainGUI.this.userDefinedView.setSelected(!MainGUI.this.userDefinedView.isSelected()); - ViewOptionsDialog.showDialog(MainGUI.this); - } - }; + this.dataInvocationRateAction = new MagicAction[MainGUI.numberOfdataInvocationRateAction]; - this.dataInvocationRateAction = new MagicAction[MainGUI.numberOfdataInvocationRateAction]; + for (int i = 0; i < MainGUI.numberOfdataInvocationRateAction; i++) { + final int thisAction = i; + this.dataInvocationRateAction[thisAction] = new MagicAction("dataInvocationRate" + (thisAction + 1)) { - for (int i = 0; i < MainGUI.numberOfdataInvocationRateAction; i++) { - final int thisAction = i; - this.dataInvocationRateAction[thisAction] = new MagicAction("dataInvocationRate" + (thisAction + 1)) { + /** + * serial version id + */ + private static final long serialVersionUID = 4859524538231496188L; - /** - * serial version id - */ - private static final long serialVersionUID = 4859524538231496188L; + /* (non-Javadoc) + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @Override + public void actionPerformed(ActionEvent e){ + for (int j = 0; j < MainGUI.numberOfdataInvocationRateAction; j++) + MainGUI.this.dataInvocationRateAction[j].setSelected(false); + MainGUI.this.dataInvocationRateAction[thisAction].setSelected(true); + Settings.setPollIntevall((thisAction + 1) * 1000); + Controller.getInstance().restartServerPoller(); + } + }; + } - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - @Override - public void actionPerformed(ActionEvent e){ - for (int j = 0; j < MainGUI.numberOfdataInvocationRateAction; j++) - MainGUI.this.dataInvocationRateAction[j].setSelected(false); - MainGUI.this.dataInvocationRateAction[thisAction].setSelected(true); - Settings.setPollIntevall((thisAction + 1) * 1000); - Controller.getInstance().restartServerPoller(); - } - }; - } + this.invisibleAction.setEnabled(false); + this.disconnectAction.setEnabled(false); + this.newMapAction.setEnabled(false); + this.loadMapAction.setEnabled(false); + // showClients.setEnabled(false); + // showAccessPoints.setEnabled(false); + // showLocations.setEnabled(false); + // showEdgesBetweenLocations.setEnabled(false); + // showEdges.setEnabled(false); + this.simpleView.setEnabled(false); + this.normalView.setEnabled(false); + this.expertView.setEnabled(false); + this.userDefinedView.setEnabled(false); + } - this.invisibleAction.setEnabled(false); - this.disconnectAction.setEnabled(false); - this.newMapAction.setEnabled(false); - this.loadMapAction.setEnabled(false); - // showClients.setEnabled(false); - // showAccessPoints.setEnabled(false); - // showLocations.setEnabled(false); - // showEdgesBetweenLocations.setEnabled(false); - // showEdges.setEnabled(false); - this.simpleView.setEnabled(false); - this.normalView.setEnabled(false); - this.expertView.setEnabled(false); - this.userDefinedView.setEnabled(false); - } + /** + * Sets the userDefinedView selected + * + */ + public void setUserDefinedView(){ + this.simpleView.setSelected(false); + this.normalView.setSelected(false); + this.expertView.setSelected(false); + this.userDefinedView.setSelected(true); + } - /** - * 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 main panel + * @return the main panel + */ + public JComponent buildMainPane(){ + buildViews(); + + UIFSplitPane pane2; - /** - * Build the main panel - * @return the main panel - */ - public JComponent buildMainPane(){ - this.mapPanel = new MapPanel(); - this.consoleView = Controller.getInstance().getConsoleView(); - this.measurementView = Controller.getInstance().getMeasurementView(); - this.outlineView = Controller.getInstance().getOutlineView(); - this.mapView = Controller.getInstance().getMapView(); - this.mapPanel.setMapView(this.mapView); + this.bottomRightTabPanel = new ViewTabPanel(); + this.bottomRightTabPanel.addView(this.measurementView); + this.bottomRightTabPanel.addView(this.consoleView); + this.bottomRightTabPanel.selectView(this.measurementView); - UIFSplitPane pane2; + 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; + } - this.bottomRightTabPanel = new ViewTabPanel(); - this.bottomRightTabPanel.addView(this.measurementView); - this.bottomRightTabPanel.addView(this.consoleView); - this.bottomRightTabPanel.selectView(this.measurementView); + /** + * 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; + } - 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 map menu + * @return the map menu + */ + public JMenu buildMapMenu(){ + JMenu menu = GUIBuilder.createMenu("map"); + menu.add(GUIBuilder.createMenuItem(this.exitAction)); + return menu; + } - /** - * 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; - } + /** + * 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)); + */ - /** - * Build the map menu - * @return the map menu - */ - public JMenu buildMapMenu(){ - JMenu menu = GUIBuilder.createMenu("map"); - menu.add(GUIBuilder.createMenuItem(this.exitAction)); - return menu; - } + 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 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)); - */ + /** + * 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 < MainGUI.numberOfdataInvocationRateAction; i++) + dataInvocationRate.add(GUIBuilder.createCheckBoxMenuItem(this.dataInvocationRateAction[i], false)); + this.dataInvocationRateAction[4].setSelected(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; - } + return menu; + ... [truncated message content] |
From: <Jan...@us...> - 2007-02-23 15:28:20
|
Revision: 556 http://svn.sourceforge.net/magicmap/?rev=556&view=rev Author: Jan_fride Date: 2007-02-23 07:27:57 -0800 (Fri, 23 Feb 2007) Log Message: ----------- synchronization, this time without new bugs ;-) Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 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-22 13:16:13 UTC (rev 555) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-23 15:27:57 UTC (rev 556) @@ -314,6 +314,7 @@ * @return */ private IMagicEdge addEdge(Vertex v1, Vertex v2){ + log.info("Adding Edge : " + v1 + " -> " + v2); if (v1 == v2) return null; Edge e = v1.findEdge(v2); if (e != null) @@ -322,7 +323,7 @@ JungEdge edge = new JungEdge(v1, v2); this.worker.suspend(); // stopGraph(); addEdge(edge); - //this.layout.update(); + this.layout.update(); ((SpringLayout) this.worker.getGraphLayout()).update(); this.worker.unsuspend(); // resumeGraph(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jan...@us...> - 2007-02-22 13:16:14
|
Revision: 555 http://svn.sourceforge.net/magicmap/?rev=555&view=rev Author: Jan_fride Date: 2007-02-22 05:16:13 -0800 (Thu, 22 Feb 2007) Log Message: ----------- synchronization Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 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-22 13:04:01 UTC (rev 554) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-22 13:16:13 UTC (rev 555) @@ -322,8 +322,10 @@ JungEdge edge = new JungEdge(v1, v2); this.worker.suspend(); // stopGraph(); addEdge(edge); - this.layout.update(); + //this.layout.update(); + ((SpringLayout) this.worker.getGraphLayout()).update(); this.worker.unsuspend(); // resumeGraph(); + return edge; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jan...@us...> - 2007-02-22 13:04:25
|
Revision: 554 http://svn.sourceforge.net/magicmap/?rev=554&view=rev Author: Jan_fride Date: 2007-02-22 05:04:01 -0800 (Thu, 22 Feb 2007) Log Message: ----------- mad bottom panel accessable Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-19 15:00:06 UTC (rev 553) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-22 13:04:01 UTC (rev 554) @@ -173,6 +173,7 @@ viewMap.put("mapPanel", mapPanel); viewMap.put("mapView", mapView); viewMap.put("consoleView", consoleView); + viewMap.put("bottomRightTabPanel", bottomRightTabPanel); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2007-02-19 15:00:13
|
Revision: 553 http://svn.sourceforge.net/magicmap/?rev=553&view=rev Author: flederohr Date: 2007-02-19 07:00:06 -0800 (Mon, 19 Feb 2007) Log Message: ----------- Bug fixed: reload map failure Solution: reset position and fixstatus of client instead of setting to null set client to null at disconnect Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-18 22:46:32 UTC (rev 552) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-19 15:00:06 UTC (rev 553) @@ -261,7 +261,7 @@ this.serverManager.reloadMap(); this.nodeModel.setCurrentMap(map); this.nodeModel.addNode(this.client); - + this.mapView.loadMap(map); } catch (MalformedURLException e) { System.out.println("Map loading failed." + e.getMessage()); @@ -318,8 +318,10 @@ this.serverManager.closeMap(); this.poller.stop(); this.measurementModel.clear(); + // reset the client + this.client.setPosition(0, 0, 0); + this.client.setFix(false); this.nodeModel.clear(); - this.client = null; } /** @@ -396,8 +398,8 @@ this.pluginManager.dispose(); if (isMapLoaded()) closeMap(); - this.serverManager.disconnect(callback); + this.client = null; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jan...@us...> - 2007-02-18 22:46:39
|
Revision: 552 http://svn.sourceforge.net/magicmap/?rev=552&view=rev Author: Jan_fride Date: 2007-02-18 14:46:32 -0800 (Sun, 18 Feb 2007) Log Message: ----------- removed log message for missing image Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java 2007-02-18 22:45:15 UTC (rev 551) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java 2007-02-18 22:46:32 UTC (rev 552) @@ -58,7 +58,7 @@ if (i != null) return i; else { - NodeIcons.log.warn("No icon found for: " + name); + //NodeIcons.log.warn("No icon found for: " + name); return NodeIcons.icons.get(NodeIcons.DEFAULT_ICON); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jan...@us...> - 2007-02-18 22:45:16
|
Revision: 551 http://svn.sourceforge.net/magicmap/?rev=551&view=rev Author: Jan_fride Date: 2007-02-18 14:45:15 -0800 (Sun, 18 Feb 2007) Log Message: ----------- made empty selection possible Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-02-18 22:44:33 UTC (rev 550) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-02-18 22:45:15 UTC (rev 551) @@ -81,7 +81,12 @@ } public void selectionChanged(NodeModelSelectionEvent selectEvent){ Node selectedNode = selectEvent.getSelectedNode(); - if (selectedNode != Node.EMPTY_NODE) tree.setSelectionPath(getOutlineNodePath(selectedNode)); + if (selectedNode != Node.EMPTY_NODE){ + tree.setSelectionPath(getOutlineNodePath(selectedNode)); + } + else{ + tree.clearSelection(); + } } @@ -108,7 +113,10 @@ } public void setSelected(Node node){ - setSelected(getOutlineNodePath(node)); + if (Node.EMPTY_NODE == node){ + clearSelection(); + } + else setSelected(getOutlineNodePath(node)); } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jan...@us...> - 2007-02-18 22:44:34
|
Revision: 550 http://svn.sourceforge.net/magicmap/?rev=550&view=rev Author: Jan_fride Date: 2007-02-18 14:44:33 -0800 (Sun, 18 Feb 2007) Log Message: ----------- made empty selection possible Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.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-18 21:03:02 UTC (rev 549) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-18 22:44:33 UTC (rev 550) @@ -609,7 +609,7 @@ */ public void vertexSelected(Vertex v){ if (v == null) { - //getModel().selectNode(Node.EMPTY_NODE); + getModel().selectNode(Node.EMPTY_NODE); } else { selectedNode = findNode(v); this.getModel().removeNodeModelSelectionListener(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jan...@us...> - 2007-02-18 21:03:30
|
Revision: 549 http://svn.sourceforge.net/magicmap/?rev=549&view=rev Author: Jan_fride Date: 2007-02-18 13:03:02 -0800 (Sun, 18 Feb 2007) Log Message: ----------- Added handlilng for node trees. MapNodes can contains children. (still beta) Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-18 21:01:59 UTC (rev 548) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-18 21:03:02 UTC (rev 549) @@ -259,7 +259,9 @@ this.currentMap = map; try { this.serverManager.reloadMap(); + this.nodeModel.setCurrentMap(map); this.nodeModel.addNode(this.client); + this.mapView.loadMap(map); } catch (MalformedURLException e) { System.out.println("Map loading failed." + e.getMessage()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jan...@us...> - 2007-02-18 21:02:23
|
Revision: 548 http://svn.sourceforge.net/magicmap/?rev=548&view=rev Author: Jan_fride Date: 2007-02-18 13:01:59 -0800 (Sun, 18 Feb 2007) Log Message: ----------- Added handlilng for node trees. MapNodes can contains children. (still beta) Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java Added Paths: ----------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ContainerNode.java 2007-02-18 21:01:59 UTC (rev 548) @@ -0,0 +1,38 @@ +package net.sf.magicmap.client.model.node; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import net.sf.magicmap.client.model.node.NodeContainer.Impl; + + +public abstract class ContainerNode extends Node implements NodeContainer { + + private final NodeContainer.Impl container; + + public ContainerNode(INodeModel model) { + super(model); + container = new Impl(this); + } + + public boolean addNode(Node child){ + return container.addNode(child); + } + + public Collection<Node> getChildren(){ + return container.getChildren(); + } + + public boolean removeNode(Node child){ + return container.removeNode(child); + } + + public Iterator<Node> iterator(){ + return container.iterator(); + } + + public NodeContainer getNodeContainer(){ + return this; + } +} Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INode.java 2007-02-18 21:01:59 UTC (rev 548) @@ -60,4 +60,6 @@ boolean isPhysical(); void setPhysical(boolean physical); + + public NodeContainer getNodeContainer(); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-18 21:01:59 UTC (rev 548) @@ -2,6 +2,7 @@ package net.sf.magicmap.client.model.node; import net.sf.magicmap.client.interfaces.NodeModelListener; +import net.sf.magicmap.client.meta.MapInfo; import net.sf.magicmap.client.model.location.INodePlacer; import java.util.ArrayList; @@ -168,6 +169,6 @@ void setNodePlacer(INodePlacer placer); INodePlacer getNodePlacer(); - void setCurrentMap(MapNode map); + void setCurrentMap(MapInfo map); MapNode getCurrentMap(); } \ No newline at end of file Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java 2007-02-18 21:01:59 UTC (rev 548) @@ -8,19 +8,48 @@ /** * @author Johannes Zapotoczky (joh...@za...) + * @author Jan Friderici * */ public interface InfoObject { + /** + * the url this info points to. + * @return + */ String getInfoUrl(); + /** + * + * @return an url to an webservice. + */ String getServiceUrl(); + /** + * The infoobjects type. + * text/html + * @return + */ String getInfoType(); + /** + * usually the shortcut icon. + * + * @return the url to a smale image. + */ String getDepiction(); + /** + * a Description of the info. + * + * @return + */ String getDescription(); + /** + * the title of the infoobject. + * + * @return a title or "<notitle>" + */ String getInfoTitle(); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java 2007-02-18 21:01:59 UTC (rev 548) @@ -16,8 +16,9 @@ * (currently only used for the outline view) * @author Johannes Zapotoczky (joh...@za...) */ -public class MapNode extends Node implements MapCallback { +public class MapNode extends ContainerNode implements MapCallback { + private MapInfo mapInfo; /** @@ -26,6 +27,7 @@ */ public MapNode(INodeModel model) { super(model); + } /* (non-Javadoc) Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java 2007-02-18 21:01:59 UTC (rev 548) @@ -210,5 +210,8 @@ public void setPhysical(boolean physical){ this.physical = physical; } + public NodeContainer getNodeContainer(){ + return null; + } } \ No newline at end of file Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeContainer.java 2007-02-18 21:01:59 UTC (rev 548) @@ -0,0 +1,76 @@ +package net.sf.magicmap.client.model.node; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeSet; + + +/** + * a container for nodes. + * + * @author Jan Friderici + * + */ +public interface NodeContainer extends Iterable<Node>{ + + boolean addNode( Node child); + boolean removeNode ( Node child); + Collection<Node> getChildren(); + + /** + * The default implementation. + * + * @author Jan + * + */ + static final class Impl{ + + private final Node myself; + + public Impl(Node myself){ + this.myself = myself; + + } + private static final Map<Node, Collection<Node>> childMap = new HashMap<Node, Collection<Node>>(); + + public boolean addNode(Node child){ + if (!childMap.containsKey(myself)) childMap.put(myself, new HashSet<Node>()); + return childMap.get(myself).add(child); + } + + boolean removeNode (Node child){ + if (!childMap.containsKey(myself)) return false; + return childMap.get(myself).remove(child); + } + + Collection<Node> getChildren(){ + if (!childMap.containsKey(myself)) return Collections.emptyList(); + return Collections.unmodifiableCollection(childMap.get(myself)); + } + Iterator<Node> iterator(){ + if (!childMap.containsKey(myself)) return new EmptyIterytor<Node>(); + return childMap.get(myself).iterator(); + } + void clear(){ + childMap.clear(); + } + } + + public static final class EmptyIterytor<T> implements Iterator<T>{ + public boolean hasNext(){ + return false; + } + + public T next(){ + return null; + } + + public void remove(){ + } + + } +} Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-17 18:13:50 UTC (rev 547) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-18 21:01:59 UTC (rev 548) @@ -11,6 +11,7 @@ import java.util.Map; import net.sf.magicmap.client.interfaces.NodeModelListener; +import net.sf.magicmap.client.meta.MapInfo; import net.sf.magicmap.client.model.location.INodePlacer; import net.sf.magicmap.client.model.location.jung.JungNodePlacer; @@ -38,7 +39,8 @@ private final Map<String, AccessPointNode> accesspoints; private final List<NodeModelListener> listeners; private final List<NodeModelSelectionListener> selectListeners; - + private final Map<String, MapNode> mapMap; + private Node selectedNode = Node.EMPTY_NODE; private final Log log = LogFactory.getLog(NodeModel.class); @@ -54,6 +56,7 @@ this.accesspoints = Collections.synchronizedMap(new HashMap<String, AccessPointNode>()); this.listeners = Collections.synchronizedList(new ArrayList<NodeModelListener>()); this.selectListeners = Collections.synchronizedList(new ArrayList<NodeModelSelectionListener>()); + mapMap = Collections.synchronizedMap(new HashMap<String, MapNode>()); setNodePlacer(new JungNodePlacer()); } @@ -71,6 +74,14 @@ if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen this.accesspoints.put(((AccessPointNode) node).getMacAddress(), (AccessPointNode) node); + if (MapNode.class.equals(node.getClass())){ + MapNode map = (MapNode)node; + mapMap.put(map.getMapInfo().name, map); + } + if (!MapNode.class.equals(node.getClass()) && currentMap != null){ + currentMap.getNodeContainer().addNode(node); + log.info("Map has Children: " + currentMap.getChildren().size()); + } for (NodeModelListener listener : this.listeners) { NodeModelListener l = (NodeModelListener) listener; l.nodeAddedEvent(node); @@ -272,8 +283,8 @@ return placer; } - public void setCurrentMap(MapNode map){ - this.currentMap = map; + public void setCurrentMap(MapInfo map){ + this.currentMap = mapMap.get(map.name); } public MapNode getCurrentMap(){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2007-02-17 18:14:13
|
Revision: 547 http://svn.sourceforge.net/magicmap/?rev=547&view=rev Author: flederohr Date: 2007-02-17 10:13:50 -0800 (Sat, 17 Feb 2007) Log Message: ----------- fixed annoying behavior (displacement when scrolling) of right click menu in MapView Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.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-17 14:11:46 UTC (rev 546) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-17 18:13:50 UTC (rev 547) @@ -501,14 +501,17 @@ return node; } + @Override public int getMapOffsetX(){ - int ox = (getWidth() - graphdraw.getWidth()) / 2; - return (ox >= 0 ? ox : 0); + if (getWidth() > graphdraw.getWidth()) return (getWidth() - graphdraw.getWidth()) / 2; + return -((JScrollPane) this.getContent()).getViewport().getViewPosition().x; + } + @Override public int getMapOffsetY(){ - int oy = (getHeight() - graphdraw.getHeight()) / 2; - return (oy >= 0 ? oy : 0); + if (getHeight() > graphdraw.getHeight()) return (getHeight() - graphdraw.getHeight()) / 2; + return -((JScrollPane) this.getContent()).getViewport().getViewPosition().y; } /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2007-02-17 14:12:09
|
Revision: 546 http://svn.sourceforge.net/magicmap/?rev=546&view=rev Author: flederohr Date: 2007-02-17 06:11:46 -0800 (Sat, 17 Feb 2007) Log Message: ----------- use avarage signal for update of AccessPointSignaLevel cleaned up updateScanresult(APSeerNode, Mac[], Signal[])-Method Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 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-17 08:14:13 UTC (rev 545) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-02-17 14:11:46 UTC (rev 546) @@ -1,9 +1,9 @@ package net.sf.magicmap.client.model.measurement; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import javax.swing.event.EventListenerList; @@ -68,28 +68,23 @@ client.notSeesAccessPoint(nodeModel.findAccessPoint(apMac)); } else { updateAccessPoint(client, accessPoint); - client.setSignalLevelForAcessPoint(nodeModel.findAccessPoint(apMac), signalLevel); + client.setSignalLevelForAcessPoint(nodeModel.findAccessPoint(apMac), accessPoint + .getAverageSignalLevel()); } } } public void updateScanResult(AccessPointSeerNode client, String[] apMac, double[] signalLevel){ - ArrayList<AccessPointNode> seenAps = client.getSeenAccessPoints(); - INodeModel nodeModel = client.getModel(); + HashSet<String> seenAps = new HashSet<String>(); + for (SeenAccessPoint sap : this.get(client)) { + seenAps.add(sap.getMac()); + } 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]); - } + seenAps.remove(apMac); + updateScanResult(client, apMac[i], signalLevel[i]); } - for (AccessPointNode ap : seenAps) { - client.notSeesAccessPoint(ap); + for (String mac : seenAps) { + updateScanResult(client, mac, Double.NEGATIVE_INFINITY); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rad...@us...> - 2007-02-17 08:14:14
|
Revision: 545 http://svn.sourceforge.net/magicmap/?rev=545&view=rev Author: radetzki09 Date: 2007-02-17 00:14:13 -0800 (Sat, 17 Feb 2007) Log Message: ----------- Removed System.out.println() Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java 2007-02-17 08:13:34 UTC (rev 544) +++ trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java 2007-02-17 08:14:13 UTC (rev 545) @@ -36,8 +36,6 @@ while (tokenizer.hasMoreTokens()) { String line = tokenizer.nextToken().trim(); - System.out.println("---"+line+"---"); - boolean containsLocalHost = line.indexOf(localHost) >= 0; if (line.startsWith("inet " + localHost)){ line = tokenizer.nextToken().trim(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rad...@us...> - 2007-02-17 08:13:36
|
Revision: 544 http://svn.sourceforge.net/magicmap/?rev=544&view=rev Author: radetzki09 Date: 2007-02-17 00:13:34 -0800 (Sat, 17 Feb 2007) Log Message: ----------- PluginLoader displays the name of the loaded plugin. Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java 2007-02-17 02:16:46 UTC (rev 543) +++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java 2007-02-17 08:13:34 UTC (rev 544) @@ -68,7 +68,6 @@ } } } catch (Exception e) { - log.warn("Invalid plugin directory: " + url.toString()); brokenUrlList.add(url); } } @@ -80,7 +79,6 @@ */ private void loadPlugin(URL url) throws Exception{ // first. Descriptor laden. - log.info("Loading URL: " + url); String jarUrl = "jar:" + url.toString() + "!/META-INF/plugin.xml"; JarURLConnection con = (JarURLConnection) new URL(jarUrl).openConnection(); net.sf.magicmap.client.plugin.util.PluginDescriptorReader descriptorReader = new net.sf.magicmap.client.plugin.util.PluginDescriptorReader(con.getInputStream()); @@ -97,7 +95,7 @@ net.sf.magicmap.client.plugin.IPlugin plugin = (IPlugin) piConstructor.newInstance(descriptor); this.pluginList.add(plugin); - PluginLoader.log.info("Plugin loaded: "); + PluginLoader.log.info("Plugin loaded (" + plugin.getArtifactId() + ")"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2007-02-17 02:16:47
|
Revision: 543 http://svn.sourceforge.net/magicmap/?rev=543&view=rev Author: flederohr Date: 2007-02-16 18:16:46 -0800 (Fri, 16 Feb 2007) Log Message: ----------- update udpplugin Modified Paths: -------------- trunk/magicmapclient/plugins/udpplugin-plugin.jar Modified: trunk/magicmapclient/plugins/udpplugin-plugin.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2007-02-17 01:33:36
|
Revision: 542 http://svn.sourceforge.net/magicmap/?rev=542&view=rev Author: flederohr Date: 2007-02-16 17:33:34 -0800 (Fri, 16 Feb 2007) Log Message: ----------- dont remove fixed accesspoints Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-02-17 00:06:55 UTC (rev 541) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java 2007-02-17 01:33:34 UTC (rev 542) @@ -88,14 +88,16 @@ if (apEdges.containsKey(ap.getMacAddress())) { apEdges.remove(ap.getMacAddress()); getModel().updateNode(this, NodeModelConstants.UPDATE_NOTSEESACCESSPOINT, ap); - boolean deleteAP = true; - for (AccessPointSeerNode asn : Controller.getInstance().getMeasurementModel().getAccessPointSeerNodes()) { - if (asn.getSignalLevelForAccessPoint(ap) != -Constants.MIN_SIGNALLEVEL) { - deleteAP = false; - break; + if (!ap.isFix()) { + boolean deleteAP = true; + for (AccessPointSeerNode asn : Controller.getInstance().getMeasurementModel().getAccessPointSeerNodes()) { + if (asn.getSignalLevelForAccessPoint(ap) != -Constants.MIN_SIGNALLEVEL) { + deleteAP = false; + break; + } } + if (deleteAP) getModel().removeNode(ap); } - if (deleteAP) getModel().removeNode(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 teilen wir unserem Modell mit + for (Object seenAp : seenAps) { + AccessPointNode ap = (AccessPointNode) seenAp; + location.notSeesAccessPoint(ap); + } + } + } - /** - * Macht irgendwass - * @param nodeModel - * @param position - */ - private void handleAccessPointXYZ(INodeModel nodeModel, PositionDTO position) { - System.out.println("Accesspointposition erzeugt oder aktualisiert."); - AccessPointDTO apdto = position.getAccessPoint(); - AccessPointNode ap = nodeModel.findAccessPoint(apdto.getMac()); - if (ap == null) { - // Gibt es noch nicht in unserem Modell => - // Schnell erzeugen - ap = new AccessPointNode(nodeModel); - ap.setMacAddress(apdto.getMac()); - nodeModel.addNode(ap); - } - ap.setId(position.getId()); - ap.setHiddenStatus(apdto.isHidden()); - // Nur Position von fixierten AccessPoints - // beachten - if (position.isFixed()) { - // AccessPoint wurde fixiert - ap.setPosition(position.getPosX(), position.getPosY(), - position.getPosZ()); - ap.setFix(true); - } else { - // Loser AccessPoint gemeldet - ap.setFix(false); - System.out.println("Unfix accesspoint received. This was not in our contract."); - } - } + /** + * Macht irgendwass + * @param nodeModel + * @param position + */ + private void handleAccessPointXYZ(INodeModel nodeModel, PositionDTO position){ + System.out.println("Accesspointposition erzeugt oder aktualisiert."); + AccessPointDTO apdto = position.getAccessPoint(); + AccessPointNode ap = nodeModel.findAccessPoint(apdto.getMac()); + if (ap == null) { + // Gibt es noch nicht in unserem Modell => + // Schnell erzeugen + ap = new AccessPointNode(nodeModel); + ap.setMacAddress(apdto.getMac()); + nodeModel.addNode(ap); + } + ap.setId(position.getId()); + ap.setHiddenStatus(apdto.isHidden()); + // Nur Position von fixierten AccessPoints + // beachten + if (position.isFixed()) { + // AccessPoint wurde fixiert + ap.setPosition(position.getPosX(), position.getPosY(), position.getPosZ()); + ap.setFix(true); + } else { + // Loser AccessPoint gemeldet + ap.setFix(false); + System.out.println("Unfix accesspoint received. This was not in our contract."); + } + } - /** - * Macht igrnedwass! - * @param nodeModel - * @param position - */ - private void handleClientXYZ(INodeModel nodeModel, PositionDTO position) { - ClientDTO clientdto = position.getClient(); - ClientNode client = (ClientNode) nodeModel.findNode(clientdto.getName()); + /** + * Macht igrnedwass! + * @param nodeModel + * @param position + */ + private void handleClientXYZ(INodeModel nodeModel, PositionDTO position){ + ClientDTO clientdto = position.getClient(); + ClientNode client = (ClientNode) nodeModel.findNode(clientdto.getName()); - // Wenn eigener Client unfixiert kommt - // Positionsangaben ignorieren - if (client == this.controller.getClient() && !position.isFixed()) { - // Aber noch schnell unfixieren - client.setFix(false); - System.out.println("Eigener Client wird ignoriert"); - return; - } else if (client == this.controller.getClient() && position.isFixed()) - System.out.println("Eigener Client empfangen mit fixierter Position."); + // Wenn eigener Client unfixiert kommt + // Positionsangaben ignorieren + if (client == this.controller.getClient() && !position.isFixed()) { + // Aber noch schnell unfixieren + client.setFix(false); + System.out.println("Eigener Client wird ignoriert"); + return; + } else if (client == this.controller.getClient() && position.isFixed()) + System.out.println("Eigener Client empfangen mit fixierter Position."); - // Sonst beachten wir alle Positionen die wir - // bekommen - if (client == null) { - System.out.println("Neuer Client empfangen (" + clientdto.getMac() + ", " - + clientdto.getName() + ". F\xFCge zum Graphen hinzu."); - client = new ClientNode(nodeModel); - client.setMacAddress(clientdto.getMac()); - client.setName(clientdto.getName()); - nodeModel.addNode(client); - } + // Sonst beachten wir alle Positionen die wir + // bekommen + if (client == null) { + System.out.println("Neuer Client empfangen (" + clientdto.getMac() + ", " + clientdto.getName() + + ". F\xFCge zum Graphen hinzu."); + client = new ClientNode(nodeModel); + client.setMacAddress(clientdto.getMac()); + client.setName(clientdto.getName()); + nodeModel.addNode(client); + } - System.out.println("Position f\xFCr Client " + client.getName() + " empfangen. fix = " - + position.isFixed()); - // client.setPosition(position.getPosX().intValue(), - // position.getPosY().intValue()); + System.out.println("Position f\xFCr Client " + client.getName() + " empfangen. fix = " + position.isFixed()); + // client.setPosition(position.getPosX().intValue(), + // position.getPosY().intValue()); - if (position.isFixed()) { - // Client wurde fixiert - client.setFix(true); - client.setPosition(position.getPosX(), position.getPosY(), - position.getPosZ()); - } else - client.setFix(false); - client.setId(position.getId()); + if (position.isFixed()) { + // Client wurde fixiert + client.setFix(true); + client.setPosition(position.getPosX(), position.getPosY(), position.getPosZ()); + } else + client.setFix(false); + client.setId(position.getId()); - // Signalst\xE4rken usw. verwaltet der scannende - // Client selbst - if (client == this.controller.getClient()) return; + // Signalst\xE4rken usw. verwaltet der scannende + // Client selbst + if (client == this.controller.getClient()) return; - // Signalcharakteristik auswerden und gesehene - // AccessPoints ebenfalls erzeugen bzw. mit - // ihnen Verbindungen - // herstellen - SignalCharacterDTO sc = position.getCharacter(); - SimpleScanResultDTO[] sr = sc.getSimpleScanResults(); - // Alle momentan gesehenen AccessPoints merken - ArrayList seenAps = client.getSeenAccessPoints(); + // Signalcharakteristik auswerden und gesehene + // AccessPoints ebenfalls erzeugen bzw. mit + // ihnen Verbindungen + // herstellen + SignalCharacterDTO sc = position.getCharacter(); + SimpleScanResultDTO[] sr = sc.getSimpleScanResults(); + // Alle momentan gesehenen AccessPoints merken + ArrayList seenAps = client.getSeenAccessPoints(); - if (sr != null) { - 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); - } - } + if (sr != null) { + 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); + } + } - /* - * (non-Javadoc) - * - * @see net.sf.magicmap.client.interfaces.ServerPollerListener#mapCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.MapDTO) - */ - public void mapCreatedOrUpdatedOrDeleted(final MapDTO mapDTO){ + /* + * (non-Javadoc) + * + * @see net.sf.magicmap.client.interfaces.ServerPollerListener#mapCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.MapDTO) + */ + public void mapCreatedOrUpdatedOrDeleted(final MapDTO mapDTO){ - try { - SwingUtilities.invokeAndWait(new Runnable() { + try { + SwingUtilities.invokeAndWait(new Runnable() { - public void run(){ - try { - INodeModel nodeModel = PollHandler.this.controller.getNodeModel(); - Node node = nodeModel.findNode(mapDTO.getName()); + public void run(){ + try { + INodeModel nodeModel = PollHandler.this.controller.getNodeModel(); + Node node = nodeModel.findNode(mapDTO.getName()); - if (node == null) { - MapNode mapNode = new MapNode(nodeModel); - mapNode.setName(mapDTO.getName()); - mapNode.setMapInfo(mapDTO); - nodeModel.addNode(mapNode); - } + if (node == null) { + MapNode mapNode = new MapNode(nodeModel); + mapNode.setName(mapDTO.getName()); + mapNode.setMapInfo(mapDTO); + nodeModel.addNode(mapNode); + } - } 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(); - } - } + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - /* - * (non-Javadoc) - * - * @see net.sf.magicmap.client.interfaces.ServerPollerListener#geoPosCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.GeoPointDTO) - */ - public void geoPosCreatedOrUpdatedOrDeleted(final GeoPointDTO pointDTO){ + /* + * (non-Javadoc) + * + * @see net.sf.magicmap.client.interfaces.ServerPollerListener#geoPosCreatedOrUpdatedOrDeleted(net.sf.magicmap.server.dto.GeoPointDTO) + */ + public void geoPosCreatedOrUpdatedOrDeleted(final GeoPointDTO pointDTO){ - try { - SwingUtilities.invokeAndWait(new Runnable() { + try { + SwingUtilities.invokeAndWait(new Runnable() { - public void run(){ - try { - INodeModel nodeModel = PollHandler.this.controller.getNodeModel(); - Node node = nodeModel.findNode(pointDTO.toString()); + public void run(){ + try { + INodeModel nodeModel = PollHandler.this.controller.getNodeModel(); + Node node = nodeModel.findNode(pointDTO.toString()); - if (node == null) { - GeoPosNode geoNode = new GeoPosNode(nodeModel); - GeoPos geoPos = new GeoPos(pointDTO.getGeoPointLong(), pointDTO.getGeoPointLat(), pointDTO.getGeoPointAlt()); - geoNode.setName(pointDTO.toString()); - geoNode.setId(pointDTO.getId()); - System.err.println("created geo node: " + geoNode.getId()); - geoNode.setGeoPos(geoPos); - nodeModel.addNode(geoNode); - geoNode.setFix(true); - geoNode.setPosition(pointDTO.getGeoPointX(), pointDTO.getGeoPointY(), - 0); - } + if (node == null) { + GeoPosNode geoNode = new GeoPosNode(nodeModel); + GeoPos geoPos = new GeoPos(pointDTO.getGeoPointLong(), pointDTO.getGeoPointLat(), pointDTO + .getGeoPointAlt()); + geoNode.setName(pointDTO.toString()); + geoNode.setId(pointDTO.getId()); + System.err.println("created geo node: " + geoNode.getId()); + geoNode.setGeoPos(geoPos); + nodeModel.addNode(geoNode); + geoNode.setFix(true); + geoNode.setPosition(pointDTO.getGeoPointX(), pointDTO.getGeoPointY(), 0); + } - } 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(); - } - } + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - /* - * (non-Javadoc) - * - * @see net.sf.magicmap.client.interfaces.ServerPollerListener#infoObjectCreatedorUpdatedOrDeleted(net.sf.magicmap.client.model.node.InfoObject) - */ - public void infoObjectCreatedorUpdatedOrDeleted(final InfoObject infoObject){ + /* + * (non-Javadoc) + * + * @see net.sf.magicmap.client.interfaces.ServerPollerListener#infoObjectCreatedorUpdatedOrDeleted(net.sf.magicmap.client.model.node.InfoObject) + */ + public void infoObjectCreatedorUpdatedOrDeleted(final InfoObject infoObject){ - try { - SwingUtilities.invokeAndWait(new Runnable() { + try { + SwingUtilities.invokeAndWait(new Runnable() { - public void run(){ - // try { - // INodeModel nodeModel = controller.getNodeModel(); - // Node node = nodeModel.findNode(infoObject.getUrl()); - // - // if (node == null) { - // InfoObjectNode infoNode = new InfoObjectNode(nodeModel); - // infoNode.setName(infoObject.getUrl()); - // infoNode.setDisplayName(infoObject.getName()); - // infoNode.setId(infoObject.hashCode()); - // String[] tags = infoObject.getUrl().split(","); - // for (String string : tags) { - // infoNode.addTag(string); - // } - // if - // (infoObject.getMap().equals(Controller.getInstance().getCurrentMap().name)) - // { - // nodeModel.addNode(infoNode); - // infoNode.setFix(true); - // infoNode.setPosition(infoObject.getX(), - // infoObject.getY(), 0); - // } - // } - // - // } catch (Exception e){ - // e.printStackTrace(); - // } - } - }); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } + public void run(){ + // try { + // INodeModel nodeModel = controller.getNodeModel(); + // Node node = nodeModel.findNode(infoObject.getUrl()); + // + // if (node == null) { + // InfoObjectNode infoNode = new InfoObjectNode(nodeModel); + // infoNode.setName(infoObject.getUrl()); + // infoNode.setDisplayName(infoObject.getName()); + // infoNode.setId(infoObject.hashCode()); + // String[] tags = infoObject.getUrl().split(","); + // for (String string : tags) { + // infoNode.addTag(string); + // } + // if + // (infoObject.getMap().equals(Controller.getInstance().getCurrentMap().name)) + // { + // nodeModel.addNode(infoNode); + // infoNode.setFix(true); + // infoNode.setPosition(infoObject.getX(), + // infoObject.getY(), 0); + // } + // } + // + // } catch (Exception e){ + // e.printStackTrace(); + // } + } + }); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/AbstractMapView.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/AbstractMapView.java 2007-02-16 20:47:06 UTC (rev 540) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/AbstractMapView.java 2007-02-17 00:06:55 UTC (rev 541) @@ -5,7 +5,6 @@ import java.util.Collection; import net.sf.magicmap.client.interfaces.MapViewListener; -import net.sf.magicmap.client.interfaces.NodeModelListener; import net.sf.magicmap.client.model.node.INodeModel; import net.sf.magicmap.client.model.node.Node; import edu.uci.ics.jung.graph.event.VertexListener; @@ -16,7 +15,7 @@ * @author Jan Friderici * */ -public abstract class AbstractMapView extends View implements VertexListener, NodeModelListener { +public abstract class AbstractMapView extends View implements VertexListener { private final Collection<MapViewListener> listeners = new ArrayList<MapViewListener>(); private INodeModel model; 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-16 20:47:06 UTC (rev 540) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-17 00:06:55 UTC (rev 541) @@ -4,43 +4,57 @@ 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.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.NodeIcon; +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.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.StringLabeller.UniqueLabelException; import edu.uci.ics.jung.graph.decorators.VertexColorFunction; +import edu.uci.ics.jung.graph.decorators.StringLabeller.UniqueLabelException; 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.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.NodeIcon; -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 * @@ -105,7 +119,7 @@ ni = NodeIcons.getInstance(); initializeGraph(); -// model.addNodeModelListener(this.layoutModel); + // model.addNodeModelListener(this.layoutModel); this.getModel().addNodeModelSelectionListener(this); } @@ -141,25 +155,25 @@ return null; } //break; - // TODO: InfonodeIcon in NodeIcons behandeln -// case INodeModel.NODETYPE_INFO : -// if (((InfoObjectNode) node).getDepiction() != null) { -// ImageIcon icon; -// try { -// icon = new ImageIcon(new URL(((InfoObjectNode) node).getDepiction()), "<Depiction>"); -// if (icon != null && icon.getIconHeight() > 0) { -// return icon; -// } -// } catch (MalformedURLException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } + // TODO: InfonodeIcon in NodeIcons behandeln + // case INodeModel.NODETYPE_INFO : + // if (((InfoObjectNode) node).getDepiction() != null) { + // ImageIcon icon; + // try { + // icon = new ImageIcon(new URL(((InfoObjectNode) node).getDepiction()), "<Depiction>"); + // if (icon != null && icon.getIconHeight() > 0) { + // return icon; + // } + // } catch (MalformedURLException e) { + // // TODO Auto-generated catch block + // e.printStackTrace(); + // } + // } break; } log.debug("Nodename: " + node.getClass().getSimpleName()); final NodeIcon nodeIcon = NodeIcons.getInstance().getNodeIcon(node); - if (nodeIcon != null)return nodeIcon.getIcon(node); + if (nodeIcon != null) return nodeIcon.getIcon(node); return ni.getIconForNode(node); } @@ -233,7 +247,7 @@ */ public void initializeGraph(){ layoutModel = (JungNodePlacer) getModel().getNodePlacer(); - graph = layoutModel;// new DirectedSparseGraph(); + graph = layoutModel;// new DirectedSparseGraph(); graphdraw = new PACWGraphDraw(layoutModel); graphdraw.setVisible(false); labeller = StringLabeller.getLabeller(graph); @@ -354,7 +368,7 @@ } }); graphdraw.getVisualizationViewer().addVertexListener(this); - layoutModel.start(); + layoutModel.startNodePlacer(); // pane.add(graphdraw); RelativeLayout rl = new RelativeLayout(); @@ -426,14 +440,14 @@ fireRightClicked(x, y); } - /** - * 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){ + /** + * 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) { @@ -478,25 +492,6 @@ } } - /** - * 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 - // stopGraph(); - // labeller.removeLabel(node.getDisplayName()); - // graph.removeVertex(v); - // ((SpringLayout) graphdraw.getGraphLayout()).update(); - // resumeGraph(); - // - // } - } - public Vertex findVertex(Node node){ return (Vertex) layoutModel.findVertex(node); } @@ -506,35 +501,6 @@ return node; } - /** - * - * - */ - public void nodeAddedEvent(Node node){ - // TODO auch unn\xF6tig oder? - layoutModel.nodeAddedEvent(node); - } - - /* - * (non-Javadoc) - * - * @see net.sf.magicmap.client.interfaces.NodeModelListener#nodeRemovedEvent(net.sf.magicmap.client.model.Node) - */ - public void nodeRemovedEvent(Node node){ - removeVertex(node); - } - - /* - * (non-Javadoc) - * - * @see net.sf.magicmap.client.interfaces.NodeModelListener#nodeUpdatedEvent(net.sf.magicmap.client.model.Node, - * int, java.lang.Object) - */ - // TODO refactor me - das geh\xF6rt hier beim besten willen nicht hin! - public void nodeUpdatedEvent(Node node, int type, Object data){ - // System.out.println(getClass() + "::nodeUpdatedEvent"); - } - public int getMapOffsetX(){ int ox = (getWidth() - graphdraw.getWidth()) / 2; return (ox >= 0 ? ox : 0); 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-16 20:47:06 UTC (rev 540) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-17 00:06:55 UTC (rev 541) @@ -1,27 +1,41 @@ package net.sf.magicmap.client.model.location.jung; -import edu.uci.ics.jung.graph.Edge; -import edu.uci.ics.jung.graph.Vertex; -import edu.uci.ics.jung.graph.decorators.StringLabeller; -import edu.uci.ics.jung.graph.impl.DirectedSparseEdge; -import edu.uci.ics.jung.graph.impl.DirectedSparseGraph; -import edu.uci.ics.jung.graph.impl.DirectedSparseVertex; -import edu.uci.ics.jung.utils.UserData; -import edu.uci.ics.jung.visualization.SpringLayout; +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.NodeMetricManager; 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 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.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.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 org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.awt.*; -import java.util.*; +import edu.uci.ics.jung.graph.Edge; +import edu.uci.ics.jung.graph.Vertex; +import edu.uci.ics.jung.graph.decorators.StringLabeller; +import edu.uci.ics.jung.graph.impl.DirectedSparseGraph; +import edu.uci.ics.jung.graph.impl.DirectedSparseVertex; +import edu.uci.ics.jung.utils.UserData; +import edu.uci.ics.jung.visualization.SpringLayout; /** * Dieses Model benutzt die Layoutfunktionen von Jung und einige Angepasste @@ -89,28 +103,28 @@ */ private final NodeHandlerFactory nodeHandler = new NodeHandlerFactory(); - private final NodeMetricManager metricManager; + private final NodeMetricManager metricManager; - public JungNodePlacer() { + public JungNodePlacer() { this(JungNodePlacer.DEFAULT_SETTINGS, new MagicMetric()); } - /** - * - * @return - */ - public NodeMetricManager getMetricManager() { - return metricManager; - } + /** + * + * @return + */ + public NodeMetricManager getMetricManager(){ + return metricManager; + } - /** + /** * * @param settings * @param metric */ public JungNodePlacer(LayoutSettings settings, NodeModelMetric metric) { super(); - this.metricManager = new NodeMetricManager(metric); + this.metricManager = new NodeMetricManager(metric); this.c... [truncated message content] |
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: <Jan...@us...> - 2007-02-16 19:36:46
|
Revision: 539 http://svn.sourceforge.net/magicmap/?rev=539&view=rev Author: Jan_fride Date: 2007-02-16 11:36:24 -0800 (Fri, 16 Feb 2007) Log Message: ----------- Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.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-16 12:48:35 UTC (rev 538) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java 2007-02-16 19:36:24 UTC (rev 539) @@ -23,6 +23,7 @@ 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.NodeIcon; import net.sf.magicmap.client.gui.utils.NodeIcons; import net.sf.magicmap.client.meta.MapInfo; import net.sf.magicmap.client.model.location.INodePlacer; @@ -42,7 +43,7 @@ /** * Kapselt das JUNG-Framework sowie die Karte - * + * * @author thuebner */ public class MapView extends AbstractMapView implements NodeModelSelectionListener { @@ -95,7 +96,7 @@ /** * Erzeugt ein auf dem Model NodeModel aufbauenen View in Form einer Karte. - * + * */ public MapView(INodeModel model, INodePlacer layoutModel) { super(model); @@ -110,7 +111,7 @@ /* * (non-Javadoc) - * + * * @see net.sf.magicmap.client.views.View#getName() */ public String getName(){ @@ -157,6 +158,8 @@ break; } log.debug("Nodename: " + node.getClass().getSimpleName()); + final NodeIcon nodeIcon = NodeIcons.getInstance().getNodeIcon(node); + if (nodeIcon != null)return nodeIcon.getIcon(node); return ni.getIconForNode(node); } @@ -221,12 +224,12 @@ /** * Initialisiert den JUNG-Graphen. Es werden - * + * * DirectSparseGraph (graph) PACGraphDraw (grapdraw) SpringLayout (sl) * LengthFunction (lf) RepulsionFunction - * + * * erzeugt und initialisiert. - * + * */ public void initializeGraph(){ layoutModel = (JungNodePlacer) getModel().getNodePlacer(); @@ -388,7 +391,7 @@ /** * Liefert die Hauptkomponenete des Views zur?ck. - * + * */ public JComponent buildViewComponent(){ // initializeGraph(); @@ -403,7 +406,7 @@ * Ein Vertex im JUNG-Graphen wurde mit der rechten Maustaste angeklickt. Es * wird ein angepasstes Ereigniss an alle registrierten Listener dieses * Views geschickt. - * + * * @see edu.uci.ics.jung.graph.event.VertexListener#vertexRightClicked(edu.uci.ics.jung.graph.Vertex, * int, int) */ @@ -416,7 +419,7 @@ * Es wurde ein im JUNG-Graphen an eine freie Steller mit der rechten * Maustaste geklickt. Es wird ein angepasstes Ereigniss an alle * registrierten Listener dieses Views geschickt. - * + * * @see edu.uci.ics.jung.graph.event.VertexListener#rightClicked(int, int) */ public void rightClicked(int x, int y){ @@ -452,7 +455,7 @@ /** * Entfernt alle Kanten an denen der Knoten beteiligt ist. - * + * * @param node */ public void removeEdges(Node node){ @@ -477,7 +480,7 @@ /** * Entfernt Knoten aus dem Graph und eventuelle Kanten - * + * * @param node */ public void removeVertex(Node node){ @@ -504,8 +507,8 @@ } /** - * * + * */ public void nodeAddedEvent(Node node){ // TODO auch unn\xF6tig oder? @@ -514,7 +517,7 @@ /* * (non-Javadoc) - * + * * @see net.sf.magicmap.client.interfaces.NodeModelListener#nodeRemovedEvent(net.sf.magicmap.client.model.Node) */ public void nodeRemovedEvent(Node node){ @@ -523,7 +526,7 @@ /* * (non-Javadoc) - * + * * @see net.sf.magicmap.client.interfaces.NodeModelListener#nodeUpdatedEvent(net.sf.magicmap.client.model.Node, * int, java.lang.Object) */ @@ -544,7 +547,7 @@ /* * (non-Javadoc) - * + * * @see edu.uci.ics.jung.graph.event.VertexListener#vertexControlDragged(edu.uci.ics.jung.graph.Vertex, * int, int) */ @@ -557,7 +560,7 @@ /* * (non-Javadoc) - * + * * @see edu.uci.ics.jung.graph.event.VertexListener#vertexControlDragged(edu.uci.ics.jung.graph.Vertex, * int, int) */ @@ -568,7 +571,7 @@ /** * Liefert die tats?chliche X-Position im Graphen - * + * * @param node * @return */ @@ -581,7 +584,7 @@ /** * Liefert die tats?chliche Y-Position im Graphen - * + * * @param node * @return */ @@ -594,7 +597,7 @@ /** * Liefert die tats?chliche Z-Position - * + * * @param node * @return */ @@ -628,11 +631,11 @@ * MeasurementView. Bei AccessPoints oder dem eigenen Client wurd * umgeschalten in den lokalen Modus, wo stetig die Werte aktualisiert * werden. - * + * * Kleiner Refactor - es wird NUR dem NodeModel bescheid gesagt das ein * neuer Knoten selektiert wurde. Die anderen Views und Models erledigen * den rest selber... - * + * * @see edu.uci.ics.jung.graph.event.VertexListener#vertexSelected(edu.uci.ics.jung.graph.Vertex) */ public void vertexSelected(Vertex v){ @@ -700,7 +703,7 @@ } /** - * Called if a + * Called if a */ public void selectionChanged(NodeModelSelectionEvent selectEvent){ Node newSelectedNode = selectEvent.getSelectedNode(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jan...@us...> - 2007-02-16 12:48:36
|
Revision: 538 http://svn.sourceforge.net/magicmap/?rev=538&view=rev Author: jan_fride Date: 2007-02-16 04:48:35 -0800 (Fri, 16 Feb 2007) Log Message: ----------- Made Icons a little bit generic Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIBuilder.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java Added Paths: ----------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcon.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIBuilder.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIBuilder.java 2007-02-16 12:39:13 UTC (rev 537) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIBuilder.java 2007-02-16 12:48:35 UTC (rev 538) @@ -20,8 +20,8 @@ import net.sf.magicmap.client.gui.MainGUI; /** - * - * + * + * * @author thuebner */ public class GUIBuilder { @@ -88,6 +88,23 @@ } + public static ImageIcon getToolIcon(String imageName, String resourcePackage){ + String imgLocation; + URL imageURL; + + if (imageName != null) { + + imgLocation = "/" + resourcePackage + "/" + imageName; + imageURL = MainGUI.class.getResource(imgLocation); + + } else + imageURL = null; + + return new ImageIcon(imageURL, "<>"); + + } + + /** * Erzeugt Button f\xFCr ToolBar mit Text, Icon, ActionCommand, Bild, * ToolBar und alternativem Text, falls Bild nicht vorhanden. Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcon.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcon.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcon.java 2007-02-16 12:48:35 UTC (rev 538) @@ -0,0 +1,18 @@ +package net.sf.magicmap.client.gui.utils; + +import javax.swing.Icon; + +import net.sf.magicmap.client.model.node.Node; + + +/** + * + * @author Jan Friderici + * + * @param <T> the nodetype this is icon is for. + */ +public interface NodeIcon { + public int getNodeType(); + public Class getNodeClass(); + public Icon getIcon(Node node); +} Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java 2007-02-16 12:39:13 UTC (rev 537) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java 2007-02-16 12:48:35 UTC (rev 538) @@ -36,6 +36,8 @@ private static final String HIDDEN = "Hidden"; + private final Map<Class, NodeIcon> iconMap = new HashMap<Class, NodeIcon>(); + private NodeIcons() { init(); } @@ -89,4 +91,11 @@ return NodeIcons.ni; } + public NodeIcon getNodeIcon(Node node){ + return iconMap.get(node.getClass()); + } + public void registerNodeIcon(NodeIcon icon){ + iconMap.put(icon.getNodeClass(), icon); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jan...@us...> - 2007-02-16 12:39:27
|
Revision: 537 http://svn.sourceforge.net/magicmap/?rev=537&view=rev Author: jan_fride Date: 2007-02-16 04:39:13 -0800 (Fri, 16 Feb 2007) Log Message: ----------- made OutlineModel accessable through OutlineView Modified Paths: -------------- trunk/magicmapclient/plugins/udpplugin-plugin.jar trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java trunk/magicmapclient/src/net/sf/magicmap/client/model/outline/OutlineModel.java Modified: trunk/magicmapclient/plugins/udpplugin-plugin.jar =================================================================== (Binary files differ) Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-02-16 10:37:27 UTC (rev 536) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2007-02-16 12:39:13 UTC (rev 537) @@ -79,7 +79,6 @@ return panel; } - public void selectionChanged(NodeModelSelectionEvent selectEvent){ Node selectedNode = selectEvent.getSelectedNode(); if (selectedNode != Node.EMPTY_NODE) tree.setSelectionPath(getOutlineNodePath(selectedNode)); @@ -227,4 +226,8 @@ public void collapseRPs(boolean b){ collapseCategory(NodeModelConstants.NODETYPE_LOCATION, b); } + + public OutlineModel getOutlineModel(){ + return this.outlineModel; + } } \ No newline at end of file Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-16 10:37:27 UTC (rev 536) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2007-02-16 12:39:13 UTC (rev 537) @@ -96,7 +96,7 @@ } /** - * + * * @return */ public NodeMetricManager getMetricManager() { @@ -159,14 +159,15 @@ * F\xFCgt einen neuen Knoten ein. */ public void insertNode(Node node){ - Vertex v = null; int type = node.getType(); - // TODO das hier ist wahrlich haesslich.... + if (node.getClass().equals(MapNode.class)) return; - 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 (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) +// + Vertex v = addVertex(node); + if (v != null) if (node.isFix()) this.layout.setFix(v); else Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/outline/OutlineModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/outline/OutlineModel.java 2007-02-16 10:37:27 UTC (rev 536) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/outline/OutlineModel.java 2007-02-16 12:39:13 UTC (rev 537) @@ -15,7 +15,7 @@ /** * A TreeModel for the NodeModel. - * + * * @author Jan * */ @@ -27,7 +27,7 @@ private final Map<Node, OutlineTreeNode> nodes; /** - * + * * @param nodeModel */ public OutlineModel(INodeModel nodeModel) { @@ -42,10 +42,9 @@ addCategory(NodeModelConstants.NODETYPE_CLIENT, GUIUtils.i18n("clients")); addCategory(NodeModelConstants.NODETYPE_LOCATION, GUIUtils.i18n("locations")); addCategory(NodeModelConstants.NODETYPE_GEOPOS, GUIUtils.i18n("Geokoordinaten")); - addCategory(NodeModelConstants.NODETYPE_INFO, GUIUtils.i18n("Infoobjekte")); + //addCategory(NodeModelConstants.NODETYPE_INFO, GUIUtils.i18n("Infoobjekte")); nodeModel.addNodeModelListener(this); - } public OutlineTreeNode getCategoryNode(int category){ @@ -53,20 +52,21 @@ } /** - * + * * @param category * @param title */ public void addCategory(int category, String title){ if (this.categories.containsKey(category)) return; OutlineTreeNode outlineTreeNode = new OutlineTreeNode(title); - this.rootNode.add(outlineTreeNode); + this.categories.put(category, outlineTreeNode); + this.insertNodeInto(outlineTreeNode, rootNode, 0); } /** - * + * */ public void nodeAddedEvent(Node node){ OutlineTreeNode parent = this.categories.get(node.getType()); @@ -87,7 +87,7 @@ } /** - * + * */ public void nodeUpdatedEvent(Node node, int type, Object data){ if (type == NodeModelConstants.UPDATE_CLEAR) { @@ -101,7 +101,7 @@ /** * Find OutlineNode for given Node and root OutlineNode * @param node - the Node to find - * @return the OutlineNode if exists, else null + * @return the OutlineNode if exists, else null */ public OutlineTreeNode findOutlineNode(Node node){ if (this.nodes.containsKey(node)) return this.nodes.get(node); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rad...@us...> - 2007-02-16 10:37:55
|
Revision: 536 http://svn.sourceforge.net/magicmap/?rev=536&view=rev Author: radetzki09 Date: 2007-02-16 02:37:27 -0800 (Fri, 16 Feb 2007) Log Message: ----------- forget a return ;-) now we get the right MAC-Address Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java 2007-02-16 10:04:27 UTC (rev 535) +++ trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java 2007-02-16 10:37:27 UTC (rev 536) @@ -36,19 +36,18 @@ while (tokenizer.hasMoreTokens()) { String line = tokenizer.nextToken().trim(); + System.out.println("---"+line+"---"); boolean containsLocalHost = line.indexOf(localHost) >= 0; + + if (line.startsWith("inet " + localHost)){ + line = tokenizer.nextToken().trim(); + String macAddressCandidate = line.substring(line.length() - 17).trim(); + if (isMacAddress(macAddressCandidate)) { + lastMacAddress = macAddressCandidate.toUpperCase(); + return lastMacAddress; + } + } - // see if line contains IP address - if (containsLocalHost && lastMacAddress != null) return lastMacAddress; - - // see if line contains MAC address - if (line.indexOf("ether") == -1) continue; - - String macAddressCandidate = line.substring(line.length() - 17).trim(); - if (isMacAddress(macAddressCandidate)) { - lastMacAddress = macAddressCandidate.toUpperCase(); - continue; - } } ParseException ex = new ParseException("cannot read MAC address for " + localHost + " from [" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rad...@us...> - 2007-02-16 10:05:07
|
Revision: 535 http://svn.sourceforge.net/magicmap/?rev=535&view=rev Author: radetzki09 Date: 2007-02-16 02:04:27 -0800 (Fri, 16 Feb 2007) Log Message: ----------- The MAC-Address for a "Mac OS X"-OperatingSystem is now available. Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/net/NetworkInfo.java Added Paths: ----------- trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java Added: trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/net/MacOSNetworkInfo.java 2007-02-16 10:04:27 UTC (rev 535) @@ -0,0 +1,94 @@ +/* + * Created on 16.02.2007 + */ + +package net.sf.magicmap.client.net; + +import java.io.IOException; +import java.text.ParseException; + +/** + * @author radetzki + */ +public class MacOSNetworkInfo extends NetworkInfo { + + public static final String IPCONFIG_COMMAND = "/sbin/ifconfig"; + + @Override + public String parseMacAddress() throws ParseException{ + String ipConfigResponse = null; + try { + ipConfigResponse = runConsoleCommand(MacOSNetworkInfo.IPCONFIG_COMMAND); + } catch (IOException e) { + e.printStackTrace(); + throw new ParseException(e.getMessage(), 0); + } + String localHost = null; + try { + localHost = java.net.InetAddress.getLocalHost().getHostAddress(); + } catch (java.net.UnknownHostException ex) { + ex.printStackTrace(); + throw new ParseException(ex.getMessage(), 0); + } + + java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(ipConfigResponse, "\n"); + String lastMacAddress = null; + + while (tokenizer.hasMoreTokens()) { + String line = tokenizer.nextToken().trim(); + boolean containsLocalHost = line.indexOf(localHost) >= 0; + + // see if line contains IP address + if (containsLocalHost && lastMacAddress != null) return lastMacAddress; + + // see if line contains MAC address + if (line.indexOf("ether") == -1) continue; + + String macAddressCandidate = line.substring(line.length() - 17).trim(); + if (isMacAddress(macAddressCandidate)) { + lastMacAddress = macAddressCandidate.toUpperCase(); + continue; + } + } + + ParseException ex = new ParseException("cannot read MAC address for " + localHost + " from [" + + ipConfigResponse + "]", 0); + ex.printStackTrace(); + throw ex; + } + + @Override + public void collectMacAddresses() throws ParseException{ + NetworkInfo.macAddresses.clear(); + String ipConfigResponse = null; + try { + ipConfigResponse = runConsoleCommand(MacOSNetworkInfo.IPCONFIG_COMMAND); + } catch (IOException e) { + e.printStackTrace(); + throw new ParseException(e.getMessage(), 0); + } + java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(ipConfigResponse, "\n"); + + String line; + String macAddressCandidate; + while (tokenizer.hasMoreTokens()) { + line = tokenizer.nextToken().trim(); + + // see if line contains MAC address + if (line.indexOf("Hardware") == -1 && line.indexOf("HWaddr") == -1) continue; + + macAddressCandidate = line.substring(line.length() - 17).trim(); + if (isMacAddress(macAddressCandidate)) NetworkInfo.macAddresses.add(macAddressCandidate); + } + } + + @Override + public String parseDomain(String hostname) throws ParseException{ + return ""; + } + + private final boolean isMacAddress(String macAddressCandidate){ + if (macAddressCandidate.length() != 17) return false; + return true; + } +} \ No newline at end of file Modified: trunk/magicmapclient/src/net/sf/magicmap/client/net/NetworkInfo.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/net/NetworkInfo.java 2007-02-14 17:29:03 UTC (rev 534) +++ trunk/magicmapclient/src/net/sf/magicmap/client/net/NetworkInfo.java 2007-02-16 10:04:27 UTC (rev 535) @@ -53,6 +53,7 @@ try { NetworkInfo info = NetworkInfo.getNetworkInfo(); String mac = info.parseMacAddress(); +// System.out.println(mac); return mac; } catch (ParseException ex) { ex.printStackTrace(); @@ -142,6 +143,8 @@ return new WindowsNetworkInfo(); else if (os.startsWith("Linux")) return new LinuxNetworkInfo(); + else if (os.startsWith("Mac")) + return new MacOSNetworkInfo(); else throw new IOException("unknown operating system: " + os); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2007-02-14 17:29:09
|
Revision: 534 http://svn.sourceforge.net/magicmap/?rev=534&view=rev Author: flederohr Date: 2007-02-14 09:29:03 -0800 (Wed, 14 Feb 2007) Log Message: ----------- InfoObjects removed from Controller and IController Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-14 15:48:36 UTC (rev 533) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-14 17:29:03 UTC (rev 534) @@ -428,41 +428,41 @@ } } - /** - * Creates an InfoObject on the current map with the supplied parameters - * @param x - * @param y - * @param z - * @param infoObject - * @param mapName - * @param fixed - * @param callback - */ - public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed, - CreatePositionCallback callback){ - if (!isConnected() || !isMapLoaded()) - callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); - else { - // serverManager.createInfoObject(x, y, z, fixed, infoObject, - // mapName, callback); - INodeModel model = Controller.getInstance().getNodeModel(); - if (infoObject instanceof InfoObjectNode) { - InfoObjectNode node = (InfoObjectNode) infoObject; - model.addNode(node); - node.setPosition(x, y, z); - node.setFix(false); - System.out.println("Added Info:\n -> " + node.toString()); - } else { - InfoObjectNode node = new InfoObjectNode(model, infoObject); - model.addNode(node); - node.setPosition(x, y, z); - node.setFix(false); - System.out.println("Added Info:\n -> " + node.toString()); - } +// /** +// * Creates an InfoObject on the current map with the supplied parameters +// * @param x +// * @param y +// * @param z +// * @param infoObject +// * @param mapName +// * @param fixed +// * @param callback +// */ +// public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed, +// CreatePositionCallback callback){ +// if (!isConnected() || !isMapLoaded()) +// callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); +// else { +// // serverManager.createInfoObject(x, y, z, fixed, infoObject, +// // mapName, callback); +// INodeModel model = Controller.getInstance().getNodeModel(); +// if (infoObject instanceof InfoObjectNode) { +// InfoObjectNode node = (InfoObjectNode) infoObject; +// model.addNode(node); +// node.setPosition(x, y, z); +// node.setFix(false); +// System.out.println("Added Info:\n -> " + node.toString()); +// } else { +// InfoObjectNode node = new InfoObjectNode(model, infoObject); +// model.addNode(node); +// node.setPosition(x, y, z); +// node.setFix(false); +// System.out.println("Added Info:\n -> " + node.toString()); +// } +// +// } +// } - } - } - /** * * @param name Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-14 15:48:36 UTC (rev 533) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-02-14 17:29:03 UTC (rev 534) @@ -194,18 +194,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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |