comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java @ 634:58c32df1a44d

Improved the describe document so that we are able to render a measurement-parameter-matrix with these data. gnv-artifacts/trunk@713 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 26 Feb 2010 13:53:05 +0000
parents a72ecacccc91
children 22cc12b1622c
comparison
equal deleted inserted replaced
633:7a136b99ad71 634:58c32df1a44d
264 Object obj = getDescibeData(uuid).get(0); 264 Object obj = getDescibeData(uuid).get(0);
265 List descs = new ArrayList(); 265 List descs = new ArrayList();
266 266
267 if (obj instanceof NamedArrayList) { 267 if (obj instanceof NamedArrayList) {
268 NamedArrayList list = (NamedArrayList) obj; 268 NamedArrayList list = (NamedArrayList) obj;
269 String[] selected = data.splitValue(); 269 List selected = Arrays.asList(data.splitValue());
270 int size = list.size(); 270 int size = list.size();
271 int ssize = selected.length;
272 271
273 for (int i = 0; i < size; i++) { 272 for (int i = 0; i < size; i++) {
274 KeyValueDescibeData kv = (KeyValueDescibeData) list.get(i); 273 KeyValueDescibeData kv = (KeyValueDescibeData) list.get(i);
275 274
276 // values are concatinated in InputData, so one InputData object can 275 // values are concatinated in InputData, so one InputData object can
277 // contain many input 276 // contain many input
278 for (int j = 0; j < ssize; j++) { 277 String key = kv.getKey();
279 if (kv.getKey().equals(selected[j])) { 278 int idx = selected.indexOf(key);
280 descs.add(kv.getValue()); 279 if (idx >= 0) {
280 descs.add(kv.getValue());
281
282 // XXX Workarround: I just wanted to remove the element at
283 // 'idx' from selected, but for any reason this is not
284 // possible (throws an exception) (iw)
285 List tmp = new ArrayList();
286 for (int j = 0; j < selected.size(); j++) {
287 if (j != idx)
288 tmp.add(selected.get(j));
281 } 289 }
290
291 selected = tmp;
282 } 292 }
283 } 293 }
284 } 294 }
285 295
286 return (String[]) descs.toArray(new String[descs.size()]); 296 return (String[]) descs.toArray(new String[descs.size()]);
707 Element choiceLableNode = creator.create("label"); 717 Element choiceLableNode = creator.create("label");
708 choiceLableNode.setTextContent(descriptions[i]); 718 choiceLableNode.setTextContent(descriptions[i]);
709 itemNode.appendChild(choiceLableNode); 719 itemNode.appendChild(choiceLableNode);
710 720
711 Element choiceValueNode = creator.create("value"); 721 Element choiceValueNode = creator.create("value");
712 choiceValueNode.setTextContent(dataName); 722 choiceValueNode.setTextContent(data.getValue());
713 itemNode.appendChild(choiceValueNode); 723 itemNode.appendChild(choiceValueNode);
714 choiceNode.appendChild(itemNode); 724 choiceNode.appendChild(itemNode);
715 } 725 }
716 726
717 selectNode.appendChild(lableNode); 727 selectNode.appendChild(lableNode);

http://dive4elements.wald.intevation.org