comparison flys-client/src/main/java/de/intevation/flys/client/server/DataFactory.java @ 1595:e53d773e6992

Display inserted W/Q values in WQSimpleArrayPanel. flys-client/trunk@3908 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Feb 2012 15:27:46 +0000
parents dbdf954dbe94
children 6a65694bdcc2
comparison
equal deleted inserted replaced
1594:ddf43791244c 1595:e53d773e6992
186 catch (NumberFormatException nfe) { 186 catch (NumberFormatException nfe) {
187 logger.warn("Error while parsing IntegerArrayData: " + nfe); 187 logger.warn("Error while parsing IntegerArrayData: " + nfe);
188 } 188 }
189 } 189 }
190 190
191 return new IntegerArrayData(name, name, integers); 191 return new IntegerArrayData(name, items[0].getLabel(), integers);
192 } 192 }
193 193
194 194
195 /** 195 /**
196 * This method creates a new instance of DefaultData which has a type 196 * This method creates a new instance of DefaultData which has a type
200 * @param name The name of the Data instance. 200 * @param name The name of the Data instance.
201 * 201 *
202 * @return an instance of DoubleArrayData. 202 * @return an instance of DoubleArrayData.
203 */ 203 */
204 protected static Data createDoubleArrayData(Element ele, String name) { 204 protected static Data createDoubleArrayData(Element ele, String name) {
205 return new DoubleArrayData(name, name, extractDataItems(ele)); 205 DataItem[] items = extractDataItems(ele);
206 String rawValue = items[0].getStringValue();
207
208 String[] values = rawValue.split(";");
209 double[] doubles = new double[values.length];
210
211 for (int i = 0; i < values.length; i++) {
212 try {
213 doubles[i] = Double.valueOf(values[i]);
214 }
215 catch (NumberFormatException nfe) {
216 logger.warn("Error while parsing DoubleArrayData: " + nfe);
217 }
218 }
219
220 return new DoubleArrayData(name, items[0].getLabel(), doubles);
206 } 221 }
207 222
208 223
209 /** 224 /**
210 * This method extracts the art:item elements placed under <i>elements</i>. 225 * This method extracts the art:item elements placed under <i>elements</i>.

http://dive4elements.wald.intevation.org