From: <jan...@us...> - 2006-11-07 18:57:23
|
Revision: 477 http://svn.sourceforge.net/magicmap/?rev=477&view=rev Author: jan_fride Date: 2006-11-07 10:53:59 -0800 (Tue, 07 Nov 2006) Log Message: ----------- Plugin erweitert (hashcode, equals und os) Modified Paths: -------------- trunk/magicmapclient/build.xml trunk/magicmapclient/magicmapclient.iml trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.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/FormLayoutReader.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java trunk/magicmapclient/src/net/sf/magicmap/plugin/AbstractPlugin.java trunk/magicmapclient/src/net/sf/magicmap/plugin/IPluginDescriptor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginException.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/SimplePluginDescriptor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/SimpleVendor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginDescriptorView.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java trunk/magicmapclient/test/net/sf/magicmap/plugin/DocumentDescriptorReaderTest.java Added Paths: ----------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.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/plugin/PluginRepository.java trunk/magicmapclient/src/net/sf/magicmap/plugin/forms/ 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 Removed Paths: ------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/SimpleInfoObjectForm.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginDescriptorReader.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginListView.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTreeModel.java Modified: trunk/magicmapclient/build.xml =================================================================== --- trunk/magicmapclient/build.xml 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/build.xml 2006-11-07 18:53:59 UTC (rev 477) @@ -10,7 +10,9 @@ <property name="server" value="../magicmapserver" /> <property name="build" value="build" /> + <property name="build-test" value="build-test" /> <property name="dist" value="dist" /> + <property name="test" value="test" /> <property name="src" value="src" /> <property name="src.gen" value="src-gen" /> <property name="res" value="res" /> @@ -27,8 +29,20 @@ <include name="*.jar" /> </fileset> </path> + <path id="test.classpath"> + <fileset dir="."> + <include name="${jar.name}" /> + </fileset> + <fileset dir="lib"> + <include name="**/*.jar" /> + </fileset> + <!-- use server classes --> + <fileset dir="${server}/dist"> + <include name="*.jar" /> + </fileset> + <pathelement location="${build}"></pathelement> + </path> - <pathconvert property="classpath" pathsep=" " dirsep="/"> <path> <fileset dir="."> @@ -56,12 +70,15 @@ <target name="prepare" depends="clean"> <mkdir dir="${build}" /> + <mkdir dir="${build-test}" /> <mkdir dir="${dist}" /> + <mkdir dir="${test}" /> <mkdir dir="${src.gen}" /> </target> <target name="clean"> <delete dir="${build}" /> + <delete dir="${build-test}" /> <delete dir="${dist}" /> <delete file="${jar.name}" /> <delete dir="${src.gen}" /> @@ -81,6 +98,13 @@ </javac> </target> + <target name="compile-tests" depends="compile"> + <javac destdir="${build-test}" debug="true" deprecation="true" debuglevel="lines,vars,source" fork="true"> + <classpath refid="test.classpath" /> + <src path="${test}" /> + </javac> + </target> + <target name="version" depends="compile"> <tstamp> <format property="build.number" pattern="yyyyMMddHHmm" /> @@ -118,5 +142,10 @@ </java> </target> + <target name="copy-resources"> + <copy todir="build"> + <fileset dir="${res}"></fileset> + </copy> + </target> </project> Modified: trunk/magicmapclient/magicmapclient.iml =================================================================== --- trunk/magicmapclient/magicmapclient.iml 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/magicmapclient.iml 2006-11-07 18:53:59 UTC (rev 477) @@ -1,283 +1,41 @@ <?xml version="1.0" encoding="UTF-8"?> <module version="4" relativePaths="true" type="JAVA_MODULE"> <component name="ModuleRootManager" /> - <component name="NewModuleRootManager"> + <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/build" /> <exclude-output /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/res" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src-gen" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> + <excludeFolder url="file://$MODULE_DIR$/.settings" /> + <excludeFolder url="file://$MODULE_DIR$/dist" /> + <excludeFolder url="file://$MODULE_DIR$/inf" /> </content> - <orderEntry type="jdk" jdkName="1.6" /> + <orderEntry type="jdk" jdkName="1.5" jdkType="JavaSDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="Groovy from GroovyJ 0.1.7 (Irida)" level="application" /> - <orderEntry type="library" name="magicmap-server.lib" level="project" /> - <orderEntry type="module-library"> + <orderEntry type="module-library" exported=""> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/wsdl4j.jar!/" /> + <root url="jar://$MODULE_DIR$/magicmap.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> - <orderEntry type="module-library"> + <orderEntry type="library" exported="" name="client-libs" level="project" /> + <orderEntry type="library" exported="" name="lib-dev" level="project" /> + <orderEntry type="module-library" exported=""> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/commons-discovery.jar!/" /> + <root url="jar://$MODULE_DIR$/../magicmapserver/dist/magicmap-server.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/log4j-1.2.8.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/xercesImpl.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/forms-1.0.5.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/xml-apis.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/looks-1.2.2.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/jaxrpc.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/axis.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/activation.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/dom4j-1.6.1.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/commons-logging.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/nekohtml.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/concurrent.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/colt.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jaxen-1.1-beta-9.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/derby.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/foxtrot.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> <orderEntryProperties /> - <javadoc-paths> - <root url="file://$MODULE_DIR$/../../../../idea/MagicMap/doc/api" /> - </javadoc-paths> </component> <component name="VcsManagerConfiguration"> <option name="ACTIVE_VCS_NAME" value="svn" /> Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-11-07 18:53:59 UTC (rev 477) @@ -3,32 +3,53 @@ public class Artifact implements IArtifact { - private final String groupid; - private final String artifactid; - private final String version; - private static final ArtifactComparator cmp = new ArtifactComparator(); + private final String groupid; + private final String artifactid; + private final String 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; + public Artifact(String groupid, String artifactid, String version) { + this.groupid = groupid; + this.artifactid = artifactid; + this.version = version; + } - } + public String getVersion(){ + return this.version; + } - public String getVersion(){ - return this.version; - } + public String getArtifactId(){ + return this.artifactid; + } - public String getArtifactId(){ - return this.artifactid; - } + public String getGroupId(){ + return this.groupid; + } - public String getGroupId(){ - return this.groupid; - } - - public int compareTo(IArtifact o){ - return Artifact.cmp.compare(this, o); - } - + public int compareTo(IArtifact o){ + return Artifact.cmp.compare(this, o); + } + /** + * 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); + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-11-07 18:53:59 UTC (rev 477) @@ -53,533 +53,539 @@ */ public class Controller implements IController { - private static int numCalled = 0; + private static int numCalled = 0; - /** - * Die Instanz. - */ - private static Controller controller = null; + /** + * Die Instanz. + */ + private static Controller controller = null; - /** - * Das Knotenmodel. - */ - private INodeModel nodeModel; // Model f\xFCr Graphen + /** + * Das Knotenmodel. + */ + private INodeModel nodeModel; // Model f\xFCr Graphen - private MeasurementModel measurementModel; // Model f\xFCr Messungen + private MeasurementModel measurementModel; // Model f\xFCr Messungen - private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte + private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte - private ClientNode client; // Ausgezeichneter Knoten + private ClientNode client; // Ausgezeichneter Knoten - private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen + private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen - private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse + private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse - private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server + private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server - // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt + // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt - private MapInfo currentMap; + private MapInfo currentMap; - private OutlineView outlineView; + private OutlineView outlineView; - private ConsoleView consoleView; + private ConsoleView consoleView; - private MapView mapView; + private MapView mapView; - private MeasurementView measurementView; + private MeasurementView measurementView; - private boolean invisble; // Invisible-Modus (keine Daten an Server) + private boolean invisble; // Invisible-Modus (keine Daten an Server) - // pseudo server items - private Collection<InfoObject> infoObjects; + // pseudo server items + private Collection<InfoObject> infoObjects; - private ScannerAllocator scannerAllocator; - private final InfoObjectProviderRegistry infoServiceRegistry; - private final PluginManager pluginManager; + private ScannerAllocator scannerAllocator; + private final InfoObjectProviderRegistry infoServiceRegistry; + private final PluginManager pluginManager; - /** - * Private constructor for singleton instance - */ - private Controller() { - DOMConfigurator.configureAndWatch("log4j.xml"); + /** + * Private constructor for singleton instance + */ + private Controller() { + DOMConfigurator.configureAndWatch("log4j.xml"); - // - // Das Model der Knoten. - // - this.nodeModel = new NodeModel(); + // + // Das Model der Knoten. + // + this.nodeModel = new NodeModel(); - /** - * Messungen f\xFCr den eigenen clienten - */ - this.measurementModel = new MeasurementModel(); + /** + * Messungen f\xFCr den eigenen clienten + */ + this.measurementModel = new MeasurementModel(); - /** - * Messungen f\xFCr alle anderen? - */ - this.measurementModelOther = new MeasurementModel(); + /** + * Messungen f\xFCr alle anderen? + */ + this.measurementModelOther = new MeasurementModel(); - this.scannerAllocator = new ScannerAllocator(); - this.currentMap = null; - this.serverManager = null; + this.scannerAllocator = new ScannerAllocator(); + this.currentMap = null; + this.serverManager = null; - this.pollhandler = new PollHandler(this); + this.pollhandler = new PollHandler(this); - buildViews(); + buildViews(); - // pseudo server items - this.infoObjects = new ArrayList<InfoObject>(); - // initializeScanner(); - this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel); - PluginHandler.getInstance(); + // pseudo server items + this.infoObjects = new ArrayList<InfoObject>(); + // initializeScanner(); + this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel); + PluginHandler.getInstance(); - this.pluginManager = new PluginManager(new Settings(), this); + //TODO + try { + this.pluginManager = new PluginManager(new Settings(), this); + } catch (MalformedURLException e) { + throw new RuntimeException(e.getMessage()); + } + } - } + /** + * Getter for client node + * + * @return the client node + */ + public ClientNode getClient(){ + return this.client; + } - /** - * Getter for client node - * - * @return the client node - */ - public ClientNode getClient(){ - return this.client; - } + /** + * Erzeugt die Hauptviews der Anwendung + */ + private void buildViews(){ + this.outlineView = new OutlineView(this.nodeModel); + this.consoleView = new ConsoleView(); + this.mapView = new MapView(this.nodeModel, null); + this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel); + // registerMeasurementModelListener(measurementView); + setMeasurementViewLocal(true); + this.nodeModel.addNodeModelListener(this.mapView); + //registerNodeModelListener(outlineView); + } - /** - * Erzeugt die Hauptviews der Anwendung - */ - private void buildViews(){ - this.outlineView = new OutlineView(this.nodeModel); - this.consoleView = new ConsoleView(); - this.mapView = new MapView(this.nodeModel, null); - this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel); - // registerMeasurementModelListener(measurementView); - setMeasurementViewLocal(true); - this.nodeModel.addNodeModelListener(this.mapView); - //registerNodeModelListener(outlineView); - } + /** + * Getter for the map view + * + * @return the map view + */ + public MapView getMapView(){ + return this.mapView; + } - /** - * Getter for the map view - * - * @return the map view - */ - public MapView getMapView(){ - return this.mapView; - } + /** + * Getter for the outline view + * + * @return the outline view + */ + public OutlineView getOutlineView(){ + return this.outlineView; + } - /** - * Getter for the outline view - * - * @return the outline view - */ - public OutlineView getOutlineView(){ - return this.outlineView; - } + /** + * Getter for the console view + * + * @return the console view + */ + public ConsoleView getConsoleView(){ + return this.consoleView; + } - /** - * Getter for the console view - * - * @return the console view - */ - public ConsoleView getConsoleView(){ - return this.consoleView; - } + /** + * Getter for the measurement view + * + * @return the measurement view + */ + public MeasurementView getMeasurementView(){ + return this.measurementView; + } - /** - * Getter for the measurement view - * - * @return the measurement view - */ - public MeasurementView getMeasurementView(){ - return this.measurementView; - } + /** + * Provides the singleton controller instance (creates a new one if null) + * + * @return the singleton controller instance + */ + public static Controller getInstance(){ + if (Controller.controller == null) { + ++Controller.numCalled; + Controller.controller = new Controller(); + } + return Controller.controller; + } - /** - * Provides the singleton controller instance (creates a new one if null) - * - * @return the singleton controller instance - */ - public static Controller getInstance(){ - if (Controller.controller == null) { - ++Controller.numCalled; - Controller.controller = new Controller(); - } - return Controller.controller; - } + /** + * Getter for the node model + * + * @return the node model + */ + public INodeModel getNodeModel(){ + return this.nodeModel; + } - /** - * Getter for the node model - * - * @return the node model - */ - public INodeModel getNodeModel(){ - return this.nodeModel; - } + /** + * Baut das MeasurementModelOther neu auf. + * + * @param ap - + * the access point seer node + */ + public void buildOtherMeasurement(AccessPointSeerNode ap){ + System.out.println("Building measurement model..."); + this.measurementModelOther.clear(); + ArrayList aes = ap.getApEdges(); + for (int i = 0; i < aes.size(); i++) { + AccessPointEdge ae = (AccessPointEdge) aes.get(i); + SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel()); + this.measurementModelOther.addAccessPoint(sp); + } + } - /** - * Baut das MeasurementModelOther neu auf. - * - * @param ap - - * the access point seer node - */ - public void buildOtherMeasurement(AccessPointSeerNode ap){ - System.out.println("Building measurement model..."); - this.measurementModelOther.clear(); - ArrayList aes = ap.getApEdges(); - for (int i = 0; i < aes.size(); i++) { - AccessPointEdge ae = (AccessPointEdge) aes.get(i); - SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel()); - this.measurementModelOther.addAccessPoint(sp); - } - } + /** + * \xC4nndert die Anzeige des Measurement-Views + * + * @param local + * true, wenn lokale St\xE4rken angezeigt werden sollen + */ + public void setMeasurementViewLocal(boolean local){ + if (local) { + // measurementModelOther.removeMeasurementModelListener(measurementView); + // measurementModel.addMeasurementModelListener(measurementView); + //measurementModel.clear(); + } else { + // measurementModel.removeMeasurementModelListener(measurementView); + // measurementModelOther.addMeasurementModelListener(measurementView); + //measurementModelOther.clear(); + } + } - /** - * \xC4nndert die Anzeige des Measurement-Views - * - * @param local - * true, wenn lokale St\xE4rken angezeigt werden sollen - */ - public void setMeasurementViewLocal(boolean local){ - if (local) { - // measurementModelOther.removeMeasurementModelListener(measurementView); - // measurementModel.addMeasurementModelListener(measurementView); - //measurementModel.clear(); - } else { - // measurementModel.removeMeasurementModelListener(measurementView); - // measurementModelOther.addMeasurementModelListener(measurementView); - //measurementModelOther.clear(); - } - } + /** + * Getter for measurement model + * + * @return the measurement model + */ + public MeasurementModel getMeasurementModel(){ + return this.measurementModel; + } - /** - * Getter for measurement model - * - * @return the measurement model - */ - public MeasurementModel getMeasurementModel(){ - return this.measurementModel; - } + /** + * Gibt an ob verbunden oder nicht verbunden + * + * @return true wenn ja, false sonst + */ + public boolean isConnected(){ + return (this.serverManager != null && this.serverManager.isConnected()); + } - /** - * Gibt an ob verbunden oder nicht verbunden - * - * @return true wenn ja, false sonst - */ - public boolean isConnected(){ - return (this.serverManager != null && this.serverManager.isConnected()); - } + /** + * Liefert Kartenbeschreibung der aktuell geladenen Karte + * + * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv + */ + public MapInfo getCurrentMap(){ + return this.currentMap; + } - /** - * Liefert Kartenbeschreibung der aktuell geladenen Karte - * - * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv - */ - public MapInfo getCurrentMap(){ - return this.currentMap; - } + /** + * Setzt aktuelle Karte und startet dabei das ServerPolling + * + * @param map + */ + public void setCurrentMap(MapInfo map){ + if (isMapLoaded()) closeMap(); + this.currentMap = map; + try { + this.serverManager.reloadMap(); + this.nodeModel.addNode(this.client); + this.mapView.loadMap(map); + } catch (MalformedURLException e) { + System.out.println("Map loading failed." + e.getMessage()); + closeMap(); + } + if (isMapLoaded() && isConnected()) { + this.nodeModel.addNodeModelListener(this.mapView); + this.serverManager.resetTimestamp(); + setMeasurementViewLocal(true); + this.poller.start(); + // initializeScanner(); // Scanner neu initialisieren + this.scannerAllocator.startAllScanner(); + PluginHandler.getInstance().loadMap(); + this.pluginManager.loadMap(); + if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0) + getMapView().setTitle( + GUIUtils.i18n("map", false) + " - " + this.currentMap.name + " Gr\xF6\xDFe: " + + this.currentMap.realwidth + " X " + this.currentMap.realheight + " cm"); + } + } - /** - * Setzt aktuelle Karte und startet dabei das ServerPolling - * - * @param map - */ - public void setCurrentMap(MapInfo map){ - if (isMapLoaded()) closeMap(); - this.currentMap = map; - try { - this.serverManager.reloadMap(); - this.nodeModel.addNode(this.client); - this.mapView.loadMap(map); - } catch (MalformedURLException e) { - System.out.println("Map loading failed." + e.getMessage()); - closeMap(); - } - if (isMapLoaded() && isConnected()) { - this.nodeModel.addNodeModelListener(this.mapView); - this.serverManager.resetTimestamp(); - setMeasurementViewLocal(true); - this.poller.start(); - // initializeScanner(); // Scanner neu initialisieren - this.scannerAllocator.startAllScanner(); - PluginHandler.getInstance().loadMap(); - this.pluginManager.loadMap(); - if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0) - getMapView().setTitle( - GUIUtils.i18n("map", false) + " - " + this.currentMap.name + " Gr\xF6\xDFe: " - + this.currentMap.realwidth + " X " + this.currentMap.realheight + " cm"); - } - } + /** + * Restart server poller + */ + public void restartServerPoller(){ + if (isMapLoaded() && isConnected()) { + this.poller.stop(); + this.poller.start(); + } + } - /** - * Restart server poller - */ - public void restartServerPoller(){ - if (isMapLoaded() && isConnected()) { - this.poller.stop(); - this.poller.start(); - } - } + /** + * Check whether map is loaded + * + * @return <code>true</code> if map loaded, <code>false</code> else + */ + public boolean isMapLoaded(){ + return this.currentMap != null; + } - /** - * Check whether map is loaded - * - * @return <code>true</code> if map loaded, <code>false</code> else - */ - public boolean isMapLoaded(){ - return this.currentMap != null; - } + /** + * Schlie\xDFt Karte und beendet Polling vom Server + * + */ + public void closeMap(){ + this.scannerAllocator.stopAllScanner(); + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + this.currentMap = null; + this.mapView.unloadMap(); + this.serverManager.closeMap(); + this.poller.stop(); + this.nodeModel.clear(); + this.nodeModel.removeNodeModelListener(this.mapView); + // nodeModel.addNode(client); + } - /** - * Schlie\xDFt Karte und beendet Polling vom Server - * - */ - public void closeMap(){ - this.scannerAllocator.stopAllScanner(); - try { - Thread.sleep(1000); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - this.currentMap = null; - this.mapView.unloadMap(); - this.serverManager.closeMap(); - this.poller.stop(); - this.nodeModel.clear(); - this.nodeModel.removeNodeModelListener(this.mapView); - // nodeModel.addNode(client); - } + /** + * Liefert X-Position des Clients auf der Karte + * + * @return client x position + */ + public int getClientPosX(){ + return this.mapView.getX(this.client); + } - /** - * Liefert X-Position des Clients auf der Karte - * - * @return client x position - */ - public int getClientPosX(){ - return this.mapView.getX(this.client); - } + /** + * Liefert Y-Position des Clients auf der Karte + * + * @return + */ + public int getClientPosY(){ + return this.mapView.getY(this.client); + } - /** - * Liefert Y-Position des Clients auf der Karte - * - * @return - */ - public int getClientPosY(){ - return this.mapView.getY(this.client); - } + /** + * Liefert Z-Position des Clients + * + * @return + */ + public int getClientPosZ(){ + return this.mapView.getZ(this.client); + } - /** - * Liefert Z-Position des Clients - * - * @return - */ - public int getClientPosZ(){ - return this.mapView.getZ(this.client); - } + /** + * Check for invisibility + * + * @return <code>true</code> if invisible, <code>false</code> else + */ + public boolean isInvisible(){ + return this.invisble; + } - /** - * Check for invisibility - * - * @return <code>true</code> if invisible, <code>false</code> else - */ - public boolean isInvisible(){ - return this.invisble; - } + /** + * Setter for invisibility + * + * @param value - + * boolean value for invisibility + */ + public void setInvisible(boolean value){ + this.invisble = value; + } - /** - * Setter for invisibility - * - * @param value - - * boolean value for invisibility - */ - public void setInvisible(boolean value){ - this.invisble = value; - } + /*************************************************************************** + * + * API f\xFCr die GUI + * + **************************************************************************/ - /*************************************************************************** - * - * API f\xFCr die GUI - * - **************************************************************************/ + public void connect(ServerConnectCallback callback){ + // Wir selber... + this.client = new ClientNode(this.nodeModel); + this.client.setName(Settings.getClientName()); + this.client.setMacAddress(Settings.getClientMAC()); + // this.nodeModel.addNode(client); - public void connect(ServerConnectCallback callback){ - // Wir selber... - this.client = new ClientNode(this.nodeModel); - this.client.setName(Settings.getClientName()); - this.client.setMacAddress(Settings.getClientMAC()); - // this.nodeModel.addNode(client); + if (Settings.isStandAlone()) + this.serverManager = new VirtualServerManager(this); + else + this.serverManager = new SOAPServerManager(this); + // Poller erzeugen (ben\xF6tigt ServerManager) + this.poller = new ServerPoller(this.serverManager, this.pollhandler); + this.serverManager.connect(callback); - if (Settings.isStandAlone()) - this.serverManager = new VirtualServerManager(this); - else - this.serverManager = new SOAPServerManager(this); - // Poller erzeugen (ben\xF6tigt ServerManager) - this.poller = new ServerPoller(this.serverManager, this.pollhandler); - this.serverManager.connect(callback); + // Start all plugins + PluginHandler.getInstance().connect(); + this.pluginManager.connect(); + } - // Start all plugins - PluginHandler.getInstance().connect(); - this.pluginManager.connect(); - } + public void disconnect(ServerDisconnectCallback callback){ + // Stop all plugins + PluginHandler.getInstance().dispose(); + this.pluginManager.dispose(); - public void disconnect(ServerDisconnectCallback callback){ - // Stop all plugins - PluginHandler.getInstance().dispose(); - this.pluginManager.dispose(); + if (isMapLoaded()) closeMap(); - if (isMapLoaded()) closeMap(); + this.serverManager.disconnect(callback); + } - this.serverManager.disconnect(callback); - } + /** + * Erzeugt einen Referenzpunkt auf der aktuellen Karte mit den aktuellen + * Messwerten des Clients mit den angegebenen Koordinaten. + */ + public void createLocation(int x, int y, int z, String name, boolean fixed, CreatePositionCallback callback){ + if (!isConnected() || !isMapLoaded()) + callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); + else + this.serverManager.createLocation(x, y, z, fixed, name, callback); + } - /** - * Erzeugt einen Referenzpunkt auf der aktuellen Karte mit den aktuellen - * Messwerten des Clients mit den angegebenen Koordinaten. - */ - public void createLocation(int x, int y, int z, String name, boolean fixed, CreatePositionCallback callback){ - if (!isConnected() || !isMapLoaded()) - callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); - else - this.serverManager.createLocation(x, y, z, fixed, name, callback); - } + /** + * Erzeugt eine Geokoordinate auf der aktuellen Karte mit den angegebenen + * Koordinaten. + */ + public void createGeoPos(int x, int y, GeoPos geoPos, String mapName, boolean fixed, CreatePositionCallback callback){ + if (!isConnected() || !isMapLoaded()) + callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); + else { + this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback); + this.poller.geomapTimerTask().run(); + } + } - /** - * Erzeugt eine Geokoordinate auf der aktuellen Karte mit den angegebenen - * Koordinaten. - */ - public void createGeoPos(int x, int y, GeoPos geoPos, String mapName, boolean fixed, CreatePositionCallback callback){ - if (!isConnected() || !isMapLoaded()) - callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); - else { - this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback); - this.poller.geomapTimerTask().run(); - } - } + /** + * Creates an InfoObject on the current map with the supplied parameters + * @param x + * @param y + * @param z + * @param infoObject + * @param mapName + * @param fixed + * @param callback + */ + public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed, + CreatePositionCallback callback){ + if (!isConnected() || !isMapLoaded()) + callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); + else { + // serverManager.createInfoObject(x, y, z, fixed, infoObject, + // mapName, callback); + INodeModel model = Controller.getInstance().getNodeModel(); + if (infoObject instanceof InfoObjectNode) { + InfoObjectNode node = (InfoObjectNode) infoObject; + model.addNode(node); + node.setPosition(x, y, z); + node.setFix(false); + System.out.println("Added Info:\n -> " + node.toString()); + } else { + InfoObjectNode node = new InfoObjectNode(model, infoObject); + model.addNode(node); + node.setPosition(x, y, z); + node.setFix(false); + System.out.println("Added Info:\n -> " + node.toString()); + } - /** - * Creates an InfoObject on the current map with the supplied parameters - * - * @param lastX - * @param lastY - * @param infoObject - * @param string - * @param b - * @param panel - */ - public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed, - CreatePositionCallback callback){ - if (!isConnected() || !isMapLoaded()) - callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); - else { - // serverManager.createInfoObject(x, y, z, fixed, infoObject, - // mapName, callback); - INodeModel model = Controller.getInstance().getNodeModel(); - if (infoObject instanceof InfoObjectNode) { - InfoObjectNode node = (InfoObjectNode) infoObject; - model.addNode(node); - node.setPosition(x, y, z); - node.setFix(false); - System.out.println("Added Info:\n -> " + node.toString()); - } else { - InfoObjectNode node = new InfoObjectNode(model, infoObject); - model.addNode(node); - node.setPosition(x, y, z); - node.setFix(false); - System.out.println("Added Info:\n -> " + node.toString()); - } + } + } - } - } + /** + * + * @param name + * @param mapname + * @param callback + */ + public void deletePosition(String name, String mapname, DeletePositionCallback callback){ + Node node = this.nodeModel.findNode(name); + if (node != null) if (node.getId() != -1) + this.serverManager.deletePosition(node.getId(), Controller.getInstance().getCurrentMap().name, callback); + else + System.out.println("Node has no positionId, so its position cannot be deleted."); + } - /** - * Entfernt einen - * - * @param node - */ - public void deletePosition(String name, String mapname, DeletePositionCallback callback){ - Node node = this.nodeModel.findNode(name); - if (node != null) if (node.getId() != -1) - this.serverManager.deletePosition(node.getId(), Controller.getInstance().getCurrentMap().name, callback); - else - System.out.println("Node has no positionId, so its position cannot be deleted."); - } + /** + * + * @param name + * @param string + * @param callback + */ + public void deleteGeoPoint(String name, String string, DeletePositionCallback callback){ + Node node = this.nodeModel.findNode(name); + if (node != null) if (node.getId() != -1) + this.serverManager.deleteGeoPoint(node.getId(), Controller.getInstance().getCurrentMap().name, callback); + else + System.out.println("Node has no positionId, so its position cannot be deleted."); + } - /** - * @param name - * @param string - * @param panel - */ - public void deleteGeoPoint(String name, String string, DeletePositionCallback callback){ - Node node = this.nodeModel.findNode(name); - if (node != null) if (node.getId() != -1) - this.serverManager.deleteGeoPoint(node.getId(), Controller.getInstance().getCurrentMap().name, callback); - else - System.out.println("Node has no positionId, so its position cannot be deleted."); - } + public void setClientPosition(final int x, final int y, final int z, final boolean fixed, final String clientMac, + final PositionCallback callback){ - public void setClientPosition(final int x, final int y, final int z, final boolean fixed, final String clientMac, - final PositionCallback callback){ + this.serverManager.setClientPosition(x, y, z, fixed, clientMac, callback); + } - this.serverManager.setClientPosition(x, y, z, fixed, clientMac, callback); - } + public void setAccessPointPosition(final int x, final int y, final int z, boolean fixed, + final String accessPointMac, final PositionCallback callback){ - public void setAccessPointPosition(final int x, final int y, final int z, boolean fixed, - final String accessPointMac, final PositionCallback callback){ + this.serverManager.setAccessPointPosition(x, y, z, fixed, accessPointMac, callback); + } - this.serverManager.setAccessPointPosition(x, y, z, fixed, accessPointMac, callback); - } + public void setAccessPointHiddenStatus(String accessPointMac, boolean hidden, PositionCallback callback){ - public void setAccessPointHiddenStatus(String accessPointMac, boolean hidden, PositionCallback callback){ + this.serverManager.setAccessPointHiddenStatus(accessPointMac, hidden, callback); + } - this.serverManager.setAccessPointHiddenStatus(accessPointMac, hidden, callback); - } + public void movePosition(final long positionId, final String mapname, final int x, final int y, final int z, + boolean fixed, final MovePositionCallback callback){ - public void movePosition(final long positionId, final String mapname, final int x, final int y, final int z, - boolean fixed, final MovePositionCallback callback){ + this.serverManager.movePosition(positionId, mapname, x, y, z, fixed, callback); + } - this.serverManager.movePosition(positionId, mapname, x, y, z, fixed, callback); - } + /** + * Holt Karte vom Server. Ergebnis via Callback + * + * @param name + * @param callback + */ + public void retrieveMap(String name, MapCallback callback){ + this.serverManager.retrieveMap(name, callback); + getMapView().setTitle(GUIUtils.i18n("map", false) + " - " + name); + } - /** - * Holt Karte vom Server. Ergebnis via Callback - * - * @param name - * @param callback - */ - public void retrieveMap(String name, MapCallback callback){ - this.serverManager.retrieveMap(name, callback); - getMapView().setTitle(GUIUtils.i18n("map", false) + " - " + name); - } + public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){ + this.serverManager.retrieveMapNames(callback, openMapDialog); + } - public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){ - this.serverManager.retrieveMapNames(callback, openMapDialog); - } + public void createNewMap(final String name, final String URL, final int imageWidth, final int imageHeight, + final int width, final int height, final CreateNewMapCallback callback){ - public void createNewMap(final String name, final String URL, final int imageWidth, final int imageHeight, - final int width, final int height, final CreateNewMapCallback callback){ + this.serverManager.createNewMap(name, URL, imageWidth, imageHeight, width, height, callback); + } - this.serverManager.createNewMap(name, URL, imageWidth, imageHeight, width, height, callback); - } + public Collection<InfoObject> getInfoObjects(){ + return this.infoObjects; + } - public Collection<InfoObject> getInfoObjects(){ - return this.infoObjects; - } + public void handleRoundComplete(AbstractScanner scanner){ + this.scannerAllocator.handleRoundComplete(scanner); + } - public void handleRoundComplete(AbstractScanner scanner){ - this.scannerAllocator.handleRoundComplete(scanner); - } + public void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner){ + this.scannerAllocator.handleScanResult(scanResult, scanner); + } - public void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner){ - this.scannerAllocator.handleScanResult(scanResult, scanner); - } + public void addScannerHandler(AbstractScannerHandler handler){ + this.scannerAllocator.addScanResultHandler(handler); + } - public void addScannerHandler(AbstractScannerHandler handler){ - this.scannerAllocator.addScanResultHandler(handler); - } - - public InfoObjectProviderRegistry getInfoProviderRegistry(){ - return this.infoServiceRegistry; - } + public InfoObjectProviderRegistry getInfoProviderRegistry(){ + return this.infoServiceRegistry; + } } Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.java 2006-11-07 18:53:59 UTC (rev 477) @@ -0,0 +1,32 @@ +package net.sf.magicmap.client.gui.forms; + +import javax.swing.*; +import java.util.*; + +/** + * Created by IntelliJ IDEA. + * User: Jan + * Date: 03.11.2006 + * Time: 14:18:25 + * To change this template use File | Settings | File Templates. + */ +public abstract class AbstractForm<C> implements Form<C>, Iterable<Attribute<C>>{ + + private final Collection<Attribute<C>> attributes = new LinkedList<Attribute<C>>(); + + public void addAttribute(String attributeName, String className, C constraints) { + this.attributes.add(new Attribute<C>(attributeName, className, constraints)); + } + + public void addLabel(String forAttribute, JComponent component, C constraints) { + this.attributes.add(new Attribute<C>(forAttribute, "", constraints, component)); + } + + public void addForm(Form form, C constraints) { + attributes.add(new Attribute<C>( "", constraints, form)); + } + public Iterator<Attribute<C>> iterator(){ + return attributes.iterator(); + } + +} Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java 2006-11-07 18:53:59 UTC (rev 477) @@ -8,61 +8,91 @@ * @see net.sf.magicmap.client.gui.forms.UserInterface * @see net.sf.magicmap.client.gui.forms.Form */ -public final class Attribute { +public class Attribute<C> { - private final String name; - private final String className; - private final Object constrains; - private final JComponent component; + private final String name; + private final String className; + private final C constrains; + private final JComponent component; + private final Form form; - /** - * creates an attribute. - * - * @param name the attributes name - * @param className not used - far later - * @param constrains the layout constraints - */ - public Attribute(String name, String className, Object constrains) { - this(name, className, constrains, null); - } - /** - * Create an Label for an Attribute - * - * @param name the attributes name this label is for - * @param className not used - * @param constrains the layout constraints - * @param component the label. - */ - public Attribute(String name, String className, Object constrains, JComponent component) { - this.name = name; - this.className = className; - this.constrains = constrains; - this.component = component; - } - public String getAttributeName(){ - return this.name; - } + /** + * creates an attribute. + * + * @param name the attributes name + * @param className not used - far later + * @param constrains the layout constraints + */ + public Attribute(String name, String className, C constrains) { + this(name, className, constrains, (JComponent)null); + } - public String getClassName(){ - return this.className; - } + /** + * Create an Label for an Attribute + * + * @param name the attributes name this label is for + * @param className not used + * @param constrains the layout constraints + * @param component the label. + */ + public Attribute(String name, String className, C constrains, JComponent component) { + this.name = name; + this.className = className; + this.constrains = constrains; + this.component = component; + form = null; + } - public Object getConstraints(){ - return this.constrains; - } + /** + * + * @param className + * @param constrains + * @param form + */ + public Attribute(String className, C constrains, Form form) { + this.name = ""; + this.className = className; + this.constrains = constrains; + this.form = form; + this.component = null; + } - public JComponent getComponent(){ - return this.component; - } + public String getAttributeName(){ + return this.name; + } - @Override - public String toString(){ - return ""; - } + public String getClassName(){ + return this.className; + } - public String toXml(){ - return ""; - } + public C getConstraints(){ + return this.constrains; + } + + /** + * Returns the attributes visual proxy. + * @param ui + * @return + */ + public JComponent getComponent(UserInterface ui){ + if (this.component != null) + return this.component; + else if (this.form != null) + return this.form.attatch((ui)); + else return ui.visualProxy(this.name, null); + } + + public Form getForm(){ + return form; + } + @Override + public String toString(){ + return ""; + } + + public String toXml(){ + return ""; + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java 2006-11-07 18:53:59 UTC (rev 477) @@ -8,7 +8,7 @@ * * Attribute sind keine Properties..... */ -public interface Form { +public interface Form<C> { /** * @@ -16,7 +16,7 @@ * @param className * @param constraints */ - public void addAttribute(String attributeName, String className, Object constraints); + public void addAttribute(String attributeName, String className, C constraints); /** * @@ -24,11 +24,13 @@ * @param component * @param constraints */ - public void addLabel(String forAttribute, JComponent component, Object constraints); + public void addLabel(String forAttribute, JComponent component, C constraints); - /** + public void addForm(Form form, C constraints); + + /** * Attatch this form to a model. * @param ui */ - public JComponent attatch(UserInterface ui); + public JComponent attatch (UserInterface ui); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java 2006-11-07 18:53:59 UTC (rev 477) @@ -1,11 +1,9 @@ package net.sf.magicmap.client.gui.forms; -import java.util.Collection; -import java.util.LinkedList; +import javax.swing.*; import javax.swing.JComponent; - import com.jgoodies.forms.builder.PanelBuilder; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; @@ -13,67 +11,47 @@ /** * */ -public class FormLayoutForm implements Form, Cloneable { +public class FormLayoutForm extends AbstractForm<CellConstraints>{ - private final FormLayout layout; - private final Collection<Attribute> attributes = new LinkedList<Attribute>(); - private JComponent form = null; - public FormLayoutForm(String colSpecs, String rowSpecs) { - this.layout = new FormLayout(colSpecs, rowSpecs); - } + private final FormLayout layout; + private JComponent form = null; - public FormLayoutForm(FormLayout layout) { - this.layout = layout; - } + public FormLayoutForm(String colSpecs, String rowSpecs) { + this.layout = new FormLayout(colSpecs, rowSpecs); + } - /** - * - * @param attributeName - * @param className - * @param constraints - */ - public void addAttribute(String attributeName, String className, Object constraints){ - this.attributes.add(new Attribute(attributeName, className, constraints)); - } + public FormLayoutForm(FormLayout layout) { + this.layout = layout; + } - /** - * - * @param forAttribute - * @param component - * @param constraints - */ - public void addLabel(String forAttribute, JComponent component, Object constraints){ - this.attributes.add(new Attribute(forAttribute, "", constraints, component)); - } - /** - * - * @param ui - * @return - */ - public JComponent attatch(UserInterface ui){ - PanelBuilder pb = new PanelBuilder(this.layout); - CellConstraints cc = null; + /** + * + * @param ui + * @return + */ + public JComponent attatch(UserInterface ui){ + PanelBuilder pb = new PanelBuilder(this.layout); + CellConstraints cc; - for (Attribute attribute : this.attributes) - if (attribute.getComponent() != null) { - cc = new CellConstraints(attribute.getConstraints().toString()); - pb.add(attribute.getComponent(), cc); - } else { - cc = new CellConstraints(attribute.getConstraints().toString()); - JComponent component = ui.visualProxy(attribute.getAttributeName(), null); - pb.add(component, cc); - } - this.form = pb.getPanel(); - return this.form; - } - - /** - * - * @return - */ - protected final FormLayout getLayout(){ - return this.layout; - } + /** + * + */ + for (Attribute<CellConstraints> attribute : this){ + cc = attribute.getConstraints(); + JComponent c = attribute.getComponent(ui); + pb.add(c,cc); + } + form = pb.getPanel(); + return this.form; + } + /** + * + * @return + */ + protected final FormLayout getLayout(){ + return this.layout; + } } + Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2006-11-07 18:53:59 UTC (rev 477) @@ -17,107 +17,94 @@ import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.SAXReader; +import com.jgoodies.forms.layout.CellConstraints; /** */ public class FormLayoutReader { - private Document document; - private ResourceBu... [truncated message content] |