changeset 788:dfbc6693247e

Integrated a stacked panel on the right side of the ParameterList that enables users to see calculation results and the helper panel at the same time. flys-client/trunk@2289 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 06 Jul 2011 12:31:32 +0000
parents 4e0b73b7113b
children e8be9a188e64
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/TableDataPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java
diffstat 15 files changed, 150 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/ChangeLog	Wed Jul 06 12:31:32 2011 +0000
@@ -1,3 +1,38 @@
+2011-07-06  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  The right side of the ParameterList now consists of a stacked panel that
+	  itself consists of the helper panel and a panel for displaying the
+	  calculation results. The user is now able to see both at the same time.
+
+	* src/main/java/de/intevation/flys/client/client/ui/CollectionView.java:
+	  Improved the Collection update process. There is no need to update the
+	  collection twice when the master artifact changed. Now, the collection
+	  is updated only a single time if the collection itself changed - and it
+	  changes everytime when its artifact is set.
+
+	* src/main/java/de/intevation/flys/client/client/ui/TableDataPanel.java:
+	  The label 'Berechnungsergebnisse' is no longer part of the Canvas
+	  created by this class.
+
+	* src/main/java/de/intevation/flys/client/client/ui/UIProvider.java,
+	  src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java:
+	  The helper panel is now a VLayout, no longer a Canvas.
+
+	* src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/MapSelection.java,
+	  src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java:
+	  Add helper widgets as members to the helper panel, no longer as
+	  children.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java: Added
+	  strings for the input support stack.
+
 2011-07-05  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Wed Jul 06 12:31:32 2011 +0000
@@ -140,6 +140,8 @@
 
     String calcTableTitle();
 
+    String helperPanelTitle();
+
     String wqTitle();
 
     String wqadaptedTitle();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Wed Jul 06 12:31:32 2011 +0000
@@ -63,6 +63,7 @@
 wqTitle = Input for W/Q Data
 wqadaptedTitle = Input for W/Q Data
 calcTableTitle = Calculated Output
+helperPanelTitle = Input Support
 wqW = W at Gauge [cm]
 wqQ = Q [m\u00b3/s]
 wqQGauge = Q [m\u00b3/s] at Gauge
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Wed Jul 06 12:31:32 2011 +0000
@@ -63,6 +63,7 @@
 wqTitle = Eingabe f\u00fcr W/Q Daten
 wqadaptedTitle = Eingabe f\u00fcr W/Q Daten
 calcTableTitle = Berechnungsausgabe
+helperPanelTitle = Eingabeunterst\u00fctzung
 wqW = W am Pegel [cm]
 wqQ = Q [m\u00b3/s]
 wqQGauge = Q [m\u00b3/s] am Pegel (Kennzeichnender Abfluss)
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Wed Jul 06 12:31:32 2011 +0000
@@ -58,6 +58,7 @@
 wqTitle = Input for W/Q Data
 wqadaptedTitle = Input for W/Q Data
 calcTableTitle = Calculated Output
+helperPanelTitle = Input Support
 wqW = W at Gauge [cm]
 wqQ = Q [m³/s]
 wqQGauge = Q [m³/s] at Gauge
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java	Wed Jul 06 12:31:32 2011 +0000
@@ -6,11 +6,12 @@
 import com.google.gwt.core.client.GWT;
 
 import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Button;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Img;
 import com.smartgwt.client.widgets.events.ClickEvent;
 import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.layout.VLayout;
 
 import de.intevation.flys.client.client.FLYSConstants;
 import de.intevation.flys.client.client.event.HasStepBackHandlers;
@@ -44,7 +45,7 @@
     protected List<StepBackHandler> backHandlers;
 
     /** The container that is used to position helper widgets.*/
-    protected Canvas helperContainer;
+    protected VLayout helperContainer;
 
     /** The artifact that contains status information.*/
     protected Artifact artifact;
@@ -175,7 +176,7 @@
      * @param helperContainer A container that is used to position helper
      * widgets.
      */
