Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java @ 1568:2432973ccced
Handle manual points on a per-chart(type) basis.
flys-client/trunk@3831 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 30 Jan 2012 13:36:10 +0000 |
parents | 87f5ed6960e8 |
children | b85761d21975 |
comparison
equal
deleted
inserted
replaced
1567:7e738bc8ed75 | 1568:2432973ccced |
---|---|
88 de.intevation.flys.client.client.services.FeedService.class); | 88 de.intevation.flys.client.client.services.FeedService.class); |
89 | 89 |
90 /** UUID of artifact to feed. */ | 90 /** UUID of artifact to feed. */ |
91 protected String uuid; | 91 protected String uuid; |
92 | 92 |
93 /** Name of the outputmode, important when feeding data. */ | |
94 protected String outputModeName; | |
95 | |
93 | 96 |
94 /** | 97 /** |
95 * Setup editor dialog. | 98 * Setup editor dialog. |
96 * @param collection The collection to use. | 99 * @param collection The collection to use. |
97 */ | 100 */ |
98 public ManualPointsEditor(Collection collection, | 101 public ManualPointsEditor(Collection collection, |
99 RedrawRequestHandler handler | 102 RedrawRequestHandler handler, String outputModeName |
100 ) { | 103 ) { |
101 this.collection = collection; | 104 this.collection = collection; |
102 this.redrawRequestHandler = handler; | 105 this.redrawRequestHandler = handler; |
106 this.outputModeName = outputModeName; | |
103 init(); | 107 init(); |
104 } | 108 } |
105 | 109 |
106 | 110 |
107 /** Searches collection for first artifact to serve (manual) point data. */ | 111 /** Searches collection for first artifact to serve (manual) point data. */ |
109 // TODO Need to be more picky (different points in different diagrams) | 113 // TODO Need to be more picky (different points in different diagrams) |
110 int size = collection.getItemLength(); | 114 int size = collection.getItemLength(); |
111 | 115 |
112 for (int i = 0; i < size; i++) { | 116 for (int i = 0; i < size; i++) { |
113 CollectionItem item = collection.getItem(i); | 117 CollectionItem item = collection.getItem(i); |
114 String dataValue = (String) item.getData().get(POINT_DATA); | 118 String dataValue = (String) item.getData().get(outputModeName |
119 + "." + POINT_DATA); | |
115 if (dataValue != null) { | 120 if (dataValue != null) { |
116 // Found it. | 121 // Found it. |
117 uuid = item.identifier(); | 122 uuid = item.identifier(); |
118 return uuid; | 123 return uuid; |
119 } | 124 } |
230 findManualPointsUUID(); | 235 findManualPointsUUID(); |
231 CollectionItem item = collection.getItem(uuid); | 236 CollectionItem item = collection.getItem(uuid); |
232 | 237 |
233 // Add points to grid. | 238 // Add points to grid. |
234 if (item != null) { | 239 if (item != null) { |
235 String jsonData = item.getData().get(POINT_DATA); | 240 String jsonData = item.getData().get(outputModeName + "." + POINT_DATA); |
236 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData); | 241 JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData); |
237 for (int i = 0; i < jsonArray.size(); i++) { | 242 for (int i = 0; i < jsonArray.size(); i++) { |
238 JSONArray point = (JSONArray) jsonArray.get(i); | 243 JSONArray point = (JSONArray) jsonArray.get(i); |
239 listGrid.addData(pointRecordFromJSON(point)); | 244 listGrid.addData(pointRecordFromJSON(point)); |
240 } | 245 } |
319 if(isDialogValid()) { | 324 if(isDialogValid()) { |
320 // Feed JSON-encoded content of listgrid. | 325 // Feed JSON-encoded content of listgrid. |
321 JSONArray list = jsonArrayFromListGrid(); | 326 JSONArray list = jsonArrayFromListGrid(); |
322 | 327 |
323 Data[] feedData = new Data[] { | 328 Data[] feedData = new Data[] { |
324 DefaultData.createSimpleStringData(POINT_DATA, | 329 DefaultData.createSimpleStringData(outputModeName + "." + POINT_DATA, |
325 list.toString()) | 330 list.toString()) |
326 }; | 331 }; |
327 | 332 |
328 feedService.feed( | 333 feedService.feed( |
329 Config.getInstance().getLocale(), | 334 Config.getInstance().getLocale(), |