changeset 4204:9f9843491ac4

Only create the GaugeTree and RiverInfoPanel once This fixes resizing issues when changing the river. SmartGWT is not able to recalculate the height and width if a GWT widget is inserted later. Every attempt to call a recalculation manually did fail. Fix for flys/issue925 (W-INFO / Pegel-Info-Modul / Zeile Gewässer-INFOS)
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 22 Oct 2012 15:29:56 +0200
parents de795c13dcfb
children 0dd8963cec9c
files flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java	Mon Oct 22 15:25:04 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java	Mon Oct 22 15:29:56 2012 +0200
@@ -8,6 +8,7 @@
 import com.google.gwt.user.client.ui.Label;
 
 import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.events.ResizedEvent;
 import com.smartgwt.client.widgets.events.ResizedHandler;
 import com.smartgwt.client.widgets.layout.SectionStackSection;
@@ -42,6 +43,7 @@
         GWT.create(GaugeOverviewInfoService.class);
 
     protected GaugeTree gaugetree;
+    protected Canvas gaugetreecanvas;
 
     protected RiverInfoPanel riverinfopanel;
 
@@ -54,6 +56,9 @@
      */
     public GaugePanel(FLYS flys, SectionStackSection sectionStack) {
         gaugetree = new GaugeTree(flys);
+        gaugetreecanvas = new Canvas();
+        gaugetreecanvas.addChild(gaugetree);
+
         setOverflow(Overflow.HIDDEN);
         sectionStack.setHidden(true);
         sectionStack.setItems(this);
@@ -98,13 +103,20 @@
     }
 
     public void renderGaugeOverviewInfo(RiverInfo riverinfo) {
-        removeMembers(getMembers());
+        gaugetree.setGauges(riverinfo);
 
-        riverinfopanel = new RiverInfoPanel(riverinfo);
-        addMember(riverinfopanel);
-        addMember(gaugetree);
+        if (riverinfopanel == null) {
+            removeMembers(getMembers());
+            riverinfopanel = new RiverInfoPanel(riverinfo);
 
-        gaugetree.setGauges(riverinfo);
+            gaugetreecanvas.setWidth("100%");
+
+            addMember(riverinfopanel);
+            addMember(gaugetreecanvas);
+        }
+        else {
+            riverinfopanel.setRiverInfo(riverinfo);
+        }
     }
 
     @Override

http://dive4elements.wald.intevation.org