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-01-14 20:56:18
|
Revision: 508
http://svn.sourceforge.net/magicmap/?rev=508&view=rev
Author: jan_fride
Date: 2007-01-14 12:56:16 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
removed old pluginsystem
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 20:54:37 UTC (rev 507)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 20:56:16 UTC (rev 508)
@@ -4,47 +4,29 @@
package net.sf.magicmap.client.controller;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-
import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.gui.views.ConsoleView;
import net.sf.magicmap.client.gui.views.MapView;
import net.sf.magicmap.client.gui.views.MeasurementView;
import net.sf.magicmap.client.gui.views.OutlineView;
-import net.sf.magicmap.client.interfaces.CreateNewMapCallback;
-import net.sf.magicmap.client.interfaces.CreatePositionCallback;
-import net.sf.magicmap.client.interfaces.DeletePositionCallback;
-import net.sf.magicmap.client.interfaces.MapCallback;
-import net.sf.magicmap.client.interfaces.MapNamesCallback;
-import net.sf.magicmap.client.interfaces.MovePositionCallback;
-import net.sf.magicmap.client.interfaces.PositionCallback;
-import net.sf.magicmap.client.interfaces.ServerConnectCallback;
-import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
+import net.sf.magicmap.client.interfaces.*;
import net.sf.magicmap.client.measurement.ScannerAllocator;
import net.sf.magicmap.client.measurement.interfaces.AbstractScanResult;
import net.sf.magicmap.client.measurement.interfaces.AbstractScanner;
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry;
-
import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.measurement.MeasurementModel;
-import net.sf.magicmap.client.model.node.AccessPointSeerNode;
-import net.sf.magicmap.client.model.node.ClientNode;
-import net.sf.magicmap.client.model.node.GeoPos;
-import net.sf.magicmap.client.model.node.INodeModel;
-import net.sf.magicmap.client.model.node.InfoObject;
-import net.sf.magicmap.client.model.node.InfoObjectNode;
-import net.sf.magicmap.client.model.node.Node;
-import net.sf.magicmap.client.model.node.NodeModel;
-import net.sf.magicmap.client.plugin.PluginHandler;
+import net.sf.magicmap.client.model.node.*;
+import net.sf.magicmap.client.plugin.PluginManager;
import net.sf.magicmap.client.utils.Settings;
-import net.sf.magicmap.plugin.PluginManager;
-
import org.apache.log4j.xml.DOMConfigurator;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collection;
+
/**
* Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den
* der Anwendung.
@@ -298,7 +280,7 @@
this.poller.start();
// initializeScanner(); // Scanner neu initialisieren
this.scannerAllocator.startAllScanner();
- PluginHandler.getInstance().loadMap();
+
this.pluginManager.loadMap();
if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
getMapView().setTitle(
@@ -414,14 +396,10 @@
this.poller = new ServerPoller(this.serverManager, this.pollhandler);
this.serverManager.connect(callback);
- // Start all plugins
- PluginHandler.getInstance().connect();
this.pluginManager.connect();
}
public void disconnect(ServerDisconnectCallback callback){
- // Stop all plugins
- PluginHandler.getInstance().dispose();
this.pluginManager.dispose();
if (isMapLoaded()) closeMap();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-01-14 20:54:37 UTC (rev 507)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-01-14 20:56:16 UTC (rev 508)
@@ -5,33 +5,14 @@
package net.sf.magicmap.client.gui;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.rmi.RemoteException;
-
-import javax.swing.AbstractAction;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JOptionPane;
-import javax.swing.JSplitPane;
-import javax.swing.JToolBar;
-
+import com.Ostermiller.util.Browser;
+import com.brunchboy.util.swing.relativelayout.AttributeConstraint;
+import com.brunchboy.util.swing.relativelayout.AttributeType;
+import com.brunchboy.util.swing.relativelayout.DependencyManager;
+import com.brunchboy.util.swing.relativelayout.RelativeLayout;
+import com.jgoodies.uif_lite.component.UIFSplitPane;
import net.sf.magicmap.client.controller.Controller;
-import net.sf.magicmap.client.gui.dialogs.AboutDialog;
-import net.sf.magicmap.client.gui.dialogs.ConnectServerDialog;
-import net.sf.magicmap.client.gui.dialogs.LoadMapDialog;
-import net.sf.magicmap.client.gui.dialogs.NewMapDialog;
-import net.sf.magicmap.client.gui.dialogs.SetProxyDialog;
-import net.sf.magicmap.client.gui.dialogs.ViewOptionsDialog;
+import net.sf.magicmap.client.gui.dialogs.*;
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
@@ -40,27 +21,22 @@
import net.sf.magicmap.client.gui.views.MapView;
import net.sf.magicmap.client.gui.views.MeasurementView;
import net.sf.magicmap.client.gui.views.OutlineView;
-import net.sf.magicmap.client.interfaces.CreateNewMapCallback;
-import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
-import net.sf.magicmap.client.interfaces.MapNamesCallback;
-import net.sf.magicmap.client.interfaces.ServerConnectCallback;
-import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
+import net.sf.magicmap.client.interfaces.*;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.meta.ServerConnectionInfo;
import net.sf.magicmap.client.model.node.MapNode;
import net.sf.magicmap.client.model.node.NodeModel;
import net.sf.magicmap.client.utils.Settings;
import net.sf.magicmap.client.utils.Version;
-import net.sf.magicmap.plugin.action.ShowPluginsAction;
-
import org.apache.axis.AxisFault;
-import com.Ostermiller.util.Browser;
-import com.brunchboy.util.swing.relativelayout.AttributeConstraint;
-import com.brunchboy.util.swing.relativelayout.AttributeType;
-import com.brunchboy.util.swing.relativelayout.DependencyManager;
-import com.brunchboy.util.swing.relativelayout.RelativeLayout;
-import com.jgoodies.uif_lite.component.UIFSplitPane;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.rmi.RemoteException;
/**
* The main GUI window
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2007-01-14 20:54:37 UTC (rev 507)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2007-01-14 20:56:16 UTC (rev 508)
@@ -1,24 +1,19 @@
package net.sf.magicmap.client.gui.forms;
+import com.jgoodies.forms.layout.CellConstraints;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.io.SAXReader;
+
+import javax.swing.*;
import java.beans.Statement;
import java.net.URL;
import java.util.Enumeration;
-import java.util.LinkedList;
import java.util.List;
import java.util.ResourceBundle;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-
-import net.sf.magicmap.plugin.SimplePluginDescriptor;
-
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.Node;
-import org.dom4j.io.SAXReader;
-import com.jgoodies.forms.layout.CellConstraints;
-
/**
*/
public class FormLayoutReader {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 20:54:41
|
Revision: 507
http://svn.sourceforge.net/magicmap/?rev=507&view=rev
Author: jan_fride
Date: 2007-01-14 12:54:37 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
removed old pluginsystem
Modified Paths:
--------------
trunk/magicmapclient/test/net/sf/magicmap/plugin/DocumentDescriptorReaderTest.java
trunk/magicmapclient/test/net/sf/magicmap/plugin/PluginLoaderTest.java
trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTableModelTest.java
Modified: trunk/magicmapclient/test/net/sf/magicmap/plugin/DocumentDescriptorReaderTest.java
===================================================================
--- trunk/magicmapclient/test/net/sf/magicmap/plugin/DocumentDescriptorReaderTest.java 2007-01-14 20:23:39 UTC (rev 506)
+++ trunk/magicmapclient/test/net/sf/magicmap/plugin/DocumentDescriptorReaderTest.java 2007-01-14 20:54:37 UTC (rev 507)
@@ -1,14 +1,14 @@
package net.sf.magicmap.plugin;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
-import junit.framework.TestCase;
+import net.sf.magicmap.client.plugin.IPluginDescriptor;
+import net.sf.magicmap.client.plugin.PluginException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import net.sf.magicmap.plugin.util.PluginDescriptorReader;
-
/**
*/
public class DocumentDescriptorReaderTest extends TestCase {
@@ -28,7 +28,7 @@
}
public void testGetDescriptor(){
// Testen ob ein rihtiges file es tut
- PluginDescriptorReader r = new PluginDescriptorReader();
+ net.sf.magicmap.client.plugin.util.PluginDescriptorReader r = new net.sf.magicmap.client.plugin.util.PluginDescriptorReader();
try {
r.loadDescription(new FileInputStream(
new File("test/net/sf/magicmap/plugin/plugin.xml")));
@@ -50,13 +50,13 @@
r.loadDescription(new FileInputStream(
new File("test/net/sf/magicmap/plugin/DocumentDescriptorReaderTest.java")));
fail("Kein XML File!");
- }catch (InvalidPluginDescriptorException ipn){
+ }catch (net.sf.magicmap.client.plugin.InvalidPluginDescriptorException ipn){
// OK!
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try{
- IPluginDescriptor piDesc = r.getDescriptor();
+ net.sf.magicmap.client.plugin.IPluginDescriptor piDesc = r.getDescriptor();
fail("Keine Exception geworfen troz falschem plugin.xml");
}catch (PluginException pin){
// ok so!
Modified: trunk/magicmapclient/test/net/sf/magicmap/plugin/PluginLoaderTest.java
===================================================================
--- trunk/magicmapclient/test/net/sf/magicmap/plugin/PluginLoaderTest.java 2007-01-14 20:23:39 UTC (rev 506)
+++ trunk/magicmapclient/test/net/sf/magicmap/plugin/PluginLoaderTest.java 2007-01-14 20:54:37 UTC (rev 507)
@@ -1,7 +1,9 @@
package net.sf.magicmap.plugin;
-import junit.framework.*;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import net.sf.magicmap.client.plugin.PluginLoader;
import java.io.File;
import java.net.URL;
@@ -11,13 +13,13 @@
protected void setUp() throws Exception {
- pluginLoader = new PluginLoader(new URL[]{new File("./plugins/").toURL()});
+ pluginLoader = new net.sf.magicmap.client.plugin.PluginLoader(new URL[]{new File("./plugins/").toURL()});
super.setUp();
}
public void testLoadPlugins(){
this.pluginLoader.loadPlugins();
- for (IPlugin iPlugin : pluginLoader) {
+ for (net.sf.magicmap.client.plugin.IPlugin iPlugin : pluginLoader) {
System.out.println("Plugin: " + iPlugin);
}
assertEquals (1, this.pluginLoader.getNumberOfPlugins());
Modified: trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTableModelTest.java
===================================================================
--- trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTableModelTest.java 2007-01-14 20:23:39 UTC (rev 506)
+++ trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTableModelTest.java 2007-01-14 20:54:37 UTC (rev 507)
@@ -1,17 +1,13 @@
package net.sf.magicmap.plugin.util;
+import net.sf.magicmap.artifact.ArtifactRepository;
+import net.sf.magicmap.client.plugin.ui.ArtifactRepositoryTableModel;
+
+import javax.swing.*;
import java.io.File;
import java.io.IOException;
-import javax.swing.JFrame;
-import javax.swing.JScrollBar;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import net.sf.magicmap.artifact.ArtifactRepository;
-import net.sf.magicmap.plugin.ui.ArtifactRepositoryTableModel;
-
-
public class ArtifactRepositoryTableModelTest {
public static void main(String[] args){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 20:23:41
|
Revision: 506
http://svn.sourceforge.net/magicmap/?rev=506&view=rev
Author: jan_fride
Date: 2007-01-14 12:23:39 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/plugin/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 20:17:08
|
Revision: 505
http://svn.sourceforge.net/magicmap/?rev=505&view=rev
Author: jan_fride
Date: 2007-01-14 12:17:04 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
update plugins
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/AbstractPlugin.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPlugin.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPluginDescriptor.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InvalidPluginDescriptorException.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginException.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginRepository.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimplePluginDescriptor.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimpleVendor.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/InstallPluginAction.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/LoadPluginsAction.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/UninstallPluginAction.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/forms/
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/forms/PluginsForm.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/package.html
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/ArtifactRepositoryTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginTableRenderer.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/util/
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/util/DirWalker.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/util/IPluginVF.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/util/OperatingSystemInfo.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/util/PluginComparator.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/util/PluginDescriptorConverter.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/util/PluginDescriptorReader.java
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/AbstractPlugin.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/AbstractPlugin.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/AbstractPlugin.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,104 @@
+
+package net.sf.magicmap.client.plugin;
+
+import net.sf.magicmap.artifact.ArtifactComparator;
+import net.sf.magicmap.artifact.IArtifact;
+import net.sf.magicmap.client.controller.IController;
+import net.sf.magicmap.client.utils.Settings;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Eine Klasse die das Implementieren von Plugins erleichtert.
+ *
+ */
+public class AbstractPlugin implements IPlugin {
+
+ protected IController controller;
+
+ private final IPluginDescriptor descriptor;
+
+ private static final ArtifactComparator cmp = new ArtifactComparator();
+
+ public static final AbstractPlugin EMPTY_PLUGIN = new AbstractPlugin(IPluginDescriptor.EMPTY);
+ /**
+ *
+ * @param descriptor
+ */
+ protected AbstractPlugin(net.sf.magicmap.client.plugin.IPluginDescriptor descriptor) {
+ assert (descriptor != null);
+ this.descriptor = descriptor;
+ }
+
+ public void disposePlugin(){
+
+ }
+
+ public void setController(IController controller){
+ this.controller = controller;
+ }
+
+ public void startPlugin(){
+
+ }
+
+ public void stopPlugin(){
+
+ }
+
+ public void setup(Settings settings){
+
+ }
+
+ public IPluginDescriptor getPluginInfos(){
+ return this.descriptor;
+ }
+
+ public String getArtifactId(){
+ return this.descriptor.getArtifactId();
+ }
+
+ public String getGroupId(){
+ return this.descriptor.getGroupId();
+ }
+
+ public final JFrame getFrame(Component c){
+ while (c != null) {
+ if (c instanceof JFrame) return (JFrame) c;
+ c = c.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * Called after the client is connected
+ */
+ public void connect(){
+
+ }
+
+ public net.sf.magicmap.artifact.Version getVersion(){
+ return this.descriptor.getVersion();
+ }
+
+ /**
+ * Called after a new map was loaded.
+ */
+ public void loadMap(){
+
+ }
+
+ public int compareTo(IArtifact o){
+ return AbstractPlugin.cmp.compare(this, o);
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public int hashCode(){
+ return descriptor.hashCode();
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPlugin.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPlugin.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPlugin.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,56 @@
+
+package net.sf.magicmap.client.plugin;
+
+import net.sf.magicmap.artifact.IArtifact;
+import net.sf.magicmap.artifact.IConfigureable;
+import net.sf.magicmap.client.controller.IController;
+
+/**
+ * Interface f\xFCr alle Plugins.
+ * Ein Plugin muss dieses Interface implementieren und einen Konstruktor haben
+ * der ein IPluginDescriptor als einziges Argument annimmt.
+ *
+ * @version 0.1
+ * @author jan_fride (ja...@fr...)
+ */
+public interface IPlugin extends IArtifact, IConfigureable {
+
+ /**
+ * Starts the plugin.
+ */
+ public void startPlugin();
+
+ /**
+ * STops the plugin (if it atsrtet Threads etc).
+ */
+ public void stopPlugin();
+
+ /**
+ * Get rid of all resources the plugin aquired.
+ */
+ public void disposePlugin();
+
+ /**
+ * For Setter injection.
+ *
+ * @param controller the controller foe our application
+ */
+ public void setController(IController controller);
+
+ /**
+ *
+ * @return informationen \xFCber dieses Plugin
+ */
+ public IPluginDescriptor getPluginInfos();
+
+ /**
+ * Called after the client is connected
+ */
+ public void connect();
+
+ /**
+ * Called after a new map was loaded.
+ */
+ public void loadMap();
+
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPluginDescriptor.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPluginDescriptor.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IPluginDescriptor.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,89 @@
+
+package net.sf.magicmap.client.plugin;
+
+import net.sf.magicmap.artifact.IArtifact;
+import net.sf.magicmap.artifact.IVendor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ *
+ */
+public interface IPluginDescriptor extends IArtifact {
+
+ /**
+ * Der Name des Plugins
+ * @return name des Plugins
+ */
+ public String getName();
+
+ /**
+ * Der Author des Plugins
+ * @return der Author
+ */
+ public IVendor getVendor();
+
+ /**
+ * Eine Beschreibung des Plugins
+ * @return eine Beschreibung
+ */
+ public String getDescription();
+
+ /**
+ * Die Version des Plugins. Die Versionierung w\xE4re z.b.
+ * 0.1.34-SNAPSHOT oder 1.0.0
+ * @return die Version.
+ */
+ public net.sf.magicmap.artifact.Version getVersion();
+
+ /**
+ * Eine Liste der Abh\xE4ngigkeiten des Plugins.
+ * @return alle Artifakte von denen das Plugin abh\xE4ngt.
+ */
+ public Collection<String[]> getDependencies();
+
+ /**
+ * Returns true if the plugin can run on your system.
+ * @return
+ */
+ public boolean isOsSupported();
+
+ public static final IPluginDescriptor EMPTY = new IPluginDescriptor() {
+ public String getName() {
+ return "";
+ }
+
+ public IVendor getVendor() {
+ return IVendor.EMPTY;
+ }
+
+ public String getDescription() {
+ return "";
+ }
+
+ public net.sf.magicmap.artifact.Version getVersion() {
+ return new net.sf.magicmap.artifact.Version("0.0.0");
+ }
+
+ public Collection<String[]> getDependencies() {
+ return new ArrayList<String[]>();
+ }
+
+ public boolean isOsSupported() {
+ return false;
+ }
+
+ public String getArtifactId() {
+ return "";
+ }
+
+ public String getGroupId() {
+ return "";
+ }
+
+ public int compareTo(IArtifact o) {
+ return -1;
+ }
+ };
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InvalidPluginDescriptorException.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InvalidPluginDescriptorException.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InvalidPluginDescriptorException.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,12 @@
+
+package net.sf.magicmap.client.plugin;
+
+/**
+
+ */
+public class InvalidPluginDescriptorException extends PluginException {
+
+ public InvalidPluginDescriptorException(String message) {
+ super(message);
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginException.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginException.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginException.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,13 @@
+
+package net.sf.magicmap.client.plugin;
+
+/**
+ * Base class for all Pluginexceptions. We use unchecked Exceptions
+ *
+ */
+public class PluginException extends RuntimeException {
+
+ public PluginException(String message) {
+ super(message);
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginLoader.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,101 @@
+
+package net.sf.magicmap.client.plugin;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.lang.reflect.Constructor;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ */
+public class PluginLoader extends URLClassLoader implements Iterable<IPlugin> {
+
+ private static final Log log = LogFactory.getLog(PluginLoader.class);
+
+ /**
+ * List of all loaded plugins.
+ */
+ private final List<IPlugin> pluginList = new LinkedList<IPlugin>();
+ private final List<URL> brokenUrlList = new LinkedList<URL>();
+
+ /**
+ *
+ * @param pluginPath an arry containing paths to installed plugins.
+ */
+ public PluginLoader(URL[] pluginPath) {
+ super(pluginPath);
+ }
+
+ /**
+ * The number of loaded plugins
+ * @return the number of loaded plugins
+ */
+ public int getNumberOfPlugins(){
+ return this.pluginList.size();
+ }
+
+ /**
+ *
+ * @return an iterator for the installed plugins.
+ */
+ public Iterator<IPlugin> iterator(){
+ return this.pluginList.iterator();
+ }
+
+ /**
+ * Durchsucht alle URLS nach Plugins. und liefert die Klassen.
+ *
+ */
+ public void loadPlugins(){
+ PluginLoader.log.info("Loading plugins:");
+ URL[] urLs = super.getURLs();
+ for (URL url : urLs){
+ try {
+ net.sf.magicmap.client.plugin.util.DirWalker walker = new net.sf.magicmap.client.plugin.util.DirWalker(url);
+ for (URL jarUrl: walker.getFiles()){
+ try{
+ loadPlugin(jarUrl);
+ }
+ catch (Exception ex){
+ brokenUrlList.add(jarUrl);
+ }
+ }
+ } catch (Exception e) {
+ brokenUrlList.add(url);
+ }
+ }
+ }
+
+ /**
+ * L\xE4dt alles aus einer URL.
+ * @param url
+ */
+ private void loadPlugin(URL url) throws Exception{
+ // first. Descriptor laden.
+ 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());
+ net.sf.magicmap.client.plugin.IPluginDescriptor descriptor = descriptorReader.getDescriptor();
+ String aClass = descriptorReader.getPluginClass();
+
+ addURL(new URL(url.toString()));
+
+
+ Class clazz = findClass(aClass);
+ Constructor[] constructors = clazz.getConstructors();
+
+ Constructor piConstructor = clazz.getConstructor(new Class[]{net.sf.magicmap.client.plugin.IPluginDescriptor.class});
+
+ net.sf.magicmap.client.plugin.IPlugin plugin = (IPlugin) piConstructor.newInstance(descriptor);
+ this.pluginList.add(plugin);
+ PluginLoader.log.info("Plugin loaded");
+
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,454 @@
+
+package net.sf.magicmap.client.plugin;
+
+import net.sf.magicmap.artifact.*;
+import net.sf.magicmap.client.controller.IController;
+import net.sf.magicmap.client.gui.MainGUI;
+import net.sf.magicmap.client.gui.forms.UserInterface;
+import net.sf.magicmap.client.gui.utils.table.FilteredTableModel;
+import net.sf.magicmap.client.gui.utils.table.NotFilter;
+import net.sf.magicmap.client.plugin.action.ShowPluginsAction;
+import net.sf.magicmap.client.plugin.forms.PluginsForm;
+import net.sf.magicmap.client.plugin.ui.PluginDescriptorModel;
+import net.sf.magicmap.client.utils.AncestorAdaptor;
+import net.sf.magicmap.client.utils.Settings;
+import org.apache.log4j.Logger;
+
+import javax.swing.*;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.*;
+
+/**
+ * Manages all Plugin in the system.
+ * The Pluginmanager has the following Attributes.
+ * <dl>
+ * <dt>AVAILABLE_PLUGINS</dt><dd>A List of all available plugins</dd>
+ * <dt>INSTALLED_PLUGINS</dt><dd>A List of all installed plugins</dd>
+ * <dt>PLUGIN_DETAILS</dt><dd>The currently selected plugins details (if any)</dd>
+ * </dl>
+ */
+public class PluginManager implements IConfigureable, UserInterface, Iterable<net.sf.magicmap.client.plugin.IPluginDescriptor>, ItemSelectable {
+ private FilteredTableModel installedModel;
+ private DefaultTableModel tableModel;
+ private FilteredTableModel availableModel;
+
+
+
+ public enum Attributes{
+ AvailablePlugins("AVAILABLE_PLUGINS"),
+ InstalledPlugins("INSTALLED_PLUGINS"),
+ PluginDetails("PLUGIN_DETAILS"),
+ PluginRepository("PLUGIN_REPOSITORY"),
+ PluginActions("PLUGIN_ACTIONS");
+
+ private final String name;
+ private Attributes(String name){
+ this.name = name;
+ }
+ public String getName(){
+ return name;
+ }
+ }
+
+ private static final Logger log = Logger.getLogger(PluginManager.class);
+
+ private final Map<net.sf.magicmap.client.plugin.IPluginDescriptor, IPlugin> plugins = new TreeMap<net.sf.magicmap.client.plugin.IPluginDescriptor, IPlugin>();
+
+
+
+ /**
+ * Used to find and setup the plugins
+ */
+ private final Settings settings;
+
+ /**
+ *
+ */
+ private final IController controller;
+
+ /**
+ * Loads all installed plugins
+ */
+ private net.sf.magicmap.client.plugin.PluginLoader pluginLoader;
+
+
+ /**
+ * contains a list of plugins the user can install.
+ */
+ private PluginRepository repository;
+
+ private PluginDescriptorModel pluginDetailModel;
+
+ private final DefaultListSelectionModel installedPluginSelection = new DefaultListSelectionModel();
+ private final DefaultListSelectionModel availablePluginSelection = new DefaultListSelectionModel();
+ private final TableSelectListener tableSelectionListener = new TableSelectListener();
+ private final EventListenerList listenerList = new EventListenerList();
+
+ /**
+ *
+ * @param settings the clients settings.
+ * @param controller the controller.
+ */
+ public PluginManager(Settings settings, IController controller) throws MalformedURLException {
+ this.settings = settings;
+ this.controller = controller;
+ this.pluginLoader = null;
+
+ controller.getMapView().addAncestorListener(new AncestorAdaptor() {
+ @Override
+ public void ancestorAdded(AncestorEvent event){
+ MainGUI mainGUI = MainGUI.getInstance();
+ JMenuBar bar = mainGUI.getJMenuBar();
+ JMenu jMenu = bar.getMenu(2);
+ jMenu.addSeparator();
+ jMenu.add(new ShowPluginsAction(mainGUI, PluginManager.this));
+ }
+ });
+
+ repository = new PluginRepository(new URL("http://vierzig4.dyndns.org/magicmap-plugins/"));
+ tableModel = new DefaultTableModel();
+ tableModel.addColumn("Name");
+ tableModel.addColumn("Version");
+ tableModel.addColumn("--");
+ installedModel = new FilteredTableModel(tableModel);
+
+ FilteredTableModel.Filter installedFilter = new FilteredTableModel.Filter() {
+ public boolean evaluate(Object[] o) {
+ return isInstalled((IArtifact) o[0]);
+ }
+
+ public int[] getColumns() {
+ return new int[]{2};
+ }
+ };
+ installedModel.addFilter(installedFilter);
+ availableModel = new FilteredTableModel(tableModel);
+ availableModel.addFilter(new NotFilter(installedFilter));
+ setup(settings);
+
+ pluginDetailModel = new net.sf.magicmap.client.plugin.ui.PluginDescriptorModel();
+ addItemListener(pluginDetailModel);
+
+ installedPluginSelection.addListSelectionListener(tableSelectionListener);
+ availablePluginSelection.addListSelectionListener(tableSelectionListener);
+ }
+
+ /**
+ * Adds the plugin. If the plugin exist an IllegalArgumentException will
+ * be thrown.
+ *
+ * @param plugin
+ * @throws IllegalArgumentException
+ */
+ private void addPlugin(IPlugin plugin) throws IllegalArgumentException{
+ plugin.setController(this.controller);
+ plugin.setup(this.settings);
+ plugins.put (plugin.getPluginInfos(), plugin);
+ tableModel.addRow(new Object[]{
+ plugin.getPluginInfos().getName(),
+ plugin.getVersion(), plugin.getPluginInfos()}
+ );
+ }
+
+ /**
+ *
+ */
+ private void loadPlugins(){
+
+ this.pluginLoader.loadPlugins();
+
+ for (IPlugin iPlugin : this.pluginLoader)
+ addPlugin(iPlugin);
+ }
+
+ /**
+ *
+ * @throws IOException
+ */
+ public void loadRepository() throws IOException {
+ Collection<net.sf.magicmap.client.plugin.IPluginDescriptor> collection = repository.loadIndex();
+ for (net.sf.magicmap.client.plugin.IPluginDescriptor descriptor: collection){
+ if (plugins.containsKey(descriptor)) continue;
+ plugins.put(descriptor, AbstractPlugin.EMPTY_PLUGIN);
+ tableModel.addRow(new Object[]{
+ descriptor.getName(),
+ descriptor.getVersion(), descriptor}
+ );
+ }
+ }
+
+ /**
+ *
+ * @param groupId
+ * @param pluginId
+ * @param version
+ * @return
+ */
+ public net.sf.magicmap.client.plugin.IPlugin getPlugin(String groupId, String pluginId, String version){
+ Artifact a = new Artifact(groupId, pluginId, version);
+ if (plugins.containsKey(a)) return plugins.get(a);
+ return null;
+ }
+ public Collection<Version> getVersions(String groupId, String artifactId){
+ return Collections.EMPTY_LIST;
+ }
+ /**
+ *
+ * @param settings
+ */
+ public void setup(Settings settings){
+ String[] pluginPaths = settings.getPluginPaths();
+ ArrayList<URL> urlList = new ArrayList<URL>();
+ for (String url : pluginPaths)
+ try {
+ urlList.add(new URL(url));
+ } catch (MalformedURLException e) {
+ PluginManager.log.info(e);
+ }
+ this.pluginLoader = new net.sf.magicmap.client.plugin.PluginLoader(urlList.toArray(new URL[0]));
+ loadPlugins();
+ }
+
+ /**
+ *
+ * @param attributeName the name of the attribute to visualize.
+ * @param parent a Scrollpane for example.
+ * @return
+ * @throws IllegalArgumentException
+ */
+ public JComponent visualProxy(String attributeName, JComponent parent) throws IllegalArgumentException{
+
+ JComponent proxy = null;
+ if (Attributes.AvailablePlugins.getName().equals(attributeName)){
+ JTable table = new JTable(availableModel);
+ table.setDefaultRenderer(net.sf.magicmap.client.plugin.IPluginDescriptor.class, new net.sf.magicmap.client.plugin.ui.PluginTableRenderer(this));
+ table.setSelectionModel(availablePluginSelection);
+ proxy = new JScrollPane(table);
+
+ }
+ else if (Attributes.InstalledPlugins.getName().equals(attributeName)){
+
+ JTable table = new JTable(installedModel); //installedModel);
+ table.setSelectionModel(installedPluginSelection);
+ proxy = new JScrollPane(table);
+
+ }
+ else if (Attributes.PluginDetails.getName().equals(attributeName)){
+ proxy = new JLabel("Later");
+ }
+ else if ("".equals(attributeName)){
+ net.sf.magicmap.client.plugin.forms.PluginsForm form = new PluginsForm(this);
+ proxy = form.attatch(this);
+ }
+ else if (Attributes.PluginRepository.getName().equals(attributeName)){
+ JTextField tf = new JTextField("http://vierzig4.dyndns.org/magicmap-plugins/");
+ tf.setEditable(false);
+ proxy = tf;
+ }
+ else{
+ proxy = pluginDetailModel.visualProxy(attributeName, parent);
+ }
+ if (parent != null){
+ parent.add(proxy);
+ }
+ return proxy;
+ }
+
+ public String[] getAttributeNames(){
+ return new String[]{
+ Attributes.InstalledPlugins.getName(),
+ Attributes.AvailablePlugins.getName(),
+ Attributes.PluginDetails.getName()
+ };
+ }
+
+ /**
+ * Called from the controller to notifi all installed plugins that
+ * the cleint is now connected to a server.
+ */
+ public void connect(){
+ for (IPlugin iPlugin : plugins.values())
+ iPlugin.connect();
+ }
+
+ /**
+ * Disposes all Plugins.
+ */
+ public void dispose(){
+ for (IPlugin iPlugin : plugins.values())
+ iPlugin.disposePlugin();
+ }
+
+ /**
+ * Called by the controller if a new Map was loaded.
+ */
+ public void loadMap(){
+ for (IPlugin iPlugin : plugins.values())
+ iPlugin.loadMap();
+ }
+
+ /**
+ * Iinstalls a plugin.
+ * @param pluginToInstall the plugin to install.
+ */
+ public void installPlugin (net.sf.magicmap.client.plugin.IPluginDescriptor pluginToInstall) throws IOException {
+ URL pluginUrl = repository.getPluginUrl(pluginToInstall);
+ try {
+ ArtifactTools tool = new ArtifactTools();
+ File installDir = new File(pluginLoader.getURLs()[0].toURI());
+ File jarFile = new File(installDir +"/" + tool.getFileName(pluginToInstall));
+ if (jarFile.exists()){
+ uninstallPlugin(pluginToInstall);
+ jarFile = new File(installDir +"/" + tool.getFileName(pluginToInstall));
+ }
+ if (jarFile.createNewFile()){
+ FileOutputStream oStr = new FileOutputStream(jarFile);
+ InputStream iStr = pluginUrl.openStream();
+ copy(iStr, oStr);
+ }else{
+ throw new IOException("Can not create new file");
+ }
+ } catch (URISyntaxException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ /**
+ *
+ * @param iStr
+ * @param oStr
+ * @throws IOException
+ */
+ private void copy(InputStream iStr, OutputStream oStr)throws IOException{
+ try{
+ while (iStr.available() > 0){
+ oStr.write(iStr.read());
+ }
+ }
+ finally{
+ if (oStr != null){
+ oStr.flush();
+ oStr.close();
+ }
+ if (iStr != null){
+ iStr.close();
+ }
+ }
+ }
+
+ /**
+ * uninstalls a plugin.
+ *
+ * @param pluginToRemove
+ */
+ public void uninstallPlugin(net.sf.magicmap.client.plugin.IPluginDescriptor pluginToRemove) throws IOException{
+ ArtifactTools tool = new ArtifactTools();
+ File installDir = null;
+ try {
+ installDir = new File(pluginLoader.getURLs()[0].toURI());
+ File jarFile = new File(installDir +"/" + tool.getFileName(pluginToRemove));
+ boolean b = jarFile.delete();
+ if (!b) throw new IOException("Can not delete File: " + jarFile.getAbsoluteFile().toString());
+ } catch (URISyntaxException e) {
+ throw new IOException(e.getMessage());
+ }
+
+ }
+
+ /**
+ *
+ * @param artiafact the atrifact to check.
+ * @return true if a plugin with the given artifactId is installed.
+ */
+ public boolean isInstalled(IArtifact artiafact){
+ return plugins.containsKey(artiafact) && plugins.get(artiafact) != net.sf.magicmap.client.plugin.AbstractPlugin.EMPTY_PLUGIN;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Iterator<net.sf.magicmap.client.plugin.IPluginDescriptor> iterator() {
+ return plugins.keySet().iterator();
+ }
+
+ public boolean isUpdateAvailable(IArtifact artifact){
+ return false;
+ }
+ /**
+ *
+ * @return
+ */
+ public int getNumberOfPlugins(){
+ return plugins.size();
+ }
+
+ public Object[] getSelectedObjects() {
+ return tableSelectionListener.selectedPluginDescriptor == null ? new Object[0] : new Object[]{tableSelectionListener.selectedPluginDescriptor};
+ }
+
+ public void addItemListener(ItemListener l) {
+ listenerList.add(ItemListener.class, l);
+ }
+
+ public void removeItemListener(ItemListener l) {
+ listenerList.remove(ItemListener.class, l);
+ }
+
+ /**
+ * Combines the two views of the plugins.
+ */
+ private class TableSelectListener implements ListSelectionListener {
+ private net.sf.magicmap.client.plugin.IPluginDescriptor selectedPluginDescriptor = null;
+
+
+ public void valueChanged (ListSelectionEvent e) {
+ if (e.getValueIsAdjusting()) return;
+
+ ListSelectionModel lsm = (ListSelectionModel)e.getSource();
+ if (lsm.isSelectionEmpty()) {
+ System.out.println("No rows are selected.");
+ } else {
+ int selectedRow = lsm.getMinSelectionIndex();
+ TableModel model = getTableModel(lsm);
+ selectedPluginDescriptor = ((net.sf.magicmap.client.plugin.IPluginDescriptor) model.getValueAt(selectedRow, 2));
+ }
+ ItemListener[] itemListeners = listenerList.getListeners(ItemListener.class);
+ ItemEvent event = null;
+ for(ItemListener itl: itemListeners){
+ if (event == null){
+ event = new ItemEvent(
+ PluginManager.this,
+ selectedPluginDescriptor == null ? 0 : selectedPluginDescriptor.hashCode(),
+ selectedPluginDescriptor,
+ ItemEvent.SELECTED);
+ }
+ itl.itemStateChanged(event);
+ }
+ }
+
+ private TableModel getTableModel(ListSelectionModel lsm) {
+ if (lsm.equals(installedPluginSelection)){
+ availablePluginSelection.clearSelection();
+ return installedModel;
+ }
+ else if(lsm.equals(availablePluginSelection)){
+ installedPluginSelection.clearSelection();
+ return availableModel;
+ }
+ return null;
+ }
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginRepository.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginRepository.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginRepository.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,126 @@
+package net.sf.magicmap.client.plugin;
+
+import net.sf.magicmap.artifact.Artifact;
+import net.sf.magicmap.artifact.ArtifactTools;
+import net.sf.magicmap.artifact.IArtifact;
+import net.sf.magicmap.client.plugin.util.PluginDescriptorReader;
+import net.sf.magicmap.client.utils.HtmlSaxParser;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Node;
+import org.dom4j.io.SAXReader;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ *
+ *
+ */
+public class PluginRepository {
+ private final URL baseUrl;
+
+ private final ArtifactTools tools = new ArtifactTools();
+
+ public PluginRepository(URL url){
+ this.baseUrl = url;
+ }
+
+ /**
+ *
+ * @param manager
+ */
+ public Collection<net.sf.magicmap.client.plugin.IPluginDescriptor> loadRepository(net.sf.magicmap.client.plugin.PluginManager manager){
+ LinkedList<net.sf.magicmap.client.plugin.IPluginDescriptor>pluginDescriptors = new LinkedList<net.sf.magicmap.client.plugin.IPluginDescriptor>();
+ return pluginDescriptors;
+ }
+
+ public Collection<String> getVersions(IArtifact artifact){
+ return new ArrayList<String>();
+ }
+
+ public URL getPluginUrl (IArtifact plugin) throws MalformedURLException {
+ return new URL(baseUrl, tools.getPath(plugin) +"/"+ tools.getFileName(plugin));
+ }
+
+ /**
+ *
+ * @param path
+ * @return
+ */
+ public net.sf.magicmap.client.plugin.IPluginDescriptor addPlugin(URL path){
+ return null;
+ }
+
+ public Collection<net.sf.magicmap.client.plugin.IPluginDescriptor> loadIndex() throws IOException {
+
+ ArrayList<net.sf.magicmap.client.plugin.IPluginDescriptor> l = new ArrayList<net.sf.magicmap.client.plugin.IPluginDescriptor>();
+ for (String groups: loadIndex(baseUrl, true)){
+ for (String artifacts: loadIndex(new URL(baseUrl +"/" + groups), true)){
+ for (String versions: loadIndex(new URL(baseUrl +"/" + groups + artifacts), true)){
+ l.add(getPluginDetails (new Artifact(
+ groups.substring(0, groups.length()-1),
+ artifacts.substring(0, artifacts.length()-1),
+ versions.substring(0, versions.length()-1)))
+ );
+ }
+ }
+ }
+ return l;
+ }
+
+ public net.sf.magicmap.client.plugin.IPluginDescriptor getPluginDetails(IArtifact artifact)throws IOException{
+ URL descriptorSource = new URL(baseUrl + tools.getPath(artifact) + "/plugin.xml");
+ PluginDescriptorReader reader = new PluginDescriptorReader(descriptorSource.openStream());
+ return reader.getDescriptor();
+ }
+ /**
+ *
+ * @return
+ * @throws Exception
+ */
+ private Collection<String> loadIndex(URL url, boolean dir) throws IOException{
+ System.out.println("Loading Index of " + url.toString());
+ SAXReader reader = new SAXReader(new HtmlSaxParser());
+
+ Document document = null;
+ try {
+ document = reader.read(url.openStream());
+ } catch (DocumentException e) {
+ throw new IOException(e.getMessage());
+ }
+ List<Node> linkList = dir ?
+ document.selectNodes("//a[((not (starts-with(@href, '/'))) and (preceding-sibling::img/@alt='[DIR]'))]") :
+ document.selectNodes("//a[not (starts-with(@href, '/'))]");
+
+ List<String> pluginLinkList = new LinkedList<String>();
+ for (Node node: linkList){
+ String href = node.valueOf("@href");
+ if (href != null && href.length() > 1)
+ pluginLinkList.add(href);
+ }
+ return pluginLinkList;
+ }
+
+ public static void main(String[] args) {
+ try {
+ PluginRepository repository = new PluginRepository(new URL("http://butler/magicmap-plugins/"));
+ Collection<String> strings = repository.loadIndex(repository.baseUrl, true);
+ System.out.println(strings.size());
+ for(String str: strings){
+ System.out.println("DIR: " + str);
+ }
+ Collection<net.sf.magicmap.client.plugin.IPluginDescriptor> artiacts = repository.loadIndex();
+ for (net.sf.magicmap.client.plugin.IPluginDescriptor a: artiacts){
+ System.out.println("Artifact: " + a.toString() + "\n\tURL:" + repository.getPluginUrl(a));
+ }
+ } catch (Exception e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimplePluginDescriptor.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimplePluginDescriptor.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimplePluginDescriptor.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,196 @@
+
+package net.sf.magicmap.client.plugin;
+
+import net.sf.magicmap.artifact.ArtifactComparator;
+import net.sf.magicmap.artifact.IArtifact;
+import net.sf.magicmap.artifact.IVendor;
+import net.sf.magicmap.artifact.Version;
+import net.sf.magicmap.client.plugin.util.OperatingSystemInfo;
+
+import java.util.*;
+
+/**
+ * Beschreibt ein Plugin. Eine immutable Klasse.
+ * @author jan_fride
+ * @version 1.0
+ * @since heute
+ */
+public class SimplePluginDescriptor implements IPluginDescriptor {
+
+ private final IVendor vendor;
+ private final String groupId;
+ private final String artifactId;
+ private final String description;
+ private final String name;
+ private final Version version;
+
+ private static final ArtifactComparator cmp = new ArtifactComparator();
+
+ private final Collection<String[]> dependencies = new LinkedList<String[]>();
+
+ private final Collection<OperatingSystemInfo> supportedOperatingSystems = new ArrayList<OperatingSystemInfo>();
+ /**
+ * Konstruktor.
+ *
+ * @param vendor der Hersteller/Author des Plugins
+ * @param groupId die Id der Gruppe des Plugins
+ * @param artifactId die ID des Plugins in seiner Gruppe.
+ * @param description eine Beschreibung des Plugins
+ * @param name der Name des Plugins
+ * @param version die Version des Plugins.
+ * @param dependencies eine Liste der Abh\xE4ngikeiten
+ * @param os a regular expression for the supported operating systems.
+ */
+ public SimplePluginDescriptor(
+ IVendor vendor,
+ String groupId,
+ String artifactId,
+ String description,
+ String name,
+ String version,
+ Collection<String[]> dependencies,
+ OperatingSystemInfo... os) {
+
+ this.vendor = vendor;
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.description = description;
+ this.name = name;
+ this.version = new Version(version);
+ this.dependencies.addAll(dependencies);
+ Collections.addAll(this.supportedOperatingSystems, os);
+
+ }
+
+ public SimplePluginDescriptor(
+ String vendorName,
+ String vendorEmail,
+ String vendorHomepage,
+ String groupId,
+ String artifactId,
+ String description,
+ String name,
+ String version,
+ Collection<String[]> dependencies,
+ OperatingSystemInfo... os) {
+ this(new SimpleVendor(vendorName, vendorEmail, vendorHomepage), groupId, artifactId, description, name,
+ version, dependencies, os);
+ }
+
+ /**
+ * Der Hersteller des Plugins
+ *
+ * @return die Beschreibung des Herstellers.
+ */
+ public IVendor getVendor(){
+ return this.vendor;
+ }
+
+ /**
+ * Eine f\xFCr Menschen verständliche Beschreibung des Plugins
+ * (also auch f\xFCr nicht Informatiker).
+ *
+ * @return die Beschreibung des Plugins.
+ */
+ public String getDescription(){
+ return this.description;
+ }
+
+ /**
+ * der Name des Plugins
+ * @return
+ */
+ public String getName(){
+ return this.name;
+ }
+
+ /**
+ * Die Version des Plugins
+ * @return
+ */
+ public Version getVersion(){
+ return this.version;
+ }
+
+ /**
+ *
+ * @return die Liste der Abh\xE4ngigkeiten.
+ */
+ public Collection<String[]> getDependencies(){
+ return this.dependencies;
+ }
+
+ /**
+ * @see net.sf.magicmap.artifact.IUniqueIdentity
+ * @return die ID des Artifacts (Plugins).
+ */
+ public String getArtifactId(){
+ return this.artifactId;
+ }
+
+ /**
+ * @see net.sf.magicmap.artifact.IUniqueIdentity
+ * @return die ID der Gruppe (Plugins).
+ */
+ public String getGroupId(){
+ return this.groupId;
+ }
+
+ /**
+ *
+ * @param artifact another unique id.
+ * @return 0 if artifact and groupdid are equal. -1 or 1 else.
+ */
+ public int compareTo(IArtifact artifact){
+ return SimplePluginDescriptor.cmp.compare(this, artifact);
+ }
+
+ /**
+ *
+ * @return true if the plugin runs on the current system.
+ */
+ public boolean isOsSupported() {
+ for(OperatingSystemInfo info: supportedOperatingSystems){
+ if (info.isCurrentOsSupported()) return true;
+ }
+ return false;
+ }
+
+ /**
+ * The same hash as any artifact.
+ * @return
+ */
+ @Override
+ public int hashCode() {
+ int hash = 31;
+ int hashFactor = 17;
+ hash += getArtifactId() == null ? 0 : getArtifactId().hashCode() * 17;
+ hash += getGroupId() == null ? 0 : getGroupId().hashCode() * 17;
+ hash += getVersion() == null ? 0 : getVersion().hashCode() * 17;
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IArtifact) {
+ IArtifact iArtifact = (IArtifact) obj;
+ return getArtifactId().equals(iArtifact.getArtifactId()) &&
+ getGroupId().equals(iArtifact.getGroupId()) &&
+ getVersion().equals(iArtifact.getVersion());
+ }
+ return super.equals(obj); //To change body of overridden methods use File | Settings | File Templates.
+ }
+ @Override
+ public String toString() {
+ return "SimplePluginDescriptor{" +
+ "vendor=" + vendor +
+ ", groupId='" + groupId + '\'' +
+ ", artifactId='" + artifactId + '\'' +
+ ", description='" + description + '\'' +
+ ", name='" + name + '\'' +
+ ", version='" + version.toString() + '\'' +
+ ", dependencies=" + (dependencies == null ? null : Arrays.asList(dependencies)) +
+ ", supportedOperatingSystems=" + supportedOperatingSystems +
+ '}';
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimpleVendor.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimpleVendor.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/SimpleVendor.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,40 @@
+
+package net.sf.magicmap.client.plugin;
+
+import net.sf.magicmap.artifact.IVendor;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 08.10.2006
+ * Time: 19:22:25
+ * To change this template use File | Settings | File Templates.
+ */
+final class SimpleVendor implements IVendor{
+
+ private final String name;
+ private final String email;
+ private final String homepage;
+
+ public SimpleVendor(String name, String email, String homepage) {
+ assert (name != null);
+ assert (email != null);
+ assert (homepage != null);
+ this.name = name;
+ this.email = email;
+ this.homepage = homepage;
+ }
+
+ public String getName(){
+ return name;
+ }
+
+ public String getEmail(){
+ return email;
+ }
+
+ public String getHomePage(){
+ return homepage;
+ }
+
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/InstallPluginAction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/InstallPluginAction.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/InstallPluginAction.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,46 @@
+package net.sf.magicmap.client.plugin.action;
+
+import net.sf.magicmap.client.gui.utils.GUIConstants;
+import net.sf.magicmap.client.gui.utils.MagicAction;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jan
+ * Date: 11.11.2006
+ * Time: 23:18:34
+ * To change this template use File | Settings | File Templates.
+ */
+public class InstallPluginAction extends MagicAction implements ItemListener {
+ private final net.sf.magicmap.client.plugin.PluginManager manager;
+ private net.sf.magicmap.client.plugin.IPluginDescriptor descriptor;
+
+ public InstallPluginAction(net.sf.magicmap.client.plugin.PluginManager manager){
+ super ("Plugin Installieren", GUIConstants.ICON_CONNECT,"Plugin Instalieren");
+ this.manager = manager;
+ manager.addItemListener(this);
+ setEnabled(false);
+ }
+ public void actionPerformed(ActionEvent e) {
+ try {
+ manager.installPlugin(descriptor);
+ } catch (IOException e1) {
+ e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ if (ItemEvent.SELECTED == e.getStateChange()){
+ setDescriptor((net.sf.magicmap.client.plugin.IPluginDescriptor) e.getItem());
+ }
+ }
+
+ public void setDescriptor(net.sf.magicmap.client.plugin.IPluginDescriptor descriptor) {
+ this.descriptor = descriptor;
+ setEnabled(descriptor != null && !manager.isInstalled(descriptor));
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/LoadPluginsAction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/LoadPluginsAction.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/LoadPluginsAction.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,36 @@
+package net.sf.magicmap.client.plugin.action;
+
+import net.sf.magicmap.client.gui.utils.GUIConstants;
+import net.sf.magicmap.client.gui.utils.MagicAction;
+import net.sf.magicmap.client.plugin.IPluginDescriptor;
+import net.sf.magicmap.client.plugin.PluginManager;
+
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 12.11.2006
+ * Time: 16:47:19
+ * To change this template use File | Settings | File Templates.
+ */
+public class LoadPluginsAction extends MagicAction{
+ private final PluginManager manager;
+ private IPluginDescriptor descriptor;
+
+ public LoadPluginsAction(PluginManager manager){
+ super ("Pluginliste laden", GUIConstants.ICON_CONNECT,"Die Liste aller vorhandenen Plugin laden");
+ this.manager = manager;
+ }
+ public void actionPerformed(ActionEvent e) {
+ try {
+ setEnabled(false);
+ manager.loadRepository();
+ } catch (IOException e1) {
+ e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }finally{
+ setEnabled(true);
+ }
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/ShowPluginsAction.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,34 @@
+package net.sf.magicmap.client.plugin.action;
+
+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.plugin.PluginManager;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 12.11.2006
+ * Time: 21:18:00
+ * To change this template use File | Settings | File Templates.
+ */
+public class ShowPluginsAction extends MagicAction {
+ private final JFrame mainFrame;
+ private final net.sf.magicmap.client.plugin.PluginManager manager;
+
+ public ShowPluginsAction(JFrame mainFrame, PluginManager manager){
+ super (GUIUtils.i18n("plugins.show"), GUIConstants.ICON_PROPERTIES, GUIUtils.i18n("plugins.tooltip"));
+ this.mainFrame = mainFrame;
+ this.manager = manager;
+ }
+ public void actionPerformed(ActionEvent e) {
+ JDialog dlg = new JDialog(mainFrame);
+ dlg.setModal(true);
+ dlg.setContentPane(manager.visualProxy("", null));
+ dlg.pack();
+ dlg.setVisible(true);
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/UninstallPluginAction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/UninstallPluginAction.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/action/UninstallPluginAction.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,48 @@
+package net.sf.magicmap.client.plugin.action;
+
+import net.sf.magicmap.client.gui.utils.GUIConstants;
+import net.sf.magicmap.client.gui.utils.MagicAction;
+import net.sf.magicmap.client.plugin.IPluginDescriptor;
+import net.sf.magicmap.client.plugin.PluginManager;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 12.11.2006
+ * Time: 18:55:24
+ * To change this template use File | Settings | File Templates.
+ */
+public class UninstallPluginAction extends MagicAction {
+
+ private final PluginManager manager;
+ private net.sf.magicmap.client.plugin.IPluginDescriptor descriptor;
+
+ public UninstallPluginAction(net.sf.magicmap.client.plugin.PluginManager manager){
+ super ("Plugin deinstallieren", GUIConstants.ICON_DELETE,"Plugin deinstalieren");
+ this.manager = manager;
+ manager.addItemListener(this);
+ setEnabled(false);
+ }
+ public void actionPerformed(ActionEvent e) {
+ try {
+ manager.uninstallPlugin(descriptor);
+ } catch (IOException e1) {
+ e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ if (ItemEvent.SELECTED == e.getStateChange()){
+ setDescriptor((IPluginDescriptor) e.getItem());
+ }
+ }
+
+ public void setDescriptor(IPluginDescriptor descriptor) {
+ this.descriptor = descriptor;
+ setEnabled(descriptor != null && manager.isInstalled(descriptor));
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/forms/PluginsForm.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/forms/PluginsForm.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/forms/PluginsForm.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,70 @@
+package net.sf.magicmap.client.plugin.forms;
+
+import com.jgoodies.forms.layout.CellConstraints;
+import net.sf.magicmap.client.gui.forms.Form;
+import net.sf.magicmap.client.gui.forms.FormLayoutForm;
+import net.sf.magicmap.client.gui.forms.TabForm;
+import net.sf.magicmap.client.gui.forms.UserInterface;
+import net.sf.magicmap.client.plugin.PluginManager;
+import static net.sf.magicmap.client.plugin.PluginManager.Attributes.*;
+import net.sf.magicmap.client.plugin.action.LoadPluginsAction;
+import net.sf.magicmap.client.plugin.action.UninstallPluginAction;
+import static net.sf.magicmap.client.plugin.ui.PluginDescriptorModel.Attributes.PluginDependencies;
+import static net.sf.magicmap.client.plugin.ui.PluginDescriptorModel.Attributes.PluginName;
+
+import javax.swing.*;
+
+/**
+ * Show a list of installed plugins a list of available plugins
+ * and some details. This form also allows the user to install uninstall
+ * plugins.
+ *
+ * @author Jan Friderici
+ *
+ */
+public final class PluginsForm extends FormLayoutForm {
+
+ private TabForm tabs;
+ private Form settingsForm;
+ private Form detailsForm;
+
+ /**
+ */
+ public PluginsForm(final PluginManager manager){
+ super ("p:grow,3dlu,p:grow", "p,3dlu, p:grow");
+ tabs = new TabForm();
+ tabs.addAttribute(AvailablePlugins.getName(), "",
+ new TabForm.TabConstraints("Vorhandene Plugins", "TT", null));
+ tabs.addAttribute(InstalledPlugins.getName(), "",
+ new TabForm.TabConstraints("Installierte Plugins", "TT", null));
+ addForm(tabs, new CellConstraints(1,3, CellConstraints.FILL, CellConstraints.FILL));
+
+ detailsForm = new FormLayoutForm("p,3dlu,p:grow", "p,3dlu,p:grow");
+ detailsForm.addLabel(PluginName.getName(), new JLabel("Name"), new CellConstraints(1,1));
+ detailsForm.addAttribute(PluginName.getName(), "", new CellConstraints(3,1));
+ detailsForm.addLabel(PluginDependencies.getName(), new JLabel("Abhaengigkeiten"), new CellConstraints(1,3));
+ detailsForm.addAttribute(PluginDependencies.getName(), "", new CellConstraints(3,3));
+
+
+ detailsForm.setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createTitledBorder("Detailansicht"),
+ BorderFactory.createEmptyBorder(5,5,5,5)));
+ addForm(detailsForm, new CellConstraints(3,3, CellConstraints.FILL, CellConstraints.FILL));
+ setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createTitledBorder("Plugin"),
+ BorderFactory.createEmptyBorder(5,5,5,5)));
+
+ // Actions!
+ FormLayoutForm actionButton = new FormLayoutForm("p,3dlu,p,6dlu,p,3dlu,p:grow", "p");
+ actionButton.addLabel("", new JButton(new net.sf.magicmap.client.plugin.action.InstallPluginAction(manager)), new CellConstraints(1,1));
+ actionButton.addLabel("", new JButton(new UninstallPluginAction(manager)), new CellConstraints(3,1));
+ actionButton.addLabel("", new JButton(new LoadPluginsAction(manager)), new CellConstraints(5,1,CellConstraints.DEFAULT, CellConstraints.FILL));
+ actionButton.addAttribute(PluginRepository.getName(), "", new CellConstraints(7,1));
+ addForm(actionButton, new CellConstraints(1,1,3,1,CellConstraints.FILL, CellConstraints.FILL));
+ }
+
+ public JComponent attatch(UserInterface ui) {
+ JComponent c = super.attatch(ui);
+ return c;
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/package.html
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/package.html (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/package.html 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,12 @@
+<html>
+<head>
+ <title>
+ Magicmap Plugins
+ </title>
+</head>
+<body>
+<h1>Plugins for Magicmap</h1>
+<p>Blah blah blah</p>
+
+</body>
+</html>
\ No newline at end of file
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/ArtifactRepositoryTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/ArtifactRepositoryTableModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/ArtifactRepositoryTableModel.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,82 @@
+
+package net.sf.magicmap.client.plugin.ui;
+
+import net.sf.magicmap.artifact.ArtifactRepository;
+import net.sf.magicmap.artifact.IArtifact;
+
+import javax.swing.event.TableModelListener;
+import javax.swing.table.TableModel;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author Jan Friderici (ja...@fr...)
+ *
+ */
+public class ArtifactRepositoryTableModel implements TableModel {
+
+ private final ArtifactRepository repository;
+ private final LinkedList<TableModelListener> listeners = new LinkedList<TableModelListener>();
+
+ public ArtifactRepositoryTableModel(ArtifactRepository repository) {
+ this.repository = repository;
+
+ }
+
+ public void addTableModelListener(TableModelListener l){
+ this.listeners.add(l);
+ }
+
+ public Class<?> getColumnClass(int columnIndex){
+ return String.class;
+ }
+
+ public int getColumnCount(){
+ return 3;
+ }
+
+ public String getColumnName(int columnIndex){
+ // TODO Auto-generated method stub
+ switch (columnIndex) {
+ case 0 :
+ return "Gruppe";
+ case 1 :
+ return "Artifact";
+ case 2 :
+ return "Version";
+ }
+ return null;
+ }
+
+ public int getRowCount(){
+ return this.repository.size();
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex){
+ IArtifact artifact = this.repository.get(rowIndex);
+ switch (columnIndex) {
+ case 0 :
+ return artifact.getGroupId();
+ case 1 :
+ return artifact.getArtifactId();
+ case 2 :
+ return artifact.getVersion();
+ }
+ return null;
+ }
+
+ public boolean isCellEditable(int rowIndex, int columnIndex){
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void removeTableModelListener(TableModelListener l){
+ this.listeners.remove(l);
+
+ }
+
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex){
+
+ }
+
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDescriptorModel.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,110 @@
+
+package net.sf.magicmap.client.plugin.ui;
+
+import net.sf.magicmap.client.gui.forms.UserInterface;
+import net.sf.magicmap.client.gui.utils.DocumentUtils;
+import net.sf.magicmap.client.plugin.IPluginDescriptor;
+
+import javax.swing.*;
+import javax.swing.text.Document;
+import javax.swing.text.PlainDocument;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 08.10.2006
+ * Time: 16:55:35
+ * To change this template use File | Settings | File Templates.
+ */
+public class PluginDescriptorModel implements ItemListener, UserInterface {
+
+
+ public enum Attributes{
+ PluginName("PLUGIN_NAME"),
+ PluginDescription("PLUGIN_DESCRIPTION"),
+ PluginDependencies("PLUGIN_DEPENDENCIES");
+
+ private final String name;
+ private Attributes(String name){
+ this.name = name;
+ }
+ public String getName(){
+ return name;
+ }
+ }
+ IPluginDescriptor selectedDescriptor;
+
+
+ public PluginDescriptorModel(){
+
+ }
+ public final Document name = new PlainDocument();
+ public final Document description = new PlainDocument();
+ public final Document vendorName = new PlainDocument();
+ public final DefaultListModel dependencies = new DefaultListModel();
+
+
+ private final DocumentUtils utils = new DocumentUtils();
+
+ /**
+ *
+ * @param e
+ */
+ public void itemStateChanged(ItemEvent e) {
+ if (ItemEvent.SELECTED == e.getStateChange()){
+ setDescriptor((IPluginDescriptor) e.getItem());
+ }
+ }
+
+ /**
+ *
+ * @param desc
+ */
+ private void setDescriptor(IPluginDescriptor desc) {
+ if (desc == null){
+ utils.setString(name, "");
+ utils.setString(description, "");
+ dependencies.clear();
+ }else{
+ utils.setString(name, desc.getName());
+ utils.setString(description, desc.getDescription());
+ dependencies.clear();
+ dependencies.copyInto(desc.getDependencies().toArray());
+ }
+ }
+
+ /**
+ *
+ * @param attributeName
+ * @param parent
+ * @return
+ * @throws IllegalArgumentException
+ */
+ public JComponent visualProxy(String attributeName, JComponent parent) throws IllegalArgumentException {
+ JComponent proxy;
+ if ("PLUGIN_NAME".equals(attributeName)){
+ JTextField tf = new JTextField(name,name.toString(), 6);
+ proxy = tf;
+ }
+ else if ("PLUGIN_DESCRIPTION".equals(attributeName)){
+ JTextArea tf = new JTextArea(description,description.toString(), 6,6);
+ proxy = tf;
+ }
+ else if (Attributes.PluginDependencies.getName().equals(attributeName)){
+ proxy = new JScrollPane(new JList(dependencies));
+ }
+ else{
+ throw new IllegalArgumentException ("Attribute not suported: " + attributeName);
+ }
+ if (parent != null){
+ parent.add(proxy);
+ }
+ return proxy;
+ }
+
+ public String[] getAttributeNames() {
+ return new String[0]; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDialog.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDialog.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginDialog.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,15 @@
+
+package net.sf.magicmap.client.plugin.ui;
+
+import net.sf.magicmap.client.plugin.PluginManager;
+
+import javax.swing.*;
+
+public class PluginDialog extends JDialog {
+
+ public PluginDialog(PluginManager manager, JFrame parent) {
+ super(parent);
+ setContentPane(manager.visualProxy("", null));
+ }
+
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginTableModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/ui/PluginTableModel.java 2007-01-14 20:17:04 UTC (rev 505)
@@ -0,0 +1,115 @@
+
+package net.sf.magicmap.client.plugin.ui;
+
+import net.sf.magicmap.artifact.ArtifactComparator;
+import net.sf.magicmap.client.gui.ISortableTableModel;
+import net.sf.magicmap.client.plugin.PluginManager;
+
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import java.beans.PropertyChangeSupport;
+import java.util.Collections;
+import java.util.LinkedList;
+
+/**
+ * The list of all installed plugins.
+ * @author Jan
+ *
+ */
+public class PluginTableModel implements ISortableTableModel {
+
+ private final PropertyChangeSupport support;
+ private final LinkedList<TableModelListener> listener = new LinkedList<TableModelListener>();
+ private final LinkedList<net.sf.magicmap.client.plugin.IPlugin> plugins = new LinkedList<net.sf.magicmap.client.plugin.IPlugin>();
+
+ private static final Class[] clazzes = new Class[]{String.class, String.class, String.class,
+ Boolean.class };
+ private final String[] names = new String[]{"Gruppe", "Plugin", "Version", "Aktiv"};
+ private boolean descending;
+ private int sortColumn;
+
+ public PluginTableModel(PluginManager manager) {
+ this.support = new PropertyChangeSupport(this);
+// for (IPlugin plugin : manager)
+// this.plugins.add(plugin);
+ }
+
+ public void addTableModelListener(TableModelListener l){
+ this.listener.add(l);
+
+ }
+
+ public Class<?> getColumnClass(int columnIndex){
+ return PluginTableModel.clazzes[columnIndex];
+ }
+
+ public int getColumnCount(){
+ return PluginTableModel.clazzes.length;
+ }
+
+ public String getColumnName(int columnIndex){
+ return this.names[columnIndex];
+ }
+
+ public int getRowCount(){
+ return this.plugins.size();
+ }
+
+ public void sortByComlumn(int column, boolean descending){
+ this.sortColumn = column;
+ this.descending = descending;
+
+ Collections.sort(this.plugins, new ArtifactComparator()); //(new int[]{column}, descending));
+
+ TableModelEvent e = new TableModelEvent(this);
+ for (TableModelListener l : this.listener)
+ l.tableChanged(e);
+ System.err.println(column);
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex){
+ if (rowIndex > this.plugins.size()) throw new IllegalArgumentException("Invalid Row: " + rowIndex);
+ net.sf.magicmap.client.plu...
[truncated message content] |
|
From: <jan...@us...> - 2007-01-14 19:57:34
|
Revision: 504
http://svn.sourceforge.net/magicmap/?rev=504&view=rev
Author: jan_fride
Date: 2007-01-14 11:57:31 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
removed old pluginsystem
Modified Paths:
--------------
trunk/magicmapclient/magicmapclient.iml
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IClientPlugin.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InfoPlugin.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/
Modified: trunk/magicmapclient/magicmapclient.iml
===================================================================
--- trunk/magicmapclient/magicmapclient.iml 2007-01-14 19:09:55 UTC (rev 503)
+++ trunk/magicmapclient/magicmapclient.iml 2007-01-14 19:57:31 UTC (rev 504)
@@ -4,37 +4,301 @@
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build" />
<exclude-output />
+ <output-test url="file://$MODULE_DIR$/build-test" />
<content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/perl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/res" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src-gen" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.settings" />
- <excludeFolder url="file://$MODULE_DIR$/dist" />
<excludeFolder url="file://$MODULE_DIR$/inf" />
+ <excludeFolder url="file://$MODULE_DIR$/lib" />
+ <excludeFolder url="file://$MODULE_DIR$/lib-dev" />
</content>
- <orderEntry type="jdk" jdkName="1.5" jdkType="JavaSDK" />
+ <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module-library" exported="">
+ <orderEntry type="library" name="Groovy from GroovyJ 0.1.8 (Demetra)" level="application" />
+ <orderEntry type="library" name="magicmap-server" level="application" />
+ <orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/magicmap.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/nekohtml.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="library" exported="" name="client-libs" level="project" />
- <orderEntry type="library" exported="" name="lib-dev" level="project" />
- <orderEntry type="module-library" exported="">
+ <orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/../magicmapserver/dist/magicmap-server.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/jaxrpc.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/concurrent.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-collections-3.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jaxen-1.1-beta-9.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/forms-1.0.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/xml-apis.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/activation.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jung-1.5.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/xmlParserAPIs.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/mail.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/derby.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/foxtrot.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-httpclient-3.0-rc3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/dom4j-1.6.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-discovery.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/RelativeLayout.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/saaj.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/log4j-1.2.8.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-logging.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/xercesImpl.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/looks-1.2.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/axis.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/ostermillerutils_1_05_00.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/jpox-20041204.032009.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/commons-codec-1.3.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/colt.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib/wsdl4j.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib-dev/axis-ant.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/lib-dev/junit.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="file://$MODULE_DIR$/build" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 19:09:55 UTC (rev 503)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 19:57:31 UTC (rev 504)
@@ -125,9 +125,6 @@
this.infoObjects = new ArrayList<InfoObject>();
// initializeScanner();
this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel);
- PluginHandler.getInstance();
-
- //TODO
try {
this.pluginManager = new PluginManager(new Settings(), this);
} catch (MalformedURLException e) {
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IClientPlugin.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IClientPlugin.java 2007-01-14 19:09:55 UTC (rev 503)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IClientPlugin.java 2007-01-14 19:57:31 UTC (rev 504)
@@ -1,24 +0,0 @@
-
-package net.sf.magicmap.client.plugin;
-
-/**
- * Wird durch die neue Architektur ersetzt.
- *
- *
- *
- */
-@Deprecated
-public interface IClientPlugin {
-
- public boolean canStartup();
-
- public void connect();
-
- public void loadMap();
-
- public void dispose();
-
- public void setId(String id);
-
- public String getId();
-}
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InfoPlugin.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InfoPlugin.java 2007-01-14 19:09:55 UTC (rev 503)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InfoPlugin.java 2007-01-14 19:57:31 UTC (rev 504)
@@ -1,30 +0,0 @@
-
-package net.sf.magicmap.client.plugin;
-
-import net.sf.magicmap.client.model.node.InfoObjectNode;
-
-@Deprecated
-public interface InfoPlugin extends IClientPlugin {
-
- /**
- *
- * @param node
- * @throws Exception
- */
- public void expandNode(InfoObjectNode node) throws Exception;
-
- /**
- *
- * @return
- * @throws Exception
- */
- public InfoObjectNode createNode() throws Exception;
-
- /**
- *
- * @param source
- * @param target
- * @param data
- */
- public void addEdge(InfoObjectNode source, InfoObjectNode target, String[][] data);
-}
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginHandler.java 2007-01-14 19:09:55 UTC (rev 503)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginHandler.java 2007-01-14 19:57:31 UTC (rev 504)
@@ -1,113 +0,0 @@
-
-package net.sf.magicmap.client.plugin;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import net.sf.magicmap.client.gui.utils.GUIUtils;
-
-@Deprecated
-public class PluginHandler {
-
- private static PluginHandler instance = null;
- private List<IClientPlugin> plugins;
- private ResourceBundle pluginBundle;
- private static final String PLUGIN_KEY = "plugins";
- private static final String BUNDLE_NAME = "plugins";
-
- private PluginHandler() {
- this.plugins = new ArrayList<IClientPlugin>();
-
- // Instantiate all availlable plugins
- initPlugins();
- }
-
- public static PluginHandler getInstance(){
- if (PluginHandler.instance == null) PluginHandler.instance = new PluginHandler();
- return PluginHandler.instance;
- }
-
- public void initPlugins(){
- if (this.pluginBundle == null) initBundle();
-
- String pluginNames;
- String[] pluginNamesArray;
- if (((pluginNames = this.pluginBundle.getString(PluginHandler.PLUGIN_KEY)) != null)
- && (pluginNames.trim().length() > 0)) {
- pluginNamesArray = pluginNames.split(",");
-
- Class clazz = null;
- IClientPlugin clientPlugin = null;
- for (String pluginName : pluginNamesArray)
- // init Plugin
- try {
- clazz = Class.forName(pluginName.trim());
- clientPlugin = (IClientPlugin) clazz.newInstance();
- clientPlugin.setId(clientPlugin.getClass().getName());
- this.plugins.add(clientPlugin);
- System.out.println("Neuer Plugin: " + clientPlugin);
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- public void initBundle() throws MissingResourceException{
- try {
- this.pluginBundle = ResourceBundle.getBundle(PluginHandler.BUNDLE_NAME, GUIUtils.getLocale());
- } catch (MissingResourceException e) {
- throw e;
- }
- }
-
- public void connect(){
- for (IClientPlugin plugin : this.plugins)
- plugin.connect();
- }
-
- public void loadMap(){
- for (IClientPlugin plugin : this.plugins)
- plugin.loadMap();
- }
-
- public void dispose(){
- for (IClientPlugin plugin : this.plugins)
- plugin.dispose();
- }
-
- public IClientPlugin getPlugin(Class clazz){
- for (IClientPlugin plugin : this.plugins)
- if (plugin.getClass().isAssignableFrom(clazz)) return plugin;
- return null;
- }
-
- public Collection<IClientPlugin> getPlugins(Class clazz){
- LinkedList<IClientPlugin> pluginList = new LinkedList<IClientPlugin>();
- for (IClientPlugin plugin : this.plugins)
- if (clazz.isAssignableFrom(plugin.getClass()))
- pluginList.add(plugin);
- else
- System.err.println(clazz + " not assignable to " + plugin.getClass());
- return pluginList;
- }
-
- public List<IClientPlugin> getPlugins(){
- return this.plugins;
- }
-
- public void setPlugins(List<IClientPlugin> plugins){
- this.plugins = plugins;
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 19:10:00
|
Revision: 503
http://svn.sourceforge.net/magicmap/?rev=503&view=rev
Author: jan_fride
Date: 2007-01-14 11:09:55 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
changed MeasurementModel as there should be only one ;-)
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -28,9 +28,9 @@
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry;
+
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.measurement.MeasurementModel;
-import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
-import net.sf.magicmap.client.model.node.AccessPointEdge;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.GeoPos;
@@ -45,8 +45,6 @@
import org.apache.log4j.xml.DOMConfigurator;
-import javax.swing.*;
-
/**
* Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den
* der Anwendung.
@@ -67,10 +65,8 @@
*/
private INodeModel nodeModel; // Model f\xFCr Graphen
- private MeasurementModel measurementModel; // Model f\xFCr Messungen
+ private IMeasurementModel measurementModel; // Model f\xFCr Messungen
- private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte
-
private ClientNode client; // Ausgezeichneter Knoten
private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen
@@ -116,10 +112,6 @@
*/
this.measurementModel = new MeasurementModel();
- /**
- * Messungen f\xFCr alle anderen?
- */
- this.measurementModelOther = new MeasurementModel();
this.scannerAllocator = new ScannerAllocator();
this.currentMap = null;
@@ -231,14 +223,14 @@
* the access point seer node
*/
public void buildOtherMeasurement(AccessPointSeerNode ap){
- System.out.println("Building measurement model...");
- this.measurementModelOther.clear();
- ArrayList aes = ap.getApEdges();
- for (int i = 0; i < aes.size(); i++) {
- AccessPointEdge ae = (AccessPointEdge) aes.get(i);
- SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel());
- this.measurementModelOther.addAccessPoint(sp);
- }
+// System.out.println("Building measurement model...");
+// this.measurementModelOther.clear();
+// ArrayList aes = ap.getApEdges();
+// for (int i = 0; i < aes.size(); i++) {
+// AccessPointEdge ae = (AccessPointEdge) aes.get(i);
+// SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel());
+// this.measurementModelOther.addAccessPoint(sp);
+// }
}
/**
@@ -264,7 +256,7 @@
*
* @return the measurement model
*/
- public MeasurementModel getMeasurementModel(){
+ public IMeasurementModel getMeasurementModel(){
return this.measurementModel;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -21,7 +21,7 @@
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
import net.sf.magicmap.client.meta.MapInfo;
import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry;
-import net.sf.magicmap.client.model.measurement.MeasurementModel;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.GeoPos;
@@ -96,7 +96,7 @@
*
* @return the measurement model
*/
- MeasurementModel getMeasurementModel();
+ IMeasurementModel getMeasurementModel();
/**
* Gibt an ob verbunden oder nicht verbunden
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -30,6 +30,7 @@
import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
import net.sf.magicmap.client.model.node.GeoPos;
import net.sf.magicmap.client.model.node.InfoObject;
+import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.server.dto.PositionDTO;
import net.sf.magicmap.server.dto.SignalCharacterDTO;
import net.sf.magicmap.server.dto.SimpleScanResultDTO;
@@ -69,7 +70,8 @@
*/
protected SignalCharacterDTO currentSignalCharacter(){
SignalCharacterDTO signalCharacter = new SignalCharacterDTO();
- Collection accessPoints = controller.getMeasurementModel().getAccessPoints();
+ ClientNode clientNode = controller.getClient();
+ Collection accessPoints = controller.getMeasurementModel().get(clientNode);
Iterator it = accessPoints.iterator();
while (it.hasNext()) {
SeenAccessPoint ap = (SeenAccessPoint) it.next();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -16,9 +16,9 @@
import net.sf.magicmap.client.measurement.Constants;
import net.sf.magicmap.client.measurement.MeasurementUtils;
-import net.sf.magicmap.client.model.measurement.MeasurementModel;
import net.sf.magicmap.client.model.measurement.MeasurementTableModel;
import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
public class MeasurementTable extends JTable {
@@ -30,9 +30,8 @@
/**
*
* @param model
- * @param otherModel
*/
- public MeasurementTable(MeasurementModel model) {
+ public MeasurementTable(IMeasurementModel model) {
this(new MeasurementTableModel(model));
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -15,8 +15,8 @@
import net.sf.magicmap.client.gui.utils.GUIBuilder;
import net.sf.magicmap.client.gui.utils.GUIConstants;
import net.sf.magicmap.client.gui.utils.GUIUtils;
-import net.sf.magicmap.client.model.measurement.MeasurementModel;
import net.sf.magicmap.client.model.measurement.MeasurementTableModel;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.INodeModel;
import net.sf.magicmap.client.model.node.Node;
@@ -37,13 +37,12 @@
private MeasurementTableModel tableModel;
private MeasurementTableModel tableModelOther;
- public MeasurementView(MeasurementModel model, INodeModel nodeModel) {
+ public MeasurementView(IMeasurementModel model, INodeModel nodeModel) {
super(GUIUtils.i18n("measurement"));
this.setFrameIcon(GUIBuilder.getToolIcon(GUIConstants.ICON_MEASUREMENT));
- this.table = new MeasurementTable(model);
+ this.table = new MeasurementTable(new MeasurementTableModel(model));
this.tableModel = (MeasurementTableModel) this.table.getModel();
- this.tableModelOther = new MeasurementTableModel(new MeasurementModel());
nodeModel.addNodeModelSelectionListener((MeasurementTableModel) this.table.getModel());
setContent(buildViewComponent());
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -1,123 +0,0 @@
-package net.sf.magicmap.client.model.measurement;
-
-import net.sf.magicmap.client.model.node.ClientNode;
-import net.sf.magicmap.client.model.node.AccessPointSeerNode;
-import net.sf.magicmap.client.interfaces.MeasurementModelListener;
-
-import javax.swing.event.EventListenerList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-
-/**
- * New Model for measurements. contains all measurement made.
- *
- */
-public class NMeasurementModel implements IMeasurementModel {
-
- private final EventListenerList listeners = new EventListenerList();
- private final MeasurementMap apMap = new MeasurementMap();
- public NMeasurementModel(){
-
- }
-
- /**
- * Adds an access point to the list of seen ap for a
- * given client.
- *
- * @param client the client seeing the ap
- * @param ap the seen access point.
- */
- public void addAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
- if (apMap.put(client, ap)){
- fireAccessPointAdded(client,ap);
- }
- }
-
- /**
- * Returns a list of seen access points for a given client.
- * @param forNode
- * @return
- */
- public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode){
- return apMap.get(forNode).values();
- }
-
- public void updateAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
- fireAccessPointChanged(client, ap);
- }
-
- public void removeAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
- if (apMap.remove(client, ap)){
- fireAccessPointRemoved(client, ap);
- }
- }
- public void addMeasurementModelListener(MeasurementModelListener l){
- listeners.add(MeasurementModelListener.class, l);
- }
-
- public void removeMeasurementModelListener(MeasurementModelListener l){
- listeners.remove(MeasurementModelListener.class, l);
- }
-
- protected final void fireAccessPointAdded(AccessPointSeerNode node, SeenAccessPoint ap){
- MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
- for (MeasurementModelListener l: modelListeners){
- l.seesAccessPoint(ap);
- }
- }
- protected final void fireAccessPointRemoved(AccessPointSeerNode node, SeenAccessPoint ap){
- MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
- for (MeasurementModelListener l: modelListeners){
- l.notseesAccessPoint(ap);
- }
- }
- protected final void fireAccessPointChanged(AccessPointSeerNode node, SeenAccessPoint ap){
- MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
- for (MeasurementModelListener l: modelListeners){
- l.updateAccessPoint(ap);
- }
- }
-
- public SeenAccessPoint getAccessPoint(ClientNode client, String mac){
- return apMap.get(client,mac);
- }
-
- private static class MeasurementMap extends HashMap<AccessPointSeerNode, Map<String, SeenAccessPoint>>{
-
- public boolean put(AccessPointSeerNode node, SeenAccessPoint ap){
- if (containsKey(node)){
-
- Map<String, SeenAccessPoint> map = get(node);
- boolean isNew =map.containsKey(ap.getMac());
- map.put(ap.getMac(), ap);
- return isNew;
- }
- else{
- HashMap<String, SeenAccessPoint> list = new HashMap<String, SeenAccessPoint>();
- list.put(ap.getMac(), ap);
- super.put(node, list);
- return true;
- }
- }
- public boolean remove(AccessPointSeerNode node, SeenAccessPoint ap){
- if (containsKey(node)){
- return get(node).remove(ap.getMac()) != null;
- }
- return false;
- }
-
-
- public Map<String, SeenAccessPoint> get(Object key) {
- Map<String, SeenAccessPoint> map = super.get(key);
- if (map == null) return new HashMap<String, SeenAccessPoint>();
- return map;
- }
- public SeenAccessPoint get(AccessPointSeerNode seer, String apMac) {
- return get(seer).get(apMac);
- }
- }
-
-
-}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java 2007-01-14 19:08:30 UTC (rev 502)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java 2007-01-14 19:09:55 UTC (rev 503)
@@ -13,8 +13,8 @@
import net.sf.magicmap.client.measurement.interfaces.AbstractScanResult;
import net.sf.magicmap.client.measurement.interfaces.AbstractScanner;
import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler;
-import net.sf.magicmap.client.model.measurement.MeasurementModel;
import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+import net.sf.magicmap.client.model.measurement.IMeasurementModel;
import net.sf.magicmap.client.model.node.AccessPointNode;
import net.sf.magicmap.client.model.node.ClientNode;
import net.sf.magicmap.client.model.node.INodeModel;
@@ -30,7 +30,7 @@
*/
public class WifiHandler extends AbstractScannerHandler {
- private MeasurementModel measurementModel;
+ private IMeasurementModel measurementModel;
private INodeModel nodeModel;
@@ -48,7 +48,7 @@
* @param client
* ClientNode
*/
- public WifiHandler(AbstractScanner canHandle, MeasurementModel mmodel, INodeModel nmodel, ClientNode client) {
+ public WifiHandler(AbstractScanner canHandle, IMeasurementModel mmodel, INodeModel nmodel, ClientNode client) {
super(canHandle);
this.measurementModel = mmodel;
this.nodeModel = nmodel;
@@ -65,7 +65,7 @@
*
* @return
*/
- public MeasurementModel getMeasurementModel(){
+ public IMeasurementModel getMeasurementModel(){
return this.measurementModel;
}
@@ -74,7 +74,7 @@
*
* @param model
*/
- public void setMeasurementModel(MeasurementModel model){
+ public void setMeasurementModel(IMeasurementModel model){
this.measurementModel = model;
}
@@ -92,7 +92,7 @@
public void run(){
String mac = result.getIdentifier();
double signalLevel = result.signalLevel;
- SeenAccessPoint ap = WifiHandler.this.measurementModel.getAccessPoint(mac);
+ SeenAccessPoint ap = WifiHandler.this.measurementModel.getAccessPoint(client, mac);
if (ap != null) {
WifiHandler.this.previous.remove(ap);
AccessPointNode node = WifiHandler.this.nodeModel.findAccessPoint(mac);
@@ -113,14 +113,14 @@
ap.addSignalLevel(signalLevel);
// Die St\xE4rke aber aus dem
// Durchschnittssignalableiten
- WifiHandler.this.measurementModel.updateAccessPoint(ap);
+ WifiHandler.this.measurementModel.updateAccessPoint(client, ap);
// AccessPoint ist aus der Berechnung ausgeschlossen
WifiHandler.this.client.setSignalLevelForAcessPoint(node, ap.getAverageSignalLevel());
}
} else {
// AccessPoint ist noch nicht im Model.
ap = new SeenAccessPoint(mac, signalLevel);
- WifiHandler.this.measurementModel.addAccessPoint(ap);
+ WifiHandler.this.measurementModel.addAccessPoint(client, ap);
// Schauen ob der Access Point dann evtl. im NodeModel
// schon vorhanden ist
AccessPointNode node = WifiHandler.this.nodeModel.findAccessPoint(mac);
@@ -165,7 +165,7 @@
SeenAccessPoint ap = (SeenAccessPoint) it.next();
// Den Durchschnitt dr\xFCcken...
ap.addDeadSignal();
- WifiHandler.this.measurementModel.updateAccessPoint(ap);
+ WifiHandler.this.measurementModel.updateAccessPoint(client, ap);
/*
* AccessPointNode node =
* nodeModel.findAccessPoint(ap.getMac()); if (node !=
@@ -175,7 +175,7 @@
if (ap.isTotallyDead()) {
// AP nur entfernen, wenn l\xE4ngere Zeit kein Signal
// mehr
- WifiHandler.this.measurementModel.removeAccessPoint(ap);
+ WifiHandler.this.measurementModel.removeAccessPoint(client, ap);
// NodeModel aktualisieren
AccessPointNode node = WifiHandler.this.nodeModel.findAccessPoint(ap.getMac());
if (node != null) // Kante zum Access Point vom eigenen Client
@@ -195,7 +195,7 @@
// Botschaften
// die beschreiben was sich ge\xE4ndert hat.
WifiHandler.this.previous = new HashSet<SeenAccessPoint>(WifiHandler.this.measurementModel
- .getAccessPoints());
+ .get(client));
}
});
} catch (InterruptedException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 19:08:32
|
Revision: 502
http://svn.sourceforge.net/magicmap/?rev=502&view=rev
Author: jan_fride
Date: 2007-01-14 11:08:30 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-14 19:08:30 UTC (rev 502)
@@ -0,0 +1,123 @@
+package net.sf.magicmap.client.model.measurement;
+
+import net.sf.magicmap.client.model.node.ClientNode;
+import net.sf.magicmap.client.model.node.AccessPointSeerNode;
+import net.sf.magicmap.client.interfaces.MeasurementModelListener;
+
+import javax.swing.event.EventListenerList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * New Model for measurements. contains all measurement made.
+ *
+ */
+public class MeasurementModel implements IMeasurementModel {
+
+ private final EventListenerList listeners = new EventListenerList();
+ private final MeasurementMap apMap = new MeasurementMap();
+ public MeasurementModel(){
+
+ }
+
+ /**
+ * Adds an access point to the list of seen ap for a
+ * given client.
+ *
+ * @param client the client seeing the ap
+ * @param ap the seen access point.
+ */
+ public void addAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
+ if (apMap.put(client, ap)){
+ fireAccessPointAdded(client,ap);
+ }
+ }
+
+ /**
+ * Returns a list of seen access points for a given client.
+ * @param forNode
+ * @return
+ */
+ public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode){
+ return apMap.get(forNode).values();
+ }
+
+ public void updateAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
+ fireAccessPointChanged(client, ap);
+ }
+
+ public void removeAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
+ if (apMap.remove(client, ap)){
+ fireAccessPointRemoved(client, ap);
+ }
+ }
+ public void addMeasurementModelListener(MeasurementModelListener l){
+ listeners.add(MeasurementModelListener.class, l);
+ }
+
+ public void removeMeasurementModelListener(MeasurementModelListener l){
+ listeners.remove(MeasurementModelListener.class, l);
+ }
+
+ protected final void fireAccessPointAdded(AccessPointSeerNode node, SeenAccessPoint ap){
+ MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
+ for (MeasurementModelListener l: modelListeners){
+ l.seesAccessPoint(ap);
+ }
+ }
+ protected final void fireAccessPointRemoved(AccessPointSeerNode node, SeenAccessPoint ap){
+ MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
+ for (MeasurementModelListener l: modelListeners){
+ l.notseesAccessPoint(ap);
+ }
+ }
+ protected final void fireAccessPointChanged(AccessPointSeerNode node, SeenAccessPoint ap){
+ MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
+ for (MeasurementModelListener l: modelListeners){
+ l.updateAccessPoint(ap);
+ }
+ }
+
+ public SeenAccessPoint getAccessPoint(ClientNode client, String mac){
+ return apMap.get(client,mac);
+ }
+
+ private static class MeasurementMap extends HashMap<AccessPointSeerNode, Map<String, SeenAccessPoint>>{
+
+ public boolean put(AccessPointSeerNode node, SeenAccessPoint ap){
+ if (containsKey(node)){
+
+ Map<String, SeenAccessPoint> map = get(node);
+ boolean isNew =map.containsKey(ap.getMac());
+ map.put(ap.getMac(), ap);
+ return isNew;
+ }
+ else{
+ HashMap<String, SeenAccessPoint> list = new HashMap<String, SeenAccessPoint>();
+ list.put(ap.getMac(), ap);
+ super.put(node, list);
+ return true;
+ }
+ }
+ public boolean remove(AccessPointSeerNode node, SeenAccessPoint ap){
+ if (containsKey(node)){
+ return get(node).remove(ap.getMac()) != null;
+ }
+ return false;
+ }
+
+
+ public Map<String, SeenAccessPoint> get(Object key) {
+ Map<String, SeenAccessPoint> map = super.get(key);
+ if (map == null) return new HashMap<String, SeenAccessPoint>();
+ return map;
+ }
+ public SeenAccessPoint get(AccessPointSeerNode seer, String apMac) {
+ return get(seer).get(apMac);
+ }
+ }
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 19:07:02
|
Revision: 501
http://svn.sourceforge.net/magicmap/?rev=501&view=rev
Author: jan_fride
Date: 2007-01-14 11:07:00 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
changed MeasurementModel as there should be only one ;-)
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2007-01-14 19:03:16 UTC (rev 500)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2007-01-14 19:07:00 UTC (rev 501)
@@ -1,7 +1,6 @@
package net.sf.magicmap.client.model.measurement;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@@ -9,8 +8,6 @@
import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.interfaces.MeasurementModelListener;
-import net.sf.magicmap.client.model.node.AccessPointEdge;
-import net.sf.magicmap.client.model.node.AccessPointNode;
import net.sf.magicmap.client.model.node.AccessPointSeerNode;
import net.sf.magicmap.client.model.node.Node;
import net.sf.magicmap.client.model.node.NodeModelSelectionEvent;
@@ -64,7 +61,7 @@
}
public MeasurementTableModel() {
- this(new NMeasurementModel());
+ this(new MeasurementModel());
}
public IMeasurementModel getMeasurementModel(){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 19:03:23
|
Revision: 500
http://svn.sourceforge.net/magicmap/?rev=500&view=rev
Author: jan_fride
Date: 2007-01-14 11:03:16 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/IMeasurementModel.java 2007-01-14 19:03:16 UTC (rev 500)
@@ -0,0 +1,26 @@
+package net.sf.magicmap.client.model.measurement;
+
+import net.sf.magicmap.client.model.node.ClientNode;
+import net.sf.magicmap.client.model.node.AccessPointSeerNode;
+import net.sf.magicmap.client.interfaces.MeasurementModelListener;
+
+import java.util.Collection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jan
+ * Date: 14.01.2007
+ * Time: 18:49:41
+ * To change this template use File | Settings | File Templates.
+ */
+public interface IMeasurementModel {
+
+ void addAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap);
+ public void updateAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap);
+ void removeAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap);
+ public void addMeasurementModelListener(MeasurementModelListener l);
+ public void removeMeasurementModelListener(MeasurementModelListener l);
+ public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode);
+
+ SeenAccessPoint getAccessPoint(ClientNode client, String mac);
+}
Deleted: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-14 17:57:00 UTC (rev 499)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java 2007-01-14 19:03:16 UTC (rev 500)
@@ -1,170 +0,0 @@
-/*
- * Created on 28.11.2004
- */
-
-package net.sf.magicmap.client.model.measurement;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import net.sf.magicmap.client.interfaces.MeasurementModelListener;
-
-/**
- * Beschreibt das Signalcharakteristik des Clients
- * nach lokalen Messungen. Diese Messung sind Grundlage
- * f\xFCr die Dastellung im MeasurementView. Auch k\xF6nnen diese
- * \xFCber WebService an einen Server geschickt werden.
- * @author thuebner
- */
-public class MeasurementModel {
-
- private HashMap<String, SeenAccessPoint> seenAccessPoints;
- private ArrayList<MeasurementModelListener> listeners;
-
- /**
- * Erstellt leeres Model
- *
- */
- public MeasurementModel() {
- this.seenAccessPoints = new HashMap<String, SeenAccessPoint>();
- this.listeners = new ArrayList<MeasurementModelListener>();
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#addAccessPoint(net.sf.magicmap.client.model.measurement.SeenAccessPoint)
- */
- public void addAccessPoint(SeenAccessPoint ap){
- this.seenAccessPoints.put(ap.getMac(), ap);
- this.fireSeesAccessPoint(ap);
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#removeAccessPoint(net.sf.magicmap.client.model.measurement.SeenAccessPoint)
- */
- public void removeAccessPoint(SeenAccessPoint ap){
- this.seenAccessPoints.remove(ap.getMac());
- this.fireNotSeesAccessPoint(ap);
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#removeAccessPointNoEvent(net.sf.magicmap.client.model.measurement.SeenAccessPoint)
- */
- public void removeAccessPointNoEvent(SeenAccessPoint ap){
- this.seenAccessPoints.remove(ap.getMac());
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#updateAccessPoint(net.sf.magicmap.client.model.measurement.SeenAccessPoint)
- */
- public void updateAccessPoint(SeenAccessPoint ap){
- this.fireUpdateAccessPoint(ap);
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#getAccessPoints()
- */
- public Collection<SeenAccessPoint> getAccessPoints(){
- return Collections.unmodifiableCollection(this.seenAccessPoints.values());
- }
-
- /*
- public void clearMeasurements() {
- this.seenAccessPoints.clear();
- }
- */
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#getAccessPoint(java.lang.String)
- */
- public SeenAccessPoint getAccessPoint(String mac){
- return this.seenAccessPoints.get(mac);
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#addMeasurementModelListener(net.sf.magicmap.client.interfaces.MeasurementModelListener)
- */
- public void addMeasurementModelListener(MeasurementModelListener l){
- if (!this.listeners.contains(l)) this.listeners.add(l);
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#removeMeasurementModelListener(net.sf.magicmap.client.interfaces.MeasurementModelListener)
- */
- public void removeMeasurementModelListener(MeasurementModelListener l){
- this.listeners.remove(l);
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#MeasurementModelListeners()
- */
- public MeasurementModelListener[] MeasurementModelListeners(){
- return this.listeners.toArray(new MeasurementModelListener[0]);
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#fireSeesAccessPoint(net.sf.magicmap.client.model.measurement.SeenAccessPoint)
- */
- public void fireSeesAccessPoint(SeenAccessPoint ap){
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- MeasurementModelListener l = (MeasurementModelListener) it.next();
- l.seesAccessPoint(ap);
- }
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#fireNotSeesAccessPoint(net.sf.magicmap.client.model.measurement.SeenAccessPoint)
- */
- public void fireNotSeesAccessPoint(SeenAccessPoint ap){
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- MeasurementModelListener l = (MeasurementModelListener) it.next();
- l.notseesAccessPoint(ap);
- }
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#fireUpdateAccessPoint(net.sf.magicmap.client.model.measurement.SeenAccessPoint)
- */
- public void fireUpdateAccessPoint(SeenAccessPoint ap){
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- MeasurementModelListener l = (MeasurementModelListener) it.next();
- l.updateAccessPoint(ap);
- }
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#fireUpdateAcessPoints()
- */
- public void fireUpdateAcessPoints(){
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- MeasurementModelListener l = (MeasurementModelListener) it.next();
- l.updateAccessPoints();
- }
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#fireClear()
- */
- public void fireClear(){
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- MeasurementModelListener l = (MeasurementModelListener) it.next();
- l.clearAccessPoints();
- }
- }
-
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.model.measurement.IMeasurementModel#clear()
- */
- public void clear(){
- this.seenAccessPoints.clear();
- fireClear();
- }
-
-}
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2007-01-14 17:57:00 UTC (rev 499)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2007-01-14 19:03:16 UTC (rev 500)
@@ -19,170 +19,171 @@
import org.apache.log4j.Logger;
/**
- *
+ *
* Enth\xE4lt alle Messwerte ;-) Die View ist daf\xFCr zut\xE4ndig nur diese anzuzeigen die
* der Benutzer sehen will....
* @author thuebner, Jan Friderici
*
*/
public class MeasurementTableModel extends DefaultTableModel
- implements
- MeasurementModelListener,
- NodeModelSelectionListener {
+ implements
+ MeasurementModelListener,
+ NodeModelSelectionListener {
- private static final Logger log = Logger.getLogger(MeasurementTableModel.class);
+ private static final Logger log = Logger.getLogger(MeasurementTableModel.class);
- private AccessPointSeerNode seerNode = null;
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ private AccessPointSeerNode seerNode = null;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
- /**
- *
- */
- private final MeasurementModel measureModel;
+ /**
+ *
+ */
+ private final IMeasurementModel measureModel;
- /**
- * Index of the accespoint in the model.
- */
- private final Map<String, Integer> accessPointRows = new HashMap<String, Integer>();
+ /**
+ * Index of the accespoint in the model.
+ */
+ private final Map<String, Integer> accessPointRows = new HashMap<String, Integer>();
- /**
- *
- *
- */
- public MeasurementTableModel(MeasurementModel measureModel) {
- super();
- this.measureModel = measureModel;
- addColumn(GUIUtils.i18n("macaddress"));
- addColumn(GUIUtils.i18n("signallevel"));
- addColumn(GUIUtils.i18n("avgsignallevel"));
- addColumn(GUIUtils.i18n("strength"));
- addColumn(GUIUtils.i18n("avgstrength"));
- measureModel.addMeasurementModelListener(this);
- }
+ /**
+ *
+ *
+ */
+ public MeasurementTableModel(IMeasurementModel measureModel) {
+ super();
+ this.measureModel = measureModel;
+ addColumn(GUIUtils.i18n("macaddress"));
+ addColumn(GUIUtils.i18n("signallevel"));
+ addColumn(GUIUtils.i18n("avgsignallevel"));
+ addColumn(GUIUtils.i18n("strength"));
+ addColumn(GUIUtils.i18n("avgstrength"));
+ measureModel.addMeasurementModelListener(this);
+ }
- public MeasurementTableModel() {
- this(new MeasurementModel());
- }
+ public MeasurementTableModel() {
+ this(new NMeasurementModel());
+ }
- public MeasurementModel getMeasurementModel(){
- return this.measureModel;
- }
+ public IMeasurementModel getMeasurementModel(){
+ return this.measureModel;
+ }
- public void clearAccessPoints(){
- MeasurementTableModel.log.info("clearAccessPoints");
- int rowCount = getRowCount() - 1;
- if (rowCount < 0) return;
- for (int i = rowCount; i >= 0; i--) {
- removeRow(i);
+ public void clearAccessPoints(){
+ MeasurementTableModel.log.info("clearAccessPoints");
+ int rowCount = getRowCount() - 1;
+ if (rowCount < 0) return;
+ for (int i = rowCount; i >= 0; i--) {
+ removeRow(i);
- fireTableRowsDeleted(i, i);
- }
- this.accessPointRows.clear();
- }
+ fireTableRowsDeleted(i, i);
+ }
+ this.accessPointRows.clear();
+ }
- /**
- * Removes an accespoint from this model.
- * @param ap the accesspoint to remove
- */
- public void notseesAccessPoint(SeenAccessPoint ap){
- MeasurementTableModel.log.info("notseesAccessPoint");
- if (null == this.seerNode) return;
- String key = ap.getMac().toLowerCase();
- if (this.accessPointRows.containsKey(key)) {
- int row = this.accessPointRows.get(key);
- for(String k : this.accessPointRows.keySet()){
- int r;
- if ((r = this.accessPointRows.get(k)) > row){
- this.accessPointRows.put(k, r-1);
- }
- }
- removeRow(row);
- this.accessPointRows.remove(key);
- fireTableRowsDeleted(row, row);
- }
- }
+ /**
+ * Removes an accespoint from this model.
+ * @param ap the accesspoint to remove
+ */
+ public void notseesAccessPoint(SeenAccessPoint ap){
+ MeasurementTableModel.log.info("notseesAccessPoint");
+ if (null == this.seerNode) return;
+ String key = ap.getMac().toLowerCase();
+ if (this.accessPointRows.containsKey(key)) {
+ int row = this.accessPointRows.get(key);
+ for(String k : this.accessPointRows.keySet()){
+ int r;
+ if ((r = this.accessPointRows.get(k)) > row){
+ this.accessPointRows.put(k, r-1);
+ }
+ }
+ removeRow(row);
+ this.accessPointRows.remove(key);
+ fireTableRowsDeleted(row, row);
+ }
+ }
- /**
- * Adds an accesspoint to this model.
- */
- public void seesAccessPoint(SeenAccessPoint ap){
- MeasurementTableModel.log.info("seesAccessPoint");
- if (null == this.seerNode) return;
- //ArrayList<AccessPointNode> seenAccessPoints = this.seerNode.getSeenAccessPoints();
- // if (seenAccessPoints.contains(ap)) {
- String key = ap.getMac().toLowerCase();
- int row = getRowCount();
+ /**
+ * Adds an accesspoint to this model.
+ */
+ public void seesAccessPoint(SeenAccessPoint ap){
+ MeasurementTableModel.log.info("seesAccessPoint");
+ if (null == this.seerNode) return;
+ //ArrayList<AccessPointNode> seenAccessPoints = this.seerNode.getSeenAccessPoints();
+ // if (seenAccessPoints.contains(ap)) {
+ String key = ap.getMac().toLowerCase();
+ int row = getRowCount();
- insertRow(row, new Object[]{ap.getMac(), ap.isDead() ? "-" : "" + ap.getLastSignalLevel() + " dB",
- "" + (Math.round(ap.getAverageSignalLevel() * 10.0)) / 10.0 + " dB", ap, ap});
- this.accessPointRows.put(key, row);
- fireTableRowsInserted(row, row);
- // }
- }
+ insertRow(row, new Object[]{ap.getMac(), ap.isDead() ? "-" : "" + ap.getLastSignalLevel() + " dB",
+ "" + (Math.round(ap.getAverageSignalLevel() * 10.0)) / 10.0 + " dB", ap, ap});
+ this.accessPointRows.put(key, row);
+ fireTableRowsInserted(row, row);
+ // }
+ }
- /**
- * Called if the signal level of a seen access point changed.
- *
- * @param ap the changed access point
- */
- public void updateAccessPoint(SeenAccessPoint ap){
- // We have no seer.
- if (this.seerNode == null){
- return;
- }
+ /**
+ * Called if the signal level of a seen access point changed.
+ *
+ * @param ap the changed access point
+ */
+ public void updateAccessPoint(SeenAccessPoint ap){
+ // We have no seer.
+ if (this.seerNode == null){
+ return;
+ }
- String key = ap.getMac().toLowerCase();
- if (this.accessPointRows.containsKey(key)) {
- int row = this.accessPointRows.get(key);
- //
- // should not happen? but does from time to time ;-)
- if (row >= getRowCount()){
- log.error("Row: " + row + ": RowCount: " + getRowCount());
- seesAccessPoint(ap);
- }
- else if (row >= 0) {
- setValueAt(ap.isDead() ? "-" : new Double(ap.getLastSignalLevel()) + " dB", row, 1);
- setValueAt(new Double((Math.round(ap.getAverageSignalLevel() * 10.0)) / 10.0) + " dB", row, 2);
- setValueAt(ap, row, 3);
- setValueAt(ap, row, 4);
- fireTableRowsUpdated(row, row);
- }
- }
+ String key = ap.getMac().toLowerCase();
+ if (this.accessPointRows.containsKey(key)) {
+ int row = this.accessPointRows.get(key);
+ //
+ // should not happen? but does from time to time ;-)
+ if (row >= getRowCount()){
+ log.error("Row: " + row + ": RowCount: " + getRowCount());
+ seesAccessPoint(ap);
+ }
+ else if (row >= 0) {
+ setValueAt(ap.isDead() ? "-" : new Double(ap.getLastSignalLevel()) + " dB", row, 1);
+ setValueAt(new Double((Math.round(ap.getAverageSignalLevel() * 10.0)) / 10.0) + " dB", row, 2);
+ setValueAt(ap, row, 3);
+ setValueAt(ap, row, 4);
+ fireTableRowsUpdated(row, row);
+ }
+ }
- }
+ }
- public void updateAccessPoints(){
- fireTableDataChanged();
- }
+ public void updateAccessPoints(){
+ fireTableDataChanged();
+ }
- /**
- * Changes the measuremnetn model if
- * the new selected node is instanceof AccessPointSeerNode
- */
- public void selectionChanged(NodeModelSelectionEvent selectEvent){
- Node selectedNode = selectEvent.getSelectedNode();
- if (selectedNode instanceof AccessPointSeerNode && selectedNode != this.seerNode)
- setAccessPointSeer((AccessPointSeerNode) selectedNode);
+ /**
+ * Changes the measuremnetn model if
+ * the new selected node is instanceof AccessPointSeerNode
+ */
+ public void selectionChanged(NodeModelSelectionEvent selectEvent){
+ Node selectedNode = selectEvent.getSelectedNode();
+ if (selectedNode instanceof AccessPointSeerNode && selectedNode != this.seerNode)
+ setAccessPointSeer((AccessPointSeerNode) selectedNode);
- }
+ }
- /**
- *
- * @param node
- */
- protected void setAccessPointSeer(AccessPointSeerNode node){
- if (node == this.seerNode) return;
- this.seerNode = node;
- this.measureModel.clear();
- ArrayList<AccessPointEdge> aes = node.getApEdges();
- for (int i = 0; i < aes.size(); i++) {
- AccessPointEdge ae = aes.get(i);
- SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel());
- this.measureModel.addAccessPoint(sp);
- }
- fireTableStructureChanged();
- }
+ /**
+ *
+ * @param node
+ */
+ protected void setAccessPointSeer(AccessPointSeerNode node){
+ if (node == this.seerNode) return;
+ this.seerNode = node;
+ clearAccessPoints();
+ for (SeenAccessPoint ap: measureModel.get(node)){
+ int row = getRowCount();
+ String key = ap.getMac().toLowerCase();
+ insertRow(row, new Object[]{ap.getMac(), ap.isDead() ? "-" : "" + ap.getLastSignalLevel() + " dB",
+ "" + (Math.round(ap.getAverageSignalLevel() * 10.0)) / 10.0 + " dB", ap, ap});
+ this.accessPointRows.put(key, row);
+ }
+ fireTableStructureChanged();
+ }
}
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/NMeasurementModel.java 2007-01-14 19:03:16 UTC (rev 500)
@@ -0,0 +1,123 @@
+package net.sf.magicmap.client.model.measurement;
+
+import net.sf.magicmap.client.model.node.ClientNode;
+import net.sf.magicmap.client.model.node.AccessPointSeerNode;
+import net.sf.magicmap.client.interfaces.MeasurementModelListener;
+
+import javax.swing.event.EventListenerList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * New Model for measurements. contains all measurement made.
+ *
+ */
+public class NMeasurementModel implements IMeasurementModel {
+
+ private final EventListenerList listeners = new EventListenerList();
+ private final MeasurementMap apMap = new MeasurementMap();
+ public NMeasurementModel(){
+
+ }
+
+ /**
+ * Adds an access point to the list of seen ap for a
+ * given client.
+ *
+ * @param client the client seeing the ap
+ * @param ap the seen access point.
+ */
+ public void addAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
+ if (apMap.put(client, ap)){
+ fireAccessPointAdded(client,ap);
+ }
+ }
+
+ /**
+ * Returns a list of seen access points for a given client.
+ * @param forNode
+ * @return
+ */
+ public Collection<SeenAccessPoint> get(AccessPointSeerNode forNode){
+ return apMap.get(forNode).values();
+ }
+
+ public void updateAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
+ fireAccessPointChanged(client, ap);
+ }
+
+ public void removeAccessPoint(AccessPointSeerNode client, SeenAccessPoint ap) {
+ if (apMap.remove(client, ap)){
+ fireAccessPointRemoved(client, ap);
+ }
+ }
+ public void addMeasurementModelListener(MeasurementModelListener l){
+ listeners.add(MeasurementModelListener.class, l);
+ }
+
+ public void removeMeasurementModelListener(MeasurementModelListener l){
+ listeners.remove(MeasurementModelListener.class, l);
+ }
+
+ protected final void fireAccessPointAdded(AccessPointSeerNode node, SeenAccessPoint ap){
+ MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
+ for (MeasurementModelListener l: modelListeners){
+ l.seesAccessPoint(ap);
+ }
+ }
+ protected final void fireAccessPointRemoved(AccessPointSeerNode node, SeenAccessPoint ap){
+ MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
+ for (MeasurementModelListener l: modelListeners){
+ l.notseesAccessPoint(ap);
+ }
+ }
+ protected final void fireAccessPointChanged(AccessPointSeerNode node, SeenAccessPoint ap){
+ MeasurementModelListener[] modelListeners = listeners.getListeners(MeasurementModelListener.class);
+ for (MeasurementModelListener l: modelListeners){
+ l.updateAccessPoint(ap);
+ }
+ }
+
+ public SeenAccessPoint getAccessPoint(ClientNode client, String mac){
+ return apMap.get(client,mac);
+ }
+
+ private static class MeasurementMap extends HashMap<AccessPointSeerNode, Map<String, SeenAccessPoint>>{
+
+ public boolean put(AccessPointSeerNode node, SeenAccessPoint ap){
+ if (containsKey(node)){
+
+ Map<String, SeenAccessPoint> map = get(node);
+ boolean isNew =map.containsKey(ap.getMac());
+ map.put(ap.getMac(), ap);
+ return isNew;
+ }
+ else{
+ HashMap<String, SeenAccessPoint> list = new HashMap<String, SeenAccessPoint>();
+ list.put(ap.getMac(), ap);
+ super.put(node, list);
+ return true;
+ }
+ }
+ public boolean remove(AccessPointSeerNode node, SeenAccessPoint ap){
+ if (containsKey(node)){
+ return get(node).remove(ap.getMac()) != null;
+ }
+ return false;
+ }
+
+
+ public Map<String, SeenAccessPoint> get(Object key) {
+ Map<String, SeenAccessPoint> map = super.get(key);
+ if (map == null) return new HashMap<String, SeenAccessPoint>();
+ return map;
+ }
+ public SeenAccessPoint get(AccessPointSeerNode seer, String apMac) {
+ return get(seer).get(apMac);
+ }
+ }
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-14 17:57:36
|
Revision: 499
http://svn.sourceforge.net/magicmap/?rev=499&view=rev
Author: jan_fride
Date: 2007-01-14 09:57:00 -0800 (Sun, 14 Jan 2007)
Log Message:
-----------
EventListener as base interface
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java 2007-01-11 17:02:31 UTC (rev 498)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java 2007-01-14 17:57:00 UTC (rev 499)
@@ -6,10 +6,12 @@
import net.sf.magicmap.client.model.measurement.SeenAccessPoint;
+import java.util.EventListener;
+
/**
* @author thuebner
*/
-public interface MeasurementModelListener {
+public interface MeasurementModelListener extends EventListener {
public void seesAccessPoint(SeenAccessPoint ap);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2007-01-11 17:03:12
|
Revision: 498
http://svn.sourceforge.net/magicmap/?rev=498&view=rev
Author: jan_fride
Date: 2007-01-11 09:02:31 -0800 (Thu, 11 Jan 2007)
Log Message:
-----------
replaced while(iterator) with foreach
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2006-12-23 23:01:49 UTC (rev 497)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-01-11 17:02:31 UTC (rev 498)
@@ -34,233 +34,243 @@
*/
public class NodeModel implements INodeModel {
- private final Map<String, Node> nodes;
- private final Map<String, Node> accesspoints;
- private final List<NodeModelListener> listeners;
- private final List<NodeModelSelectionListener> selectListeners;
+ private final Map<String, Node> nodes;
+ private final Map<String, AccessPointNode> accesspoints;
+ private final List<NodeModelListener> listeners;
+ private final List<NodeModelSelectionListener> selectListeners;
- private Node selectedNode = Node.EMPTY_NODE;
+ private Node selectedNode = Node.EMPTY_NODE;
- private final Log log = LogFactory.getLog(NodeModel.class);
- /**
- * Erzeugt neues leeres Model
- *
- */
- public NodeModel() {
- // Collections.synchronizedMap(new HashMap<String, Double>());
+ private final Log log = LogFactory.getLog(NodeModel.class);
+ /**
+ * Erzeugt neues leeres Model
+ *
+ */
+ public NodeModel() {
+ // Collections.synchronizedMap(new HashMap<String, Double>());
- this.nodes = Collections.synchronizedMap(new HashMap<String, Node>());
- this.accesspoints = Collections.synchronizedMap(new HashMap<String, Node>());
- this.listeners = Collections.synchronizedList(new ArrayList<NodeModelListener>());
- this.selectListeners = Collections.synchronizedList(new ArrayList<NodeModelSelectionListener>());
- }
+ this.nodes = Collections.synchronizedMap(new HashMap<String, Node>());
+ this.accesspoints = Collections.synchronizedMap(new HashMap<String, AccessPointNode>());
+ this.listeners = Collections.synchronizedList(new ArrayList<NodeModelListener>());
+ this.selectListeners = Collections.synchronizedList(new ArrayList<NodeModelSelectionListener>());
+ }
- /**
- * Add a new node and notifies all listeners about it.
- * DOes nothing if a node with the model contains a node with the same name.
- * @param node the node to add.
- */
- public void addNode(Node node){
- if (this.nodes.containsKey(node.getName())) return;
- log.info("Adding Node: " + node.getName());
- this.nodes.put(node.getName(), node);
- // special handling for APs
- if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen
- this.accesspoints.put(((AccessPointNode) node).getMacAddress(), node);
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- NodeModelListener l = (NodeModelListener) it.next();
- l.nodeAddedEvent(node);
- }
- }
+ /**
+ * Add a new node and notifies all listeners about it.
+ * DOes nothing if a node with the model contains a node with the same name.
+ * @param node the node to add.
+ */
+ public void addNode(Node node){
+ if (this.nodes.containsKey(node.getName())) return;
+ log.info("Adding Node: " + node.getName());
+ this.nodes.put(node.getName(), node);
+ // special handling for APs
+ if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen
+ this.accesspoints.put(((AccessPointNode) node).getMacAddress(), (AccessPointNode)node);
- /**
- * Remove a node
- * @param node
- */
- public void removeNode(Node node){
- this.nodes.remove(node.getName());
- if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen
- this.accesspoints.remove(((AccessPointNode) node).getMacAddress());
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- NodeModelListener l = (NodeModelListener) it.next();
- l.nodeRemovedEvent(node);
- }
- }
+ for (NodeModelListener listener : this.listeners) {
+ NodeModelListener l = (NodeModelListener) listener;
+ l.nodeAddedEvent(node);
+ }
+ }
- public void fireSeesAccessPoint(Node node, AccessPointNode ap){
- updateNode(node, NodeModelConstants.UPDATE_SEESACCESSPOINT, ap);
- }
+ /**
+ * Remove a node
+ * @param node
+ */
+ public void removeNode(Node node){
+ this.nodes.remove(node.getName());
+ if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen
+ this.accesspoints.remove(((AccessPointNode) node).getMacAddress());
- public void fireNotSeesAccessPoint(Node node, AccessPointNode ap){
- updateNode(node, NodeModelConstants.UPDATE_NOTSEESACCESSPOINT, ap);
- }
+ for (NodeModelListener listener : this.listeners) {
+ NodeModelListener l = (NodeModelListener) listener;
+ l.nodeRemovedEvent(node);
+ }
+ }
- /**
- * Notofiziert alle Listener das sich ein Knoten ge\xE4ndert hat.
- *
- * @param node der ge\xE4ndert Knoten
- * @param type die Art der \xC4nderung
- * @param data Daten?
- */
- public void updateNode(Node node, int type, Object data){
- Iterator it = this.listeners.iterator();
- while (it.hasNext()) {
- NodeModelListener l = (NodeModelListener) it.next();
- l.nodeUpdatedEvent(node, type, data);
- }
- }
+ public void fireSeesAccessPoint(Node node, AccessPointNode ap){
+ updateNode(node, NodeModelConstants.UPDATE_SEESACCESSPOINT, ap);
+ }
- /**
- * Aktualisiert den Hash-Schl\xFCssel f\xFCr einen Knoten.
- * Unter Node.name wird der neue Hashwert erwartet.
- *
- * @param node Knoten der aktualisiert werden soll
- * @param name Alter Hash-Wert
- */
- public void rehashNode(Node node, String name){
- this.nodes.remove(name);
- this.nodes.put(node.getName(), node);
- updateNode(node, NodeModelConstants.UPDATE_LABELCHANGED, name);
- }
+ public void fireNotSeesAccessPoint(Node node, AccessPointNode ap){
+ updateNode(node, NodeModelConstants.UPDATE_NOTSEESACCESSPOINT, ap);
+ }
- public ArrayList findNeighbors(Node node){
- ArrayList result = new ArrayList();
- if (node instanceof ClientNode) {
- ArrayList aes = ((ClientNode) node).getApEdges();
- }
- return result;
- }
+ /**
+ * Notofiziert alle Listener das sich ein Knoten ge\xE4ndert hat.
+ *
+ * @param node der ge\xE4ndert Knoten
+ * @param type die Art der \xC4nderung
+ * @param data Daten, z.B. ein AccessPoint
+ */
+ public void updateNode(Node node, int type, Object data){
- public ArrayList findNonNeighbors(Node node){
- ArrayList result = new ArrayList();
- return result;
- }
+ for (NodeModelListener listener : this.listeners) {
+ NodeModelListener l = (NodeModelListener) listener;
+ l.nodeUpdatedEvent(node, type, data);
+ }
+ }
- public void addNodeModelListener(NodeModelListener nodeModelListener){
- if (!this.listeners.contains(nodeModelListener)) {
- this.listeners.add(nodeModelListener);
- Iterator nodesIterator = this.nodes.values().iterator();
- while (nodesIterator.hasNext()) {
- Node node = (Node) nodesIterator.next();
- nodeModelListener.nodeAddedEvent(node);
- }
- }
- }
+ /**
+ * Aktualisiert den Hash-Schl\xFCssel f\xFCr einen Knoten.
+ * Unter Node.name wird der neue Hashwert erwartet.
+ *
+ * @param node Knoten der aktualisiert werden soll
+ * @param name Alter Hash-Wert
+ */
+ public void rehashNode(Node node, String name){
+ this.nodes.remove(name);
+ this.nodes.put(node.getName(), node);
+ updateNode(node, NodeModelConstants.UPDATE_LABELCHANGED, name);
+ }
- public void removeNodeModelListener(NodeModelListener l){
- this.listeners.remove(l);
- }
+ public ArrayList findNeighbors(Node node){
+ ArrayList result = new ArrayList();
+ if (node instanceof ClientNode) {
+ ArrayList aes = ((ClientNode) node).getApEdges();
+ }
+ return result;
+ }
- public NodeModelListener[] nodeModelListeners(){
- return this.listeners.toArray(new NodeModelListener[0]);
- }
+ public ArrayList findNonNeighbors(Node node){
+ ArrayList result = new ArrayList();
+ return result;
+ }
- public ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(ArrayList<AccessPointNode> accesspoints){
- return getLocationsWithAtLeastOneAccessPoint(accesspoints, null);
- }
+ public void addNodeModelListener(NodeModelListener nodeModelListener){
+ if (!this.listeners.contains(nodeModelListener)) {
+ this.listeners.add(nodeModelListener);
- /**
- * Gibt alle Orte/Referenzpunkte zur\xFCck, die mindestens einen
- * AccessPoint mit der \xFCbergebenen gemeinsam haben.
- * @param accesspoints
- * @param exclude
- * @return
- */
- public ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(ArrayList<AccessPointNode> accesspoints,
- Node exclude){
- ArrayList<LocationNode> result = new ArrayList<LocationNode>();
- HashSet<AccessPointNode> accessPointsHash = new HashSet<AccessPointNode>(accesspoints);
- Iterator it = this.nodes.values().iterator();
- while (it.hasNext()) {
- Node o = (Node) it.next();
- if (o.getType() == NodeModelConstants.NODETYPE_LOCATION && exclude != o) {
- LocationNode location = (LocationNode) o;
- ArrayList<AccessPointNode> seenAccessPoints = location.getSeenAccessPoints();
- for (int j = 0; j < seenAccessPoints.size(); j++) {
- AccessPointNode p = seenAccessPoints.get(j);
- if (accessPointsHash.contains(p)) {
- result.add(location);
- break;
- }
- }
- }
- }
- return result;
- }
+ for (Node node1 : this.nodes.values()) {
+ Node node = (Node) node1;
+ nodeModelListener.nodeAddedEvent(node);
+ }
+ }
+ }
- /**
- *
- */
- public Node findNode(String name){
- Node node = this.nodes.get(name);
- return node;
- }
+ public void removeNodeModelListener(NodeModelListener l){
+ this.listeners.remove(l);
+ }
- public boolean nodeExists(String name){
- return (findNode(name) != null);
- }
+ public NodeModelListener[] nodeModelListeners(){
+ return this.listeners.toArray(new NodeModelListener[0]);
+ }
- public AccessPointNode findAccessPoint(String mac){
- AccessPointNode node = (AccessPointNode) this.accesspoints.get(mac);
- return node;
- }
+ public ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(ArrayList<AccessPointNode> accesspoints){
+ return getLocationsWithAtLeastOneAccessPoint(accesspoints, null);
+ }
- public boolean accessPointExists(String mac){
- return (findAccessPoint(mac) != null);
- }
+ /**
+ * Gibt alle Orte/Referenzpunkte zur\xFCck, die mindestens einen
+ * AccessPoint mit der \xFCbergebenen gemeinsam haben.
+ * @param accesspoints a list of accesspoints
+ * @param exclude dont add this node to the results
+ * @return
+ */
+ public ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(
+ ArrayList<AccessPointNode> accesspoints,
+ Node exclude){
+ ArrayList<LocationNode> result = new ArrayList<LocationNode>();
+ HashSet<AccessPointNode> accessPointsHash = new HashSet<AccessPointNode>(accesspoints);
- /**
- * @return
- */
- public Collection getNodes(){
- return Collections.unmodifiableCollection(this.nodes.values());
- }
+ for (Node node : this.nodes.values()) {
+ if (node.getType() == NodeModelConstants.NODETYPE_LOCATION && exclude != node) {
+ LocationNode location = (LocationNode) node;
+ ArrayList<AccessPointNode> seenAccessPoints = location.getSeenAccessPoints();
+ for (AccessPointNode p : seenAccessPoints) {
+ if (accessPointsHash.contains(p)) {
+ result.add(location);
+ break;
+ }
+ }
+ }
+ }
+ return result;
+ }
- /**
- * Entfernt alles aus dem Model
- *
- */
- public void clear(){
- for (Node node : this.nodes.values())
- if (node instanceof AccessPointSeerNode) ((AccessPointSeerNode) node).clearAllEdges();
- this.nodes.clear();
- this.accesspoints.clear();
- updateNode(null, NodeModelConstants.UPDATE_CLEAR, null);
- }
+ /**
+ * Returns the node with the given name.
+ * @param name the nodes (display) name
+ * @return a node or null if node with given name exists
+ */
+ public Node findNode(String name){
+ Node node = this.nodes.get(name);
+ return node;
+ }
- public void addNodeModelSelectionListener(NodeModelSelectionListener l){
- this.selectListeners.add(l);
+ /**
+ * Checks if a node with a given name exists in this model
+ * @param name the nodes name
+ * @return true if a node with the given name exists, false else
+ */
+ public boolean nodeExists(String name){
+ return (findNode(name) != null);
+ }
- }
+ /**
+ * Finds an access point with the given mac
+ * @param mac the mac to search for
+ * @return an ap or null
+ */
+ public AccessPointNode findAccessPoint(String mac){
+ AccessPointNode node = (AccessPointNode) this.accesspoints.get(mac);
+ return node;
+ }
- public void removeNodeModelSelectionListener(NodeModelSelectionListener l){
- this.selectListeners.remove(l);
+ public boolean accessPointExists(String mac){
+ return accesspoints.containsKey(mac);
+ }
- }
+ /**
+ * @return
+ */
+ public Collection getNodes(){
+ return Collections.unmodifiableCollection(this.nodes.values());
+ }
- public Node selectNode(Node newSelectedNode){
- if (null == newSelectedNode) throw new IllegalArgumentException("Not may not be null");
+ /**
+ * Entfernt alles aus dem Model
+ *
+ */
+ public void clear(){
+ for (Node node : this.nodes.values())
+ if (node instanceof AccessPointSeerNode) ((AccessPointSeerNode) node).clearAllEdges();
+ this.nodes.clear();
+ this.accesspoints.clear();
+ updateNode(null, NodeModelConstants.UPDATE_CLEAR, null);
+ }
- NodeModelSelectionEvent e = new NodeModelSelectionEvent(this, newSelectedNode, this.selectedNode);
- this.selectedNode = newSelectedNode;
- updateSelection(e);
- return this.selectedNode;
- }
+ public void addNodeModelSelectionListener(NodeModelSelectionListener l){
+ this.selectListeners.add(l);
- /**
- *
- * @param e
- */
- private void updateSelection(NodeModelSelectionEvent e){
- LinkedList<NodeModelSelectionListener> tmpList = new LinkedList<NodeModelSelectionListener>();
- synchronized (this.selectListeners) {
- tmpList.addAll(this.selectListeners);
- }
+ }
- for (NodeModelSelectionListener listener : tmpList)
- listener.selectionChanged(e);
+ public void removeNodeModelSelectionListener(NodeModelSelectionListener l){
+ this.selectListeners.remove(l);
+ }
- }
+ public Node selectNode(Node newSelectedNode){
+ if (null == newSelectedNode) throw new IllegalArgumentException("node must not be null");
+
+ NodeModelSelectionEvent e = new NodeModelSelectionEvent(this, newSelectedNode, this.selectedNode);
+ this.selectedNode = newSelectedNode;
+ updateSelection(e);
+ return this.selectedNode;
+ }
+
+ /**
+ *
+ * @param e
+ */
+ private void updateSelection(NodeModelSelectionEvent e){
+ LinkedList<NodeModelSelectionListener> tmpList = new LinkedList<NodeModelSelectionListener>();
+ synchronized (this.selectListeners) {
+ tmpList.addAll(this.selectListeners);
+ }
+
+ for (NodeModelSelectionListener listener : tmpList)
+ listener.selectionChanged(e);
+
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2006-12-23 23:02:11
|
Revision: 497
http://svn.sourceforge.net/magicmap/?rev=497&view=rev
Author: jan_fride
Date: 2006-12-23 15:01:49 -0800 (Sat, 23 Dec 2006)
Log Message:
-----------
javadoc and class did not match (please update javadoc if changing interfaces!)
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2006-12-18 14:52:51 UTC (rev 496)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2006-12-23 23:01:49 UTC (rev 497)
@@ -164,7 +164,8 @@
/**
* Gibt alle Orte/Referenzpunkte zur\xFCck, die mindestens einen
* AccessPoint mit der \xFCbergebenen gemeinsam haben.
- * @param result
+ * @param accesspoints
+ * @param exclude
* @return
*/
public ArrayList<LocationNode> getLocationsWithAtLeastOneAccessPoint(ArrayList<AccessPointNode> accesspoints,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2006-12-18 14:53:19
|
Revision: 496
http://svn.sourceforge.net/magicmap/?rev=496&view=rev
Author: flederohr
Date: 2006-12-18 06:52:51 -0800 (Mon, 18 Dec 2006)
Log Message:
-----------
Property Changed:
----------------
trunk/magicmapclient/
Property changes on: trunk/magicmapclient
___________________________________________________________________
Name: svn:ignore
-
build
dist
magicmap
derby.log
src-gen
MagicMap
nightly.launch
bin
magicmap.jar
referenzpunkt.txt
client.txt
MagicMap.launch
settings.ini
+
build
dist
magicmap
derby.log
src-gen
MagicMap
nightly.launch
bin
magicmap.jar
referenzpunkt.txt
client.txt
MagicMap.launch
settings.ini
build-test
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2006-12-18 14:49:19
|
Revision: 495
http://svn.sourceforge.net/magicmap/?rev=495&view=rev
Author: flederohr
Date: 2006-12-18 06:48:54 -0800 (Mon, 18 Dec 2006)
Log Message:
-----------
removed logmessage because it can result in an nullpointerexception
Modified Paths:
--------------
trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java
Modified: trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java
===================================================================
--- trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java 2006-12-14 15:58:00 UTC (rev 494)
+++ trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java 2006-12-18 14:48:54 UTC (rev 495)
@@ -489,7 +489,6 @@
protected PositionDTO getPosition(String name){
PositionDTO p = positionHash.get(name);
- logger.info("Position: " + p.getId() + " with z-coordinate: " + p.getPosZ());
return p;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2006-12-14 15:58:35
|
Revision: 494
http://svn.sourceforge.net/magicmap/?rev=494&view=rev
Author: flederohr
Date: 2006-12-14 07:58:00 -0800 (Thu, 14 Dec 2006)
Log Message:
-----------
fixed bug no. 1585107 : recalculating row values in accessPointRows after detetion of a row
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2006-12-13 13:46:52 UTC (rev 493)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java 2006-12-14 15:58:00 UTC (rev 494)
@@ -93,6 +93,12 @@
String key = ap.getMac().toLowerCase();
if (this.accessPointRows.containsKey(key)) {
int row = this.accessPointRows.get(key);
+ for(String k : this.accessPointRows.keySet()){
+ int r;
+ if ((r = this.accessPointRows.get(k)) > row){
+ this.accessPointRows.put(k, r-1);
+ }
+ }
removeRow(row);
this.accessPointRows.remove(key);
fireTableRowsDeleted(row, row);
@@ -105,7 +111,7 @@
public void seesAccessPoint(SeenAccessPoint ap){
MeasurementTableModel.log.info("seesAccessPoint");
if (null == this.seerNode) return;
- ArrayList<AccessPointNode> seenAccessPoints = this.seerNode.getSeenAccessPoints();
+ //ArrayList<AccessPointNode> seenAccessPoints = this.seerNode.getSeenAccessPoints();
// if (seenAccessPoints.contains(ap)) {
String key = ap.getMac().toLowerCase();
int row = getRowCount();
@@ -134,6 +140,7 @@
//
// should not happen? but does from time to time ;-)
if (row >= getRowCount()){
+ log.error("Row: " + row + ": RowCount: " + getRowCount());
seesAccessPoint(ap);
}
else if (row >= 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2006-12-13 13:47:00
|
Revision: 493
http://svn.sourceforge.net/magicmap/?rev=493&view=rev
Author: jan_fride
Date: 2006-12-13 05:46:52 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
made some members private, added javadoc (minimal)
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/package.html
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/node/NodeModel.java
Removed Paths:
-------------
trunk/magicmapclient/test/net/sf/magicmap/plugin/util/PluginTableModelTest.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-12-13 13:23:14 UTC (rev 492)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-12-13 13:46:52 UTC (rev 493)
@@ -111,7 +111,7 @@
private AbstractAction exitAction;
private AbstractAction aboutAction;
private AbstractAction onlineHelp;
- MapView mapView;
+ private MapView mapView;
private MagicAction invisibleAction;
private MagicAction simpleView;
private MagicAction normalView;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java 2006-12-13 13:23:14 UTC (rev 492)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java 2006-12-13 13:46:52 UTC (rev 493)
@@ -37,7 +37,7 @@
/**
* Komponente des Programmes, welches die Karte verwaltet und auf das NodeModel
* gesteuert durch Benutzeraktionen zugreift.
- *
+ *
* @author thuebner
*/
public class MapPanel extends JPanel implements IMapPanel {
@@ -55,7 +55,7 @@
private int lastY;
- Node selectedNode;
+ private Node selectedNode;
private AbstractAction createLocationAction;
@@ -87,7 +87,7 @@
/**
* Getter for selected node
- *
+ *
* @return the selected node
*/
public Node getSelectedNode(){
@@ -275,7 +275,7 @@
}
/**
- *
+ *
* @return
*/
private JPopupMenu buildMapMenu(){
@@ -291,7 +291,7 @@
}
/**
- *
+ *
* @param node
* @return
*/
@@ -348,7 +348,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.MapListener#vertexRightClicked(edu.uci.ics.jung.graph.Vertex,
* int, int)
*/
@@ -364,7 +364,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.MapListener#rightClicked(int, int)
*/
public void rightClicked(int x, int y){
@@ -377,7 +377,7 @@
}
/**
- *
+ *
* @return
*/
public int getLastX(){
@@ -385,7 +385,7 @@
}
/**
- *
+ *
* @return
*/
public int getLastY(){
@@ -395,7 +395,7 @@
/**
* Referenzpunkt mit aktuell gemessenen Werten anlegen. Dies geschieht \xFCber
* den Controller, so dass dieser am Server gespeichert werden kann.
- *
+ *
*/
void createLocation(){
@@ -411,7 +411,7 @@
* \xC4nderung, daher sollte die Information \xFCber den Client und der
* Zeitpunkt des Anlegens einer Position !!!NICHT!!! in ihrem Namen
* gespeichert werden!!!!
- *
+ *
* todo: Hier den Client und den Zeitpunkt aus dem Namen entfernen,
* Information nur beim Darstellen auf der Karte aus dem PositionDTO
* nehmen!
@@ -424,7 +424,7 @@
/**
* Create a geo pos for the current selected location
- *
+ *
*/
void createGeoPos(){
// TODO \xDCber den Dialog auch die H\xF6he einlesen
@@ -436,7 +436,7 @@
/**
* Create an info object for the current selected location
- *
+ *
*/
void createInfoObject(){
// TODO \xDCber den Dialog auch die H\xF6he einlesen
@@ -448,7 +448,7 @@
/**
* Create an info object for the current selected location
- *
+ *
*/
protected void measureLocation(){
if (this.selectedNode != null) {
@@ -485,7 +485,7 @@
/**
* Zuletzt angeklicketen Knoten umbennen
- *
+ *
*/
void renameNode(){
// Ort benenen
@@ -500,7 +500,7 @@
* Fixiert oder unfixiert einen Knoten, so wie der User es w�nscht und
* teilt dies dem Server mit. Das lokale Modell aktualisiert sich dann erst
* �ber den Poller.
- *
+ *
* @param b
*/
protected void setFix(boolean b){
@@ -552,7 +552,7 @@
/**
* Liefert die in diesem Panel gesetzte MapView zur�ck
- *
+ *
* @return
*/
public AbstractMapView getMapView(){
@@ -561,7 +561,7 @@
/**
* Setzt MapView
- *
+ *
* @param mapView
*/
public void setMapView(AbstractMapView mapView){
@@ -595,7 +595,7 @@
}
/**
- *
+ *
*/
protected void hideAP(){
if (this.selectedNode != null) {
@@ -615,7 +615,7 @@
}
/**
- *
+ *
*/
protected void nohideAP(){
if (this.selectedNode != null) {
@@ -628,7 +628,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.CreatePositionCallback#positionCreated()
*/
public void positionCreated(){
@@ -639,7 +639,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.CreatePositionCallback#positionCreationError(java.lang.Exception)
*/
public void positionCreationError(Exception e){
@@ -648,7 +648,7 @@
}
/**
- *
+ *
*/
protected void fetchLocations(){
// Controller.getInstance().fetchPositionsFromServer();
@@ -656,7 +656,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.DeletePositionCallback#positionDeleted()
*/
@@ -667,7 +667,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.DeletePositionCallback#positionDeleteError(java.lang.Exception)
*/
public void positionDeleteError(Exception e){
@@ -677,7 +677,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.PositionCallback#positionUpdated(java.lang.String)
*/
public void positionUpdated(String name){
@@ -687,7 +687,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.PositionCallback#positionError(java.lang.Exception)
*/
public void positionError(Exception e){
@@ -697,7 +697,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.MapViewListener#nodeFixiated(net.sf.magicmap.client.model.node.Node)
*/
public void nodeFixiated(Node node){
@@ -707,7 +707,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.MovePositionCallback#positionMoved(long)
*/
public void positionMoved(long positionId){
@@ -717,7 +717,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.MovePositionCallback#positionMoveError(java.lang.Exception)
*/
public void positionMoveError(Exception e){
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/package.html
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/package.html 2006-12-13 13:23:14 UTC (rev 492)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/package.html 2006-12-13 13:46:52 UTC (rev 493)
@@ -0,0 +1,25 @@
+<html>
+<head>
+<title>Package gui</title>
+</head>
+<body>
+The following tree shows the structure of the most
+importante clients components:
+<ul><li> MainGUI
+<ul><li> UIFSplitPane
+<ul><li> OutlineView
+</li><li> UIFSplitPane
+<ul><li> MapPanel
+<ul><li> AbstractMapView
+</li></ul>
+</li><li> ViewTabPanel
+<ul><li> MeasurementView
+</li><li> ConsoleView
+</li></ul>
+</li></ul>
+</li></ul>
+</li></ul>
+</li></ul>
+
+</body>
+</html>
\ No newline at end of file
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineTree.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineTree.java 2006-12-13 13:23:14 UTC (rev 492)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineTree.java 2006-12-13 13:46:52 UTC (rev 493)
@@ -18,14 +18,24 @@
import net.sf.magicmap.client.model.outline.OutlineTreeNode;
/**
- *
+ * The tree for all MagicNodes.
+ *
* @author Jan Friderici
* @author thuebner
* @author Johannes Zapotoczky (joh...@za...)
- *
+ * @see OutlineModel
*/
public class OutlineTree extends JTree {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *
+ * @param model
+ */
public OutlineTree(OutlineModel model) {
super(model);
setRootVisible(false);
@@ -35,6 +45,10 @@
setBorder(new EmptyBorder(new Insets(3, 3, 3, 3)));
}
+ /**
+ *
+ * @param nodeModel
+ */
public OutlineTree(INodeModel nodeModel) {
this(new OutlineModel(nodeModel));
@@ -42,7 +56,7 @@
/**
* Private class for the outline rendering
- *
+ *
* @author (vermutlich) thuebner
* @author Johannes Zapotoczky (joh...@za...)
*/
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2006-12-13 13:23:14 UTC (rev 492)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java 2006-12-13 13:46:52 UTC (rev 493)
@@ -1,5 +1,5 @@
/*
- * Created on 26.11.2004
+ * Created on 26.11.2004
*/
package net.sf.magicmap.client.gui.views;
@@ -32,8 +32,8 @@
/**
* View for the outline (left side list view of the application)
- *
- * @author thuebner
+ *
+ * @author thuebner
*/
public class OutlineView extends View implements TreeSelectionListener, NodeModelSelectionListener {
@@ -49,7 +49,7 @@
private OutlineTreeNode rootNode;
/**
- * Constructor
+ * Constructor
*/
public OutlineView(INodeModel nodeModel) {
super("OutlineView");
@@ -153,7 +153,7 @@
/**
* Find OutlineNode for given Node
* @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){
return ((OutlineModel) this.tree.getModel()).findOutlineNode(node);
@@ -165,6 +165,7 @@
* @param node - the OutlineNode to find out the index
* @return the index of node in parent
*/
+ @Deprecated
private int getAlphabeticalIndex(OutlineTreeNode node){
OutlineTreeNode parent = (OutlineTreeNode) node.getParent();
int index = 0;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2006-12-13 13:23:14 UTC (rev 492)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2006-12-13 13:46:52 UTC (rev 493)
@@ -11,6 +11,10 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
import net.sf.magicmap.client.interfaces.NodeModelListener;
/**
@@ -25,6 +29,7 @@
* (maps (as a special case), geopoints, info objects, rfid antennas, etc.)
*
* @author Johannes Zapotoczky (joh...@za...)
+ * @author Jan Friderici
*
*/
public class NodeModel implements INodeModel {
@@ -36,6 +41,7 @@
private Node selectedNode = Node.EMPTY_NODE;
+ private final Log log = LogFactory.getLog(NodeModel.class);
/**
* Erzeugt neues leeres Model
*
@@ -51,10 +57,12 @@
/**
* Add a new node and notifies all listeners about it.
- *
- * @param node
+ * DOes nothing if a node with the model contains a node with the same name.
+ * @param node the node to add.
*/
public void addNode(Node node){
+ if (this.nodes.containsKey(node.getName())) return;
+ log.info("Adding Node: " + node.getName());
this.nodes.put(node.getName(), node);
// special handling for APs
if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen
Deleted: trunk/magicmapclient/test/net/sf/magicmap/plugin/util/PluginTableModelTest.java
===================================================================
--- trunk/magicmapclient/test/net/sf/magicmap/plugin/util/PluginTableModelTest.java 2006-12-13 13:23:14 UTC (rev 492)
+++ trunk/magicmapclient/test/net/sf/magicmap/plugin/util/PluginTableModelTest.java 2006-12-13 13:46:52 UTC (rev 493)
@@ -1,84 +0,0 @@
-package net.sf.magicmap.plugin.util;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Locale;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-
-import net.sf.magicmap.client.controller.Controller;
-import net.sf.magicmap.client.gui.utils.GUIUtils;
-import net.sf.magicmap.client.utils.Settings;
-import net.sf.magicmap.plugin.PluginManager;
-import net.sf.magicmap.plugin.ui.PluginTableModel;
-import junit.framework.TestCase;
-
-
-public class PluginTableModelTest extends TestCase {
-
- PluginTableModel pluginModel;
- PluginManager manager;
-
- public PluginTableModelTest(String arg0) {
- super(arg0);
- Settings.setup(new String[0]);
- GUIUtils.setPlasticLookAndFeel();
- GUIUtils.setLocale(Locale.getDefault());
- }
-
- protected void setUp() throws Exception{
-
-
- manager = new PluginManager(new Settings(), Controller.getInstance());
- pluginModel = new PluginTableModel (manager);
- super.setUp();
- }
-
- protected void tearDown() throws Exception{
- super.tearDown();
- }
-
- public void testModel() throws Exception{
- JFrame f = new JFrame();
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JPanel p = new JPanel(new BorderLayout());
- JTable t = new SortableTable (pluginModel);
- t.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- p.add(new JScrollPane(t), BorderLayout.CENTER);
- JButton b = new JButton("Sort");
- b.addActionListener(new DoffiListener());
- p.add(b, BorderLayout.SOUTH);
- f.setContentPane(p);
- f.pack();
- f.setVisible(true);
- }
- public static void main(String[] args){
- PluginTableModelTest test = new PluginTableModelTest("ll");
- try {
- test.manager = new PluginManager(new Settings(), Controller.getInstance());
- test.pluginModel = new PluginTableModel (test.manager);
- test.testModel();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- class DoffiListener implements ActionListener{
- int sort = 0;
- public DoffiListener(){
-
- }
- public void actionPerformed(ActionEvent e){
- pluginModel.sortByComlumn(sort, true);
- sort = (sort+1) %4;
-
- }
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2006-12-13 13:23:42
|
Revision: 492
http://svn.sourceforge.net/magicmap/?rev=492&view=rev
Author: jan_fride
Date: 2006-12-13 05:23:14 -0800 (Wed, 13 Dec 2006)
Log Message:
-----------
made shure that map names must be unique....
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2006-12-11 19:44:28 UTC (rev 491)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2006-12-13 13:23:14 UTC (rev 492)
@@ -198,6 +198,7 @@
LoadMapDialog.this.ok.setEnabled(true);
INodeModel nodeModel = Controller.getInstance().getNodeModel();
MapNode node = new MapNode(nodeModel);
+ node.setName(mapDTO.getName());
node.setDisplayName(mapDTO.getName());
node.setMapInfo(mapDTO);
nodeModel.addNode(node);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2006-12-11 19:44:59
|
Revision: 491
http://svn.sourceforge.net/magicmap/?rev=491&view=rev
Author: jan_fride
Date: 2006-12-11 11:44:28 -0800 (Mon, 11 Dec 2006)
Log Message:
-----------
1) Edges, just an idea.
2) made the MapDialog nicer. maps with invalid image urls are marked as invalid.
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -39,7 +39,7 @@
/**
* Managet die Client-Server-Kommunikation sowie die Verbindung selbst.
- *
+ *
* @author thuebner
*/
public class SOAPServerManager extends ServerManager {
@@ -62,7 +62,7 @@
/**
* Stellt Verbindung zum Server her
- *
+ *
*/
@Override
public void connect(final ServerConnectCallback callback){
@@ -93,7 +93,7 @@
}
/**
- *
+ *
* @param callback
*/
@Override
@@ -123,7 +123,7 @@
}
/**
- *
+ *
* @param name
* @param URL
* @param width
@@ -164,10 +164,12 @@
/**
* Liefert die eindeutigen Namen der auf dem Server angelegten Karten
* zur\xFCck.
- *
+ *
* @param callback
* MapNamesCallback Objekt welches das MapNamesCallback
* implementiert um die Kartennamen bzw. die
+ * @param openDialog
+ * momentan unbenutzt
*/
@Override
public void retrieveMapNames(final MapNamesCallback callback, final boolean openDialog){
@@ -197,7 +199,7 @@
/**
* L\xE4dt Daten zu einer Karte vom Server. Das Ergebniss wird \xFCber eine
* Callback Funktionen geliefert.
- *
+ *
* @param name
* @param callback
*/
@@ -247,7 +249,7 @@
/**
* Erzeugt einen Referenzpunkt auf dem Server
- *
+ *
* @param node
* @param callback
*/
@@ -282,7 +284,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#createGeoPos(int,
* int, boolean, net.sf.magicmap.client.model.node.GeoPos,
* java.lang.String,
@@ -321,7 +323,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#createInfoObject(int,
* int, boolean, net.sf.magicmap.client.model.node.InfoObject,
* java.lang.String,
@@ -340,12 +342,12 @@
synchronized (SOAPServerManager.mutex) {
try {
// SOAPServerManager.this.mapDelegate.createInfoObject(
- // sessionId,
- // mapName,
- // x,
- // y,
- // z,
- // infoObject.getName(),
+ // sessionId,
+ // mapName,
+ // x,
+ // y,
+ // z,
+ // infoObject.getName(),
// infoObject.getUrl(),
// infoObject.getType()
// );
@@ -364,7 +366,7 @@
/**
* Entfernt einen Referenzpunkt oder die Positionierung eines AccessPoints
* oder Clients mit gegebener Id vom Server
- *
+ *
* @param node
* @param callback
*/
@@ -394,7 +396,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#deleteGeoPoint(long,
* java.lang.String,
* net.sf.magicmap.client.interfaces.DeletePositionCallback)
@@ -424,7 +426,7 @@
/**
* Bewegt einen Referenzpunkt oder die Positionierung eines AccessPoints
* oder Clients mit gegebener Id vom Server
- *
+ *
* @param node
* @param callback
*/
@@ -467,7 +469,7 @@
* Eine Position von (-1,-1) bedeutet, dass der Client nicht fixiert ist
* sondern frei beweglich ist. Es werden dann nur seine Signalst\xE4rken
* geupdatet.
- *
+ *
* @param x
* X-Koordinate bzgl. Map
* @param y
@@ -507,7 +509,7 @@
* Eine Position von (-1,-1) bedeutet, dass der Client nicht fixiert ist
* sondern frei beweglich ist. Es werden dann nur seine Signalst\xE4rken
* geupdatet.
- *
+ *
* @param x
* X-Koordinate bzgl. Map
* @param y
@@ -545,7 +547,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#setAccessPointHiddenStatus(long,
* java.lang.String, java.lang.String, boolean,
* net.sf.magicmap.client.interfaces.PositionCallback)
@@ -576,7 +578,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchPositionsFromServer(net.sf.magicmap.client.interfaces.FetchPositionsCallback)
*/
@Override
@@ -618,7 +620,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.interfaces.ServerPollerListener#positionCreatedOrUpdatedOrDeleted(java.lang.String,
* long, net.sf.magicmap.client.delegate.dto.PositionDTO)
*/
@@ -674,7 +676,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#reloadMap()
*/
@Override
@@ -689,7 +691,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#closeMap()
*/
@Override
@@ -703,7 +705,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchGeoPointsFromServer(net.sf.magicmap.client.interfaces.FetchGeoPointsCallback)
*/
@Override
@@ -734,7 +736,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchMapsFromServer(net.sf.magicmap.client.interfaces.FetchMapsCallback)
*/
@Override
@@ -766,7 +768,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see net.sf.magicmap.client.controller.ServerManager#fetchInfoPointsFromServer(net.sf.magicmap.client.interfaces.FetchInfoPointsCallback)
*/
@Override
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -810,7 +810,8 @@
/* (non-Javadoc)
* @see net.sf.magicmap.client.interfaces.MapNamesCallback#mapNamesReceived(java.lang.String[])
*/
- public void addMapNamesToOutline(String[] names){
+ @Deprecated
+ public void addMapNamesToOutline(String[] names){
for (String element : names) {
MapNode node = new MapNode(new NodeModel());
Controller.getInstance().retrieveMap(element, node);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -4,6 +4,7 @@
package net.sf.magicmap.client.gui.dialogs;
+import java.awt.Component;
import java.awt.Cursor;
import java.awt.Frame;
import java.awt.event.ActionEvent;
@@ -11,6 +12,9 @@
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JList;
@@ -20,6 +24,7 @@
import javax.swing.border.EtchedBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
import net.sf.magicmap.client.controller.Controller;
import net.sf.magicmap.client.gui.utils.GUIUtils;
@@ -28,6 +33,8 @@
import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
import net.sf.magicmap.client.interfaces.MapCallback;
import net.sf.magicmap.client.meta.MapInfo;
+import net.sf.magicmap.client.model.node.INodeModel;
+import net.sf.magicmap.client.model.node.MapNode;
import net.sf.magicmap.server.dto.MapDTO;
import com.brunchboy.util.swing.relativelayout.RelativeLayout;
@@ -35,7 +42,7 @@
/**
* Ein Dialog zum Laden einer vorhandenen Karte
* @author thuebner
- *
+ *
* Refactored on 1.3.2006
* @author Johannes Zapotoczky <joh...@za...>
*/
@@ -54,6 +61,15 @@
private Cursor cursor;
private JButton ok;
+ private DefaultComboBoxModel mapModel;
+
+ /**
+ *
+ * @param owner used for Model Dialogs.
+ * @param maps th list of all maps on the server.
+ * @param listener ??
+ * @return the selected map.
+ */
public static MapInfo showDialog(Frame owner, String[] maps, LoadMapDialogListener listener){
LoadMapDialog d = new LoadMapDialog(owner, maps);
GUIUtils.locateOnScreen(d);
@@ -83,7 +99,32 @@
builder.setLeft("mapslabel", 10);
builder.setTop("mapslabel", 10);
- this.list = new JList(maps);
+ mapModel = new DefaultComboBoxModel();
+ for (String map: maps){
+ mapModel.addElement(new MapEntry(map));
+ }
+ this.list = new JList(mapModel);
+ list.setCellRenderer(new DefaultListCellRenderer(){
+
+ @Override
+ public Component getListCellRendererComponent(JList list, Object value, int arg2, boolean arg3, boolean arg4){
+ Component cellRenderer = super.getListCellRendererComponent(list, value, arg2, arg3, arg4);
+ MapEntry entry = (MapEntry)value;
+ switch (entry.status){
+ case 1:
+ setText("<html><strike>"+entry.name + "</strike></html>");
+ break;
+ case 2:
+ setText("<html><b>"+entry.name + "</b></html>");
+ break;
+ default:
+ setText(entry.name);
+ break;
+ }
+ return cellRenderer;
+ }
+
+ });
JScrollPane pane = new JScrollPane(this.list);
builder.add(pane, "list");
builder.setLeft("list", 10);
@@ -135,8 +176,9 @@
}
}
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.interfaces.MapCallback#mapReceived(net.sf.magicmap.client.delegate.dto.MapDTO)
+ /**
+ * Callback. Tries to load the images map and if successfull enables th ok button and ads the
+ * map to the model.
*/
public void mapReceived(final MapDTO mapDTO){
try {
@@ -152,10 +194,25 @@
LoadMapDialog.this.info.imageURL = mapDTO.getImageURL().toString();
setCursor(new Cursor(Cursor.WAIT_CURSOR));
LoadMapDialog.this.preview.loadImage(LoadMapDialog.this.info.imageURL);
- if (LoadMapDialog.this.preview.getImageHeight() > -1)
+ if (LoadMapDialog.this.preview.getImageHeight() > -1){
LoadMapDialog.this.ok.setEnabled(true);
- else
+ INodeModel nodeModel = Controller.getInstance().getNodeModel();
+ MapNode node = new MapNode(nodeModel);
+ node.setDisplayName(mapDTO.getName());
+ node.setMapInfo(mapDTO);
+ nodeModel.addNode(node);
+ int selectedIndex = list.getSelectedIndex();
+ MapEntry defectMap = (MapEntry) mapModel.getElementAt(selectedIndex);
+ defectMap.status = 2;
+ }
+ else{
LoadMapDialog.this.ok.setEnabled(false);
+ int selectedIndex = list.getSelectedIndex();
+ MapEntry defectMap = (MapEntry) mapModel.getElementAt(selectedIndex);
+ defectMap.status = 1;
+ list.repaint();
+ }
+
setCursor(LoadMapDialog.this.cursor);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
@@ -185,8 +242,16 @@
*/
public void valueChanged(ListSelectionEvent e){
if (!e.getValueIsAdjusting()) {
- String map = (String) this.list.getSelectedValue();
+ String map = ((MapEntry) this.list.getSelectedValue()).name;
Controller.getInstance().retrieveMap(map, this);
}
}
+ private static final class MapEntry{
+ public MapEntry(String map){
+ name = map;
+ status = 0;
+ }
+ public final String name;
+ public int status;
+ }
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -3,6 +3,7 @@
import java.util.HashMap;
+import net.sf.magicmap.client.model.node.IMagicEdge;
import net.sf.magicmap.client.model.node.Node;
/**
@@ -38,7 +39,7 @@
* @param n2 das Ziel der Kante
* @return
*/
- public Object addEdge(Node n1, Node n2);
+ public IMagicEdge addEdge(Node n1, Node n2);
/**
* Löscht eine gerichtete Kante. (also nur eine Richtung).
@@ -99,7 +100,7 @@
}
/**
- *
+ *
* @param node
* @param type
* @param data
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungEdge.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -0,0 +1,22 @@
+package net.sf.magicmap.client.model.location.jung;
+
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.impl.DirectedSparseEdge;
+import net.sf.magicmap.client.model.node.IMagicEdge;
+import net.sf.magicmap.client.model.node.Node;
+
+
+public class JungEdge extends DirectedSparseEdge implements IMagicEdge{
+
+ public JungEdge(Vertex arg0, Vertex arg1) {
+ super(arg0, arg1);
+ }
+
+ public Node getSourceNode(){
+ return (Node) getSource().getUserDatum(LayoutSettings.NODE_KEY);
+ }
+
+ public Node getTargetNode(){
+ return (Node) getDest().getUserDatum(LayoutSettings.NODE_KEY);
+ }
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2006-12-04 19:12:56 UTC (rev 490)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -21,6 +21,7 @@
import net.sf.magicmap.client.model.location.jung.handler.PositionUpdateHandler;
import net.sf.magicmap.client.model.location.jung.handler.SeeAccessPointHandler;
import net.sf.magicmap.client.model.node.ClientNode;
+import net.sf.magicmap.client.model.node.IMagicEdge;
import net.sf.magicmap.client.model.node.INodeModel;
import net.sf.magicmap.client.model.node.LocationNode;
import net.sf.magicmap.client.model.node.Node;
@@ -41,9 +42,9 @@
/**
* Dieses Model benutzt die Layoutfunktionen von Jung und einige Angepasste
* Layoutalgorithmen um die Knotenposition zu berechnen.
- *
+ *
* @author Jan
- *
+ *
*/
public class JungNodePlacer extends DirectedSparseGraph implements INodePlacer, NodeModelListener, NodeModelConstants {
@@ -316,13 +317,22 @@
* @param node2
* @return
*/
- public Edge addEdge(Node node1, Node node2){
+ public IMagicEdge addEdge(Node node1, Node node2){
if (node1 == node2) return null;
Vertex v = findVertex(node1);
Vertex w = findVertex(node2);
- if (v == null || w == null) return null;
- return addEdge(v, w);
+ Edge e = v.findEdge(w);
+ if (e != null)
+ return (IMagicEdge) e;
+ else {
+ JungEdge edge = new JungEdge(v,w);
+ this.worker.suspend(); // stopGraph();
+ addEdge(edge);
+ this.layout.update();
+ this.worker.unsuspend(); // resumeGraph();
+ return edge;
+ }
}
/**
Added: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/IMagicEdge.java 2006-12-11 19:44:28 UTC (rev 491)
@@ -0,0 +1,13 @@
+package net.sf.magicmap.client.model.node;
+
+
+/**
+ * An edge connects two Nodes. Used to hide the implementation (eg jung)
+ *
+ * @author jan
+ *
+ */
+public interface IMagicEdge {
+ public Node getSourceNode();
+ public Node getTargetNode();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2006-12-04 19:12:57
|
Revision: 490
http://svn.sourceforge.net/magicmap/?rev=490&view=rev
Author: flederohr
Date: 2006-12-04 11:12:56 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Fix the problem of repeated polling of the same ReferencePoint in localServer-mode
Modified Paths:
--------------
trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java
Modified: trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java
===================================================================
--- trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java 2006-12-04 18:59:19 UTC (rev 489)
+++ trunk/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java 2006-12-04 19:12:56 UTC (rev 490)
@@ -524,7 +524,7 @@
logger.info("leaving getPositionsSince()");
return positions.toArray(new PositionDTO[0]);
} else {
- Collection<String> newPositions = timeMap.tailMap(time).values();
+ Collection<String> newPositions = timeMap.tailMap(time+1).values();
logger.info("Daten in timeMap: " + timeMap.toString());
logger.info("Daten in tailMap: " + newPositions.toString());
PositionDTO[] positions = new PositionDTO[newPositions.size()];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2006-12-04 18:59:50
|
Revision: 489
http://svn.sourceforge.net/magicmap/?rev=489&view=rev
Author: flederohr
Date: 2006-12-04 10:59:19 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
using Version as return type
Modified Paths:
--------------
trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTest.java
Modified: trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTest.java
===================================================================
--- trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTest.java 2006-11-30 20:29:03 UTC (rev 488)
+++ trunk/magicmapclient/test/net/sf/magicmap/plugin/util/ArtifactRepositoryTest.java 2006-12-04 18:59:19 UTC (rev 489)
@@ -12,6 +12,7 @@
import net.sf.magicmap.artifact.ArtifactRepository;
import net.sf.magicmap.artifact.IArtifact;
+import net.sf.magicmap.artifact.Version;
import junit.framework.TestCase;
@@ -24,9 +25,9 @@
IArtifact artifact = new IArtifact(){
- public String getVersion(){
+ public Version getVersion(){
// TODO Auto-generated method stub
- return "1.5.3";
+ return new Version("1.3.5");
}
public String getArtifactId(){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2006-11-30 20:29:34
|
Revision: 488
http://svn.sourceforge.net/magicmap/?rev=488&view=rev
Author: jan_fride
Date: 2006-11-30 12:29:03 -0800 (Thu, 30 Nov 2006)
Log Message:
-----------
missing classes
Modified Paths:
--------------
trunk/magicmapclient/res/log4j.xml
Added Paths:
-----------
trunk/magicmapclient/res/log4j.dtd
trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java
Added: trunk/magicmapclient/res/log4j.dtd
===================================================================
--- trunk/magicmapclient/res/log4j.dtd (rev 0)
+++ trunk/magicmapclient/res/log4j.dtd 2006-11-30 20:29:03 UTC (rev 488)
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!-- Authors: Chris Taylor, Ceki Gulcu. -->
+
+<!-- Version: 1.2 -->
+
+<!-- A configuration element consists of optional renderer
+elements,appender elements, categories and an optional root
+element. -->
+
+<!ELEMENT log4j:configuration (renderer*, appender*,(category|logger)*,root?,
+ categoryFactory?)>
+
+<!-- The "threshold" attribute takes a level value such that all -->
+<!-- logging statements with a level equal or below this value are -->
+<!-- disabled. -->
+
+<!-- Setting the "debug" enable the printing of internal log4j logging -->
+<!-- statements. -->
+
+<!-- By default, debug attribute is "null", meaning that we not do touch -->
+<!-- internal log4j logging settings. The "null" value for the threshold -->
+<!-- attribute can be misleading. The threshold field of a repository -->
+<!-- cannot be set to null. The "null" value for the threshold attribute -->
+<!-- simply means don't touch the threshold field, the threshold field -->
+<!-- keeps its old value. -->
+
+<!ATTLIST log4j:configuration
+ xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
+ threshold (all|debug|info|warn|error|fatal|off|null) "null"
+ debug (true|false|null) "null"
+>
+
+<!-- renderer elements allow the user to customize the conversion of -->
+<!-- message objects to String. -->
+
+<!ELEMENT renderer EMPTY>
+<!ATTLIST renderer
+ renderedClass CDATA #REQUIRED
+ renderingClass CDATA #REQUIRED
+>
+
+<!-- Appenders must have a name and a class. -->
+<!-- Appenders may contain an error handler, a layout, optional parameters -->
+<!-- and filters. They may also reference (or include) other appenders. -->
+<!ELEMENT appender (errorHandler?, param*, layout?, filter*, appender-ref*)>
+<!ATTLIST appender
+ name ID #REQUIRED
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT layout (param*)>
+<!ATTLIST layout
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT filter (param*)>
+<!ATTLIST filter
+ class CDATA #REQUIRED
+>
+
+<!-- ErrorHandlers can be of any class. They can admit any number of -->
+<!-- parameters. -->
+
+<!ELEMENT errorHandler (param*, root-ref?, logger-ref*, appender-ref?)>
+<!ATTLIST errorHandler
+ class CDATA #REQUIRED
+>
+
+<!ELEMENT root-ref EMPTY>
+
+<!ELEMENT logger-ref EMPTY>
+<!ATTLIST logger-ref
+ ref IDREF #REQUIRED
+>
+
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+ name CDATA #REQUIRED
+ value CDATA #REQUIRED
+>
+
+
+<!-- The priority class is org.apache.log4j.Level by default -->
+<!ELEMENT priority (param*)>
+<!ATTLIST priority
+ class CDATA #IMPLIED
+ value CDATA #REQUIRED
+>
+
+<!-- The level class is org.apache.log4j.Level by default -->
+<!ELEMENT level (param*)>
+<!ATTLIST level
+ class CDATA #IMPLIED
+ value CDATA #REQUIRED
+>
+
+
+<!-- If no level element is specified, then the configurator MUST not -->
+<!-- touch the level of the named category. -->
+<!ELEMENT category (param*,(priority|level)?,appender-ref*)>
+<!ATTLIST category
+ class CDATA #IMPLIED
+ name CDATA #REQUIRED
+ additivity (true|false) "true"
+>
+
+<!-- If no level element is specified, then the configurator MUST not -->
+<!-- touch the level of the named logger. -->
+<!ELEMENT logger (level?,appender-ref*)>
+<!ATTLIST logger
+ name ID #REQUIRED
+ additivity (true|false) "true"
+>
+
+
+<!ELEMENT categoryFactory (param*)>
+<!ATTLIST categoryFactory
+ class CDATA #REQUIRED>
+
+<!ELEMENT appender-ref EMPTY>
+<!ATTLIST appender-ref
+ ref IDREF #REQUIRED
+>
+
+<!-- If no priority element is specified, then the configurator MUST not -->
+<!-- touch the priority of root. -->
+<!-- The root category always exists and cannot be subclassed. -->
+<!ELEMENT root (param*, (priority|level)?, appender-ref*)>
+
+
+<!-- ==================================================================== -->
+<!-- A logging event -->
+<!-- ==================================================================== -->
+<!ELEMENT log4j:eventSet (log4j:event*)>
+<!ATTLIST log4j:eventSet
+ xmlns:log4j CDATA #FIXED "http://jakarta.apache.org/log4j/"
+ version (1.1|1.2) "1.2"
+ includesLocationInfo (true|false) "true"
+>
+
+
+
+<!ELEMENT log4j:event (log4j:message, log4j:NDC?, log4j:throwable?,
+ log4j:locationInfo?) >
+
+<!-- The timestamp format is application dependent. -->
+<!ATTLIST log4j:event
+ logger CDATA #REQUIRED
+ level CDATA #REQUIRED
+ thread CDATA #REQUIRED
+ timestamp CDATA #REQUIRED
+>
+
+<!ELEMENT log4j:message (#PCDATA)>
+<!ELEMENT log4j:NDC (#PCDATA)>
+
+<!ELEMENT log4j:throwable (#PCDATA)>
+
+<!ELEMENT log4j:locationInfo EMPTY>
+<!ATTLIST log4j:locationInfo
+ class CDATA #REQUIRED
+ method CDATA #REQUIRED
+ file CDATA #REQUIRED
+ line CDATA #REQUIRED
+>
Modified: trunk/magicmapclient/res/log4j.xml
===================================================================
--- trunk/magicmapclient/res/log4j.xml 2006-11-30 20:24:22 UTC (rev 487)
+++ trunk/magicmapclient/res/log4j.xml 2006-11-30 20:29:03 UTC (rev 488)
@@ -3,27 +3,25 @@
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="MeinAppender" class="org.apache.log4j.FileAppender">
- <param name="file" value="magicmapclient.log" />
- <param name="Append" value="true" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d{ISO8601} %-5p [%t] %c: %m%n" />
- </layout>
- </appender>
-<appender name="MeinAppender2" class="org.apache.log4j.ConsoleAppender">
-
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d{ISO8601} %-5p %c: %m%n" />
- </layout>
- </appender>
+ <appender name="MeinAppender" class="org.apache.log4j.FileAppender">
+ <param name="file" value="magicmapclient.log" />
+ <param name="Append" value="true" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{ISO8601} %-5p [%t] %c: %m%n" />
+ </layout>
+ </appender>
+ <appender name="MeinAppender2" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{ISO8601} %-5p %c: %m%n" />
+ </layout>
+ </appender>
- <root>
- <priority value="INFO" />
- <appender-ref ref="MeinAppender" />
- <appender-ref ref="MeinAppender2" />
- </root>
-
+ <root>
+ <priority value="INFO" />
+ <appender-ref ref="MeinAppender" />
+ <appender-ref ref="MeinAppender2" />
+ </root>
</log4j:configuration>
Added: trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java 2006-11-30 20:29:03 UTC (rev 488)
@@ -0,0 +1,118 @@
+
+package net.sf.magicmap.plugin.ui;
+
+import java.beans.PropertyChangeSupport;
+import java.util.Collections;
+import java.util.LinkedList;
+
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+
+import net.sf.magicmap.client.gui.ISortableTableModel;
+import net.sf.magicmap.plugin.IPlugin;
+import net.sf.magicmap.plugin.PluginManager;
+import net.sf.magicmap.plugin.util.PluginComparator;
+import net.sf.magicmap.artifact.ArtifactComparator;
+
+/**
+ * The list of all installed plugins.
+ * @author Jan
+ *
+ */
+public class PluginTableModel implements ISortableTableModel {
+
+ private final PropertyChangeSupport support;
+ private final LinkedList<TableModelListener> listener = new LinkedList<TableModelListener>();
+ private final LinkedList<IPlugin> plugins = new LinkedList<IPlugin>();
+
+ private static final Class[] clazzes = new Class[]{String.class, String.class, String.class,
+ Boolean.class };
+ private final String[] names = new String[]{"Gruppe", "Plugin", "Version", "Aktiv"};
+ private boolean descending;
+ private int sortColumn;
+
+ public PluginTableModel(PluginManager manager) {
+ this.support = new PropertyChangeSupport(this);
+// for (IPlugin plugin : manager)
+// this.plugins.add(plugin);
+ }
+
+ public void addTableModelListener(TableModelListener l){
+ this.listener.add(l);
+
+ }
+
+ public Class<?> getColumnClass(int columnIndex){
+ return PluginTableModel.clazzes[columnIndex];
+ }
+
+ public int getColumnCount(){
+ return PluginTableModel.clazzes.length;
+ }
+
+ public String getColumnName(int columnIndex){
+ return this.names[columnIndex];
+ }
+
+ public int getRowCount(){
+ return this.plugins.size();
+ }
+
+ public void sortByComlumn(int column, boolean descending){
+ this.sortColumn = column;
+ this.descending = descending;
+
+ Collections.sort(this.plugins, new ArtifactComparator()); //(new int[]{column}, descending));
+
+ TableModelEvent e = new TableModelEvent(this);
+ for (TableModelListener l : this.listener)
+ l.tableChanged(e);
+ System.err.println(column);
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex){
+ if (rowIndex > this.plugins.size()) throw new IllegalArgumentException("Invalid Row: " + rowIndex);
+ IPlugin plugin = this.plugins.get(rowIndex);
+ switch (columnIndex) {
+ case 0 :
+ return plugin.getGroupId();
+ case 1 :
+ return plugin.getPluginInfos().getName();
+ case 2 :
+ return plugin.getVersion();
+ case 3 :
+ return true;
+ default :
+ throw new IllegalArgumentException("Invalid col: " + columnIndex);
+ }
+
+ }
+
+ /**
+ * @return false
+ */
+ public boolean isCellEditable(int rowIndex, int columnIndex){
+ return false;
+ }
+
+ public void removeTableModelListener(TableModelListener l){
+ this.listener.remove(l);
+ }
+
+ /**
+ * Does nothing!
+ */
+ public void setValueAt(Object aValue, int rowIndex, int columnIndex){
+ // TODO Auto-generated method stub
+
+ }
+
+ public int getSortColumn(){
+ return this.sortColumn;
+ }
+
+ public boolean isDecending(){
+ return this.descending;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2006-11-30 20:24:48
|
Revision: 487
http://svn.sourceforge.net/magicmap/?rev=487&view=rev
Author: jan_fride
Date: 2006-11-30 12:24:22 -0800 (Thu, 30 Nov 2006)
Log Message:
-----------
missing classes
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/NewMapDialog.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/plugin/action/UninstallPluginAction.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/util/OperatingSystemInfo.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/NewMapDialog.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/NewMapDialog.java 2006-11-29 09:33:47 UTC (rev 486)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/NewMapDialog.java 2006-11-30 20:24:22 UTC (rev 487)
@@ -235,7 +235,7 @@
// w = Long.parseLong(width.getText());
// h = Long.parseLong(height.getText());
if (newvalue > 0 && w > 0 && h > 0) {
- // rHeight.setText(Long.toString((h * newvalue) / w));
+ // rHeight.setText(Long.getPath((h * newvalue) / w));
}
} catch (NumberFormatException e1) {
// rHeight.setText("");
@@ -251,7 +251,7 @@
// w = Long.parseLong(width.getText());
// h = Long.parseLong(height.getText());
if (newvalue > 0 && w > 0 && h > 0) {
- // rWidth.setText(Long.toString((w * newvalue) / h));
+ // rWidth.setText(Long.getPath((w * newvalue) / h));
}
} catch (NumberFormatException e1) {
// rWidth.setText("");
Added: trunk/magicmapclient/src/net/sf/magicmap/plugin/action/UninstallPluginAction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/plugin/action/UninstallPluginAction.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/plugin/action/UninstallPluginAction.java 2006-11-30 20:24:22 UTC (rev 487)
@@ -0,0 +1,48 @@
+package net.sf.magicmap.plugin.action;
+
+import net.sf.magicmap.client.gui.utils.MagicAction;
+import net.sf.magicmap.client.gui.utils.GUIConstants;
+import net.sf.magicmap.plugin.PluginManager;
+import net.sf.magicmap.plugin.IPluginDescriptor;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 12.11.2006
+ * Time: 18:55:24
+ * To change this template use File | Settings | File Templates.
+ */
+public class UninstallPluginAction extends MagicAction {
+
+ private final PluginManager manager;
+ private IPluginDescriptor descriptor;
+
+ public UninstallPluginAction(PluginManager manager){
+ super ("Plugin deinstallieren", GUIConstants.ICON_DELETE,"Plugin deinstalieren");
+ this.manager = manager;
+ manager.addItemListener(this);
+ setEnabled(false);
+ }
+ public void actionPerformed(ActionEvent e) {
+ try {
+ manager.uninstallPlugin(descriptor);
+ } catch (IOException e1) {
+ e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ if (ItemEvent.SELECTED == e.getStateChange()){
+ setDescriptor((IPluginDescriptor) e.getItem());
+ }
+ }
+
+ public void setDescriptor(IPluginDescriptor descriptor) {
+ this.descriptor = descriptor;
+ setEnabled(descriptor != null && manager.isInstalled(descriptor));
+ }
+}
Added: trunk/magicmapclient/src/net/sf/magicmap/plugin/util/OperatingSystemInfo.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/plugin/util/OperatingSystemInfo.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/plugin/util/OperatingSystemInfo.java 2006-11-30 20:24:22 UTC (rev 487)
@@ -0,0 +1,54 @@
+package net.sf.magicmap.plugin.util;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 09.11.2006
+ * Time: 17:45:46
+ * To change this template use File | Settings | File Templates.
+ */
+public final class OperatingSystemInfo {
+ public final String name;
+ public final String arch;
+ public final String version;
+
+ public OperatingSystemInfo(String name, String arch, String version){
+ this.name = name;
+ this.arch = arch;
+ this.version = version;
+ }
+ public boolean isCurrentOsSupported(){
+ return (name.equals(System.getProperty("os.system")) &&
+ arch.equals(System.getProperty("os.arch")));
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ OperatingSystemInfo that = (OperatingSystemInfo) o;
+
+ if (!arch.equals(that.arch)) return false;
+ if (!name.equals(that.name)) return false;
+ if (!version.equals(that.version)) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = name.hashCode();
+ result = 31 * result + arch.hashCode();
+ result = 31 * result + version.hashCode();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "OperatingSystemInfo{" +
+ "name='" + name + '\'' +
+ ", arch='" + arch + '\'' +
+ ", version='" + version + '\'' +
+ '}';
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jan...@us...> - 2006-11-29 09:34:17
|
Revision: 486
http://svn.sourceforge.net/magicmap/?rev=486&view=rev
Author: jan_fride
Date: 2006-11-29 01:33:47 -0800 (Wed, 29 Nov 2006)
Log Message:
-----------
gui zum instalieren von plugins
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java
trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java
trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java
trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/TabForm.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/VisualList.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/AbstractPlugin.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/IPluginDescriptor.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginLoader.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginManager.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginRepository.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/SimplePluginDescriptor.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/forms/PluginsForm.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/util/PluginComparator.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/util/PluginDescriptorReader.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactTools.java
trunk/magicmapclient/src/net/sf/magicmap/artifact/Version.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/DocumentUtils.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/table/
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/table/AndFilter.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/table/FilteredTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/table/NotFilter.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/action/
trunk/magicmapclient/src/net/sf/magicmap/plugin/action/InstallPluginAction.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/action/LoadPluginsAction.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/action/ShowPluginsAction.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginDescriptorModel.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableRenderer.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/util/DirWalker.java
Removed Paths:
-------------
trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginDescriptorView.java
trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-11-17 11:02:55 UTC (rev 485)
+++ trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -5,16 +5,16 @@
private final String groupid;
private final String artifactid;
- private final String version;
+ private final Version version;
private static final ArtifactComparator cmp = new ArtifactComparator();
public Artifact(String groupid, String artifactid, String version) {
this.groupid = groupid;
this.artifactid = artifactid;
- this.version = version;
+ this.version = new Version(version);
}
- public String getVersion(){
+ public Version getVersion(){
return this.version;
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java 2006-11-17 11:02:55 UTC (rev 485)
+++ trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -2,6 +2,7 @@
package net.sf.magicmap.artifact;
import java.util.Comparator;
+import java.util.StringTokenizer;
public class ArtifactComparator implements Comparator<IArtifact> {
Added: trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactTools.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactTools.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactTools.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -0,0 +1,26 @@
+package net.sf.magicmap.artifact;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jan
+ * Date: 09.11.2006
+ * Time: 19:36:25
+ * To change this template use File | Settings | File Templates.
+ */
+public class ArtifactTools {
+
+ public String getPath(IArtifact artifact){
+ return artifact.getGroupId() + "/" + artifact.getArtifactId() + "/"+artifact.getVersion();
+ }
+
+ public IArtifact fromString(String str){
+ String[] tokens = str.split("/");
+ if (tokens == null || tokens.length != 3) return new Artifact("","","");
+ else return new Artifact(tokens[0], tokens[1], tokens[2]);
+ }
+
+ public String getFileName(IArtifact artifact){
+ return artifact.getArtifactId() + "-" + artifact.getVersion()+".jar";
+ }
+
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java 2006-11-17 11:02:55 UTC (rev 485)
+++ trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -3,6 +3,6 @@
public interface IArtifact extends IUniqueIdentity<IArtifact> {
- public String getVersion();
+ public Version getVersion();
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java 2006-11-17 11:02:55 UTC (rev 485)
+++ trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -3,10 +3,24 @@
/**
* Beschreibt einen Hersteller.
- *
+ *
*/
public interface IVendor {
+ IVendor EMPTY = new IVendor(){
+ public String getName() {
+ return "";
+ }
+
+ public String getEmail() {
+ return "";
+ }
+
+ public String getHomePage() {
+ return "";
+ }
+ };
+
public String getName();
public String getEmail();
Added: trunk/magicmapclient/src/net/sf/magicmap/artifact/Version.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/artifact/Version.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/artifact/Version.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -0,0 +1,58 @@
+package net.sf.magicmap.artifact;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: jan
+ * Date: 11.11.2006
+ * Time: 16:48:25
+ * To change this template use File | Settings | File Templates.
+ */
+public class Version implements Comparable<Version> {
+
+ private final String versionString;
+ private final long version;
+ private final long snapShot;
+
+ public Version(String versionStr){
+ this.versionString = versionStr;
+
+ String[] tokens = versionStr.split("-");
+ if (tokens.length != 0){
+ version = parseVersion(versionStr.split("\\."));
+ snapShot = 0;
+ }else{
+ version = parseVersion(tokens[0].split("\\."));
+ snapShot = parseSnaphsot(tokens[1]);
+ }
+
+ }
+
+ private long parseVersion(String[] str) {
+ int pow = str.length * 100;
+ long result = 0;
+ for (String s: str){
+ result += Integer.parseInt(s) * pow;
+ pow = pow / 100;
+ }
+ return result;
+ }
+ private long parseSnaphsot(String snap){
+ long result = 0;
+ if("SNAPSHOT".equals(snap)) return 1;
+ return Long.parseLong(snap);
+ }
+
+
+ public int compareTo(Version o) {
+ int comp = version == o.version ? 0 :
+ version < o.version ? -1 : 1;
+ if (comp != 0) return comp;
+ return snapShot == o.snapShot ? 0 :
+ snapShot < o.snapShot ? -1 : 1;
+ }
+ @Override
+ public String toString(){
+ return versionString;
+ }
+
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-11-17 11:02:55 UTC (rev 485)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -45,6 +45,8 @@
import org.apache.log4j.xml.DOMConfigurator;
+import javax.swing.*;
+
/**
* Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den
* der Anwendung.
@@ -136,7 +138,7 @@
//TODO
try {
this.pluginManager = new PluginManager(new Settings(), this);
- } catch (MalformedURLException e) {
+ } catch (MalformedURLException e) {
throw new RuntimeException(e.getMessage());
}
}
@@ -162,7 +164,7 @@
setMeasurementViewLocal(true);
this.nodeModel.addNodeModelListener(this.mapView);
//registerNodeModelListener(outlineView);
- }
+ }
/**
* Getter for the map view
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2006-11-17 11:02:55 UTC (rev 485)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -243,7 +243,7 @@
// if (position.getGeoPoint() != null) {
// GeoPointDTO gpdto = position.getGeoPoint();
// GeoPosNode geoNode = (GeoPosNode)
- // nodeModel.findNode(gpdto.toString());
+ // nodeModel.findNode(gpdto.getPath());
// if (geoNode == null) {
// geoNode.setPosition(position.getPosX(),
// position.getPosY());
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-11-17 11:02:55 UTC (rev 485)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2006-11-29 09:33:47 UTC (rev 486)
@@ -51,6 +51,7 @@
import net.sf.magicmap.client.model.node.NodeModel;
import net.sf.magicmap.client.utils.Settings;
import net.sf.magicmap.client.utils.Version;
+import net.sf.magicmap.plugin.action.ShowPluginsAction;
import org.apache.axis.AxisFault;
@@ -65,795 +66,797 @@
* The main GUI window
* @author thuebner
*/
+@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;
- }
+ /**
+ * 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 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;
- MapView mapView;
- private MagicAction invisibleAction;
- private MagicAction simpleView;
- private MagicAction normalView;
- private MagicAction expertView;
- private MagicAction userDefinedView;
+ 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;
+ MapView mapView;
+ private MagicAction invisibleAction;
+ private MagicAction simpleView;
+ private MagicAction normalView;
+ private MagicAction expertView;
+ private MagicAction userDefinedView;
- 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();
+ // 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));
- }
+ // 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(){
- 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);
+ /**
+ * 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);
- UIFSplitPane pane2;
+ UIFSplitPane pane2;
- this.bottomRightTabPanel = new ViewTabPanel();
- this.bottomRightTabPanel.addView(this.measurementView);
- this.bottomRightTabPanel.addView(this.consoleView);
- this.bottomRightTabPanel.selectView(this.measurementView);
+ this.bottomRightTabPanel = new ViewTabPanel();
+ this.bottomRightTabPanel.addView(this.measurementView);
+ this.bottomRightTabPanel.addView(this.consoleView);
+ this.bottomRightTabPanel.selectView(this.measurementView);
- UIFSplitPane pane = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.outlineView,
- (pane2 = UIFSplitPane.createStrippedSplitPane(JSplitPane.VERTICAL_SPLIT, this.mapPanel,
- this.bottomRightTabPanel)));
- pane.setDividerSize(GUIConstants.DIVIDER_SIZE);
- pane.setDividerBorderVisible(false);
- pane2.setDividerSize(GUIConstants.DIVIDER_SIZE);
- pane2.setDividerBorderVisible(false);
- pane2.setDividerLocation(1.0);
- return pane;
- }
+ UIFSplitPane pane = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.outlineView,
+ (pane2 = UIFSplitPane.createStrippedSplitPane(JSplitPane.VERTICAL_SPLIT, this.mapPanel,
+ this.bottomRightTabPanel)));
+ pane.setDividerSize(GUIConstants.DIVIDER_SIZE);
+ pane.setDividerBorderVisible(false);
+ pane2.setDividerSize(GUIConstants.DIVIDER_SIZE);
+ pane2.setDividerBorderVisible(false);
+ pane2.setDividerLocation(1.0);
+ return pane;
+ }
- /**
- * Build the file menu
- * @return the file menu
- */
- private JMenu buildFileMenu(){
- JMenu menu = GUIBuilder.createMenu("file");
- menu.add(GUIBuilder.createMenuItem(this.connectAction));
- menu.add(GUIBuilder.createMenuItem(this.disconnectAction));
- menu.addSeparator();
- menu.add(GUIBuilder.createMenuItem(this.newMapAction));
- menu.add(GUIBuilder.createMenuItem(this.loadMapAction));
- menu.addSeparator();
- menu.add(GUIBuilder.createMenuItem(this.exitAction));
- return menu;
- }
+ /**
+ * 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 map menu
- * @return the map menu
- */
- public JMenu buildMapMenu(){
- JMenu menu = GUIBuilder.createMenu("map");
- menu.add(GUIBuilder.createMenuItem(this.exitAction));
- return menu;
- }
+ /**
+ * Build the map menu
+ * @return the map menu
+ */
+ public JMenu buildMapMenu(){
+ JMenu menu = GUIBuilder.createMenu("map");
+ menu.add(GUIBuilder.createMenuItem(this.exitAction));
+ return menu;
+ }
- /**
- * Build the view menu
- * @return the view menu
- */
- public JMenu buildViewMenu(){
- JMenu menu = GUIBuilder.createMenu("view");
- /* menu.add(GUIBuilder.createCheckBoxMenuItem(showAccessPoints, true));
- menu.add(GUIBuilder.createCheckBoxMenuItem(showClients, true));
- menu.add(GUIBuilder.createCheckBoxMenuItem(showLocations, true));
- menu.add(GUIBuilder.createCheckBoxMenuItem(showEdges, true));
- menu.add(GUIBuilder.createCheckBoxMenuItem(showEdgesBetweenLocations, true));
- */
+ /**
+ * Build the view menu
+ * @return the view menu
+ */
+ public JMenu buildViewMenu(){
+ JMenu menu = GUIBuilder.createMenu("view");
+ /* menu.add(GUIBuilder.createCheckBoxMenuItem(showAccessPoints, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showClients, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showLocations, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showEdges, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showEdgesBetweenLocations, true));
+ */
- menu.add(GUIBuilder.createCheckBoxMenuItem(this.simpleView, false));
- menu.add(GUIBuilder.createCheckBoxMenuItem(this.normalView, false));
- menu.add(GUIBuilder.createCheckBoxMenuItem(this.expertView, false));
- menu.addSeparator();
- menu.add(GUIBuilder.createCheckBoxMenuItem(this.userDefinedView, false));
- this.normalView.setSelected(true);
- return menu;
- }
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.simpleView, false));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.normalView, false));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.expertView, false));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.userDefinedView, false));
+ this.normalView.setSelected(true);
+ return menu;
+ }
- /**
- * Build the options menu
- * @return the options menu
- */
- public JMenu buildOptionsMenu(){
- JMenu menu = GUIBuilder.createMenu("options");
- menu.add(GUIBuilder.createCheckBoxMenuItem(this.invisibleAction, Controller.getInstance().isInvisible()));
- menu.add(GUIBuilder.createMenuItem(this.setProxyAction));
- JMenu dataInvocationRate = GUIBuilder.createMenu("datainvocationrate");
- menu.add(dataInvocationRate);
- for (int i = 0; i < MainGUI.numberOfdataInvocationRateAction; i++)
- dataInvocationRate.add(GUIBuilder.createCheckBoxMenuItem(this.dataInvocationRateAction[i], false));
- this.dataInvocationRateAction[4].setSelected(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);
- return menu;
- }
+ return menu;
+ }
- /**
- * Build the help menu
- * @return the help menu
- */
- public JMenu buildHelpMenu(){
- Browser.init();
- JMenu menu = GUIBuilder.createMenu("help");
- menu.add(GUIBuilder.createMenuItem(this.onlineHelp));
- menu.addSeparator();
- menu.add(GUIBuilder.createMenuItem(this.aboutAction));
- return menu;
- }
+ /**
+ * Build the help menu
+ * @return the help menu
+ */
+ public JMenu buildHelpMenu(){
+ Browser.init();
+ JMenu menu = GUIBuilder.createMenu("help");
+ menu.add(GUIBuilder.createMenuItem(this.onlineHelp));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createMenuItem(this.aboutAction));
+ return menu;
+ }
- /**
- * Add buttons to main toolbar
- * @param bar - the toolbar
- */
- public void addMainToolBarButtons(JToolBar bar){
- JButton button = null;
- button = GUIBuilder.createToolButton(this.connectAction);
- bar.add(button);
- button = GUIBuilder.createToolButton(this.disconnectAction);
- bar.add(button);
- bar.addSeparator();
- button = GUIBuilder.createToolButton(this.newMapAction);
- bar.add(button);
- button = GUIBuilder.createToolButton(this.loadMapAction);
- bar.add(button);
- bar.addSeparator();
- bar.add(GUIBuilder.createToolToggleButton(this.invisibleAction));
- // bar.addSeparator();
- }
+ /**
+ * Add buttons to main toolbar
+ * @param bar - the toolbar
+ */
+ public void addMainToolBarButtons(JToolBar bar){
+ JButton button = null;
+ button = GUIBuilder.createToolButton(this.connectAction);
+ bar.add(button);
+ button = GUIBuilder.createToolButton(this.disconnectAction);
+ bar.add(button);
+ bar.addSeparator();
+ button = GUIBuilder.createToolButton(this.newMapAction);
+ bar.add(button);
+ button = GUIBuilder.createToolButton(this.loadMapAction);
+ bar.add(button);
+ bar.addSeparator();
+ bar.add(GUIBuilder.createToolToggleButton(this.invisibleAction));
- /**
- * Main entry point for the gui and the whole client
- * @param args - startup arguments
- */
- // public static void main(String[] args) {
- //
- // JWindow splashScreen = new JWindow();
- //
- // JLabel splashLabel = new JLabel(new ImageIcon("magicmap-splash.png"));
- //
- // splashScreen.getContentPane().add(splashLabel, BorderLayout.CENTER);
- // splashScreen.pack();
- // Dimension screenSize =
- // Toolkit.getDefaultToolkit().getScreenSize();
- // Dimension labelSize = splashLabel.getPreferredSize();
- // splashScreen.setLocation(screenSize.width/2 - (labelSize.width/2),
- // screenSize.height/2 - (labelSize.height/2));
- // splashScreen.setVisible(true);
- // screenSize = null;
- // labelSize = null;
- //
- // Settings.setup(args);
- // GUIUtils.setPlasticLookAndFeel();
- // GUIUtils.setLocale(Locale.getDefault());
- // //GUIUtils.setLocale(Locale.US);
- // JFrame frame = MainGUI.getInstance();
- // GUIUtils.locateOnScreen(frame);
- // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- //
- // splashScreen.setVisible(false);
- // splashScreen.dispose();
- //
- // frame.setVisible(true);
- // }
- /* (non-Javadoc)
- * @see net.sf.magicmap.client.interfaces.ServerConnectCallback#connected(long)
- */
- public void connected(long sesssionId){
+ // bar.addSeparator();
+ }
- this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_CONNECTED));
- this.statusBar.setInvisible(Controller.getInstance().isInvisible());
- this.connectAction.setEnabled(false);
- this.disconnectAction.setEnabled(true);
- this.newMapAction.setEnabled(true);
- this.loadMapAction.setEnabled(true);
- setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- // Controller.getInstance().retrieveMapNames(MainGUI.this, false);
+ /**
+ * Main entry point for the gui and the whole client
+ * @param args - startup arguments
+ */
+ // public static void main(String[] args) {
+ //
+ // JWindow splashScreen = new JWindow();
+ //
+ // JLabel splashLabel = new JLabel(new ImageIcon("magicmap-splash.png"));
+ //
+ // splashScreen.getContentPane().add(splashLabel, BorderLayout.CENTER);
+ // splashScreen.pack();
+ // Dimension screenSize =
+ // Toolkit.getDefaultToolkit().getScreenSize();
+ // Dimension labelSize = splashLabel.getPreferredSize();
+ // splashScreen.setLocation(screenSize.width/2 - (labelSize.width/2),
+ // screenSize.height/2 - (labelSize.height/2));
+ // splashScreen.setVisible(true);
+ // screenSize = null;
+ // labelSize = null;
+ //
+ // Settings.setup(args);
+ // GUIUtils.setPlasticLookAndFeel();
+ // GUIUtils.setLocale(Locale.getDefault());
+ // //GUIUtils.setLocale(Locale.US);
+ // JFrame frame = MainGUI.getInstance();
+ // GUIUtils.locateOnScreen(frame);
+ // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ //
+ // splashScreen.setVisi...
[truncated message content] |
|
From: <fle...@us...> - 2006-11-17 11:03:17
|
Revision: 485
http://svn.sourceforge.net/magicmap/?rev=485&view=rev
Author: flederohr
Date: 2006-11-17 03:02:55 -0800 (Fri, 17 Nov 2006)
Log Message:
-----------
renamed some variables for better understanding
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2006-11-12 12:46:11 UTC (rev 484)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java 2006-11-17 11:02:55 UTC (rev 485)
@@ -101,7 +101,7 @@
int t2 = n2.getType();
boolean c1 = (t1 == INodeModel.NODETYPE_CLIENT || t1 == INodeModel.NODETYPE_LOCATION);
boolean c2 = (t2 == INodeModel.NODETYPE_CLIENT || t2 == INodeModel.NODETYPE_LOCATION);
- boolean clientLocation = (c1 && c2);
+ boolean clientOrLocation = (c1 && c2);
double desiredLength = calculateLength(n1, n2, c1, c2);
@@ -110,7 +110,7 @@
double len = Math.sqrt(vx * vx + vy * vy);
double lengthRatio = (len + 1) / (desiredLength + 1);
- adjustCallibration(clientLocation, len, desiredLength, !n1.isFix() || !n2.isFix());
+ adjustCallibration(clientOrLocation, len, desiredLength, !n1.isFix() || !n2.isFix());
e.setUserDatum(LayoutSettings.NODE_DISTANCE_KEY, lengthRatio, UserData.REMOVE);
return desiredLength;
@@ -124,9 +124,10 @@
* @param desiredLen
* @param fixed
*/
- private void adjustCallibration(boolean clientOrLocation, double len, double desiredLen, boolean fixed){
+ private void adjustCallibration(boolean clientOrLocation, double len, double desiredLen, boolean notFixed){
+ if (notFixed) return;
+
double d = (len + 1) / (desiredLen + 1);
- if (fixed) return;
if (clientOrLocation) {
if (d < 0.95) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fle...@us...> - 2006-11-12 12:46:24
|
Revision: 484
http://svn.sourceforge.net/magicmap/?rev=484&view=rev
Author: flederohr
Date: 2006-11-12 04:46:11 -0800 (Sun, 12 Nov 2006)
Log Message:
-----------
Property Changed:
----------------
branches/newjpox/magicmapserver/dblayer/lib/
branches/newjpox/magicmapserver/web/WEB-INF/lib/
Property changes on: branches/newjpox/magicmapserver/dblayer/lib
___________________________________________________________________
Name: svn:ignore
- bcel-5.1.jar
commons-collections-3.0.jar
commons-logging.jar
commons-logging-api.jar
jpox-1.1.0-beta-1.jar
jpox-enhancer-1.1.0-beta-1.jar
log4j-1.2.9.jar
xdoclet-1.2.jar
xdoclet-jdo-module-1.3-SNAPSHOT.jar
xjavadoc-1.0.3.jar
+ bcel-5.1.jar
commons-collections-3.0.jar
commons-logging.jar
commons-logging-api.jar
jpox-1.1.0-beta-1.jar
jpox-enhancer-1.1.0-beta-1.jar
log4j-1.2.9.jar
xdoclet-1.2.jar
xdoclet-jdo-module-1.3-SNAPSHOT.jar
xjavadoc-1.0.3.jar
Property changes on: branches/newjpox/magicmapserver/web/WEB-INF/lib
___________________________________________________________________
Name: svn:ignore
- magicmap-db-layer.jar
+ magicmap-db-layer.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|