comparison gwt-client/src/main/java/org/dive4elements/river/client/client/FLYS.java @ 6480:d19a0ffb9ccf

More robustness in FLYS.onModuleLoad() service calls.
author Christian Lins <christian.lins@intevation.de>
date Thu, 27 Jun 2013 17:42:22 +0200
parents ac6c41fcae55
children 519023ce3500
comparison
equal deleted inserted replaced
6479:ac6c41fcae55 6480:d19a0ffb9ccf
163 GWT.log("serverInfoService.callBack.onSuccess"); 163 GWT.log("serverInfoService.callBack.onSuccess");
164 GWT.log("help-url=" + result.get("help-url")); 164 GWT.log("help-url=" + result.get("help-url"));
165 Config.getInstance().setWikiUrl(result.get("help-url")); 165 Config.getInstance().setWikiUrl(result.get("help-url"));
166 166
167 // Start user service; somewhat nested here... 167 // Start user service; somewhat nested here...
168 userService.getCurrentUser(locale, new AsyncCallback<User>() { 168 startUserService(locale);
169 @Override
170 public void onFailure(Throwable caught) {
171 GWT.log("Could not find a logged in user.");
172 String msg = getExceptionString(MSG, caught);
173 SC.warn(msg);
174 }
175
176 @Override
177 public void onSuccess(User user) {
178 GWT.log("Found a user. Set '"+ user.getName() + "'");
179 setCurrentUser(user);
180
181 header.setCurrentUser(user);
182
183 projectList = new ProjectList(FLYS.this, user);
184 workspace = new FLYSWorkspace(FLYS.this);
185 view.setProjectList(projectList);
186 view.setFLYSWorkspace(workspace);
187
188 readRivers();
189 }
190 });
191 } 169 }
192 170
193 @Override 171 @Override
194 public void onFailure(Throwable caught) { 172 public void onFailure(Throwable caught) {
195 GWT.log("Could not read server information."); 173 GWT.log("Could not read server information.");
196 String msg = getExceptionString(MSG, caught); 174 String msg = getExceptionString(MSG, caught);
197 SC.warn(msg); 175 SC.warn(msg);
176 startUserService(locale);
177 }
178 });
179 }
180
181 protected void startUserService(String locale) {
182 userService.getCurrentUser(locale, new AsyncCallback<User>() {
183 @Override
184 public void onFailure(Throwable caught) {
185 GWT.log("Could not find a logged in user.");
186 String msg = getExceptionString(MSG, caught);
187 SC.warn(msg);
188 }
189
190 @Override
191 public void onSuccess(User user) {
192 GWT.log("Found a user. Set '"+ user.getName() + "'");
193 setCurrentUser(user);
194
195 header.setCurrentUser(user);
196
197 projectList = new ProjectList(FLYS.this, user);
198 workspace = new FLYSWorkspace(FLYS.this);
199 view.setProjectList(projectList);
200 view.setFLYSWorkspace(workspace);
201
202 readRivers();
198 } 203 }
199 }); 204 });
200 } 205 }
201 206
202 207

http://dive4elements.wald.intevation.org