|
From: <an...@us...> - 2007-05-30 14:54:41
|
Revision: 659
http://svn.sourceforge.net/magicmap/?rev=659&view=rev
Author: anweiss
Date: 2007-05-30 07:54:26 -0700 (Wed, 30 May 2007)
Log Message:
-----------
added the possibility to add listeners to the pollhandler
Modified Paths:
--------------
trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java
Added Paths:
-----------
trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-05-30 14:50:55 UTC (rev 658)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -128,6 +128,7 @@
* @see net.sf.magicmap.client.interfaces.FetchPositionsCallback#positionFetchError(java.lang.Exception)
*/
public void positionFetchError(Exception e){
+ this.listener.positionFetchError(e);
e.printStackTrace();
synchronized (ServerPoller.syncObj) {
this.isFetching = false;
@@ -138,6 +139,7 @@
* @see net.sf.magicmap.client.interfaces.FetchGeoPointsCallback#geoPointFetchError(java.lang.Exception)
*/
public void geoPointFetchError(Exception e){
+ this.listener.geoPositionFetchError(e);
e.printStackTrace();
synchronized (ServerPoller.syncObj) {
this.isFetching = false;
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java 2007-05-30 14:50:55 UTC (rev 658)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -136,21 +136,33 @@
}
public static boolean showConnectError(){
- return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("cantconnectretry"), GUIUtils
- .i18n("cantconnect"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null, new String[]{
- GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("cantconnectretry"),
+ GUIUtils.i18n("cantconnect"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null,
+ new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
}
+ public static boolean showConnectError(String cause){
+ if (cause == "UnknownHost") {
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(),
+ GUIUtils.i18n("cantconnectretry"), GUIUtils.i18n("cantconnect"), JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE, null, new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")},
+ GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
+ }
+ else return showConnectionError();
+ }
+
public static boolean showAuthentificationError(String message){
- return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("serverresponse") + "\n" + message,
- GUIUtils.i18n("authentificationerror"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null,
- new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils.i18n("retry")) == JOptionPane.YES_OPTION;
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("serverresponse")
+ + "\n" + message, GUIUtils.i18n("authentificationerror"), JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE, null, new String[]{GUIUtils.i18n("retry"), GUIUtils.i18n("no")}, GUIUtils
+ .i18n("retry")) == JOptionPane.YES_OPTION;
}
public static boolean showConnectionError(){
- return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils.i18n("connectionsproblemsreconnect"),
- GUIUtils.i18n("connectionproblems"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null,
- new String[]{GUIUtils.i18n("yes"), GUIUtils.i18n("no")}, GUIUtils.i18n("yes")) == JOptionPane.YES_OPTION;
+ return JOptionPane.showOptionDialog(MainGUI.getInstance().getMainFrame(), GUIUtils
+ .i18n("connectionsproblemsreconnect"), GUIUtils.i18n("connectionproblems"),
+ JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE, null, new String[]{GUIUtils.i18n("yes"),
+ GUIUtils.i18n("no")}, GUIUtils.i18n("yes")) == JOptionPane.YES_OPTION;
}
public static void showErrorDialog(String message){
Added: trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java (rev 0)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PollHandlerListener.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -0,0 +1,35 @@
+/*
+ * created on 17.04.2007
+ */
+package net.sf.magicmap.client.interfaces;
+
+
+
+/**
+ * @author Andreas Wei\xDF
+ *
+ */
+public interface PollHandlerListener {
+
+ public void positionCreatedOrUpdatedOrDeleted();
+
+ public void mapCreatedOrUpdatedOrDeleted();
+
+
+ public void geoPosCreatedOrUpdatedOrDeleted();
+
+ /**
+ *
+ * @param e
+ */
+ public void positionFetchError(Exception e);
+
+ /**
+ *
+ * @param e
+ */
+ public void geoPositionFetchError(Exception e);
+
+
+ public void mapCreatedOrUpdatedOrDeletedError(Exception e);
+}
Modified: trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java
===================================================================
--- trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java 2007-05-30 14:50:55 UTC (rev 658)
+++ trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java 2007-05-30 14:54:26 UTC (rev 659)
@@ -44,4 +44,16 @@
*/
public void geoPosCreatedOrUpdatedOrDeleted(GeoPointDTO pointDTO);
+ /**
+ *
+ * @param e
+ */
+ public void positionFetchError(Exception e);
+
+ /**
+ *
+ * @param e
+ */
+ public void geoPositionFetchError(Exception e);
+
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|