Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintPanel.java @ 5821:79717f1cf6eb
Set the title for the html feature info viewer
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 24 Apr 2013 19:03:20 +0200 |
parents | 3e2ab854d5c0 |
children |
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; |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
12 import com.smartgwt.client.widgets.form.fields.SelectItem; |
4472
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.ClickEvent; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
14 import com.smartgwt.client.widgets.form.fields.events.ClickHandler; |
5611
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
15 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
|
16 |
5606
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.Bounds; |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
18 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
|
19 |
4472
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.Config; |
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.FLYSConstants; |
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.CollectionAttributeService; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
35 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
36 import java.util.ArrayList; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
37 import java.util.LinkedHashMap; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
38 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
|
39 import java.util.MissingResourceException; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
40 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
41 public class MapPrintPanel extends Canvas { |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
42 |
5675
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_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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
54 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
|
55 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
56 /** CollectionAttribute Update Service. */ |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
57 protected CollectionAttributeServiceAsync updater = |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
58 GWT.create(CollectionAttributeService.class); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
59 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
60 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
61 protected Collection collection; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
62 protected Settings settings; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 // 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
|
73 protected MapToolbar mapToolbar; |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
74 protected MapPrintWindow parent; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
75 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
76 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
|
77 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
|
78 this.mapToolbar = mapToolbar; |
bd78d2b0e309
Map print settings can now be configured via settings window.
Christian Lins <christian.lins@intevation.de>
parents:
4473
diff
changeset
|
79 this.parent = parent; |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
80 initLayout(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
81 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
82 this.settings = collection.getSettings("print-settings"); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
83 if (settings == null) { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
84 settings = new OutputSettings(); |
4473
6db783627137
Map print does now submit additional parameters to MapPrintServiceImpl.
Christian Lins <christian.lins@intevation.de>
parents:
4472
diff
changeset
|
85 GWT.log("settings are empty"); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
86 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
87 else { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
88 List<Property> properties = settings.getSettings("default"); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
89 for (Property prop : properties) { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
90 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
|
91 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
|
92 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
|
93 this.pageTitle.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_RANGE)) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
96 this.pageRange.setValue(props.getValue()); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
97 } |
5606
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_SUBTITLE)) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
99 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
|
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_STRETCH)) { |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
102 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
|
103 } |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
104 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
|
105 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
|
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_SOURCE)) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
108 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
|
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_CREATOR)) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
111 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
|
112 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
113 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
|
114 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
|
115 } else { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
116 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
|
117 } |
4472
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 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
120 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
121 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
122 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
|
123 // TODO: i18n |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 this.pageDatePlace.setTitle(MSG.mapDate()); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
132 |
5755
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
133 pageTitle.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
134 pageSubtitle.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
135 pageRange.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
136 pageStretch.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
137 pageInstitution.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
138 pageSource.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
139 pageCreator.setLength(30); |
3e2ab854d5c0
Increase acceptet print dialog input length to 30
Andre Heinecke <aheinecke@intevation.de>
parents:
5721
diff
changeset
|
140 pageDatePlace.setLength(30); |
5611
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
141 ButtonItem printButton = createPrintButtonItem(); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
142 |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
143 printButton.setAlign(Alignment.RIGHT); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
144 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
145 DynamicForm df = new DynamicForm(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
146 df.setFields( |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
147 // this.pageFormat, |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
148 this.pageTitle, |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
149 this.pageSubtitle, |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
150 this.pageRange, |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
151 this.pageStretch, |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
152 this.pageInstitution, |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
153 this.pageSource, |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
154 this.pageCreator, |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
155 this.pageDatePlace, |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
156 this.pageLogo, |
5611
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
157 printButton); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
158 addChild(df); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
159 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
160 |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
161 protected SelectItem createPageLogoSelectItem() { |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
162 LinkedHashMap values = new LinkedHashMap(); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
163 // 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
|
164 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
|
165 |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
166 SelectItem selItem = new SelectItem(); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
167 selItem.setTitle(MSG.mapLogo()); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
168 selItem.setValueMap(values); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
169 selItem.setDefaultToFirstOption(true); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
170 |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
171 return selItem; |
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 |
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 * 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
|
176 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
177 protected SelectItem createPageFormatSelectItem() { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
178 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
|
179 // TODO: i18n |
4965
8af500d62098
Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents:
4474
diff
changeset
|
180 values.put("A4 landscape", "DIN A4 (Querformat)"); |
8af500d62098
Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents:
4474
diff
changeset
|
181 //values.put("A4 portrait", "DIN A4 (Hochformat)"); |
8af500d62098
Editing Map print config.
Christian Lins <christian.lins@intevation.de>
parents:
4474
diff
changeset
|
182 //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
|
183 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
184 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
|
185 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
|
186 selItem.setValueMap(values); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
187 selItem.setDefaultToFirstOption(true); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
188 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
189 return selItem; |
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 */ |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
192 protected ButtonItem createPrintButtonItem() { |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
193 ButtonItem btn = new ButtonItem(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
194 btn.addClickHandler(new ClickHandler() { |
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 public void onClick(ClickEvent event) { |
5611
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
197 updateCollection(); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
198 Window.open(createPrintUrl(), "_blank", ""); |
17e2324c760e
Renable map print button
Andre Heinecke <aheinecke@intevation.de>
parents:
5606
diff
changeset
|
199 parent.destroy(); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
200 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
201 }); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
202 btn.setTitle(MSG.print()); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
203 return btn; |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
204 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
205 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
206 private String createPrintUrl() { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
207 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
|
208 Collection collection = ot.getCollection(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
209 String uuid = collection.identifier(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
210 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
211 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
|
212 ? "floodmap" |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
213 : "map"; |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
214 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
215 StringBuilder url = new StringBuilder(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
216 url.append(GWT.getModuleBaseURL()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
217 url.append("map-print?"); |
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 Map map = mapToolbar.getMap(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
220 Bounds bounds = map.getExtent(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
221 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
222 if (bounds != null) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
223 try { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
224 url.append("minx="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
225 url.append(bounds.getLowerLeftX()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
226 url.append("&"); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
227 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
228 url.append("maxx="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
229 url.append(bounds.getUpperRightX()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
230 url.append("&"); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
231 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
232 url.append("miny="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
233 url.append(bounds.getLowerLeftY()); |
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("maxy="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
237 url.append(bounds.getUpperRightY()); |
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 catch (Exception e) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
241 // 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
|
242 // 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
|
243 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
244 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
245 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
246 url.append("uuid="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
247 url.append(uuid); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
248 url.append("&maptype="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
249 url.append(mapType); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
250 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
251 appendPrintToUrl(collection, url); |
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 return url.toString(); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
254 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
255 |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
256 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
|
257 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
|
258 if (settings != null) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
259 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
|
260 for (Property prop : properties) { |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
261 PropertySetting props = (PropertySetting)prop; |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
262 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
|
263 String localized; |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
264 try { |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
265 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
|
266 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
267 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
|
268 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
|
269 } |
5721
280093510e1d
Also java encode the info side of the data table
Andre Heinecke <aheinecke@intevation.de>
parents:
5718
diff
changeset
|
270 url.append(toJavaEncodedString(localized)); |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
271 url.append("="); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
272 url.append(props.getValue()); |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
273 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
274 } |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
275 // O.o |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
276 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
|
277 ).getCollectionView().getArtifact()); |
5721
280093510e1d
Also java encode the info side of the data table
Andre Heinecke <aheinecke@intevation.de>
parents:
5718
diff
changeset
|
278 url.append("&" + toJavaEncodedString(MSG.getString(MAPFISH_RIVER)) + "=" + river); |
5675
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
279 } |
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 // 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
|
282 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
|
283 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
|
284 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
|
285 |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
286 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 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
|
295 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
296 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
297 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
298 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
299 } |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
300 |
10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
Andre Heinecke <aheinecke@intevation.de>
parents:
5622
diff
changeset
|
301 return ""; |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
302 } |
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
303 |
5714
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
304 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
|
305 if (str == null) { |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
306 return null; |
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 StringBuilder sb = new StringBuilder(); |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
309 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
|
310 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
|
311 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
|
312 sb.append("\\u"); |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
313 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
|
314 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
|
315 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
|
316 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
|
317 } else { |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
318 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
|
319 } |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
320 } |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
321 return sb.toString(); |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
322 } |
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
323 |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
324 protected void updateCollection() { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
325 final Config config = Config.getInstance(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
326 final String loc = config.getLocale(); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
327 |
5606
0d8564196d73
Break printing to rework the parametrization of the print job
Andre Heinecke <aheinecke@intevation.de>
parents:
4965
diff
changeset
|
328 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
|
329 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
330 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
|
331 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
|
332 // 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
|
333 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
|
334 properties.add(new PropertySetting(MAPFISH_RANGE, toJavaEncodedString(pageRange.getValueAsString()))); |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
335 properties.add(new PropertySetting(MAPFISH_STRETCH, toJavaEncodedString(pageStretch.getValueAsString()))); |
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
336 properties.add(new PropertySetting(MAPFISH_INSTITUTION, toJavaEncodedString(pageInstitution.getValueAsString()))); |
5714
1103308b19ca
Add toJavaEncodedString function to encode strings in utf-16 notation
Andre Heinecke <aheinecke@intevation.de>
parents:
5675
diff
changeset
|
337 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
|
338 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
|
339 properties.add(new PropertySetting(MAPFISH_DATEPLACE, toJavaEncodedString(pageDatePlace.getValueAsString()))); |
5717
22e03ca8c39d
Add configurable logo for map print and rename/reorder fields
Andre Heinecke <aheinecke@intevation.de>
parents:
5714
diff
changeset
|
340 properties.add(new PropertySetting(MAPFISH_LOGO, toJavaEncodedString(pageLogo.getValueAsString()))); |
4472
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
341 settings.setSettings("default", properties); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
342 |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
343 collection.addSettings("print-settings", settings); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
344 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
|
345 @Override |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
346 public void onFailure(Throwable caught) { |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
347 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
|
348 SC.warn(MSG.getString(caught.getMessage())); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
349 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
350 @Override |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
351 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
|
352 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
|
353 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
354 }); |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
355 } |
dc7e41efd5ba
Work (in progress) on a print settings dialog.
Christian Lins <christian.lins@intevation.de>
parents:
diff
changeset
|
356 } |