You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/11/04 16:23:38 UTC

svn commit: r1197594 - in /myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main: java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java resources/META-INF/xdoc-web-config.vm

Author: lu4242
Date: Fri Nov  4 15:23:38 2011
New Revision: 1197594

URL: http://svn.apache.org/viewvc?rev=1197594&view=rev
Log:
Enhance web config parameters report

Modified:
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/xdoc-web-config.vm

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java?rev=1197594&r1=1197593&r2=1197594&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/Model.java Fri Nov  4 15:23:38 2011
@@ -22,7 +22,9 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.TreeMap;
+import java.util.TreeSet;
 
 import org.apache.commons.digester.Digester;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.io.XmlWriter;
@@ -607,4 +609,28 @@ public class Model
     {
         return _modelId;
     }
+    
+    //THIS METHODS ARE USED FOR VELOCITY TO GET DATA AND GENERATE CLASSES
+    
+    public List getWebConfigGroups(List modelIds)
+    {
+        Set<String> groups = new TreeSet<String>();
+        for (Iterator it = _webConfigs.iterator(); it.hasNext();)
+        {
+            WebConfigMeta wcm = (WebConfigMeta) it.next();
+            if (modelIds.contains(wcm.getModelId()))
+            {
+                for (Iterator it1 = wcm.getWebConfigParametersList().iterator(); it1.hasNext();)
+                {
+                    WebConfigParamMeta wcpm = (WebConfigParamMeta) it1.next();
+                    
+                    if (wcpm.getGroup() != null && wcpm.getGroup().length() > 0)
+                    {
+                        groups.add(wcpm.getGroup());
+                    }
+                }
+            }
+        }
+        return new ArrayList(groups);
+    }
 }

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/xdoc-web-config.vm
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/xdoc-web-config.vm?rev=1197594&r1=1197593&r2=1197594&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/xdoc-web-config.vm (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/resources/META-INF/xdoc-web-config.vm Fri Nov  4 15:23:38 2011
@@ -1,10 +1,20 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <document>
  <properties>
-  <title>Web Context Params</title>
+  <title>Web Context Parameters</title>
  </properties>
  <body>
-  <section name="Summary">
+  <section name="Web Context Parameters">
+  <p>
+  MyFaces core behavior can be customized, adding some web config params into your 
+  WEB-INF/web.xml file for your custom project in this way:
+  </p>
+  <div class="source"><pre>
+      &lt;context-param&gt;
+        &lt;param-name&gt;org.apache.myfaces.SOME_USEFUL_PARAM&lt;/param-name&gt;
+        &lt;param-value&gt;someValue&lt;/param-value&gt;
+      &lt;/context-param&gt;
+  </pre></div>
   <p>
   Below is the list of available web context parameters supported: 
   </p>
@@ -12,50 +22,160 @@
 #if ($baseContent)
 $baseContent
 #end
-  <section name="Web Context Parameters">
+## ----------------------------- PROPERTY MACROS -----------------------------
+##
+## -------------------------------
+## writeWebConfigParamRow
+## -------------------------------
+##
+#macro(writeWebConfigParamRow $webConfigParam) 
+ <tr>
+  <td><a href="#$webConfigParam.name.replace('.','_')">$webConfigParam.name</a></td>
+#if ($webConfigParam.since)
+  <td>$webConfigParam.since</td>
+#else
+  <td></td>
+#end
+#if ($webConfigParam.defaultValue)
+  <td>$webConfigParam.defaultValue</td>
+#else
+  <td></td>
+#end
+#if ($webConfigParam.description)
+  <td>$webConfigParam.description</td>
+#elseif ($webConfigParam.longDescription)
+  <td>$webConfigParam.longDescription</td>
+#else
+  <td></td>
+#end
+ </tr>
+#end
+##
+## ----------------------------- END PROPERTY MACROS -------------------------
+##
+
+  <section name="Summary">
+  <p>Click on the name of each param to find detailed information about each one of them.</p>
+  <p>The "since" column means the version since the param was added. Note this param is not "lineal",
+  so please check the release dates on myfaces issue tracker to know if an specified version
+  has or not the selected param. For example, if a param was added on 2.0.7, it means that 2.1.1
+  has the parameter because it was released on the same time, but 2.1.0 will not have it, because
+  it was released before that date.
+  </p>
+#set ($webConfigGroups = ${model.getWebConfigGroups($modelIds)})
+#set ($webConfigGroupsLabel = {"resources" : "Resources (resource)", 
+                               "validation" : "Conversion and Validation (validation)", 
+                               "state" : "State Saving (state)",
+                               "EL" : "Expression Language (EL)",
+                               "viewhandler" : "View Handling (viewhandler)",
+                               "render" : "Rendering (render)"} )
+#foreach( $webConfigGroup in $webConfigGroups )
+#if (${webConfigGroupsLabel.containsKey($webConfigGroup)})
+#set ($groupLabel = $webConfigGroupsLabel.get($webConfigGroup))
+#else
+#set ($groupLabel = $webConfigGroup)
+#end
+  <p><b>$groupLabel Configuration Params</b></p>
+<table>
+ <tr>
+  <th>Name</th>
+  <th>Since</th>
+  <th>Default Value</th>
+  <th>Short Description</th>
+ </tr>
 #set ($webConfigList = ${model.getWebConfigs()})
 #foreach( $webConfig in $webConfigList )
 #if ($modelIds.contains($webConfig.modelId))
