Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java @ 2532:261347ea60b8
Added new Data type StringOptionsData; allow this Data type for ParameterMatrixPanel.
flys-client/trunk@4428 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 16 May 2012 14:52:39 +0000 |
parents | fe177e7f61d1 |
children | 0de61fc9d281 |
comparison
equal
deleted
inserted
replaced
2531:180a500d7ddb | 2532:261347ea60b8 |
---|---|
179 } | 179 } |
180 else if (type.equals("intarray")) { | 180 else if (type.equals("intarray")) { |
181 list.add(new IntegerArrayData(name, label, null)); | 181 list.add(new IntegerArrayData(name, label, null)); |
182 } | 182 } |
183 else if (type.equals("intoptions") && uiProvider.equals("parameter-matrix")) { | 183 else if (type.equals("intoptions") && uiProvider.equals("parameter-matrix")) { |
184 NodeList choices = ClientProtocolUtils.getItemNodes(d); | 184 list.add(DataFactory.createIntegerOptionsData(d, name, label)); |
185 DataItem[] opts = extractIntegerOptions(choices); | 185 } |
186 | 186 else if (type.equals("options")) { |
187 list.add(new IntegerOptionsData(name, label, opts)); | 187 list.add(DataFactory.createStringOptionsData(d, name, label)); |
188 } | 188 } |
189 else if (type.equals("intoptions")) { | 189 else if (type.equals("intoptions")) { |
190 NodeList choices = ClientProtocolUtils.getItemNodes(d); | 190 NodeList choices = ClientProtocolUtils.getItemNodes(d); |
191 DataItem[] opts = extractCurrentDataItems(choices); | 191 DataItem[] opts = extractCurrentDataItems(choices); |
192 | 192 |
241 | 241 |
242 return null; | 242 return null; |
243 } | 243 } |
244 | 244 |
245 | 245 |
246 protected static DataItem[] extractIntegerOptions(NodeList options) { | |
247 DataItem[] items = new DataItem[options.getLength()]; | |
248 | |
249 for (int i = 0, n = options.getLength(); i < n; i++) { | |
250 Element el = (Element) options.item(i); | |
251 | |
252 String value = el.getTextContent(); | |
253 String label = XMLUtils.xpathString( | |
254 el, "@art:label", ArtifactNamespaceContext.INSTANCE); | |
255 | |
256 items[i] = new DefaultDataItem(label, label, value); | |
257 } | |
258 | |
259 return items; | |
260 } | |
261 | |
262 | |
263 /** | 246 /** |
264 * This method extract the {@link DataItem}s of the DESCRIBE document. | 247 * This method extract the {@link DataItem}s of the DESCRIBE document. |
265 * | 248 * |
266 * @param items The items in the DESCRIBE document. | 249 * @param items The items in the DESCRIBE document. |
267 * | 250 * |