annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintPanel.java @ 5714:1103308b19ca

Add toJavaEncodedString function to encode strings in utf-16 notation used by java. This fixes printing of unicode characters.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 15 Apr 2013 11:34:28 +0200
parents 10aac4ec2d76
children 22e03ca8c39d
rev   line source
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui.map;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
2
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
4 import com.google.gwt.user.client.rpc.AsyncCallback;
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
5 import com.google.gwt.user.client.Window;
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
6
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
7 import com.smartgwt.client.util.SC;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.widgets.Canvas;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.widgets.form.DynamicForm;
5611
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
10 import com.smartgwt.client.widgets.form.fields.TextItem;
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
11 import com.smartgwt.client.widgets.form.fields.ButtonItem;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
12 import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
13 import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
5611
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
14 import com.smartgwt.client.types.Alignment;
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
15
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
16 import org.gwtopenmaps.openlayers.client.Bounds;
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
17 import org.gwtopenmaps.openlayers.client.Map;
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
18
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.client.client.Config;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.client.client.FLYSConstants;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.client.client.services.CollectionAttributeService;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
22 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.client.shared.model.Collection;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
24 import de.intevation.flys.client.shared.model.OutputSettings;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.client.shared.model.Property;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
26 import de.intevation.flys.client.shared.model.PropertySetting;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
27 import de.intevation.flys.client.shared.model.Settings;
5675
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
28 import de.intevation.flys.client.shared.model.Artifact;
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
29 import de.intevation.flys.client.shared.model.ArtifactDescription;
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
30 import de.intevation.flys.client.shared.model.Data;
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
31 import de.intevation.flys.client.shared.model.DataItem;
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
32 import de.intevation.flys.client.shared.model.DataList;
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
33
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
34
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
35 import java.util.ArrayList;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
36 import java.util.LinkedHashMap;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
37 import java.util.List;
5675
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
38 import java.util.MissingResourceException;
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
39
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
40 public class MapPrintPanel extends Canvas {
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
41
5675
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
42 private static final String MAPFISH_MAPTITLE = "mapfish_mapTitle";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
43 private static final String MAPFISH_RANGE = "mapfish_data_range";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
44 private static final String MAPFISH_SUBTITLE = "mapfish_data_subtitle";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
45 private static final String MAPFISH_STRETCH = "mapfish_data_strech";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
46 private static final String MAPFISH_CREATED = "mapfish_data_created";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
47 private static final String MAPFISH_SOURCE = "mapfish_data_source";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
48 private static final String MAPFISH_CREATOR = "mapfish_data_creator";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
49 private static final String MAPFISH_DATEPLACE = "mapfish_data_dateplace";
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
50 private static final String MAPFISH_RIVER = "mapfish_data_river";
4474
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
51
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
52 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
53
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
54 /** CollectionAttribute Update Service. */
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
55 protected CollectionAttributeServiceAsync updater =
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
56 GWT.create(CollectionAttributeService.class);
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
57
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
58
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
59 protected Collection collection;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
60 protected Settings settings;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
61 protected TextItem pageTitle = new TextItem();
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
62 protected TextItem pageRange = new TextItem();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
63 protected TextItem pageSubtitle = new TextItem();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
64 protected TextItem pageStrech = new TextItem();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
65 protected TextItem pageCreated = new TextItem();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
66 protected TextItem pageSource = new TextItem();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
67 protected TextItem pageCreator = new TextItem();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
68 protected TextItem pageDatePlace = new TextItem();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
69 // protected SelectItem pageFormat = createPageFormatSelectItem();
4474
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
70 protected MapToolbar mapToolbar;
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
71 protected MapPrintWindow parent;
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
72
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
73 public MapPrintPanel(Collection collection, MapToolbar mapToolbar, MapPrintWindow parent) {
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
74 this.collection = collection;
4474
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
75 this.mapToolbar = mapToolbar;
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
76 this.parent = parent;
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
77 initLayout();
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
78
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
79 this.settings = collection.getSettings("print-settings");
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
80 if (settings == null) {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
81 settings = new OutputSettings();
4473
6db783627137 Map print does now submit additional parameters to MapPrintServiceImpl.
Christian Lins <christian.lins@intevation.de>
parents: 4472
diff changeset
82 GWT.log("settings are empty");
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
83 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
84 else {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
85 List<Property> properties = settings.getSettings("default");
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
86 for (Property prop : properties) {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
87 PropertySetting props = (PropertySetting)prop;
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
88 GWT.log(props.getName() + "=" + props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
89 if (props.getName().equals(MAPFISH_MAPTITLE)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
90 this.pageTitle.setValue(props.getValue());
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
91 }
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
92 else if (props.getName().equals(MAPFISH_RANGE)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
93 this.pageRange.setValue(props.getValue());
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
94 }
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
95 else if (props.getName().equals(MAPFISH_SUBTITLE)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
96 this.pageSubtitle.setValue(props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
97 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
98 else if (props.getName().equals(MAPFISH_STRETCH)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
99 this.pageStrech.setValue(props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
100 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
101 else if (props.getName().equals(MAPFISH_CREATED)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
102 this.pageCreated.setValue(props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
103 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
104 else if (props.getName().equals(MAPFISH_SOURCE)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
105 this.pageSource.setValue(props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
106 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
107 else if (props.getName().equals(MAPFISH_CREATOR)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
108 this.pageCreator.setValue(props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
109 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
110 else if (props.getName().equals(MAPFISH_DATEPLACE)) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
111 this.pageDatePlace.setValue(props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
112 } else {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
113 GWT.log("Unknown Print property: " + prop.getName());
4474
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
114 }
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
115 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
116 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
117 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
118
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
119 protected void initLayout() {
4474
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
120 // TODO: i18n
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
121 this.pageTitle.setTitle("Titel");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
122 this.pageSubtitle.setTitle("Untertitel");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
123 this.pageRange.setTitle("Bereich");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
124 this.pageStrech.setTitle("Strecke");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
125 this.pageCreated.setTitle("Aufgestellt");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
126 this.pageSource.setTitle("Datenquelle");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
127 this.pageCreator.setTitle("Ersteller");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
128 this.pageDatePlace.setTitle("Ort, Datum");
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
129
5675
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
130 pageTitle.setLength(21);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
131 pageSubtitle.setLength(21);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
132 pageRange.setLength(21);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
133 pageStrech.setLength(21);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
134 pageCreated.setLength(21);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
135 pageSource.setLength(21);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
136 pageCreator.setLength(21);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
137 pageDatePlace.setLength(21);
5611
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
138 ButtonItem printButton = createPrintButtonItem();
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
139
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
140 printButton.setAlign(Alignment.RIGHT);
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
141
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
142 DynamicForm df = new DynamicForm();
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
143 df.setFields(
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
144 // this.pageFormat,
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
145 this.pageTitle,
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
146 this.pageSubtitle,
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
147 this.pageRange,
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
148 this.pageStrech,
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
149 this.pageCreated,
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
150 this.pageSource,
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
151 this.pageCreator,
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
152 this.pageDatePlace,
5611
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
153 printButton);
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
154 addChild(df);
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
155 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
156
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
157 /*
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
158 * Commented out because we only provide a layout for A4 Landscape atm
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
159
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
160 protected SelectItem createPageFormatSelectItem() {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
161 LinkedHashMap values = new LinkedHashMap();
4474
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
162 // TODO: i18n
4965
8af500d62098 Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents: 4474
diff changeset
163 values.put("A4 landscape", "DIN A4 (Querformat)");
8af500d62098 Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents: 4474
diff changeset
164 //values.put("A4 portrait", "DIN A4 (Hochformat)");
8af500d62098 Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents: 4474
diff changeset
165 //values.put("A0 portrait", "DIN A0 (Hochformat)");
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
166
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
167 SelectItem selItem = new SelectItem();
4474
bd78d2b0e309 Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents: 4473
diff changeset
168 selItem.setTitle("Seitengröße:"); // TODO: i18n
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
169 selItem.setValueMap(values);
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
170 selItem.setDefaultToFirstOption(true);
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
171
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
172 return selItem;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
173 }
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
174 */
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
175 protected ButtonItem createPrintButtonItem() {
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
176 ButtonItem btn = new ButtonItem();
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
177 GWT.log("Button created");
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
178 btn.addClickHandler(new ClickHandler() {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
179
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
180 public void onClick(ClickEvent event) {
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
181 GWT.log("Print Button Click");
5611
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
182 updateCollection();
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
183 Window.open(createPrintUrl(), "_blank", "");
17e2324c760e Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents: 5606
diff changeset
184 parent.destroy();
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
185 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
186 });
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
187 btn.setTitle(MSG.print());
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
188 return btn;
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
189 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
190
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
191 private String createPrintUrl() {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
192 MapOutputTab ot = (MapOutputTab)mapToolbar.getOutputTab();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
193 Collection collection = ot.getCollection();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
194 String uuid = collection.identifier();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
195
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
196 String mapType = collection.getOutputModes().containsKey("floodmap")
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
197 ? "floodmap"
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
198 : "map";
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
199
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
200 StringBuilder url = new StringBuilder();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
201 url.append(GWT.getModuleBaseURL());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
202 url.append("map-print?");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
203
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
204 Map map = mapToolbar.getMap();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
205 Bounds bounds = map.getExtent();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
206
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
207 if (bounds != null) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
208 try {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
209 url.append("minx=");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
210 url.append(bounds.getLowerLeftX());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
211 url.append("&");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
212
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
213 url.append("maxx=");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
214 url.append(bounds.getUpperRightX());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
215 url.append("&");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
216
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
217 url.append("miny=");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
218 url.append(bounds.getLowerLeftY());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
219 url.append("&");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
220
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
221 url.append("maxy=");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
222 url.append(bounds.getUpperRightY());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
223 url.append("&");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
224 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
225 catch (Exception e) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
226 // XXX: Ignore it. bounds.getXXX() throw
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
227 // exceptions when bound is invalid. :-/
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
228 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
229 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
230
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
231 url.append("uuid=");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
232 url.append(uuid);
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
233 url.append("&maptype=");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
234 url.append(mapType);
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
235
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
236 appendPrintToUrl(collection, url);
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
237
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
238 return url.toString();
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
239 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
240
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
241 private void appendPrintToUrl(Collection collection, StringBuilder url) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
242 Settings settings = collection.getSettings("print-settings");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
243 if (settings != null) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
244 List<Property> properties = settings.getSettings("default");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
245 for (Property prop : properties) {
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
246 PropertySetting props = (PropertySetting)prop;
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
247 url.append("&");
5675
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
248 String localized;
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
249 try {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
250 localized = MSG.getString(props.getName());
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
251 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
252 catch (MissingResourceException mre) {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
253 localized = props.getName();
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
254 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
255 url.append(localized);
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
256 url.append("=");
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
257 url.append(props.getValue());
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
258 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
259 }
5675
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
260 // O.o
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
261 String river = findRiver(((MapOutputTab)mapToolbar.getOutputTab()
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
262 ).getCollectionView().getArtifact());
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
263 url.append("&" + MSG.getString(MAPFISH_RIVER) + "=" + river);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
264 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
265
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
266 // Copy of DatacageWindow's findRiver
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
267 protected String findRiver(Artifact artifact) {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
268 ArtifactDescription adescr = artifact.getArtifactDescription();
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
269 DataList [] data = adescr.getOldData();
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
270
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
271 if (data != null && data.length > 0) {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
272 for (int i = 0; i < data.length; i++) {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
273 DataList dl = data[i];
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
274 if (dl.getState().equals("state.winfo.river")) {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
275 for (int j = dl.size()-1; j >= 0; --j) {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
276 Data d = dl.get(j);
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
277 DataItem [] di = d.getItems();
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
278 if (di != null && di.length == 1) {
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
279 return d.getItems()[0].getStringValue();
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
280 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
281 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
282 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
283 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
284 }
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
285
10aac4ec2d76 Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents: 5622
diff changeset
286 return "";
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
287 }
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
288
5714
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
289 public static String toJavaEncodedString(String str) {
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
290 if (str == null) {
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
291 return null;
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
292 }
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
293 StringBuilder sb = new StringBuilder();
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
294 for (int i = 0, len = str.length(); i < len; i++) {
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
295 int unipoint = Character.codePointAt(str, i);
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
296 if ((unipoint < 32) || (unipoint > 127)) {
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
297 sb.append("\\u");
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
298 sb.append(Integer.toHexString((unipoint >> 3*4) & 0xf));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
299 sb.append(Integer.toHexString((unipoint >> 2*4) & 0xf));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
300 sb.append(Integer.toHexString((unipoint >> 1*4) & 0xf));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
301 sb.append(Integer.toHexString((unipoint >> 0*4) & 0xf));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
302 } else {
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
303 sb.append(str.charAt(i));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
304 }
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
305 }
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
306 return sb.toString();
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
307 }
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
308
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
309 protected void updateCollection() {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
310 final Config config = Config.getInstance();
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
311 final String loc = config.getLocale();
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
312
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
313 GWT.log("MapPrintPanel.updateCollection via RPC now");
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
314
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
315 List<Property> properties = new ArrayList<Property>();
5714
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
316 properties.add(new PropertySetting(MAPFISH_MAPTITLE, toJavaEncodedString(pageTitle.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
317 // properties.add(new PropertySetting(MAPFISH_LAYOUT, toJavaEncodedString(pageFormat.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
318 properties.add(new PropertySetting(MAPFISH_SUBTITLE, toJavaEncodedString(pageSubtitle.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
319 properties.add(new PropertySetting(MAPFISH_RANGE, toJavaEncodedString(pageRange.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
320 properties.add(new PropertySetting(MAPFISH_STRETCH, toJavaEncodedString(pageStrech.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
321 properties.add(new PropertySetting(MAPFISH_CREATED, toJavaEncodedString(pageCreated.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
322 properties.add(new PropertySetting(MAPFISH_SOURCE, toJavaEncodedString(pageSource.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
323 properties.add(new PropertySetting(MAPFISH_CREATOR, toJavaEncodedString(pageCreator.getValueAsString())));
1103308b19ca Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents: 5675
diff changeset
324 properties.add(new PropertySetting(MAPFISH_DATEPLACE, toJavaEncodedString(pageDatePlace.getValueAsString())));
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
325 settings.setSettings("default", properties);
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
326
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
327 collection.addSettings("print-settings", settings);
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
328 updater.update(collection, loc, new AsyncCallback<Collection>() {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
329 @Override
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
330 public void onFailure(Throwable caught) {
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
331 GWT.log("Could not update collection attributes.");
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
332 SC.warn(MSG.getString(caught.getMessage()));
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
333 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
334 @Override
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
335 public void onSuccess(Collection collection) {
5606
0d8564196d73 Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents: 4965
diff changeset
336 GWT.log("MapPrint: collection attributes updated");
4472
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
337 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
338 });
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
339 }
dc7e41efd5ba Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
340 }

http://dive4elements.wald.intevation.org