comparison flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java @ 2521:fe177e7f61d1

Added a new UIProvider that renders a matrix of checkboxes for user input. flys-client/trunk@4401 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 14 May 2012 14:45:02 +0000
parents 69a498896c9c
children 261347ea60b8
comparison
equal deleted inserted replaced
2520:fe67f1345687 2521:fe177e7f61d1
178 } 178 }
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")) {
184 NodeList choices = ClientProtocolUtils.getItemNodes(d);
185 DataItem[] opts = extractIntegerOptions(choices);
186
187 list.add(new IntegerOptionsData(name, label, opts));
188 }
183 else if (type.equals("intoptions")) { 189 else if (type.equals("intoptions")) {
184 NodeList choices = ClientProtocolUtils.getItemNodes(d); 190 NodeList choices = ClientProtocolUtils.getItemNodes(d);
185 DataItem[] opts = extractCurrentDataItems(choices); 191 DataItem[] opts = extractCurrentDataItems(choices);
186 192
187 list.add(new IntegerOptionsData(name, label, opts)); 193 list.add(new IntegerOptionsData(name, label, opts));
235 241
236 return null; 242 return null;
237 } 243 }
238 244
239 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
240 /** 263 /**
241 * This method extract the {@link DataItem}s of the DESCRIBE document. 264 * This method extract the {@link DataItem}s of the DESCRIBE document.
242 * 265 *
243 * @param items The items in the DESCRIBE document. 266 * @param items The items in the DESCRIBE document.
244 * 267 *

http://dive4elements.wald.intevation.org