-    public void setContainer(Canvas helperContainer) {
+    public void setContainer(VLayout helperContainer) {
         this.helperContainer = helperContainer;
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Wed Jul 06 12:31:32 2011 +0000
@@ -320,21 +320,15 @@
         ArtifactDescription desc = art.getArtifactDescription();
         OutputMode[] outs        = desc.getOutputModes();
 
-        fireOutputModesChangeEvent(outs);
-
         setArtifact(art);
-        clearOutputTabs();
 
-        if (parameterList.hasPanel()) {
-            parameterList.removePanel();
-        }
         Collection c = getCollection();
 
         if (outs != null && c == null) {
             User user = getFlys().getCurrentUser();
             createNewCollection(user.identifier());
         }
-        else if (outs != null && c != null) {
+        else if (c != null) {
             Config config = Config.getInstance();
             String url    = config.getServerUrl();
             String locale = config.getLocale();
@@ -407,14 +401,29 @@
 
 
     public void onOutputModesChange(OutputModesChangeEvent event) {
+        clearOutputTabs();
         OutputMode[] outs = event.getOutputModes();
 
         if (outs == null) {
             return;
         }
 
+        boolean hasCSV = false;
+
         for (OutputMode out: outs) {
             addOutputTab(out.getName(), out);
+
+            if (out instanceof ExportMode) {
+                ExportMode export = (ExportMode) out;
+
+                if (export.getFacet("csv") != null) {
+                    hasCSV = true;
+                }
+            }
+        }
+
+        if (!hasCSV) {
+            parameterList.removeTable();
         }
     }
 
@@ -428,11 +437,11 @@
         if (out instanceof ExportMode) {
             ExportMode export = (ExportMode) out;
 
-            if (export.getFacet("csv") != null) {
+            if (export.getFacet("csv") != null && !parameterList.hasTable()) {
                 TableDataPanel p = new TableDataPanel();
                 p.setUuid(collection.identifier());
                 p.setName(out.getName());
-                parameterList.setPanel (p);
+                parameterList.setTable(p);
             }
 
             return;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java	Wed Jul 06 12:31:32 2011 +0000
@@ -430,7 +430,7 @@
         tabs.addTab(locations, 0);
         tabs.addTab(distances, 1);
 
-        helperContainer.addChild(tabs);
+        helperContainer.addMember(tabs);
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Wed Jul 06 12:31:32 2011 +0000
@@ -568,7 +568,7 @@
         inputTables.addTab(locations);
         inputTables.addTab(distances);
 
-        helperContainer.addChild(inputTables);
+        helperContainer.addMember(inputTables);
 
         return layout;
     }
@@ -873,7 +873,7 @@
             inputTables.addTab(t2);
             updateDistanceInfo(tableData);
 
-            helperContainer.addChild(inputTables);
+            helperContainer.addMember(inputTables);
             inputTables.selectTab(0);
         }
         else {
@@ -894,7 +894,7 @@
                 updateDistanceInfo(tableData);
             }
 
-            helperContainer.addChild(inputTables);
+            helperContainer.addMember(inputTables);
             inputTables.selectTab(1);
         }
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java	Wed Jul 06 12:31:32 2011 +0000
@@ -61,7 +61,7 @@
         // TODO implement event handling in the river map
 
         h.addMember(form);
-        helperContainer.addChild(map);
+        helperContainer.addMember(map);
 
         return h;
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Wed Jul 06 12:31:32 2011 +0000
@@ -9,9 +9,12 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.types.VisibilityMode;
 import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.SectionStack;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
 import com.smartgwt.client.widgets.layout.VLayout;
 import com.smartgwt.client.widgets.tab.Tab;
 
@@ -99,8 +102,8 @@
     protected VLayout currentItems;
     protected VLayout exportModes;
     protected VLayout report;
-    protected Canvas  helperPanel;
-    protected Canvas  tablePanel;
+    protected VLayout helperPanel;
+    protected VLayout tablePanel;
     protected Canvas  reportPanel;
 
     public ParameterList(FLYS flys, CollectionView cView, String title) {
@@ -153,7 +156,6 @@
 
     protected void init() {
         HLayout rootLayout = new HLayout();
-        tablePanel = new Canvas();
         rootLayout.setMembersMargin(20);
 
         VLayout left = new VLayout();
@@ -177,13 +179,8 @@
         reportPanel.setHeight("*");
         report.addMember(reportPanel);
 
-        // This canvas is used to render helper widgets
-        helperPanel = new Canvas();
-        helperPanel.setWidth("*");
-        helperPanel.setHeight100();
-
         rootLayout.addMember(left);
-        rootLayout.addMember(helperPanel);
+        rootLayout.addMember(createSectionStack());
 
         topLayout.addMember(rootLayout);
         if (artifact == null) {
@@ -196,6 +193,56 @@
     }
 
 
+    protected SectionStack createSectionStack() {
+        SectionStack stack = new SectionStack();
+        stack.setHeight100();
+        stack.setCanResizeSections(true);
+        stack.setVisibilityMode(VisibilityMode.MULTIPLE);
+
+        // This canvas is used to render helper widgets
+        final SectionStackSection helperSection = new SectionStackSection();
+        helperSection.setExpanded(false);
+        helperSection.setTitle(MSG.helperPanelTitle());
+        helperPanel = new VLayout() {
+            public void addMember(Canvas component) {
+                super.addMember(component);
+                helperSection.setExpanded(true);
+            }
+
+            public void removeMembers(Canvas[] components) {
+                super.removeMembers(components);
+                helperSection.setExpanded(false);
+            }
+        };
+        helperPanel.setWidth100();
+        helperPanel.setHeight100();
+        helperSection.setItems(helperPanel);
+
+        // This canvas is used to render calculation results
+        final SectionStackSection tableSection = new SectionStackSection();
+        tableSection.setExpanded(false);
+        tableSection.setTitle(MSG.calcTableTitle());
+        tablePanel = new VLayout() {
+            public void addMember(Canvas component) {
+                super.addMember(component);
+                tableSection.setExpanded(true);
+            }
+
+            public void removeMembers(Canvas[] components) {
+                super.removeMembers(components);
+                tableSection.setExpanded(false);
+            }
+        };
+        tablePanel.setHeight100();
+        tablePanel.setWidth100();
+        tableSection.setItems(tablePanel);
+
+        stack.setSections(helperSection, tableSection);
+
+        return stack;
+    }
+
+
     protected void setArtifact(Artifact artifact) {
         Artifact tmp  = this.artifact;
         this.artifact = artifact;
@@ -517,8 +564,9 @@
     public void onParameterChange(ParameterChangeEvent event) {
         GWT.log("ParameterList.onParameterChange");
 
-        for (Canvas c: helperPanel.getChildren()) {
-            helperPanel.removeChild(c);
+        Canvas[] c = helperPanel.getMembers();
+        if (c != null && c.length > 0) {
+            helperPanel.removeMembers(c);
         }
 
         Artifact art             = event.getNewValue();
@@ -681,24 +729,33 @@
      *
      * @param table The table data panel.
      */
-    public void setPanel (TableDataPanel table) {
-        tablePanel = table.create();
-        tablePanel.setHeight100();
-        tablePanel.setWidth100();
-        helperPanel.addChild(tablePanel);
+    public void setTable(TableDataPanel table) {
+        removeTable();
+
+        Canvas c = table.create();
+        c.setHeight100();
+        c.setWidth100();
+
+        tablePanel.addMember(c);
+    }
+
+
+    public boolean hasTable() {
+        Canvas[] members = tablePanel.getMembers();
+
+        return members != null && members.length > 0;
     }
 
 
     /**
      * Removes the table from the parameter list.
      */
-    public void removePanel() {
-        topLayout.removeMember(tablePanel);
-    }
+    public void removeTable() {
+        Canvas[] members = tablePanel.getMembers();
 
-
-    public boolean hasPanel() {
-        return topLayout.hasMember(tablePanel);
+        if (members != null && members.length > 0) {
+            tablePanel.removeMembers(members);
+        }
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java	Wed Jul 06 12:31:32 2011 +0000
@@ -270,7 +270,7 @@
 
         container.setMembersMargin(30);
 
-        helperContainer.addChild(locationTable);
+        helperContainer.addMember(locationTable);
         createInputPanel();
         return layout;
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/TableDataPanel.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/TableDataPanel.java	Wed Jul 06 12:31:32 2011 +0000
@@ -7,7 +7,6 @@
 
 import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.layout.VLayout;
 import com.smartgwt.client.widgets.grid.ListGrid;
 import com.smartgwt.client.widgets.grid.ListGridField;
@@ -86,10 +85,6 @@
             }
         );
 
-        Label l = new Label (MESSAGES.calcTableTitle());
-        l.setHeight(20);
-
-        container.addMember(l);
         container.addMember(dataTable);
 
         return container;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java	Wed Jul 06 12:31:32 2011 +0000
@@ -3,6 +3,7 @@
 import java.io.Serializable;
 
 import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.layout.VLayout;
 
 import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.shared.model.Artifact;
@@ -42,7 +43,7 @@
      *
      * @param container A container that is used to position helper widgets.
      */
-    public void setContainer(Canvas container);
+    public void setContainer(VLayout container);
 
 
     /**
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Tue Jul 05 17:28:04 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Wed Jul 06 12:31:32 2011 +0000
@@ -245,7 +245,7 @@
         tabs.addTab(wTab, 0);
         tabs.addTab(qTab, 1);
 
-        helperContainer.addChild(tabs);
+        helperContainer.addMember(tabs);
 
         fetchWQData();
     }

http://dive4elements.wald.intevation.org