Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 4473:6db783627137
Map print does now submit additional parameters to MapPrintServiceImpl.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Sat, 10 Nov 2012 23:47:38 +0100 |
parents | dc7e41efd5ba |
children | bd78d2b0e309 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Sat Nov 10 00:53:28 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Sat Nov 10 23:47:38 2012 +0100 @@ -18,8 +18,13 @@ import de.intevation.flys.client.client.ui.Toolbar; import de.intevation.flys.client.client.utils.EnableDisableCmd; import de.intevation.flys.client.shared.model.Collection; +import de.intevation.flys.client.shared.model.Property; +import de.intevation.flys.client.shared.model.PropertySetting; +import de.intevation.flys.client.shared.model.Settings; import de.intevation.flys.client.shared.model.ThemeList; +import java.util.List; + import org.gwtopenmaps.openlayers.client.Bounds; import org.gwtopenmaps.openlayers.client.Map; import org.gwtopenmaps.openlayers.client.control.DragPan; @@ -288,7 +293,7 @@ return new ImgLink( baseUrl + MSG.downloadPDF(), - getPrintUrl(), + createPrintUrl(), 20, 20, true); } @@ -688,10 +693,29 @@ @Override public void onMapZoom(MapZoomListener.MapZoomEvent e) { - printMapLink.setSource(getPrintUrl()); + printMapLink.setSource(createPrintUrl()); } - public String getPrintUrl() { + protected void appendPrintSettingsToUrl(Collection collection, StringBuilder url) { + Settings settings = collection.getSettings("print-settings"); + if (settings != null) { + List<Property> properties = settings.getSettings("default"); + for (Property prop : properties) { + GWT.log("prop=" + prop.getName()); + PropertySetting props = (PropertySetting)prop; + if (props.getName().equals("page-format")) { + + } + else if (props.getName().equals("page-title")) { + url.append("&page-title="); + url.append(props.getValue()); + GWT.log(props.getName() + "=" + props.getValue()); + } + } + } + } + + public String createPrintUrl() { MapOutputTab ot = (MapOutputTab)getOutputTab(); Collection collection = ot.getCollection(); String uuid = collection.identifier(); @@ -700,21 +724,30 @@ ? "floodmap" : "map"; - String url = GWT.getModuleBaseURL() + "map-print?"; + StringBuilder url = new StringBuilder(); + url.append(GWT.getModuleBaseURL()); + url.append("map-print?"); Map map = getMap(); Bounds bounds = map.getExtent(); if (bounds != null) { try { - double minX = bounds.getLowerLeftX(); - double maxX = bounds.getUpperRightX(); - double minY = bounds.getLowerLeftY(); - double maxY = bounds.getUpperRightY(); - url += "minx=" + minX + "&"; - url += "maxx=" + maxX + "&"; - url += "miny=" + minY + "&"; - url += "maxy=" + maxY + "&"; + url.append("minx="); + url.append(bounds.getLowerLeftX()); + url.append("&"); + + url.append("maxx="); + url.append(bounds.getUpperRightX()); + url.append("&"); + + url.append("miny="); + url.append(bounds.getLowerLeftY()); + url.append("&"); + + url.append("maxy="); + url.append(bounds.getUpperRightY()); + url.append("&"); } catch (Exception e) { // XXX: Ignore it. bounds.getXXX() throw @@ -722,9 +755,14 @@ } } - url += "uuid=" + uuid + "&maptype=" + mapType; + url.append("uuid="); + url.append(uuid); + url.append("&maptype="); + url.append(mapType); - return url; + appendPrintSettingsToUrl(collection, url); + + return url.toString(); }