changeset 7934:71a2e408adca

Moved info stack section to top level widget (parameterlist).
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 17 Jun 2014 09:47:45 +0200
parents 900299ab8e6e
children 6f8f13d829e5
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/CollectionView.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugePanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationPanel.java
diffstat 5 files changed, 13 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/CollectionView.java	Tue Jun 17 09:45:48 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/CollectionView.java	Tue Jun 17 09:47:45 2014 +0200
@@ -513,7 +513,6 @@
 
                 if (export.getFacet("csv") != null) {
                     hasCSV = true;
-                    parameterList.contractInfoPanel();
                 }
             }
         }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java	Tue Jun 17 09:45:48 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java	Tue Jun 17 09:47:45 2014 +0200
@@ -11,6 +11,7 @@
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
+import com.smartgwt.client.types.Overflow;
 import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.types.VisibilityMode;
 import com.smartgwt.client.util.SC;
@@ -225,6 +226,7 @@
         stack.setHeight100();
         stack.setCanResizeSections(true);
         stack.setVisibilityMode(VisibilityMode.MULTIPLE);
+        stack.setOverflow(Overflow.SCROLL);
 
         // This canvas is used to render helper widgets.
         final SectionStackSection helperSection = new SectionStackSection();
@@ -256,6 +258,7 @@
             public void addMember(Canvas component) {
                 super.addMember(component);
                 tableSection.setExpanded(true);
+                stack.getSection(InfoPanel.SECTION_ID).setExpanded(false);
             }
 
             @Override
@@ -979,12 +982,17 @@
         GWT.log("ParameterList - showInfoPanel");
 
         /* Don't add InfoPanel twice */
-        SectionStackSection exists = stack.getSection(InfoPanel.SECTION_ID);
-        if (exists == null) {
-            stack.addSection(infoPanel.getSection(), 0);
+        SectionStackSection info = stack.getSection(InfoPanel.SECTION_ID);
+        if (info == null) {
+            info = new SectionStackSection();
+            info.setTitle(infoPanel.getSectionTitle());
+            info.setID(InfoPanel.SECTION_ID);
+            info.setName(InfoPanel.SECTION_ID);
+            info.setItems(infoPanel);
+            stack.addSection(info, 0);
         }
 
-        infoPanel.show();
+        info.setExpanded(true);
     }
 
     private void hideInfoPanel() {
@@ -1017,16 +1025,5 @@
             hideInfoPanel();
         }
     }
-
-    /**
-     * Allow to close all folds of the info panel.
-     * This is necessary e.g. if a csv result should be shown.
-     */
-    public void contractInfoPanel() {
-        if (infoPanel != null) {
-            infoPanel.contract();
-        }
-    }
-
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugePanel.java	Tue Jun 17 09:45:48 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugePanel.java	Tue Jun 17 09:47:45 2014 +0200
@@ -42,7 +42,6 @@
      * Loads the river info and renders it afterwards.
      */
     public void refresh() {
-        contract();
 
         riverInfoService.getGauges(this.river, new AsyncCallback<RiverInfo>() {
             @Override
@@ -54,7 +53,6 @@
             public void onSuccess(RiverInfo riverinfo) {
                 GWT.log("Loaded river info");
                 render(riverinfo);
-                expand();
             }
         });
     }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoPanel.java	Tue Jun 17 09:45:48 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoPanel.java	Tue Jun 17 09:47:45 2014 +0200
@@ -11,8 +11,6 @@
 import com.google.gwt.core.client.GWT;
 
 import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
 import com.smartgwt.client.widgets.layout.VLayout;
 import org.dive4elements.river.client.client.FLYS;
 import org.dive4elements.river.client.client.FLYSConstants;
@@ -30,9 +28,6 @@
     /** The instance of FLYS */
     protected FLYS flys;
 
-    /** SectionStackSection where this InfoPanel belongs in*/
-    protected SectionStackSection section;
-
     /** Name of the river */
     protected String river;
 
@@ -49,20 +44,11 @@
     public final static String SECTION_ID = "InfoPanelSection";
 
     public InfoPanel(FLYS flys, InfoListGrid listgrid) {
-        SectionStackSection section = new SectionStackSection();
-        section.setExpanded(false);
-        section.setTitle(getSectionTitle());
-        section.setName(SECTION_ID);
-        section.setID(SECTION_ID);
-
         setOverflow(Overflow.HIDDEN);
         setStyleName("infopanel");
 
         this.flys = flys;
 
-        section.setHidden(true);
-        section.setItems(this);
-        this.section = section;
         this.listgrid = listgrid;
         this.addMember(listgrid);
     }
@@ -96,59 +82,11 @@
         this.listgrid.setRiverInfo(riverinfo);
     }
 
-    /**
-     * Hide the section stack section.
-     */
-    @Override
-    public void hide() {
-        GWT.log("InfoPanel - hide");
-        this.section.setHidden(true);
-    }
-
-    /**
-     * Show the section stack section.
-     */
-    @Override
-    public void show() {
-        GWT.log("InfoPanel - show");
-        this.section.setHidden(false);
-    }
-
-    @Override
-    public void addMember(Canvas component) {
-        super.addMember(component);
-        expand();
-    }
-
-    @Override
-    public void removeMembers(Canvas[] components) {
-        super.removeMembers(components);
-        contract();
-    }
-
-    public SectionStackSection getSection() {
-        return this.section;
-    }
-
     protected void removeAllMembers() {
         removeMembers(getMembers());
     }
 
-    /**
-     * Expands the gauge section.
-     */
-    public void expand() {
-        section.setExpanded(true);
-    }
-
-    /**
-     * Contracts/shrinks the expanded gauge section.
-     */
-    public void contract() {
-        section.setExpanded(false);
-    }
-
     protected abstract void refresh();
 
-    protected abstract String getSectionTitle();
+    public abstract String getSectionTitle();
 }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationPanel.java	Tue Jun 17 09:45:48 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationPanel.java	Tue Jun 17 09:47:45 2014 +0200
@@ -44,7 +44,6 @@
     @Override
     public void refresh() {
         GWT.log("MeasurementStationPanel - refresh");
-        contract();
 
         riverInfoService.getMeasurementStations(this.river,
             new AsyncCallback<RiverInfo>() {
@@ -57,7 +56,6 @@
                 public void onSuccess(RiverInfo riverinfo) {
                     GWT.log("MeasurementStationPanel - Loaded river info");
                     render(riverinfo);
-                    expand();
                 }
         });
     }

http://dive4elements.wald.intevation.org