# HG changeset patch # User Björn Ricks # Date 1350912596 -7200 # Node ID 9f9843491ac42fcd52b6c1f5aa22fc168b58521c # Parent de795c13dcfb66914516e9ab245c88575ce517ae 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) diff -r de795c13dcfb -r 9f9843491ac4 flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java --- 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