changeset 90:f8c240f28c2a

The title of the parameter tab will change after the module has been selectd. flys-client/trunk@1603 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 29 Mar 2011 10:11:57 +0000 (2011-03-29)
parents 131e3f23a74e
children 0d8203594bb4
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java
diffstat 3 files changed, 50 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Mar 29 09:45:57 2011 +0000
+++ b/flys-client/ChangeLog	Tue Mar 29 10:11:57 2011 +0000
@@ -1,3 +1,13 @@
+2011-03-29  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  The ParameterList is a Tab now and can set its title itself. So, the
+	  title will change after the module is chosen.
+
+	* src/main/java/de/intevation/flys/client/client/ui/CollectionView.java:
+	  Removed code to insert the ParameterList into a new Tab. This is no longer
+	  needed, because the ParameterList is a Tab itself.
+
 2011-03-29  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSMessages_en.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Tue Mar 29 09:45:57 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Tue Mar 29 10:11:57 2011 +0000
@@ -72,9 +72,6 @@
 
     protected TabSet tabs;
 
-    /** The parameter tab.*/
-    protected Tab parameterTab;
-
     /** The output tab.*/
     protected Map<String, OutputTab> outputTabs;
 
@@ -93,11 +90,11 @@
         this.collection = collection;
 
         this.tabs              = new TabSet();
-        this.parameterTab      = new Tab(messages.winfo());
         this.outputTabs        = new HashMap<String, OutputTab>();
-        this.parameterList     = new ParameterList(flys, this);
         this.handlers          = new ArrayList<CollectionChangeHandler>();
         this.layout            = new VLayout();
+        this.parameterList     = new ParameterList(
+            flys, this, messages.new_calculation());
 
         addCollectionChangeHandler(this);
 
@@ -126,10 +123,7 @@
         addItem(layout);
 
         layout.addMember(tabs);
-        tabs.addTab(parameterTab);
-
-        tabs.setTabTitle(0, messages.new_calculation());
-        tabs.updateTab(0, parameterList);
+        tabs.addTab(parameterList);
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Tue Mar 29 09:45:57 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Tue Mar 29 10:11:57 2011 +0000
@@ -10,6 +10,7 @@
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
 
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.ArtifactDescription;
@@ -40,7 +41,7 @@
 
 
 public class ParameterList
-extends      HLayout
+extends      Tab
 implements   StepBackHandler, StepForwardHandler, ParameterChangeHandler,
              HasParameterChangeHandler
 {
@@ -78,7 +79,9 @@
     protected VLayout currentItems;
     protected Canvas  helperPanel;
 
-    public ParameterList(FLYS flys, CollectionView cView) {
+    public ParameterList(FLYS flys, CollectionView cView, String title) {
+        super(title);
+
         this.cView = cView;
         this.flys  = flys;
 
@@ -92,7 +95,8 @@
 
 
     protected void init() {
-        setMembersMargin(20);
+        HLayout rootLayout = new HLayout();
+        rootLayout.setMembersMargin(20);
 
         VLayout left = new VLayout();
 
@@ -112,12 +116,14 @@
         // This canvas is used to render helper widgets
         helperPanel = new Canvas();
 
-        addMember(left);
-        addMember(helperPanel);
+        rootLayout.addMember(left);
+        rootLayout.addMember(helperPanel);
 
         Canvas moduleSelection = renderNew();
         moduleSelection.setLayoutAlign(VerticalAlignment.TOP);
         currentItems.addMember(moduleSelection);
+
+        setPane(rootLayout);
     }
 
 
@@ -189,6 +195,32 @@
                 String module = moduleItems[0].getStringValue();
                 String river  = riversItems[0].getStringValue();
 
+                if (module == null) {
+                    // TODO throw / show error!
+                    return;
+                }
+
+                // XXX We should change the following lines of code if we know
+                // more about i18n in GWT.
+                if (module.equals("winfo")) {
+                    setTitle(MSG.winfo());
+                }
+                else if (module.equals("minfo")) {
+                    setTitle(MSG.minfo());
+                }
+                else if (module.equals("minfo")) {
+                    setTitle(MSG.minfo());
+                }
+                else if (module.equals("map")) {
+                    setTitle(MSG.map());
+                }
+                else if (module.equals("chart")) {
+                    setTitle(MSG.chart());
+                }
+                else if (module.equals("fix")) {
+                    setTitle(MSG.fix());
+                }
+
                 final String serverUrl = Config.getInstance().getServerUrl();
                 final Data[] feedData  = new Data[] { data[1] };
                 artifactService.create(

http://dive4elements.wald.intevation.org