comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java @ 78:969faa37a11b

Added Multiselectsupport for InputValues gnv-artifacts/trunk@94 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 16 Sep 2009 12:38:24 +0000
parents 0e38f512f7e4
children e33c61735a4e
comparison
equal deleted inserted replaced
77:0e38f512f7e4 78:969faa37a11b
122 NodeList inputValuesNodes = Config.getNodeSetXPath(configuration,"inputvalues/inputvalue"); 122 NodeList inputValuesNodes = Config.getNodeSetXPath(configuration,"inputvalues/inputvalue");
123 this.inputValues = new HashMap<String,InputValue>(inputValuesNodes.getLength()); 123 this.inputValues = new HashMap<String,InputValue>(inputValuesNodes.getLength());
124 this.inputValueNames = new ArrayList<String>(inputValuesNodes.getLength()); 124 this.inputValueNames = new ArrayList<String>(inputValuesNodes.getLength());
125 for (int i = 0 ; i < inputValuesNodes.getLength(); i++){ 125 for (int i = 0 ; i < inputValuesNodes.getLength(); i++){
126 Node inputValueNode = inputValuesNodes.item(i); 126 Node inputValueNode = inputValuesNodes.item(i);
127 InputValue inputValue = new DefaultInputValue(Config.getStringXPath(inputValueNode,"@name"), Config.getStringXPath(inputValueNode,"@type")); 127 InputValue inputValue = new DefaultInputValue(Config.getStringXPath(inputValueNode,"@name"), Config.getStringXPath(inputValueNode,"@type"), Boolean.parseBoolean(Config.getStringXPath(inputValueNode,"@multiselect")));
128 log.debug(inputValue.toString()); 128 log.debug(inputValue.toString());
129 this.inputValues.put(inputValue.getName(),inputValue); 129 this.inputValues.put(inputValue.getName(),inputValue);
130 this.inputValueNames.add(inputValue.getName()); 130 this.inputValueNames.add(inputValue.getName());
131 } 131 }
132 132
246 while (it.hasNext()){ 246 while (it.hasNext()){
247 247
248 Object o = it.next(); 248 Object o = it.next();
249 if (!it.hasNext()){ 249 if (!it.hasNext()){
250 if (o instanceof Collection<?>){ 250 if (o instanceof Collection<?>){
251 Element selectNode = xmlutilities.createXFormElement(document,"select");
252 // TODO: HACK: 251 // TODO: HACK:
253 // BESSERE LÖSUNG FINDEN 252 // BESSERE LÖSUNG FINDEN
254 Object[] names = this.inputValueNames.toArray(); 253 Object[] names = this.inputValueNames.toArray();
255 String name = names[names.length-1].toString(); 254 String name = names[names.length-1].toString();
256 255 boolean multiselect = this.inputValues.get(name).isMultiselect();
256
257 Element selectNode = xmlutilities.createXFormElement(document,multiselect ? "select" : "select1");
257 selectNode.setAttribute("ref", name); 258 selectNode.setAttribute("ref", name);
258 259
259 Element lableNode = xmlutilities.createXFormElement(document, "label"); 260 Element lableNode = xmlutilities.createXFormElement(document, "label");
260 lableNode.setTextContent(name); 261 lableNode.setTextContent(name);
261 Element choiceNode = xmlutilities.createXFormElement(document, "choices"); 262 Element choiceNode = xmlutilities.createXFormElement(document, "choices");

http://dive4elements.wald.intevation.org