Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPrintPanel.java @ 5675:10aac4ec2d76
Localize the _data strings, limit the input in the panel and Search
the current river in a very roundabout manner,.. (River search code
was taken from the datacage window)
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 12 Apr 2013 12:56:25 +0200 |
parents | b28a6d05e969 |
children | 1103308b19ca |
comparison
equal
deleted
inserted
replaced
5674:c6a6ef2d4e7e | 5675:10aac4ec2d76 |
---|---|
23 import de.intevation.flys.client.shared.model.Collection; | 23 import de.intevation.flys.client.shared.model.Collection; |
24 import de.intevation.flys.client.shared.model.OutputSettings; | 24 import de.intevation.flys.client.shared.model.OutputSettings; |
25 import de.intevation.flys.client.shared.model.Property; | 25 import de.intevation.flys.client.shared.model.Property; |
26 import de.intevation.flys.client.shared.model.PropertySetting; | 26 import de.intevation.flys.client.shared.model.PropertySetting; |
27 import de.intevation.flys.client.shared.model.Settings; | 27 import de.intevation.flys.client.shared.model.Settings; |
28 import de.intevation.flys.client.shared.model.Artifact; | |
29 import de.intevation.flys.client.shared.model.ArtifactDescription; | |
30 import de.intevation.flys.client.shared.model.Data; | |
31 import de.intevation.flys.client.shared.model.DataItem; | |
32 import de.intevation.flys.client.shared.model.DataList; | |
33 | |
28 | 34 |
29 import java.util.ArrayList; | 35 import java.util.ArrayList; |
30 import java.util.LinkedHashMap; | 36 import java.util.LinkedHashMap; |
31 import java.util.List; | 37 import java.util.List; |
38 import java.util.MissingResourceException; | |
32 | 39 |
33 public class MapPrintPanel extends Canvas { | 40 public class MapPrintPanel extends Canvas { |
34 | 41 |
35 private static final String MAPFISH_MAPTITLE = "mapfish-mapTitle"; | 42 private static final String MAPFISH_MAPTITLE = "mapfish_mapTitle"; |
36 private static final String MAPFISH_RANGE = "mapfish-data-range"; | 43 private static final String MAPFISH_RANGE = "mapfish_data_range"; |
37 private static final String MAPFISH_SUBTITLE = "mapfish-data-subtitle"; | 44 private static final String MAPFISH_SUBTITLE = "mapfish_data_subtitle"; |
38 private static final String MAPFISH_STRETCH = "mapfish-data-strech"; | 45 private static final String MAPFISH_STRETCH = "mapfish_data_strech"; |
39 private static final String MAPFISH_CREATED = "mapfish-data-created"; | 46 private static final String MAPFISH_CREATED = "mapfish_data_created"; |
40 private static final String MAPFISH_SOURCE = "mapfish-data-source"; | 47 private static final String MAPFISH_SOURCE = "mapfish_data_source"; |
41 private static final String MAPFISH_CREATOR = "mapfish-data-creator"; | 48 private static final String MAPFISH_CREATOR = "mapfish_data_creator"; |
42 private static final String MAPFISH_DATEPLACE = "mapfish-data-dateplace"; | 49 private static final String MAPFISH_DATEPLACE = "mapfish_data_dateplace"; |
50 private static final String MAPFISH_RIVER = "mapfish_data_river"; | |
43 | 51 |
44 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); | 52 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); |
45 | 53 |
46 /** CollectionAttribute Update Service. */ | 54 /** CollectionAttribute Update Service. */ |
47 protected CollectionAttributeServiceAsync updater = | 55 protected CollectionAttributeServiceAsync updater = |
117 this.pageCreated.setTitle("Aufgestellt"); | 125 this.pageCreated.setTitle("Aufgestellt"); |
118 this.pageSource.setTitle("Datenquelle"); | 126 this.pageSource.setTitle("Datenquelle"); |
119 this.pageCreator.setTitle("Ersteller"); | 127 this.pageCreator.setTitle("Ersteller"); |
120 this.pageDatePlace.setTitle("Ort, Datum"); | 128 this.pageDatePlace.setTitle("Ort, Datum"); |
121 | 129 |
130 pageTitle.setLength(21); | |
131 pageSubtitle.setLength(21); | |
132 pageRange.setLength(21); | |
133 pageStrech.setLength(21); | |
134 pageCreated.setLength(21); | |
135 pageSource.setLength(21); | |
136 pageCreator.setLength(21); | |
137 pageDatePlace.setLength(21); | |
122 ButtonItem printButton = createPrintButtonItem(); | 138 ButtonItem printButton = createPrintButtonItem(); |
123 | 139 |
124 printButton.setAlign(Alignment.RIGHT); | 140 printButton.setAlign(Alignment.RIGHT); |
125 | 141 |
126 DynamicForm df = new DynamicForm(); | 142 DynamicForm df = new DynamicForm(); |
227 if (settings != null) { | 243 if (settings != null) { |
228 List<Property> properties = settings.getSettings("default"); | 244 List<Property> properties = settings.getSettings("default"); |
229 for (Property prop : properties) { | 245 for (Property prop : properties) { |
230 PropertySetting props = (PropertySetting)prop; | 246 PropertySetting props = (PropertySetting)prop; |
231 url.append("&"); | 247 url.append("&"); |
232 url.append(props.getName()); | 248 String localized; |
249 try { | |
250 localized = MSG.getString(props.getName()); | |
251 } | |
252 catch (MissingResourceException mre) { | |
253 localized = props.getName(); | |
254 } | |
255 url.append(localized); | |
233 url.append("="); | 256 url.append("="); |
234 url.append(props.getValue()); | 257 url.append(props.getValue()); |
235 } | 258 } |
236 } | 259 } |
260 // O.o | |
261 String river = findRiver(((MapOutputTab)mapToolbar.getOutputTab() | |
262 ).getCollectionView().getArtifact()); | |
263 url.append("&" + MSG.getString(MAPFISH_RIVER) + "=" + river); | |
264 } | |
265 | |
266 // Copy of DatacageWindow's findRiver | |
267 protected String findRiver(Artifact artifact) { | |
268 ArtifactDescription adescr = artifact.getArtifactDescription(); | |
269 DataList [] data = adescr.getOldData(); | |
270 | |
271 if (data != null && data.length > 0) { | |
272 for (int i = 0; i < data.length; i++) { | |
273 DataList dl = data[i]; | |
274 if (dl.getState().equals("state.winfo.river")) { | |
275 for (int j = dl.size()-1; j >= 0; --j) { | |
276 Data d = dl.get(j); | |
277 DataItem [] di = d.getItems(); | |
278 if (di != null && di.length == 1) { | |
279 return d.getItems()[0].getStringValue(); | |
280 } | |
281 } | |
282 } | |
283 } | |
284 } | |
285 | |
286 return ""; | |
237 } | 287 } |
238 | 288 |
239 protected void updateCollection() { | 289 protected void updateCollection() { |
240 final Config config = Config.getInstance(); | 290 final Config config = Config.getInstance(); |
241 final String loc = config.getLocale(); | 291 final String loc = config.getLocale(); |