-<p>Artifact Id: $webConfig.modelId</p>
 #set ($webConfigParamList = ${webConfig.getWebConfigParametersList()})
+#foreach( $webConfigParam in $webConfigParamList )
+#if ($webConfigParam.group == $webConfigGroup)
+#writeWebConfigParamRow($webConfigParam)
+#end
+#end
+#end
+#end
+</table>
+#end
+
+  <p><b>Other Configuration Params</b></p>
 <table>
  <tr>
   <th>Name</th>
-  <th>Default Value</th>
-  <th>Expected Values</th>
   <th>Since</th>
-  <th>Description</th>
-  <th>Source Class</th>
+  <th>Default Value</th>
+  <th>Short Description</th>
  </tr>
+#set ($webConfigList = ${model.getWebConfigs()})
+#foreach( $webConfig in $webConfigList )
+#if ($modelIds.contains($webConfig.modelId))
+#set ($webConfigParamList = ${webConfig.getWebConfigParametersList()})
 #foreach( $webConfigParam in $webConfigParamList )
- <tr>
-  <td>$webConfigParam.name</td>
+#if (!$webConfigParam.group)
+#writeWebConfigParamRow($webConfigParam)
+#elseif ($webConfigParam.group == "")
+#writeWebConfigParamRow($webConfigParam)
+#end
+#end
+#end
+#end
+</table>
+  </section>
+  <section name="Detailed Information">
+
+#foreach( $webConfig in $webConfigList )
+#if ($modelIds.contains($webConfig.modelId))
+<p>Artifact Id: $webConfig.modelId</p>
+<table>
+#set ($webConfigParamList = ${webConfig.getWebConfigParametersList()})
+#foreach( $webConfigParam in $webConfigParamList )
+  <tr><td>
+  <p>
+    <b>Param Name:</b> <a name="$webConfigParam.name.replace('.','_')">$webConfigParam.name</a>
+    <br/>
 #if ($webConfigParam.defaultValue)
-  <td>$webConfigParam.defaultValue</td>
-#else
-  <td></td>
+    <b>Default Value:</b> $webConfigParam.defaultValue
+    <br/>
 #end
 #if ($webConfigParam.expectedValues)
-  <td>$webConfigParam.expectedValues</td>
-#else
-  <td></td>
+    <b>Expected Values:</b> $webConfigParam.expectedValues
+    <br/>
 #end
 #if ($webConfigParam.since)
-  <td>$webConfigParam.since</td>
+    <b>Since:</b> $webConfigParam.since
+    <br/>
+#end
+    <b>Group:</b> #if ($webConfigParam.group)$webConfigParam.group#end
+    <br/>
+    <b>Tags:</b> #if ($webConfigParam.tags)$webConfigParam.tags#end
+    <br/>
+#if ($webConfigParam.sourceClassName.startsWith("javax.faces."))
+#set ($javadocPath = "../myfaces-api/xref/" + $webConfigParam.sourceClassName.replace('.', '/') )
+#elseif ($webConfigParam.sourceClassName.startsWith("org.apache.myfaces.shared."))
+#set ($javadocPath = "../myfaces-impl-shared/xref/" + $webConfigParam.sourceClassName.replace('.', '/') )
 #else
-  <td></td>
+#set ($javadocPath = "./xref/" + $webConfigParam.sourceClassName.replace('.', '/') )
 #end
+    <b>Source Class:</b> <a href="${javadocPath}.html">$webConfigParam.sourceClassName</a>
+    <br/>
 #if ($webConfigParam.longDescription)
-  <td>$webConfigParam.longDescription</td>
+    <b>Description:</b> 
+    <br/>
+    $webConfigParam.longDescription
+#elseif ($webConfigParam.description)
+    <b>Description:</b> 
+    <br/>
+    $webConfigParam.description
 #else
-  <td></td>
+    <b>Description:</b> no description available yet.
+    <br/>
 #end
-  <td>$webConfigParam.sourceClassName</td>
- </tr>
+  </p>
+  </td></tr>
 #end
 </table>
 #end
 #end
+
   </section>
  </body> 
-</document>
\ No newline at end of file
+</document>