Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java Wed May 16 13:43:15 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java Wed May 16 14:52:39 2012 +0000 @@ -181,10 +181,10 @@ list.add(new IntegerArrayData(name, label, null)); } else if (type.equals("intoptions") && uiProvider.equals("parameter-matrix")) { - NodeList choices = ClientProtocolUtils.getItemNodes(d); - DataItem[] opts = extractIntegerOptions(choices); - - list.add(new IntegerOptionsData(name, label, opts)); + list.add(DataFactory.createIntegerOptionsData(d, name, label)); + } + else if (type.equals("options")) { + list.add(DataFactory.createStringOptionsData(d, name, label)); } else if (type.equals("intoptions")) { NodeList choices = ClientProtocolUtils.getItemNodes(d); @@ -243,23 +243,6 @@ } - protected static DataItem[] extractIntegerOptions(NodeList options) { - DataItem[] items = new DataItem[options.getLength()]; - - for (int i = 0, n = options.getLength(); i < n; i++) { - Element el = (Element) options.item(i); - - String value = el.getTextContent(); - String label = XMLUtils.xpathString( - el, "@art:label", ArtifactNamespaceContext.INSTANCE); - - items[i] = new DefaultDataItem(label, label, value); - } - - return items; - } - - /** * This method extract the {@link DataItem}s of the DESCRIBE document. *