Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/MultipleLocationPanel.java @ 1615:07c38d054f91
Translate data item in locationpanel label.
flys-client/trunk@3984 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 09 Feb 2012 08:51:00 +0000 |
parents | 66671b69c7ea |
children | f13a7c126f24 |
comparison
equal
deleted
inserted
replaced
1614:592751b635e3 | 1615:07c38d054f91 |
---|---|
51 | 51 |
52 /** The input helper (usually right side, table to click on, values are | 52 /** The input helper (usually right side, table to click on, values are |
53 * then entered in the texfield. */ | 53 * then entered in the texfield. */ |
54 protected LocationPicker picker; | 54 protected LocationPicker picker; |
55 | 55 |
56 | |
56 /** | 57 /** |
57 * Creates a new LocationDistancePanel instance. | 58 * Creates a new LocationDistancePanel instance. |
58 */ | 59 */ |
59 public MultipleLocationPanel() { | 60 public MultipleLocationPanel() { |
60 picker = new LocationPicker(this); | 61 picker = new LocationPicker(this); |
75 findDataItemName(data); | 76 findDataItemName(data); |
76 | 77 |
77 VLayout layout = new VLayout(); | 78 VLayout layout = new VLayout(); |
78 layout.setMembersMargin(10); | 79 layout.setMembersMargin(10); |
79 | 80 |
80 Label label = new Label(MSG.location ()); | 81 // Take translated data item name as label, if translation available. |
82 String labelString; | |
83 try { | |
84 labelString = MSG.getString(getDataItemName()); | |
85 } | |
86 catch(java.util.MissingResourceException mre) { | |
87 GWT.log("Cannot find translation for data item name : " + getDataItemName()); | |
88 labelString = MSG.location(); | |
89 } | |
90 Label label = new Label(labelString); | |
81 Canvas widget = createWidget(data); | 91 Canvas widget = createWidget(data); |
82 Canvas submit = getNextButton(); | 92 Canvas submit = getNextButton(); |
83 | 93 |
84 initDefaults(data); | 94 initDefaults(data); |
85 | 95 |
222 return errors; | 232 return errors; |
223 } | 233 } |
224 | 234 |
225 | 235 |
226 /** | 236 /** |
227 * This method returns the selected data. | 237 * This method returns the selected data (to feed). |
228 * | 238 * |
229 * @return the selected/inserted data. | 239 * @return the selected/inserted data in feedable form. |
230 */ | 240 */ |
231 public Data[] getData() { | 241 public Data[] getData() { |
232 saveLocationValues(locationPanel); | 242 saveLocationValues(locationPanel); |
233 double[] values = getLocationValues(); | 243 double[] values = getLocationValues(); |
234 Data[] data = new Data[2]; | 244 Data[] data = new Data[2]; |
279 | 289 |
280 picker.getLocationTable().setDataSource(new DistanceInfoDataSource( | 290 picker.getLocationTable().setDataSource(new DistanceInfoDataSource( |
281 url, river, "locations")); | 291 url, river, "locations")); |
282 } | 292 } |
283 | 293 |
294 | |
284 // TODO allow multiple selections here or in LocationPanel | 295 // TODO allow multiple selections here or in LocationPanel |
285 /** | 296 /** |
286 * Callback when an item from the input helper was clicked. | 297 * Callback when an item from the input helper was clicked. |
287 * Set the respective km-value in the location value field. | 298 * Set the respective km-value in the location value field. |
288 * @param e event passed. | 299 * @param e event passed. |