diff gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java @ 6479:ac6c41fcae55

Use help-url provided by ServerInfoService (fix for #1197). Required some changes in FLYS.onModuleLoad(), should be reviewed by someone.
author Christian Lins <christian.lins@intevation.de>
date Thu, 27 Jun 2013 17:36:51 +0200
parents b0b0ba6e7bb0
children d19a0ffb9ccf
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java	Thu Jun 27 17:25:12 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java	Thu Jun 27 17:36:51 2013 +0200
@@ -154,7 +154,7 @@
         vertical.draw();
 
         Config config = Config.getInstance();
-        String locale = config.getLocale();
+        final String locale = config.getLocale();
 
         serverInfoService.getConfig(locale, new AsyncCallback<Map<String,String>>() {
 
@@ -162,36 +162,39 @@
             public void onSuccess(Map<String, String> result) {
                 GWT.log("serverInfoService.callBack.onSuccess");
                 GWT.log("help-url=" + result.get("help-url"));
+                Config.getInstance().setWikiUrl(result.get("help-url"));
+
+                // Start user service; somewhat nested here...
+                userService.getCurrentUser(locale, new AsyncCallback<User>() {
+                    @Override
+                    public void onFailure(Throwable caught) {
+                        GWT.log("Could not find a logged in user.");
+                        String msg = getExceptionString(MSG, caught);
+                        SC.warn(msg);
+                    }
+
+                    @Override
+                    public void onSuccess(User user) {
+                        GWT.log("Found a user. Set '"+ user.getName() + "'");
+                        setCurrentUser(user);
+
+                        header.setCurrentUser(user);
+
+                        projectList = new ProjectList(FLYS.this, user);
+                        workspace   = new FLYSWorkspace(FLYS.this);
+                        view.setProjectList(projectList);
+                        view.setFLYSWorkspace(workspace);
+
+                        readRivers();
+                    }
+                });
             }
 
             @Override
             public void onFailure(Throwable caught) {
-               GWT.log("serverInfoService.callBack.onFailure");
-
-            }
-        });
-
-        userService.getCurrentUser(locale, new AsyncCallback<User>() {
-            @Override
-            public void onFailure(Throwable caught) {
-                GWT.log("Could not find a logged in user.");
-                String msg = getExceptionString(MSG, caught);
-                SC.warn(msg);
-            }
-
-            @Override
-            public void onSuccess(User user) {
-                GWT.log("Found a user. Set '"+ user.getName() + "'");
-                setCurrentUser(user);
-
-                header.setCurrentUser(user);
-
-                projectList = new ProjectList(FLYS.this, user);
-                workspace   = new FLYSWorkspace(FLYS.this);
-                view.setProjectList(projectList);
-                view.setFLYSWorkspace(workspace);
-
-                readRivers();
+               GWT.log("Could not read server information.");
+               String msg = getExceptionString(MSG, caught);
+               SC.warn(msg);
             }
         });
     }

http://dive4elements.wald.intevation.org