Mercurial > dive4elements > river
changeset 5538:ef32ab3c1679
d4e/client: Map preview in DigitizePanel is now properly resized (as long as the project is not reopened).
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 25 Mar 2013 14:36:39 +0100 |
parents | 7eb6e1f16e9d |
children | 8d0af912351c |
files | flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java |
diffstat | 2 files changed, 42 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Mar 25 12:41:00 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Mar 25 14:36:39 2013 +0100 @@ -1,19 +1,16 @@ package de.intevation.flys.client.client.ui; -import java.util.List; - -import org.gwtopenmaps.openlayers.client.Map; -import org.gwtopenmaps.openlayers.client.control.Attribution; -import org.gwtopenmaps.openlayers.client.layer.WMS; -import org.gwtopenmaps.openlayers.client.layer.WMSOptions; -import org.gwtopenmaps.openlayers.client.layer.WMSParams; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; + import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.events.ParentMovedEvent; +import com.smartgwt.client.widgets.events.ParentMovedHandler; +import com.smartgwt.client.widgets.events.ResizedEvent; +import com.smartgwt.client.widgets.events.ResizedHandler; import com.smartgwt.client.widgets.events.VisibilityChangedEvent; import com.smartgwt.client.widgets.events.VisibilityChangedHandler; import com.smartgwt.client.widgets.layout.VLayout; @@ -34,6 +31,14 @@ import de.intevation.flys.client.shared.model.DefaultDataItem; import de.intevation.flys.client.shared.model.MapInfo; +import java.util.List; + +import org.gwtopenmaps.openlayers.client.Map; +import org.gwtopenmaps.openlayers.client.control.Attribution; +import org.gwtopenmaps.openlayers.client.layer.WMS; +import org.gwtopenmaps.openlayers.client.layer.WMSOptions; +import org.gwtopenmaps.openlayers.client.layer.WMSParams; + public class DigitizePanel extends SelectProvider @@ -58,7 +63,7 @@ @Override public Canvas create(DataList list) { - List<Data> data = list.getAll(); + List<Data> data = list.getAll(); // FIXME: data is not used? getAll() side-effects? helperContainer.addVisibilityChangedHandler(this); DataList clone = (DataList) list.clone(); @@ -150,7 +155,22 @@ floodMap = mapPanel.getFloodMap(); Map map = floodMap.getMap(); + helperContainer.addResizedHandler(new ResizedHandler() { + + @Override + public void onResized(ResizedEvent event) { + mapPanel.doLayout(helperContainer.getWidth(), helperContainer.getHeight()); + } + }); + helperContainer.addParentMovedHandler(new ParentMovedHandler() { + + @Override + public void onParentMoved(ParentMovedEvent event) { + mapPanel.updateSize(); + } + }); helperContainer.addMember(mapPanel); + //helperContainer.setSize(helperContainer.getWidthAsString()(), helperContainer.getHeightAsString()()); parameterList.registerCollectionViewTabHandler(this);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java Mon Mar 25 12:41:00 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java Mon Mar 25 14:36:39 2013 +0100 @@ -1,11 +1,7 @@ package de.intevation.flys.client.client.ui.map; import com.google.gwt.core.client.GWT; -import com.smartgwt.client.widgets.events.ParentMovedEvent; -import com.smartgwt.client.widgets.events.ParentMovedHandler; -import com.smartgwt.client.widgets.events.ResizedEvent; -import com.smartgwt.client.widgets.events.ResizedHandler; -import com.smartgwt.client.widgets.layout.VLayout; +import com.google.gwt.user.client.ui.AbsolutePanel; import de.intevation.flys.client.shared.model.BBox; import de.intevation.flys.client.shared.model.MapInfo; @@ -17,7 +13,7 @@ * Panel that contains a MapWidget and a MapToolbar. * This panel is used by the flood map calculation input helper. */ -public class MapPanel extends VLayout { +public class MapPanel extends AbsolutePanel { protected MapToolbar toolbar; @@ -43,33 +39,23 @@ private void initLayout() { - setWidth100(); - setHeight100(); + setWidth("100%"); + setHeight("100%"); floodMapWidget = floodMap.getMapWidget(); toolbar = new MapToolbar(floodMap, digitizeEnabled); - addMember(toolbar); - addMember(floodMapWidget); - - addResizedHandler(new ResizedHandler() { - @Override - public void onResized(ResizedEvent event) { - doLayout(); - } - }); - - addParentMovedHandler(new ParentMovedHandler() { - @Override - public void onParentMoved(ParentMovedEvent event) { - floodMapWidget.getMap().updateSize(); - } - }); + add(toolbar); + add(floodMapWidget); } - protected void doLayout() { - int width = getWidth(); - int height = getHeight(); + public void updateSize() { + floodMapWidget.getMap().updateSize(); + } + + public void doLayout(int w, int h) { + int width = w; + int height = h; GWT.log("MapPanel.size: " + width + "x" + height); width -= 2; // minus black borders