Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 5606:0d8564196d73
Break printing to rework the parametrization of the print job
There is now only one print button that opens a dialog
with input fields for additional attributes as specified by
desktop flys.
Currently the print button does not work and this commit
is part of a WIP.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 09 Apr 2013 11:51:29 +0200 |
parents | 6fb4e29a2a9b |
children |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Mon Apr 08 17:40:20 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Tue Apr 09 11:51:29 2013 +0200 @@ -25,7 +25,6 @@ import java.util.List; -import org.gwtopenmaps.openlayers.client.Bounds; import org.gwtopenmaps.openlayers.client.Map; import org.gwtopenmaps.openlayers.client.control.DragPan; import org.gwtopenmaps.openlayers.client.control.SelectFeature; @@ -66,8 +65,7 @@ protected ImgButton infoButton; protected ImgButton removeButton; protected ImgButton elevationButton; - protected ImgLink printMapLink; - protected ImgButton printMapSettings; + protected ImgButton printMap; protected Label epsgLabel; @@ -124,11 +122,8 @@ addWMSButton = createWMSControl(); addMember(addWMSButton); - printMapLink = createPrintMapLink(); - addMember(printMapLink); - - printMapSettings = createMapPrintSettingsControl(); - addMember(printMapSettings); + printMap = createMapPrintControl(); + addMember(printMap); } addMember(zoomToMaxButton); @@ -281,18 +276,6 @@ return btn; } - protected ImgLink createPrintMapLink() { - String baseUrl = GWT.getHostPageBaseURL(); - - getMap().addMapZoomListener(this); - - return new ImgLink( - baseUrl + MSG.downloadPDF(), - createPrintUrl(), - 20, 20, - true); - } - protected ImgButton createMaxExtentControl() { ImgButton zoomToMax = createButton(MSG.zoom_all(), new ClickHandler() { @@ -647,16 +630,18 @@ } - protected ImgButton createMapPrintSettingsControl() { + protected ImgButton createMapPrintControl() { final MapToolbar mtb = this; ImgButton btn = createButton(MSG.printMapSettings(), new ClickHandler() { @Override public void onClick(ClickEvent event) { - MapPrintSettingsWindow mpsw = - new MapPrintSettingsWindow(outputTab.getCollection(), mtb); + MapPrintWindow mpsw = + new MapPrintWindow(outputTab.getCollection(), mtb); outputTab.getCollectionView().addChild(mpsw); } }); + btn.setTooltip(MSG.printTooltip()); + return btn; } @@ -689,78 +674,9 @@ @Override public void onMapZoom(MapZoomListener.MapZoomEvent e) { - updatePrintUrl(); - } - - 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) { - PropertySetting props = (PropertySetting)prop; - url.append("&"); - url.append(props.getName()); - url.append("="); - url.append(props.getValue()); - } - } - } - - public void updatePrintUrl() { - printMapLink.setSource(createPrintUrl()); +// updatePrintUrl(); } - public String createPrintUrl() { - MapOutputTab ot = (MapOutputTab)getOutputTab(); - Collection collection = ot.getCollection(); - String uuid = collection.identifier(); - - String mapType = collection.getOutputModes().containsKey("floodmap") - ? "floodmap" - : "map"; - - StringBuilder url = new StringBuilder(); - url.append(GWT.getModuleBaseURL()); - url.append("map-print?"); - - Map map = getMap(); - Bounds bounds = map.getExtent(); - - if (bounds != null) { - try { - 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 - // exceptions when bound is invalid. :-/ - } - } - - url.append("uuid="); - url.append(uuid); - url.append("&maptype="); - url.append(mapType); - - appendPrintSettingsToUrl(collection, url); - - return url.toString(); - } - - public void updateThemes(ThemeList themeList) { if (legendWindow != null) { legendWindow.update(themeList);