diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java @ 4062:145980c21700

Handle error conditions more robust.
author Christian Lins <christian.lins@intevation.de>
date Mon, 08 Oct 2012 12:10:50 +0200
parents 22cd60315e08
children 03de5c424f95
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Mon Oct 08 11:01:20 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Mon Oct 08 12:10:50 2012 +0200
@@ -1,11 +1,5 @@
 package de.intevation.flys.client.client.ui;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
@@ -20,19 +14,6 @@
 import com.smartgwt.client.widgets.tab.Tab;
 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
 
-import de.intevation.flys.client.shared.model.Artifact;
-import de.intevation.flys.client.shared.model.WINFOArtifact;
-import de.intevation.flys.client.shared.model.ArtifactDescription;
-import de.intevation.flys.client.shared.model.Collection;
-import de.intevation.flys.client.shared.model.Data;
-import de.intevation.flys.client.shared.model.DataItem;
-import de.intevation.flys.client.shared.model.DataList;
-import de.intevation.flys.client.shared.model.DefaultData;
-import de.intevation.flys.client.shared.model.DefaultDataItem;
-import de.intevation.flys.client.shared.model.ReportMode;
-import de.intevation.flys.client.shared.model.ExportMode;
-import de.intevation.flys.client.shared.model.OutputMode;
-import de.intevation.flys.client.shared.model.River;
 import de.intevation.flys.client.client.Config;
 import de.intevation.flys.client.client.FLYS;
 import de.intevation.flys.client.client.FLYSConstants;
@@ -51,13 +32,32 @@
 import de.intevation.flys.client.client.event.StepForwardEvent;
 import de.intevation.flys.client.client.event.StepForwardHandler;
 import de.intevation.flys.client.client.services.AdvanceService;
-import de.intevation.flys.client.client.services.ReportService;
 import de.intevation.flys.client.client.services.AdvanceServiceAsync;
 import de.intevation.flys.client.client.services.ArtifactService;
 import de.intevation.flys.client.client.services.ArtifactServiceAsync;
+import de.intevation.flys.client.client.services.ReportService;
+import de.intevation.flys.client.client.services.ReportServiceAsync;
 import de.intevation.flys.client.client.services.StepForwardService;
 import de.intevation.flys.client.client.services.StepForwardServiceAsync;
-import de.intevation.flys.client.client.services.ReportServiceAsync;
+import de.intevation.flys.client.shared.model.Artifact;
+import de.intevation.flys.client.shared.model.ArtifactDescription;
+import de.intevation.flys.client.shared.model.Collection;
+import de.intevation.flys.client.shared.model.Data;
+import de.intevation.flys.client.shared.model.DataItem;
+import de.intevation.flys.client.shared.model.DataList;
+import de.intevation.flys.client.shared.model.DefaultData;
+import de.intevation.flys.client.shared.model.DefaultDataItem;
+import de.intevation.flys.client.shared.model.ExportMode;
+import de.intevation.flys.client.shared.model.OutputMode;
+import de.intevation.flys.client.shared.model.ReportMode;
+import de.intevation.flys.client.shared.model.River;
+import de.intevation.flys.client.shared.model.WINFOArtifact;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
 
 
 public class ParameterList
