Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java @ 25:2da6be38d8b6
Added a User interface and a default implementation to handle users in this client.
flys-client/trunk@1411 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 07 Mar 2011 13:40:37 +0000 |
parents | fe2f4d1dd784 |
children | e4155a6833a9 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Wed Mar 02 10:00:17 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Mon Mar 07 13:40:37 2011 +0000 @@ -8,11 +8,10 @@ import com.smartgwt.client.widgets.layout.VLayout; -import de.intevation.artifacts.common.model.User; - import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.DefaultCollection; +import de.intevation.flys.client.shared.model.User; import de.intevation.flys.client.client.services.ArtifactService; import de.intevation.flys.client.client.services.ArtifactServiceAsync; @@ -51,6 +50,9 @@ /** The FLYSWorkspace.*/ protected FLYSWorkspace workspace; + /** The user who is currently logged in.*/ + protected User currentUser; + /** * This is the entry point method. @@ -72,15 +74,18 @@ RootPanel.get("app").add(vertical); initConfiguration(); + String serverUrl = Config.getInstance().getServerUrl(); - userService.getCurrentUser(new AsyncCallback<User>() { + userService.getCurrentUser(serverUrl, new AsyncCallback<User>() { public void onFailure(Throwable caught) { GWT.log("Could not find a logged in user."); // TODO do something } public void onSuccess(User user) { - GWT.log("Found a user. Set '"+ user.getLastName()+"'"); + GWT.log("Found a user. Set '"+ user.getName() + "'"); + setCurrentUser(user); + menu.setCurrentUser(user); projectList = new ProjectList(user); @@ -103,6 +108,24 @@ /** + * Returns the user that is currently logged in. + * + * @return the current user. + */ + public User getCurrentUser() { + return currentUser; + } + + + /** + * Sets the current user. + */ + public void setCurrentUser(User user) { + currentUser = user; + } + + + /** * This method creates a new CollectionView and adds it to the workspace. */ public void newProject() {