diff flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java @ 229:924da6695800

Each service is now called with the name of the current locale to set the request object's locale manually in the HttpClient. flys-client/trunk@1681 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 14 Apr 2011 07:53:01 +0000
parents 9040663aee01
children 92c200887b20
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Tue Apr 12 13:48:11 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Thu Apr 14 07:53:01 2011 +0000
@@ -114,11 +114,14 @@
         RootPanel.get("app").add(vertical);
 
         initConfiguration();
-        String serverUrl = Config.getInstance().getServerUrl();
+
+        Config config = Config.getInstance();
+        String url    = config.getServerUrl();
+        String locale = config.getLocale();
 
         getRivers();
 
-        userService.getCurrentUser(serverUrl, new AsyncCallback<User>() {
+        userService.getCurrentUser(url, locale, new AsyncCallback<User>() {
             public void onFailure(Throwable caught) {
                 GWT.log("Could not find a logged in user.");
                 SC.warn(MSG.getString(caught.getMessage()));
@@ -188,10 +191,13 @@
 
 
     protected void readRivers() {
-        String url = Config.getInstance().getServerUrl();
+        Config config = Config.getInstance();
+        String url    = config.getServerUrl();
+        String locale = config.getLocale();
+
         GWT.log("Fetch rivers from server '" + url + "'");
 
-        riverService.list(url, new AsyncCallback<River[]>() {
+        riverService.list(url, locale, new AsyncCallback<River[]>() {
             public void onFailure(Throwable caught) {
                 GWT.log("Could not recieve a list of rivers.");
                 SC.warn(MSG.getString(caught.getMessage()));
@@ -238,10 +244,11 @@
 
         GWT.log("Open existing project: " + collectionID);
 
-        Config config    = Config.getInstance();
-        final String url = config.getServerUrl();
+        Config config       = Config.getInstance();
+        final String url    = config.getServerUrl();
+        final String locale = config.getLocale();
 
-        describeCollectionService.describe(collectionID, url,
+        describeCollectionService.describe(collectionID, url, locale,
             new AsyncCallback<Collection>() {
                 public void onFailure(Throwable caught) {
                     SC.warn(MSG.getString(caught.getMessage()));
@@ -258,6 +265,7 @@
 
                     getArtifactService.getArtifact(
                         url,
+                        locale,
                         item.identifier(),
                         item.hash(),
                         new AsyncCallback<Artifact>() {
@@ -285,17 +293,20 @@
      * Create a new Artifact.
      */
     public void newArtifact(String factory) {
-        String url = Config.getInstance().getServerUrl();
+        Config config = Config.getInstance();
+        String url    = config.getServerUrl();
+        String locale = config.getLocale();
 
-        artifactService.create(url, factory, new AsyncCallback<Artifact>() {
-            public void onFailure(Throwable caught) {
-                GWT.log("Could not create the new artifact.");
-                GWT.log(caught.getMessage());
-            }
+        artifactService.create(url, locale, factory,
+            new AsyncCallback<Artifact>() {
+                public void onFailure(Throwable caught) {
+                    GWT.log("Could not create the new artifact.");
+                    SC.warn(MSG.getString(caught.getMessage()));
+                }
 
-            public void onSuccess(Artifact artifact) {
-                GWT.log("Successfully created a new artifact.");
-            }
+                public void onSuccess(Artifact artifact) {
+                    GWT.log("Successfully created a new artifact.");
+                }
         });
     }
 }

http://dive4elements.wald.intevation.org