Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MapPrintPanel.java @ 6384:2987d81ea719
Further fix encoding handling in the print service
- Strings are now html escaped additionaly to java encoding
- Escaping / encoding moved into maputils
- The legend url is urlencoded
- Properties are no longer stored in an encoded manner but
rather encoded on demand
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 21 Jun 2013 12:15:30 +0200 |
parents | 9d5f09698d81 |
children | 3823b8bd6bfd |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.client.ui.map; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
10 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
11 import org.dive4elements.river.client.client.Config; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
12 import org.dive4elements.river.client.client.FLYSConstants; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
13 import org.dive4elements.river.client.client.services.CollectionAttributeService; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
14 import org.dive4elements.river.client.client.services.CollectionAttributeServiceAsync; |
6245
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
15 import org.dive4elements.river.client.shared.model.Artifact; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
16 import org.dive4elements.river.client.shared.model.ArtifactDescription; |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
17 import org.dive4elements.river.client.shared.model.Collection; |
6245
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
18 import org.dive4elements.river.client.shared.model.Data; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
19 import org.dive4elements.river.client.shared.model.DataItem; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
20 import org.dive4elements.river.client.shared.model.DataList; |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
21 import org.dive4elements.river.client.shared.model.OutputSettings; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
22 import org.dive4elements.river.client.shared.model.Property; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
23 import org.dive4elements.river.client.shared.model.PropertySetting; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
24 import org.dive4elements.river.client.shared.model.Settings; |
6384
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
25 import org.dive4elements.river.client.shared.MapUtils; |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
26 |
6245
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
27 import com.google.gwt.core.client.GWT; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
28 import com.google.gwt.user.client.Window; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
29 import com.google.gwt.user.client.rpc.AsyncCallback; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
30 import com.smartgwt.client.types.Alignment; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
31 import com.smartgwt.client.util.SC; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
32 import com.smartgwt.client.widgets.Canvas; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
33 import com.smartgwt.client.widgets.form.DynamicForm; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
34 import com.smartgwt.client.widgets.form.fields.ButtonItem; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
35 import com.smartgwt.client.widgets.form.fields.SelectItem; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
36 import com.smartgwt.client.widgets.form.fields.TextItem; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
37 import com.smartgwt.client.widgets.form.fields.events.ClickEvent; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
38 import com.smartgwt.client.widgets.form.fields.events.ClickHandler; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
39 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
40 import java.util.ArrayList; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
41 import java.util.LinkedHashMap; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
42 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
|
43 import java.util.MissingResourceException; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
44 |
6245
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
45 import org.gwtopenmaps.openlayers.client.Bounds; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
46 import org.gwtopenmaps.openlayers.client.Map; |
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
47 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
48 public class MapPrintPanel extends Canvas { |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
49 |
5675
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_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
|
51 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
|
52 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
|
53 private static final String MAPFISH_STRETCH = "mapfish_data_strech"; |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
54 private static final String MAPFISH_INSTITUTION = "mapfish_data_institution"; |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 private static final String MAPFISH_RIVER = "mapfish_data_river"; |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
59 private static final String MAPFISH_LOGO = "mapfish_logo"; |
4474
bd78d2b0e309
Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents:
4473
diff
changeset
|
60 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
61 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
|
62 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
63 /** CollectionAttribute Update Service. */ |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
64 protected CollectionAttributeServiceAsync updater = |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
65 GWT.create(CollectionAttributeService.class); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
66 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
67 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
68 protected Collection collection; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
69 protected Settings settings; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
70 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
|
71 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
|
72 protected TextItem pageSubtitle = new TextItem(); |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
73 protected TextItem pageStretch = new TextItem(); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
74 protected TextItem pageInstitution = new TextItem(); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
75 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
|
76 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
|
77 protected TextItem pageDatePlace = new TextItem(); |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
78 protected SelectItem pageLogo = createPageLogoSelectItem(); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
79 // 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
|
80 protected MapToolbar mapToolbar; |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
81 protected MapPrintWindow parent; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
82 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
83 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
|
84 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
|
85 this.mapToolbar = mapToolbar; |
bd78d2b0e309
Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents:
4473
diff
changeset
|
86 this.parent = parent; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
87 initLayout(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
88 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
89 this.settings = collection.getSettings("print-settings"); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
90 if (settings == null) { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
91 settings = new OutputSettings(); |
4473
6db783627137
Map print does now submit additional parameters to MapPrintServiceImpl.
Christian Lins <christian.lins@intevation.de>
parents:
4472
diff
changeset
|
92 GWT.log("settings are empty"); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
93 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
94 else { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
95 List<Property> properties = settings.getSettings("default"); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
96 for (Property prop : properties) { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 this.pageTitle.setValue(props.getValue()); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
101 } |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
102 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
|
103 this.pageRange.setValue(props.getValue()); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
104 } |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
105 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
|
106 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
|
107 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
108 else if (props.getName().equals(MAPFISH_STRETCH)) { |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
109 this.pageStretch.setValue(props.getValue()); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
110 } |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
111 else if (props.getName().equals(MAPFISH_INSTITUTION)) { |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
112 this.pageInstitution.setValue(props.getValue()); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
113 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
114 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
|
115 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
|
116 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
117 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
|
118 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
|
119 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
120 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
|
121 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
|
122 } else { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
123 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
|
124 } |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
125 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
126 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
127 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
128 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
129 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
|
130 // TODO: i18n |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
131 this.pageTitle.setTitle(MSG.mapTitle()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
132 this.pageSubtitle.setTitle(MSG.mapSubtitle()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
133 this.pageRange.setTitle(MSG.mapRange()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
134 this.pageStretch.setTitle(MSG.mapStretch()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
135 this.pageInstitution.setTitle(MSG.mapInstitution()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
136 this.pageSource.setTitle(MSG.mapSource()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
137 this.pageCreator.setTitle(MSG.mapCreator()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
138 this.pageDatePlace.setTitle(MSG.mapDate()); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
139 |
6245
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
140 pageTitle.setLength(20); |
5755
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
141 pageSubtitle.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
142 pageRange.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
143 pageStretch.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
144 pageInstitution.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
145 pageSource.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
146 pageCreator.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
147 pageDatePlace.setLength(30); |
5611
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
148 ButtonItem printButton = createPrintButtonItem(); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
149 |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
150 printButton.setAlign(Alignment.RIGHT); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
151 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
152 DynamicForm df = new DynamicForm(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
153 df.setFields( |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
154 // this.pageFormat, |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
155 this.pageTitle, |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
156 this.pageSubtitle, |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
157 this.pageRange, |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
158 this.pageStretch, |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
159 this.pageInstitution, |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
160 this.pageSource, |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
161 this.pageCreator, |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
162 this.pageDatePlace, |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
163 this.pageLogo, |
5611
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
164 printButton); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
165 addChild(df); |
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 |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
168 protected SelectItem createPageLogoSelectItem() { |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
169 LinkedHashMap values = new LinkedHashMap(); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
170 // TODO: this should be configurable |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
171 values.put(MSG.bfgLogo(), "BfG Logo"); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
172 |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
173 SelectItem selItem = new SelectItem(); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
174 selItem.setTitle(MSG.mapLogo()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
175 selItem.setValueMap(values); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
176 selItem.setDefaultToFirstOption(true); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
177 |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
178 return selItem; |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
179 } |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
180 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
181 /* |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
182 * 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
|
183 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
184 protected SelectItem createPageFormatSelectItem() { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
185 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
|
186 // TODO: i18n |
4965
8af500d62098
Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents:
4474
diff
changeset
|
187 values.put("A4 landscape", "DIN A4 (Querformat)"); |
8af500d62098
Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents:
4474
diff
changeset
|
188 //values.put("A4 portrait", "DIN A4 (Hochformat)"); |
8af500d62098
Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents:
4474
diff
changeset
|
189 //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
|
190 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
191 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
|
192 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
|
193 selItem.setValueMap(values); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
194 selItem.setDefaultToFirstOption(true); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
195 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
196 return selItem; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
197 } |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
198 */ |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
199 protected ButtonItem createPrintButtonItem() { |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
200 ButtonItem btn = new ButtonItem(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
201 btn.addClickHandler(new ClickHandler() { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
202 |
6245
54f1f4d90c72
Limit PDF map title length to 20 characters (#767).
Christian Lins <christian.lins@intevation.de>
parents:
5993
diff
changeset
|
203 @Override |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
204 public void onClick(ClickEvent event) { |
5611
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
205 updateCollection(); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
206 Window.open(createPrintUrl(), "_blank", ""); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
207 parent.destroy(); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
208 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
209 }); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
210 btn.setTitle(MSG.print()); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
211 return btn; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
212 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
213 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
214 private String createPrintUrl() { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
215 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
|
216 Collection collection = ot.getCollection(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
217 String uuid = collection.identifier(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
218 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
219 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
|
220 ? "floodmap" |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
221 : "map"; |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
222 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
223 StringBuilder url = new StringBuilder(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
224 url.append(GWT.getModuleBaseURL()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
225 url.append("map-print?"); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
226 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
227 Map map = mapToolbar.getMap(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
228 Bounds bounds = map.getExtent(); |
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 if (bounds != null) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
231 try { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
232 url.append("minx="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
233 url.append(bounds.getLowerLeftX()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
234 url.append("&"); |
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 url.append("maxx="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
237 url.append(bounds.getUpperRightX()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
238 url.append("&"); |
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 url.append("miny="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
241 url.append(bounds.getLowerLeftY()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
242 url.append("&"); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
243 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
244 url.append("maxy="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
245 url.append(bounds.getUpperRightY()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
246 url.append("&"); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
247 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
248 catch (Exception e) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
249 // 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
|
250 // 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
|
251 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
252 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
253 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
254 url.append("uuid="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
255 url.append(uuid); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
256 url.append("&maptype="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
257 url.append(mapType); |
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 appendPrintToUrl(collection, url); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
260 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
261 return url.toString(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
262 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
263 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
264 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
|
265 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
|
266 if (settings != null) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
267 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
|
268 for (Property prop : properties) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
269 PropertySetting props = (PropertySetting)prop; |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
270 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
|
271 String localized; |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
272 try { |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
273 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
|
274 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
275 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
|
276 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
|
277 } |
6384
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
278 url.append(MapUtils.toSaveHTMLJavaString(localized)); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
279 url.append("="); |
6384
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
280 url.append(MapUtils.toSaveHTMLJavaString((String)props.getValue())); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
281 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
282 } |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
283 // O.o |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
284 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
|
285 ).getCollectionView().getArtifact()); |
6384
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
286 url.append("&" + MapUtils.toSaveHTMLJavaString(MSG.getString(MAPFISH_RIVER)) + "=" + |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
287 MapUtils.toSaveHTMLJavaString(river)); |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
288 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
289 |
6379
9d5f09698d81
Search the river name also in the map.river state
Andre Heinecke <aheinecke@intevation.de>
parents:
6245
diff
changeset
|
290 // Copy of DatacageWindow's findRiver with added state for map.river |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
295 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
|
296 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
|
297 DataList dl = data[i]; |
6379
9d5f09698d81
Search the river name also in the map.river state
Andre Heinecke <aheinecke@intevation.de>
parents:
6245
diff
changeset
|
298 if (dl.getState().equals("state.winfo.river") || |
9d5f09698d81
Search the river name also in the map.river state
Andre Heinecke <aheinecke@intevation.de>
parents:
6245
diff
changeset
|
299 dl.getState().equals("state.map.river")) { |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
300 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
|
301 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
|
302 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
|
303 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
|
304 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
|
305 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
306 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
307 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
308 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
309 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
310 |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
311 return ""; |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
312 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
313 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
314 protected void updateCollection() { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
315 final Config config = Config.getInstance(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
316 final String loc = config.getLocale(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
317 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
318 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
|
319 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
320 List<Property> properties = new ArrayList<Property>(); |
6384
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
321 properties.add(new PropertySetting(MAPFISH_MAPTITLE, pageTitle.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
322 // properties.add(new PropertySetting(MAPFISH_LAYOUT, pageFormat.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
323 properties.add(new PropertySetting(MAPFISH_SUBTITLE, pageSubtitle.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
324 properties.add(new PropertySetting(MAPFISH_RANGE, pageRange.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
325 properties.add(new PropertySetting(MAPFISH_STRETCH, pageStretch.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
326 properties.add(new PropertySetting(MAPFISH_INSTITUTION, pageInstitution.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
327 properties.add(new PropertySetting(MAPFISH_SOURCE, pageSource.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
328 properties.add(new PropertySetting(MAPFISH_CREATOR, pageCreator.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
329 properties.add(new PropertySetting(MAPFISH_DATEPLACE, pageDatePlace.getValueAsString())); |
2987d81ea719
Further fix encoding handling in the print service
Andre Heinecke <aheinecke@intevation.de>
parents:
6379
diff
changeset
|
330 properties.add(new PropertySetting(MAPFISH_LOGO, pageLogo.getValueAsString())); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
331 settings.setSettings("default", properties); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
332 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
333 collection.addSettings("print-settings", settings); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
334 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
|
335 @Override |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
336 public void onFailure(Throwable caught) { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
337 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
|
338 SC.warn(MSG.getString(caught.getMessage())); |
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 @Override |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
341 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
|
342 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
|
343 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
344 }); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
345 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
346 } |