Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintSettingsPanel.java @ 4474:bd78d2b0e309
Map print settings can now be configured via settings window.
Configurable for now are page layout (A0 or A4), caption text and
comment text.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Sun, 11 Nov 2012 14:44:12 +0100 |
parents | 6db783627137 |
children | 8af500d62098 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintSettingsPanel.java Sat Nov 10 23:47:38 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintSettingsPanel.java Sun Nov 11 14:44:12 2012 +0100 @@ -28,6 +28,11 @@ public class MapPrintSettingsPanel extends Canvas { + public static final String MAPFISH_COMMENT = "mapfish-comment"; + public static final String MAPFISH_LAYOUT = "mapfish-layout"; + public static final String MAPFISH_MAPTITLE = "mapfish-mapTitle"; + public static final String MAPFISH_PAGESIZE = "mapfish-pageSize"; + /** The interface that provides i18n messages. */ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -38,9 +43,15 @@ protected Collection collection; protected Settings settings; protected TextItem pageTitle = new TextItem(); + protected SelectItem pageFormat = createPageFormatSelectItem(); + protected TextItem pageComment = new TextItem(); + protected MapToolbar mapToolbar; + protected MapPrintSettingsWindow parent; - public MapPrintSettingsPanel(Collection collection) { + public MapPrintSettingsPanel(Collection collection, MapToolbar mapToolbar, MapPrintSettingsWindow parent) { this.collection = collection; + this.mapToolbar = mapToolbar; + this.parent = parent; initLayout(); this.settings = collection.getSettings("print-settings"); @@ -53,24 +64,30 @@ for (Property prop : properties) { GWT.log("prop=" + prop.getName()); PropertySetting props = (PropertySetting)prop; - if (props.getName().equals("page-format")) { - + if (props.getName().equals(MAPFISH_PAGESIZE)) { + this.pageFormat.setValue(props.getValue()); } - else if (props.getName().equals("page-title")) { + else if (props.getName().equals(MAPFISH_MAPTITLE)) { this.pageTitle.setValue(props.getValue()); GWT.log(props.getName() + "=" + props.getValue()); } + else if (props.getName().equals(MAPFISH_COMMENT)) { + this.pageComment.setValue(props.getValue()); + } } } } protected void initLayout() { + // TODO: i18n this.pageTitle.setTitle("Seitentitel:"); + this.pageComment.setTitle("Kommentar:"); DynamicForm df = new DynamicForm(); df.setFields( - createPageFormatSelectItem(), + this.pageFormat, this.pageTitle, + this.pageComment, createSaveSettingsButtonItem() ); addChild(df); @@ -78,11 +95,12 @@ protected SelectItem createPageFormatSelectItem() { LinkedHashMap values = new LinkedHashMap(); - values.put("din_a4", "DIN A4"); - values.put("din_a0", "DIN A0"); + // TODO: i18n + values.put("A4 portrait", "DIN A4 (Hochformat)"); + values.put("A0 portrait", "DIN A0 (Hochformat)"); SelectItem selItem = new SelectItem(); - selItem.setTitle("Seitenformat:"); + selItem.setTitle("Seitengröße:"); // TODO: i18n selItem.setValueMap(values); selItem.setDefaultToFirstOption(true); @@ -96,6 +114,8 @@ @Override public void onClick(ClickEvent event) { updateCollection(); + mapToolbar.updatePrintUrl(); + parent.destroy(); } }); btn.setTitle("Speichern"); @@ -109,7 +129,9 @@ GWT.log("MapPrintSettingsPanel.updateCollection via RPC now"); List<Property> properties = new ArrayList<Property>(); - properties.add(new PropertySetting("page-title", this.pageTitle.getValueAsString())); + properties.add(new PropertySetting(MAPFISH_MAPTITLE, this.pageTitle.getValueAsString())); + properties.add(new PropertySetting(MAPFISH_COMMENT, this.pageComment.getValueAsString())); + properties.add(new PropertySetting(MAPFISH_LAYOUT, this.pageFormat.getValueAsString())); settings.setSettings("default", properties); collection.addSettings("print-settings", settings);