|
From: <fle...@us...> - 2007-02-25 15:50:59
|
Revision: 572
http://svn.sourceforge.net/magicmap/?rev=572&view=rev
Author: flederohr
Date: 2007-02-25 07:50:28 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
Reconstructed the GUI Components
MainGUI is no longer a JFrame itself but provides a JFrame(MainFrame) as a field
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/ViewTabPanel.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/ConnectServerDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/ViewOptionsDialog.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIConstants.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/ConsoleView.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapNamesCallback.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java
trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java
trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginManager.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -179,7 +179,7 @@
this.nodeModel.addNode(this.client);
// TODO: Interface f\xFCr GUI mit methode loadMap()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).loadMap(map);
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).loadMap(map);
} catch (MalformedURLException e) {
System.out.println("Map loading failed." + e.getMessage());
closeMap();
@@ -194,7 +194,7 @@
if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0)
// TODO: Interface f\xFCr GUI mit methode setMapTitle()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).setTitle(GUIUtils.i18n("map", false)
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false)
+ " - " + this.currentMap.name + " Gr\xF6\xDFe: " + this.currentMap.realwidth + " X "
+ this.currentMap.realheight + " cm");
}
@@ -233,7 +233,7 @@
}
this.currentMap = null;
// TODO: Interface f\xFCr GUI mit methode unloadMap()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).unloadMap();
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).unloadMap();
this.serverManager.closeMap();
this.poller.stop();
this.measurementModel.clear();
@@ -341,7 +341,6 @@
callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen."));
else {
this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback);
- this.poller.geomapTimerTask().run();
}
}
@@ -440,7 +439,7 @@
public void retrieveMap(String name, MapCallback callback){
this.serverManager.retrieveMap(name, callback);
// TODO: Interface f\xFCr GUI mit methode setMapTitle()
- ((MapView) MainGUI.getInstance().getViewComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ ((MapView) MainGUI.getInstance().getJComponent("mapView")).setTitle(GUIUtils.i18n("map", false) + " - "
+ name);
}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -183,8 +183,6 @@
String[] names = SOAPServerManager.this.mapDelegate.getMapNames();
if (openDialog)
callback.openMapDialog(names);
- else
- callback.addMapNamesToOutline(names);
} catch (Exception e) {
e.printStackTrace();
callback.getMapNamesError(e);
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -11,7 +11,6 @@
import net.sf.magicmap.client.interfaces.FetchGeoPointsCallback;
import net.sf.magicmap.client.interfaces.FetchInfoPointsCallback;
-import net.sf.magicmap.client.interfaces.FetchMapsCallback;
import net.sf.magicmap.client.interfaces.FetchPositionsCallback;
import net.sf.magicmap.client.interfaces.ServerPollerListener;
import net.sf.magicmap.client.model.node.InfoObject;
@@ -26,12 +25,7 @@
* oder vom Anwender erzeugte Referenzpunkte.
* @author thuebner
*/
-public class ServerPoller
- implements
- FetchPositionsCallback,
- FetchGeoPointsCallback,
- FetchMapsCallback,
- FetchInfoPointsCallback {
+public class ServerPoller implements FetchPositionsCallback, FetchGeoPointsCallback, FetchInfoPointsCallback {
private static String syncObj = "TEST";
@@ -48,7 +42,7 @@
public void start(){
this.timer.scheduleAtFixedRate(builderTimerTask(), Settings.POLL_DELAY, Settings.getPollIntevall());
- this.timer.scheduleAtFixedRate(geomapTimerTask(), Settings.POLL_DELAY + 1000, 120000);
+ this.timer.scheduleAtFixedRate(geoPointsTimerTask(), Settings.POLL_DELAY + 1000, 120000);
}
public void stop(){
@@ -80,7 +74,7 @@
};
}
- public TimerTask geomapTimerTask(){
+ public TimerTask geoPointsTimerTask(){
return new TimerTask() {
@Override
@@ -89,7 +83,6 @@
if (!ServerPoller.this.isFetching) {
ServerPoller.this.isFetching = true;
ServerPoller.this.serverManager.fetchGeoPointsFromServer(ServerPoller.this);
- ServerPoller.this.serverManager.fetchMapsFromServer(ServerPoller.this);
}
}
}
@@ -168,16 +161,6 @@
}
/* (non-Javadoc)
- * @see net.sf.magicmap.client.interfaces.FetchMapsCallback#mapFetchError(java.lang.Exception)
- */
- public void mapFetchError(Exception e){
- e.printStackTrace();
- synchronized (ServerPoller.syncObj) {
- this.isFetching = false;
- }
- }
-
- /* (non-Javadoc)
* @see net.sf.magicmap.client.interfaces.FetchInfoPointsCallback#infoPointFetchError(java.lang.Exception)
*/
public void infoPointFetchError(Exception e){
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -185,8 +185,6 @@
if (openDialog) {
callback.openMapDialog(names);
- } else {
- callback.addMapNamesToOutline(names);
}
} catch (Exception e) {
e.printStackTrace();
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -57,7 +57,7 @@
GUIUtils.setPlasticLookAndFeel();
GUIUtils.setLocale(Locale.getDefault());
- JFrame frame = MainGUI.getInstance();
+ JFrame frame = MainGUI.getInstance().getMainFrame();
GUIUtils.locateOnScreen(frame);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainFrame.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -0,0 +1,755 @@
+
+package net.sf.magicmap.client.gui;
+
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.HeadlessException;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.rmi.RemoteException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JOptionPane;
+import javax.swing.JSplitPane;
+import javax.swing.JToolBar;
+
+import net.sf.magicmap.client.controller.Controller;
+import net.sf.magicmap.client.gui.dialogs.AboutDialog;
+import net.sf.magicmap.client.gui.dialogs.ConnectServerDialog;
+import net.sf.magicmap.client.gui.dialogs.LoadMapDialog;
+import net.sf.magicmap.client.gui.dialogs.NewMapDialog;
+import net.sf.magicmap.client.gui.dialogs.SetProxyDialog;
+import net.sf.magicmap.client.gui.dialogs.ViewOptionsDialog;
+import net.sf.magicmap.client.gui.utils.GUIBuilder;
+import net.sf.magicmap.client.gui.utils.GUIConstants;
+import net.sf.magicmap.client.gui.utils.GUIUtils;
+import net.sf.magicmap.client.gui.utils.MagicAction;
+import net.sf.magicmap.client.gui.views.ConsoleView;
+import net.sf.magicmap.client.gui.views.MapView;
+import net.sf.magicmap.client.gui.views.MeasurementView;
+import net.sf.magicmap.client.gui.views.OutlineView;
+import net.sf.magicmap.client.interfaces.CreateNewMapCallback;
+import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
+import net.sf.magicmap.client.interfaces.MapNamesCallback;
+import net.sf.magicmap.client.interfaces.ServerConnectCallback;
+import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
+import net.sf.magicmap.client.meta.MapInfo;
+import net.sf.magicmap.client.meta.ServerConnectionInfo;
+import net.sf.magicmap.client.utils.Settings;
+import net.sf.magicmap.client.utils.Version;
+
+import org.apache.axis.AxisFault;
+
+import com.Ostermiller.util.Browser;
+import com.brunchboy.util.swing.relativelayout.AttributeConstraint;
+import com.brunchboy.util.swing.relativelayout.AttributeType;
+import com.brunchboy.util.swing.relativelayout.DependencyManager;
+import com.brunchboy.util.swing.relativelayout.RelativeLayout;
+import com.jgoodies.uif_lite.component.UIFSplitPane;
+
+public class MainFrame extends JFrame
+implements
+ServerConnectCallback,
+ServerDisconnectCallback,
+CreateNewMapCallback,
+MapNamesCallback,
+LoadMapDialogListener {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = -3842976532877305041L;
+ private JMenuBar menuBar;
+ private JToolBar toolBar;
+ private StatusPanel statusBar;
+ private MapPanel mapPanel;
+ private OutlineView outlineView;
+ private ConsoleView consoleView;
+ private MapView mapView;
+ private MeasurementView measurementView;
+ private ViewTabPanel bottomRightTabPanel;
+ private RelativeLayout layout;
+ private AbstractAction connectAction;
+ private AbstractAction setProxyAction;
+ private AbstractAction disconnectAction;
+ private AbstractAction newMapAction;
+ private AbstractAction loadMapAction;
+ private AbstractAction exitAction;
+ private AbstractAction aboutAction;
+ private AbstractAction onlineHelp;
+ private MagicAction invisibleAction;
+ private MagicAction simpleView;
+ private MagicAction normalView;
+ private MagicAction expertView;
+ private MagicAction userDefinedView;
+ private static final int numberOfdataInvocationRateAction = 10;
+ private MagicAction[] dataInvocationRateAction;
+
+ public MainFrame() throws HeadlessException {
+ super();
+
+ // Aktionen erstellen
+ buildActions();
+
+ // Layout vorbereiten
+ this.layout = new RelativeLayout();
+ Container pane = this.getContentPane();
+ pane.setLayout(this.layout);
+
+ // Hauptfenstereigenschaften setzen
+ this.setSize(new Dimension(1024, 768));
+ this.setTitle("MagicMap - Version " + Version.getVersion());
+ this.setIconImage(GUIBuilder.getToolIcon("MagicMap.png", ".").getImage());
+
+ //Menu erstellen
+ this.menuBar = new JMenuBar();
+ this.setJMenuBar(this.menuBar);
+ this.menuBar.add(buildFileMenu());
+ this.menuBar.add(buildViewMenu());
+ this.menuBar.add(buildOptionsMenu());
+ this.menuBar.add(buildHelpMenu());
+ MainGUI.getInstance().registerJComponent(menuBar, "menuBar");
+
+ // Statusleiste erstelelen
+ this.statusBar = new StatusPanel();
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+
+ // ToolBar erstellen
+ this.toolBar = new JToolBar();
+ this.toolBar.setRollover(true);
+ // toolBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
+ // menuBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
+ addMainToolBarButtons(this.toolBar);
+
+ // Komponenten einf\xFCgen in das ContentPane
+ pane.add(this.toolBar, "toolbar");
+ pane.add(buildMainPane(), "mainpane");
+ pane.add(this.statusBar, "status");
+
+ // Einige Constrains bzgl. Layout definieren:
+
+ // ToolBar ganz oben
+ this.layout.addConstraint("toolbar", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, 0));
+ this.layout.addConstraint("toolbar", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, 0));
+ this.layout.addConstraint("toolbar", AttributeType.TOP, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.TOP, 0));
+
+ // StatusBar ganz unten
+ this.layout.addConstraint("status", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, -2));
+ this.layout.addConstraint("status", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, 2));
+ this.layout.addConstraint("status", AttributeType.BOTTOM, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.BOTTOM, -2));
+
+ // Hauptpanel dazwischen mit gewissem Abstand zum ToolBar
+ this.layout.addConstraint("mainpane", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.RIGHT, -GUIConstants.WINDOW_MARGIN));
+ this.layout.addConstraint("mainpane", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
+ AttributeType.LEFT, GUIConstants.WINDOW_MARGIN));
+ this.layout.addConstraint("mainpane", AttributeType.BOTTOM, new AttributeConstraint("status",
+ AttributeType.TOP, -5));
+ this.layout.addConstraint("mainpane", AttributeType.TOP, new AttributeConstraint("toolbar",
+ AttributeType.BOTTOM, GUIConstants.DIVIDER_SIZE));
+
+ }
+
+ /**
+ * Build the main panel
+ * @return the main panel
+ */
+ public JComponent buildMainPane(){
+ buildViews();
+
+ UIFSplitPane pane2;
+
+ this.bottomRightTabPanel = new ViewTabPanel("bottomRightTabPanel");
+ this.bottomRightTabPanel.addView(this.measurementView);
+ this.bottomRightTabPanel.addView(this.consoleView);
+ this.bottomRightTabPanel.selectView(this.measurementView);
+
+ UIFSplitPane pane = UIFSplitPane.createStrippedSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.outlineView,
+ (pane2 = UIFSplitPane.createStrippedSplitPane(JSplitPane.VERTICAL_SPLIT, this.mapPanel,
+ this.bottomRightTabPanel)));
+ pane.setDividerSize(GUIConstants.DIVIDER_SIZE);
+ pane.setDividerBorderVisible(false);
+ pane2.setDividerSize(GUIConstants.DIVIDER_SIZE);
+ pane2.setDividerBorderVisible(false);
+ pane2.setDividerLocation(1.0);
+ return pane;
+ }
+
+ /**
+ * Build the file menu
+ * @return the file menu
+ */
+ private JMenu buildFileMenu(){
+ JMenu menu = GUIBuilder.createMenu("file");
+ menu.add(GUIBuilder.createMenuItem(this.connectAction));
+ menu.add(GUIBuilder.createMenuItem(this.disconnectAction));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createMenuItem(this.newMapAction));
+ menu.add(GUIBuilder.createMenuItem(this.loadMapAction));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createMenuItem(this.exitAction));
+ return menu;
+ }
+
+ /**
+ * Sets the userDefinedView selected
+ *
+ */
+ public void setUserDefinedView(){
+ this.simpleView.setSelected(false);
+ this.normalView.setSelected(false);
+ this.expertView.setSelected(false);
+ this.userDefinedView.setSelected(true);
+ }
+
+ /**
+ * Build the map menu
+ * @return the map menu
+ */
+ public JMenu buildMapMenu(){
+ JMenu menu = GUIBuilder.createMenu("map");
+ menu.add(GUIBuilder.createMenuItem(this.exitAction));
+ return menu;
+ }
+
+ /**
+ * Build the view menu
+ * @return the view menu
+ */
+ public JMenu buildViewMenu(){
+ JMenu menu = GUIBuilder.createMenu("view");
+ /* menu.add(GUIBuilder.createCheckBoxMenuItem(showAccessPoints, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showClients, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showLocations, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showEdges, true));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(showEdgesBetweenLocations, true));
+ */
+
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.simpleView, false));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.normalView, false));
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.expertView, false));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.userDefinedView, false));
+ this.normalView.setSelected(true);
+ return menu;
+ }
+
+ /**
+ * Build the options menu
+ * @return the options menu
+ */
+ public JMenu buildOptionsMenu(){
+ JMenu menu = GUIBuilder.createMenu("options");
+ menu.add(GUIBuilder.createCheckBoxMenuItem(this.invisibleAction, Controller.getInstance().isInvisible()));
+ menu.add(GUIBuilder.createMenuItem(this.setProxyAction));
+ JMenu dataInvocationRate = GUIBuilder.createMenu("datainvocationrate");
+ menu.add(dataInvocationRate);
+ for (int i = 0; i < MainFrame.numberOfdataInvocationRateAction; i++)
+ dataInvocationRate.add(GUIBuilder.createCheckBoxMenuItem(this.dataInvocationRateAction[i], false));
+ this.dataInvocationRateAction[4].setSelected(true);
+
+ return menu;
+ }
+
+ /**
+ * Build the help menu
+ * @return the help menu
+ */
+ public JMenu buildHelpMenu(){
+ Browser.init();
+ JMenu menu = GUIBuilder.createMenu("help");
+ menu.add(GUIBuilder.createMenuItem(this.onlineHelp));
+ menu.addSeparator();
+ menu.add(GUIBuilder.createMenuItem(this.aboutAction));
+ return menu;
+ }
+
+ /**
+ * Erzeugt die Hauptviews der Anwendung
+ */
+ private void buildViews(){
+ this.outlineView = new OutlineView(Controller.getInstance().getNodeModel(), "outlineView");
+ this.consoleView = new ConsoleView("consoleView");
+ this.mapView = new MapView(Controller.getInstance().getNodeModel(), null, "mapView");
+ this.measurementView = new MeasurementView(Controller.getInstance().getMeasurementModel(), Controller
+ .getInstance().getNodeModel(), "measurementView");
+ this.mapPanel = new MapPanel("mapPanel");
+ this.mapPanel.setMapView(this.mapView);
+ }
+
+ /**
+ * Add buttons to main toolbar
+ * @param bar - the toolbar
+ */
+ public void addMainToolBarButtons(JToolBar bar){
+ JButton button = null;
+ button = GUIBuilder.createToolButton(this.connectAction);
+ bar.add(button);
+ button = GUIBuilder.createToolButton(this.disconnectAction);
+ bar.add(button);
+ bar.addSeparator();
+ button = GUIBuilder.createToolButton(this.newMapAction);
+ bar.add(button);
+ button = GUIBuilder.createToolButton(this.loadMapAction);
+ bar.add(button);
+ bar.addSeparator();
+ bar.add(GUIBuilder.createToolToggleButton(this.invisibleAction));
+
+ // bar.addSeparator();
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerConnectCallback#connected(long)
+ */
+ public void connected(long sesssionId){
+
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_CONNECTED));
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.connectAction.setEnabled(false);
+ this.disconnectAction.setEnabled(true);
+ this.newMapAction.setEnabled(true);
+ this.loadMapAction.setEnabled(true);
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ // Controller.getInstance().retrieveMapNames(MainGUI.this, false);
+
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerConnectCallback#connectionError(java.lang.Exception)
+ */
+ public void connectionError(Exception e){
+ this.connectAction.setEnabled(true);
+ this.disconnectAction.setEnabled(false);
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+
+ if (e instanceof AxisFault) {
+ AxisFault f = (AxisFault) e;
+ if (GUIUtils.showAuthentificationError(f.getFaultString()))
+ connect();
+ else
+ this.connectAction.actionPerformed(new ActionEvent(this, 0, ""));
+ } else if (e instanceof RemoteException) if (GUIUtils.showConnectError())
+ connect();
+ else
+ this.connectAction.actionPerformed(new ActionEvent(this, 0, ""));
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerDisconnectCallback#disconnected()
+ */
+ public void disconnected(){
+ this.connectAction.setEnabled(true);
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.disconnectAction.setEnabled(false);
+ this.newMapAction.setEnabled(false);
+ this.loadMapAction.setEnabled(false);
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.ServerDisconnectCallback#disconnectionError(java.lang.Exception)
+ */
+ public void disconnectionError(Exception e){
+ this.connectAction.setEnabled(true);
+ this.disconnectAction.setEnabled(false);
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
+ //JOptionPane.showMessageDialog(this, "Fehler beim Trennen der Verbindung:\n\n " + e.getMessage());
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.CreateNewMapCallback#newMapCreated()
+ */
+ public void newMapCreated(MapInfo map){
+ Controller.getInstance().setCurrentMap(map);
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.CreateNewMapCallback#createNewMapError(java.lang.Exception)
+ */
+ public void createNewMapError(Exception e){
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ JOptionPane.showMessageDialog(this, "Fehler beim Erzeugen der Karte\n\n " + e.getMessage() + "\n"
+ + sw.toString());
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.MapNamesCallback#mapNamesReceived(java.lang.String[])
+ */
+ public void openMapDialog(String[] names){
+ LoadMapDialog.showDialog(this, names, this);
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.MapNamesCallback#getMapNamesError(java.lang.Exception)
+ */
+ public void getMapNamesError(Exception e){
+ // currently no implementation
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.client.interfaces.LoadMapDialogListener#loadMap(net.sf.magicmap.client.meta.MapInfo)
+ */
+ public synchronized void loadMap(MapInfo info){
+ Controller.getInstance().setCurrentMap(info);
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ this.invisibleAction.setEnabled(true);
+ this.simpleView.setEnabled(true);
+ this.normalView.setEnabled(true);
+ this.expertView.setEnabled(true);
+ this.userDefinedView.setEnabled(true);
+
+ }
+
+ /**
+ * Wechselt zwischen Sichtbar und Unsichtbar
+ *
+ */
+ protected void toogleInvisible(){
+ Controller.getInstance().setInvisible(!Controller.getInstance().isInvisible());
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ }
+
+ /**
+ * Connect to server
+ */
+ protected void connect(){
+ setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_CONNECTING));
+ this.statusBar.setInvisible(Controller.getInstance().isInvisible());
+ Controller.getInstance().connect(this);
+ }
+
+
+ /**
+ * Action builder for the action of the GUI
+ *
+ */
+ public void buildActions(){
+
+ this.connectAction = new MagicAction("connect", GUIConstants.ICON_CONNECT, "connecttooltip") {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 8256739041910656216L;
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
+ public void actionPerformed(ActionEvent e){
+ ServerConnectionInfo info = new ServerConnectionInfo();
+ info.hostname = Settings.getHostname();
+ info.port = Settings.getPort();
+ info.name = Settings.getClientName();
+ info.password = Settings.getClientPassword();
+ info.useNoServer = Settings.isStandAlone();
+ info = ConnectServerDialog.showDialog(MainFrame.this, info);
+ if (info != null) {
+
+ Settings.setClientName(info.name);
+ Settings.setClientPassword(info.password);
+ Settings.setServerURL(info.hostname, info.port);
+ Settings.setStandAlone(info.useNoServer);
+ connect();
+ }
+ //TODO: hier die Mapnamen einlesen und im Tree
+ }
+ };
+
+ this.setProxyAction = new MagicAction("setproxy", GUIConstants.ICON_CONNECT, "setproxytooltip") {
+
+ /**
+ * serial version id
+ */
+ private static final long serialVersionUID = 8620117054998094069L;
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
+ public void actionPerformed(ActionEvent e){
+ SetProxyDialog.showDialog(MainFrame.this);
+ }
+ };
+
+ this.disconnectAction = new MagicAction("disconnect", GUIConstants.ICON_DISCONNECT, "disconnecttooltip") {
+
+ /**
+ * serial version id
+ */
+ 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(MainFrame.this);
+ }
+ };
+
+ this.newMapAction = new MagicAction("newmap", GUIConstants.ICON_NEWMAP, "newmaptooltip") {
+
+ /**
+ * 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(MainFrame.this);
+ if (info != null)
+ Controller.getInstance().createNewMap(info.name, info.imageURL, info.width, info.height,
+ info.realwidth, info.realheight, MainFrame.this);
+ }
+ };
+
+ this.loadMapAction = new MagicAction("loadmap", GUIConstants.ICON_LOADMAP, "loadmaptooltip") {
+
+ /**
+ * 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(MainFrame.this, true);
+ }
+ };
+
+ this.exitAction = new MagicAction("exit", GUIConstants.ICON_EXIT, "exit") {
+
+ /**
+ * 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){
+ MainFrame.this.setVisible(false);
+ System.exit(0);
+ }
+ };
+
+ this.onlineHelp = new MagicAction("onlinehelp", GUIConstants.ICON_HELP, "onlinehelptooltip") {
+
+ /**
+ * 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
+ }
+ }
+ };
+
+ this.aboutAction = new MagicAction("about") {
+
+ /**
+ * 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(MainFrame.this);
+ }
+ };
+
+ this.invisibleAction = new MagicAction("invisible", GUIConstants.ICON_INVISIBLE, "invisibletooltip") {
+
+ /**
+ * 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();
+ }
+ };
+
+
+ this.simpleView = new MagicAction("simpleview") {
+
+ /**
+ * 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);
+ */
+ MainFrame.this.mapView.setShowAccessPoints(false);
+ MainFrame.this.outlineView.collapseAPs(true);
+ MainFrame.this.mapView.setShowClients(true);
+ MainFrame.this.mapView.setShowEdges(false);
+ MainFrame.this.mapView.setShowEdgesBetweenLocations(false);
+ MainFrame.this.mapView.setShowLocations(false);
+ MainFrame.this.outlineView.collapseRPs(true);
+ MainFrame.this.mapView.setShowEdgesForSelectedNode(false);
+
+ MainFrame.this.simpleView.setSelected(true);
+ MainFrame.this.normalView.setSelected(false);
+ MainFrame.this.expertView.setSelected(false);
+ MainFrame.this.userDefinedView.setSelected(false);
+ }
+ };
+
+ this.normalView = new MagicAction("normalview") {
+
+ /**
+ * 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){
+
+ MainFrame.this.mapView.setShowAccessPoints(true);
+ MainFrame.this.outlineView.collapseAPs(false);
+ MainFrame.this.mapView.setShowClients(true);
+ MainFrame.this.mapView.setShowEdges(true);
+ MainFrame.this.mapView.setShowEdgesBetweenLocations(false);
+ MainFrame.this.mapView.setShowLocations(true);
+ MainFrame.this.outlineView.collapseRPs(false);
+ MainFrame.this.mapView.setShowEdgesForSelectedNode(true);
+
+ MainFrame.this.simpleView.setSelected(false);
+ MainFrame.this.normalView.setSelected(true);
+ MainFrame.this.expertView.setSelected(false);
+ MainFrame.this.userDefinedView.setSelected(false);
+ }
+ };
+
+ this.expertView = new MagicAction("expertview") {
+
+ /**
+ * 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){
+ MainFrame.this.mapView.setShowAccessPoints(true);
+ MainFrame.this.outlineView.collapseAPs(false);
+ MainFrame.this.mapView.setShowClients(true);
+ MainFrame.this.mapView.setShowEdges(true);
+ MainFrame.this.mapView.setShowEdgesBetweenLocations(true);
+ MainFrame.this.mapView.setShowLocations(true);
+ MainFrame.this.outlineView.collapseRPs(false);
+ MainFrame.this.mapView.setShowEdgesForSelectedNode(false);
+
+ MainFrame.this.simpleView.setSelected(false);
+ MainFrame.this.normalView.setSelected(false);
+ MainFrame.this.expertView.setSelected(true);
+ MainFrame.this.userDefinedView.setSelected(false);
+ }
+ };
+
+ this.userDefinedView = new MagicAction("userdefinedview") {
+
+ /**
+ * 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){
+ MainFrame.this.userDefinedView.setSelected(!MainFrame.this.userDefinedView.isSelected());
+ ViewOptionsDialog.showDialog(MainFrame.this);
+ }
+ };
+
+ this.dataInvocationRateAction = new MagicAction[MainFrame.numberOfdataInvocationRateAction];
+
+ for (int i = 0; i < MainFrame.numberOfdataInvocationRateAction; i++) {
+ final int thisAction = i;
+ this.dataInvocationRateAction[thisAction] = new MagicAction("dataInvocationRate" + (thisAction + 1)) {
+
+ /**
+ * 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 < MainFrame.numberOfdataInvocationRateAction; j++)
+ MainFrame.this.dataInvocationRateAction[j].setSelected(false);
+ MainFrame.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);
+ this.simpleView.setEnabled(false);
+ this.normalView.setEnabled(false);
+ this.expertView.setEnabled(false);
+ this.userDefinedView.setEnabled(false);
+ }
+
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-24 14:40:57 UTC (rev 571)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java 2007-02-25 15:50:28 UTC (rev 572)
@@ -5,96 +5,32 @@
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 java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import javax.swing.AbstractAction;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JOptionPane;
-import javax.swing.JSplitPane;
-import javax.swing.JToolBar;
-import net.sf.magicmap.client.controller.Controller;
-import net.sf.magicmap.client.gui.dialogs.AboutDialog;
-import net.sf.magicmap.client.gui.dialogs.ConnectServerDialog;
-import net.sf.magicmap.client.gui.dialogs.LoadMapDialog;
-import net.sf.magicmap.client.gui.dialogs.NewMapDialog;
-import net.sf.magicmap.client.gui.dialogs.SetProxyDialog;
-import net.sf.magicmap.client.gui.dialogs.ViewOptionsDialog;
import net.sf.magicmap.client.gui.utils.AccessPointNodeIcon;
import net.sf.magicmap.client.gui.utils.ClientNodeIcon;
-import net.sf.magicmap.client.gui.utils.GUIBuilder;
-import net.sf.magicmap.client.gui.utils.GUIConstants;
-import net.sf.magicmap.client.gui.utils.GUIUtils;
import net.sf.magicmap.client.gui.utils.GeoPosNodeIcon;
import net.sf.magicmap.client.gui.utils.LocationNodeIcon;
-import net.sf.magicmap.client.gui.utils.MagicAction;
import net.sf.magicmap.client.gui.utils.MapNodeIcon;
import net.sf.magicmap.client.gui.utils.NodeIcons;
-import net.sf.magicmap.client.gui.views.ConsoleView;
-import net.sf.magicmap.client.gui.views.MapView;
-import net.sf.magicmap.client.gui.views.MeasurementView;
-import net.sf.magicmap.client.gui.views.OutlineView;
-import net.sf.magicmap.client.interfaces.CreateNewMapCallback;
-import net.sf.magicmap.client.interfaces.LoadMapDialogListener;
-import net.sf.magicmap.client.interfaces.MapNamesCallback;
-import net.sf.magicmap.client.interfaces.ServerConnectCallback;
-import net.sf.magicmap.client.interfaces.ServerDisconnectCallback;
-import net.sf.magicmap.client.meta.MapInfo;
-import net.sf.magicmap.client.meta.ServerConnectionInfo;
import net.sf.magicmap.client.model.node.INodeSelectionModel;
-import net.sf.magicmap.client.model.node.MapNode;
-import net.sf.magicmap.client.model.node.NodeModel;
import net.sf.magicmap.client.model.node.NodeSelectionModel;
-import net.sf.magicmap.client.utils.Settings;
-import net.sf.magicmap.client.utils.Version;
-import org.apache.axis.AxisFault;
-
-import com.Ostermiller.util.Browser;
-import com.brunchboy.util.swing.relativelayout.AttributeConstraint;
-import com.brunchboy.util.swing.relativelayout.AttributeType;
-import com.brunchboy.util.swing.relativelayout.DependencyManager;
-import com.brunchboy.util.swing.relativelayout.RelativeLayout;
-import com.jgoodies.uif_lite.component.UIFSplitPane;
-
/**
* The main GUI window
* @author thuebner
* @author Florian Lederer
*/
-@SuppressWarnings({"JavadocReference"})
-public class MainGUI extends JFrame
- implements
- ServerConnectCallback,
- ServerDisconnectCallback,
- CreateNewMapCallback,
- MapNamesCallback,
- LoadMapDialogListener {
+public class MainGUI {
/**
- * serial version id
- */
- private static final long serialVersionUID = -3842976532877305041L;
-
- /**
* singleton instance of the main GUI
*/
- private static MainGUI mainGUI = null;
+ private static MainGUI mainGUI = null;
/**
* Getter for the singleton instance of the main GUI
@@ -104,36 +40,12 @@
if (MainGUI.mainGUI == null) MainGUI.mainGUI = new MainGUI();
return MainGUI.mainGUI;
}
- private Map<String, JComponent> viewMap = new HashMap<String, JComponent>();
- private JMenuBar menuBar;
- private JToolBar toolBar;
- private StatusPanel statusBar;
- private MapPanel mapPanel;
- private OutlineView outlineView;
- private ConsoleView consoleView;
- private MapView mapView;
- private MeasurementView measurementView;
- private ViewTabPanel bottomRightTabPanel;
- private RelativeLayout layout;
- private AbstractAction connectAction;
- private AbstractAction setProxyAction;
- private AbstractAction disconnectAction;
- private AbstractAction newMapAction;
- private AbstractAction loadMapAction;
- private AbstractAction exitAction;
- private AbstractAction aboutAction;
- private AbstractAction onlineHelp;
- private MagicAction invisibleAction;
- private MagicAction simpleView;
- private MagicAction normalView;
- private MagicAction expertView;
- private MagicAction userDefinedView;
+
+ private Map<String, JComponent> jComponentMap = new HashMap<String, JComponent>();
private INodeSelectionModel nodeSelectionModel;
private NodeIcons nodeIcons;
+ private MainFrame mainFrame;
- private static final int numberOfdataInvocationRateAction = 10;
- private MagicAction[] dataInvocationRateAction;
-
/**
* Erzeugt Hauptfenster der Anwendung.
* Private constructor, only used by getInstance() to fulfill singleton pattern
@@ -150,773 +62,35 @@
nodeIcons.registerNodeIcon(new LocationNodeIcon());
nodeIcons.registerNodeIcon(new GeoPosNodeIcon());
nodeIcons.registerNodeIcon(new MapNodeIcon());
-
- // Aktionen erstellen
- buildActions();
-
- // Layout vorbereiten
- this.layout = new RelativeLayout();
- Container pane = this.getContentPane();
- pane.setLayout(this.layout);
-
- // Hauptfenstereigenschaften setzen
- this.setSize(new Dimension(1024, 768));
- this.setTitle("MagicMap - Version " + Version.getVersion());
- this.setIconImage(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());
-
- // Statusleiste erstelelen
- this.statusBar = new StatusPanel();
- this.statusBar.setMessage(GUIUtils.i18n(GUIConstants.STATE_DISCONNECTED));
-
- // ToolBar erstellen
- this.toolBar = new JToolBar();
- this.toolBar.setRollover(true);
- // toolBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
- // menuBar.putClientProperty(com.jgoodies.plaf.plastic.PlasticLookAndFeel.IS_3D_KEY, Boolean.TRUE);
- addMainToolBarButtons(this.toolBar);
-
- // Komponenten einf\xFCgen in das ContentPane
- pane.add(this.toolBar, "toolbar");
- pane.add(buildMainPane(), "mainpane");
- pane.add(this.statusBar, "status");
-
- // Einige Constrains bzgl. Layout definieren:
-
- // ToolBar ganz oben
- this.layout.addConstraint("toolbar", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.RIGHT, 0));
- this.layout.addConstraint("toolbar", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.LEFT, 0));
- this.layout.addConstraint("toolbar", AttributeType.TOP, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.TOP, 0));
-
- // StatusBar ganz unten
- this.layout.addConstraint("status", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.RIGHT, -2));
- this.layout.addConstraint("status", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.LEFT, 2));
- this.layout.addConstraint("status", AttributeType.BOTTOM, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.BOTTOM, -2));
-
- // Hauptpanel dazwischen mit gewissem Abstand zum ToolBar
- this.layout.addConstraint("mainpane", AttributeType.RIGHT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.RIGHT, -GUIConstants.WINDOW_MARGIN));
- this.layout.addConstraint("mainpane", AttributeType.LEFT, new AttributeConstraint(DependencyManager.ROOT_NAME,
- AttributeType.LEFT, GUIConstants.WINDOW_MARGIN));
- this.layout.addConstraint("mainpane", AttributeType.BOTTOM, new AttributeConstraint("status",
- AttributeType.TOP, -5));
- this.layout.addConstraint("mainpane", AttributeType.TOP, new AttributeConstraint("toolbar",
- AttributeType.BOTTOM, GUIConstants.DIVIDER_SIZE));
-
- viewMap.put("outlineView", outlineView);
- viewMap.put("consoleView", consoleView);
- viewMap.put("mapView", mapView);
- viewMap.put("bottomRightTabPanel", bottomRightTabPanel);
- viewMap.put("mapPanel", mapPanel);
-
}
/**
- * Action builder for the action of the GUI
- *
+ * @return the mainFrame
*/
- public void buildActions(){
-
- this.connectAction = new MagicAction("connect", GUIConstants.ICON_CONNECT, "connecttooltip") {
-
- /**
- * serial version id
- */
- private static final long serialVersionUID = 8256739041910656216L;
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- @Override
- public void actionPerformed(ActionEvent e){
- ServerConnectionInfo info = new ServerConnectionInfo();
- info.hostname = Settings.getHostname();
- info.port = Settings.getPort();
- info.name = Settings.getClientName();
- info.password = Settings.getClientPassword();
- info.useNoServer = Settings.isStandAlone();
- info = ConnectServerDialog.showDialog(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
- }
- };
-
- this.setProxyAction = new MagicAction("setproxy", GUIConstants.ICON_CONNECT, "setproxytooltip") {
-
- /**
- * serial version id
- */
- private static final long serialVersionUID = 8620117054998094069L;
-
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- @Override
- public void actionPerformed(ActionEvent e){
- SetProxyDialog.showDialog(MainGUI.this);
- }
- };
-
- this.disconnectAction = new MagicAction("disconnect", GUIConstants.ICON_DISCONNECT, "disconnecttooltip") {
-
- /**
- * 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);
- }
- };
-
- this.newMapAction = new MagicAction("newmap", GUIConstants.ICON_NEWMAP, "newmaptooltip") {
-
- /**
- * 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);
- }
- };
-
- this.loadMapAction = new MagicAction("loadmap", GUIConstants.ICON_LOADMAP, "loadmaptooltip") {
-
- /**
- * 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);
- }
- };
-
- this.exitAction = new MagicAction("exit", GUIConstants.ICON_EXIT, "exit") {
-
- /**
- * 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);
- }
- };
-
- this.onlineHelp = new MagicAction("onlinehelp", GUIConstants.ICON_HELP, "onlinehelptooltip") {
-
- /**
- * 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
- }
- }
- };
-
- this.aboutAction = new MagicAction("about") {
-
- /**
- * 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);
- }
- };
-
- this.invisibleAction = new MagicAction("invisible", GUIConstants.ICON_INVISIBLE, "invisibletooltip") {
-
- /**
- * 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();
- }
- };
-
- // 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") {
-
- /**
- * 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);
-
- 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") {
-
- /**
- * 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){
-
- MainGUI.this.mapView.setShowAccessPoints(true);
- MainGUI.this.outlineView.collapseAPs(false);
- MainGUI.this.mapView.setShowClients(true);
...
[truncated message content] |