@@ -213,11 +213,13 @@
         gaugeSection.setExpanded(false);
         gaugeSection.setTitle(MSG.gaugePanelTitle());
         gaugePanel = new GaugePanel(flys, gaugeSection) {
+            @Override
             public void addMember(Canvas component) {
                 super.addMember(component);
                 gaugeSection.setExpanded(true);
             }
 
+            @Override
             public void removeMembers(Canvas[] components) {
                 super.removeMembers(components);
                 gaugeSection.setExpanded(false);
@@ -231,11 +233,13 @@
         helperSection.setExpanded(false);
         helperSection.setTitle(MSG.helperPanelTitle());
         helperPanel = new VLayout() {
+            @Override
             public void addMember(Canvas component) {
                 super.addMember(component);
                 stack.expandSection(helperSection.getID());
             }
 
+            @Override
             public void removeMembers(Canvas[] components) {
                 super.removeMembers(components);
                 helperSection.setExpanded(false);
@@ -250,11 +254,13 @@
         tableSection.setExpanded(false);
         tableSection.setTitle(MSG.calcTableTitle());
         tablePanel = new VLayout() {
+            @Override
             public void addMember(Canvas component) {
                 super.addMember(component);
                 tableSection.setExpanded(true);
             }
 
+            @Override
             public void removeMembers(Canvas[] components) {
                 super.removeMembers(components);
                 tableSection.setExpanded(false);
@@ -296,6 +302,7 @@
      *
      * @param handler The new ParameterChangeHandler.
      */
+    @Override
     public void addParameterChangeHandler(ParameterChangeHandler handler) {
         if (handler != null) {
             parameterHandlers.add(handler);
@@ -343,11 +350,12 @@
             items);
 
         LinkSelection widget           = new LinkSelection();
-        HasStepForwardHandlers handler = (HasStepForwardHandlers) widget;
+        HasStepForwardHandlers handler = widget;
 
         widget.setContainer(helperPanel);
 
         handler.addStepForwardHandler(new StepForwardHandler() {
+            @Override
             public void onStepForward(StepForwardEvent event) {
                 lockUI();
                 Data[] data = event.getData();
@@ -375,23 +383,27 @@
                 artifactService.create(
                     locale, module.toLowerCase(), null,
                     new AsyncCallback<Artifact>() {
+                        @Override
                         public void onFailure(Throwable caught) {
                             unlockUI();
                             GWT.log("Could not create the new artifact.");
                             SC.warn(MSG.getString(caught.getMessage()));
                         }
 
+                        @Override
                         public void onSuccess(Artifact artifact) {
                             GWT.log("Successfully created a new artifact.");
 
                             forwardService.go(locale, artifact, feedData,
                             new AsyncCallback<Artifact>() {
+                                @Override
                                 public void onFailure(Throwable caught) {
                                     unlockUI();
                                     GWT.log("Could not feed the artifact.");
                                     SC.warn(caught.getMessage());
                                 }
 
+                                @Override
                                 public void onSuccess(Artifact artifact) {
                                     GWT.log("Successfully feed the artifact.");
                                     old.clear();
@@ -604,6 +616,7 @@
      *
      * @param event The StepForwardEvent.
      */
+    @Override
     public void onStepForward(StepForwardEvent event) {
         GWT.log("CollectionView - onStepForward()");
         lockUI();
@@ -613,12 +626,14 @@
 
         forwardService.go(locale, artifact, event.getData(),
             new AsyncCallback<Artifact>() {
+                @Override
                 public void onFailure(Throwable caught) {
                     unlockUI();
                     GWT.log("Could not feed the artifact.");
-                    SC.warn(MSG.getString(caught.getMessage()));
+                    SC.warn(FLYS.getExceptionString(MSG, caught));
                 }
 
+                @Override
                 public void onSuccess(Artifact artifact) {
                     GWT.log("Successfully feed the artifact.");
                     old.clear();
@@ -636,6 +651,7 @@
      *
      * @param e The StepBackEvent that holds the identifier of the target state.
      */
+    @Override
     public void onStepBack(StepBackEvent e) {
         lockUI();
         final String target    = e.getTarget();
@@ -645,12 +661,14 @@
 
         advanceService.advance(locale, artifact, target,
             new AsyncCallback<Artifact>() {
+                @Override
                 public void onFailure(Throwable caught) {
                     unlockUI();
                     GWT.log("Could not go back to '" + target + "'");
-                    SC.warn(MSG.getString(caught.getMessage()));
+                    SC.warn(FLYS.getExceptionString(MSG, caught));
                 }
 
+                @Override
                 public void onSuccess(Artifact artifact) {
                     GWT.log("Successfully step back to '" + target + "'");
 
@@ -664,17 +682,20 @@
     }
 
 
+    @Override
     public void onAdvance(final String target) {
         Config config          = Config.getInstance();
         final String locale    = config.getLocale();
 
         advanceService.advance(locale, artifact, target,
             new AsyncCallback<Artifact>() {
+                @Override
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not go to '" + target + "'");
-                    SC.warn(MSG.getString(caught.getMessage()));
+                    SC.warn(FLYS.getExceptionString(MSG, caught));
                 }
 
+                @Override
                 public void onSuccess(Artifact artifact) {
                     GWT.log("Successfully advanced to '" + target + "'");
 
@@ -693,6 +714,7 @@
      *
      * @param event The ParameterChangeEvent.
      */
+    @Override
     public void onParameterChange(ParameterChangeEvent event) {
         GWT.log("ParameterList.onParameterChange");
 
@@ -758,6 +780,7 @@
     }
 
 
+    @Override
     public void onCollectionChange(CollectionChangeEvent event) {
         Collection                 c = event.getNewValue();
         Map<String, OutputMode> outs = c.getOutputModes();
@@ -775,6 +798,7 @@
     }
 
 
+    @Override
     public void onOutputModesChange(OutputModesChangeEvent event) {
 
         Collection c = cView.getCollection();
@@ -855,10 +879,12 @@
 
             reportService.report(cid, locale, report.getName(),
                 new AsyncCallback<String>() {
+                    @Override
                     public void onFailure(Throwable caught) {
-                        SC.warn(caught.getMessage());
+                        SC.warn(FLYS.getExceptionString(MSG, caught));
                     }
 
+                    @Override
                     public void onSuccess(String msg) {
                         setReportMessage(msg);
                     }

http://dive4elements.wald.intevation.org