Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java @ 575:5277f46a63c2
The description of a facet is now displayed in the ChartThemePanel.
flys-client/trunk@2141 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 17 Jun 2011 09:57:23 +0000 |
parents | ba238f917b94 |
children | 210339fd1a34 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Thu Jun 16 15:57:20 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Fri Jun 17 09:57:23 2011 +0000 @@ -8,6 +8,7 @@ import javax.xml.xpath.XPathConstants; import org.w3c.dom.Document; +import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -203,7 +204,7 @@ List<Theme> themeList = new ArrayList<Theme>(num); for (int i = 0; i < num; i++) { - Theme theme = parseTheme(themes.item(i)); + Theme theme = parseTheme((Element) themes.item(i)); if (theme != null) { themeList.add(theme); @@ -214,27 +215,27 @@ } - protected Theme parseTheme(Node node) { + protected Theme parseTheme(Element ele) { System.out.println("DescribeCollectionServiceImpl.parseTheme"); - String strAct = XMLUtils.xpathString( - node, "@art:active", ArtifactNamespaceContext.INSTANCE); - - String art = XMLUtils.xpathString( - node, "@art:artifact", ArtifactNamespaceContext.INSTANCE); + String uri = ArtifactNamespaceContext.NAMESPACE_URI; - String fac = XMLUtils.xpathString( - node, "@art:facet", ArtifactNamespaceContext.INSTANCE); + String strAct = ele.getAttributeNS(uri, "active"); + String art = ele.getAttributeNS(uri, "artifact"); + String fac = ele.getAttributeNS(uri, "facet"); + String strPos = ele.getAttributeNS(uri, "pos"); + String desc = ele.getAttributeNS(uri, "description"); + String strIdx = ele.getAttributeNS(uri, "index"); - String strPos = XMLUtils.xpathString( - node, "@art:pos", ArtifactNamespaceContext.INSTANCE); - - if (strAct != null && art != null && fac != null && strPos != null) { + if (strAct != null && art != null && fac != null + && strPos != null && strIdx != null) + { try { int pos = Integer.valueOf(strPos); int active = Integer.valueOf(strAct); + int idx = Integer.valueOf(strIdx); - return new DefaultTheme(pos, active > 0, art, fac); + return new DefaultTheme(pos, idx, active > 0, art, fac, desc); } catch (NumberFormatException nfe) { nfe.printStackTrace(); @@ -359,14 +360,17 @@ List<Facet> facets = new ArrayList<Facet>(num); - for (int i = 0; i < num; i++) { - Node facetNode = facetList.item(i); + String uri = ArtifactNamespaceContext.NAMESPACE_URI; - String name = XMLUtils.xpathString( - facetNode, "@art:name", ArtifactNamespaceContext.INSTANCE); + for (int i = 0; i < num; i++) { + Element facetEl = (Element) facetList.item(i); - if (name != null && name.length() > 0) { - facets.add(new DefaultFacet(name)); + String name = facetEl.getAttributeNS(uri, "name"); + String desc = facetEl.getAttributeNS(uri, "description"); + String index = facetEl.getAttributeNS(uri, "index"); + + if (name != null && name.length() > 0 && index != null) { + facets.add(new DefaultFacet(name, Integer.valueOf(index),desc)); } }