diff flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java @ 2500:69a498896c9c

Create a link to an online help page and put it in front of the input panels. flys-client/trunk@4336 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 03 May 2012 06:19:04 +0000
parents e53d773e6992
children fe177e7f61d1
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java	Wed May 02 19:07:23 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java	Thu May 03 06:19:04 2012 +0000
@@ -51,6 +51,8 @@
 
     public static final String XPATH_UIPROVIDER = "@art:uiprovider";
 
+    public static final String XPATH_HELP_TEXT = "@art:helpText";
+
     public static final String XPATH_REACHABLE_STATE = "art:state";
 
     public static final String XPATH_STATIC_STATE_NODE = "art:state";
@@ -118,6 +120,7 @@
         logger.debug("ArtifactDescriptionFactory.extractCurrentData");
 
         NodeList data     = ClientProtocolUtils.getSelectNode(dynamicNode);
+        String help       = extractHelpText(dynamicNode);
         String uiProvider = extractUIProvider(dynamicNode);
 
         if (data == null || data.getLength() == 0) {
@@ -125,7 +128,7 @@
         }
 
         int      dataNum = data.getLength();
-        DataList list    = new DataList(state, dataNum, uiProvider);
+        DataList list    = new DataList(state, dataNum, uiProvider, null, help);
 
         for (int i = 0; i < dataNum; i++) {
             Element   d  = (Element) data.item(i);
@@ -381,6 +384,8 @@
                 tmp, "@art:uiprovider", ArtifactNamespaceContext.INSTANCE);
             String label = XMLUtils.xpathString(
                 tmp, "@art:label", ArtifactNamespaceContext.INSTANCE);
+            String help = XMLUtils.xpathString(
+                tmp, "@art:helpText", ArtifactNamespaceContext.INSTANCE);
 
             NodeList dataNodes = (NodeList) XMLUtils.xpath(
                 tmp,
@@ -393,7 +398,7 @@
             }
 
             int size      = dataNodes.getLength();
-            DataList list = new DataList(name, size, uiprovider, label);
+            DataList list = new DataList(name, size, uiprovider, label, help);
 
             for (int j = 0; j < size; j++) {
                 Node dataNode = dataNodes.item(j);
@@ -425,6 +430,22 @@
 
 
     /**
+     * This method extracts the help text specified by the data node.
+     *
+     * @param ui The data node.
+     *
+     * @return the help text.
+     */
+    protected static String extractHelpText(Node ui) {
+        return (String) XMLUtils.xpath(
+            ui,
+            XPATH_HELP_TEXT,
+            XPathConstants.STRING,
+            ArtifactNamespaceContext.INSTANCE);
+    }
+
+
+    /**
      * This method extracts the reachable states of the current artifact.
      *
      * @param reachable The reachable states node.

http://dive4elements.wald.intevation.org