Author: drobiazko
Date: Sun Feb 22 22:45:00 2009
New Revision: 746843

URL: http://svn.apache.org/viewvc?rev=746843&view=rev
Log:
TAP5-525: The Component Report should provide the Tapestry version a parameter 
or a component was introduced in

Modified:
    
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ClassDescription.java
    
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ComponentReport.java
    
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParameterDescription.java
    
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParametersDoclet.java
    
tapestry/tapestry5/trunk/tapestry-component-report/src/test/java/org/apache/tapestry/mojo/ComponentReportTest.java

Modified: 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ClassDescription.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ClassDescription.java?rev=746843&r1=746842&r2=746843&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ClassDescription.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ClassDescription.java
 Sun Feb 22 22:45:00 2009
@@ -29,13 +29,17 @@
     private final boolean supportsInformalParameters;
 
     private final Map<String, ParameterDescription> parameters = newMap();
+    
+    private final String since;
 
-    public ClassDescription(String className, String superClassName, String 
description, boolean supportsInformalParameters)
+    public ClassDescription(String className, String superClassName, String 
description, 
+               boolean supportsInformalParameters, String since)
     {
         this.className = className;
         this.superClassName = superClassName;
         this.description = description;
         this.supportsInformalParameters = supportsInformalParameters;
+        this.since = since;
     }
 
     public String getClassName()
@@ -63,4 +67,8 @@
                return supportsInformalParameters;
        }
 
+       public String getSince() {
+               return since;
+       }
+
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ComponentReport.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ComponentReport.java?rev=746843&r1=746842&r2=746843&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ComponentReport.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ComponentReport.java
 Sun Feb 22 22:45:00 2009
@@ -56,7 +56,7 @@
     private static final String REFERENCE_DIR = "ref";
 
     private final static String[] PARAMETER_HEADERS = {"Name", "Type", 
"Flags", "Default", "Default Prefix",
-            "Description"};
+       "Since","Description"};
 
     private static final Pattern TAPESTRY5_PATTERN = 
Pattern.compile("(org\\.apache\\.tapestry5[#_\\w\\.]*)");
 
@@ -402,6 +402,13 @@
 
             addChild(addChild(container, "ul"), "li", className);
         }
+        
+        if(!"".equals(cd.getSince()))
+        {
+               section = addSection(body, "Available since");
+               
+               addChild(section, "p", cd.getSince());
+        }
 
 
         if (!parameters.isEmpty())
@@ -440,6 +447,7 @@
                 addChild(row, "td", InternalUtils.join(flags));
                 addChild(row, "td", pd.getDefaultValue());
                 addChild(row, "td", pd.getDefaultPrefix());
+                addChild(row, "td", pd.getSince());
                 addChildWithJavadocs(row, "td", pd.getDescription(), 
javadocHref);
             }
         }
@@ -807,9 +815,10 @@
             String className = element.getAttributeValue("name");
             String superClassName = element.getAttributeValue("super-class");
             String supportsInformalParameters = 
element.getAttributeValue("supports-informal-parameters");
+            String since = element.getAttributeValue("since");
 
             ClassDescription cd = new ClassDescription(className, 
superClassName, description,
-                                                       
Boolean.valueOf(supportsInformalParameters));
+                                                       
Boolean.valueOf(supportsInformalParameters), since);
 
             result.put(className, cd);
 
@@ -839,9 +848,10 @@
             boolean allowNull = 
Boolean.parseBoolean(node.getAttributeValue("allowNull"));
             String defaultPrefix = node.getAttributeValue("default-prefix");
             String description = node.getValue();
+            String since = node.getAttributeValue("since");
 
             ParameterDescription pd = new ParameterDescription(name, type, 
defaultValue, defaultPrefix, required,
-                                                               allowNull, 
cache, description);
+                                                               allowNull, 
cache, description, since);
 
             cd.getParameters().put(name, pd);
         }

Modified: 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParameterDescription.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParameterDescription.java?rev=746843&r1=746842&r2=746843&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParameterDescription.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParameterDescription.java
 Sun Feb 22 22:45:00 2009
@@ -31,10 +31,12 @@
     private final boolean cache;
 
     private final String description;
+    
+    private final String since;
 
     public ParameterDescription(String name, String type, String defaultValue,
                                 String defaultPrefix, boolean required, 
boolean allowNull, boolean cache,
-                                String description)
+                                String description, String since)
     {
         this.name = name;
         this.type = type;
@@ -44,6 +46,7 @@
         this.allowNull = allowNull;
         this.cache = cache;
         this.description = description;
+        this.since = since;
     }
 
     public boolean getCache()
@@ -85,4 +88,9 @@
     {
         return allowNull;
     }
+
+       public String getSince() 
+       {
+               return since;
+       }
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParametersDoclet.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParametersDoclet.java?rev=746843&r1=746842&r2=746843&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParametersDoclet.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-component-report/src/main/java/org/apache/tapestry/mojo/ParametersDoclet.java
 Sun Feb 22 22:45:00 2009
@@ -81,8 +81,8 @@
             
             Map<String, String> annotationValues = findAnnotation(classDoc, 
"SupportsInformalParameters");
 
-            println("<class name=\"%s\" super-class=\"%s\"  
supports-informal-parameters=\"%s\">", classDoc.qualifiedTypeName(),
-                    classDoc.superclass().qualifiedTypeName(), 
annotationValues!=null);
+            println("<class name=\"%s\" super-class=\"%s\"  
supports-informal-parameters=\"%s\" since=\"%s\">", 
classDoc.qualifiedTypeName(),
+                    classDoc.superclass().qualifiedTypeName(), 
annotationValues!=null, getSinceTagValue(classDoc));
             print("<description>");
             printDescription(classDoc);
             println("</description>", classDoc.commentText());
@@ -100,10 +100,11 @@
                 String name = annotationValues.get("name");
                 if (name == null) name = fd.name().replaceAll("^[$_]*", "");
 
-                print("<parameter name=\"%s\" type=\"%s\" default=\"%s\" 
required=\"%s\" cache=\"%s\" default-prefix=\"%s\">",
+                print("<parameter name=\"%s\" type=\"%s\" default=\"%s\" 
required=\"%s\" cache=\"%s\" " +
+                                         "default-prefix=\"%s\" since=\"%s\">",
                       name, fd.type().qualifiedTypeName(), 
get(annotationValues, "value", ""),
                       get(annotationValues, "required", "false"), 
get(annotationValues, "cache", "true"),
-                      get(annotationValues, "defaultPrefix", "prop"));
+                      get(annotationValues, "defaultPrefix", "prop"), 
getSinceTagValue(fd));
 
                 // Body of a parameter is the comment text.
 
@@ -114,6 +115,13 @@
 
             println("</class>");
         }
+        
+        private String getSinceTagValue(Doc doc)
+        {
+               Tag[] sinceTags = doc.tags("since");
+               
+               return 0<sinceTags.length? sinceTags[0].text():"";
+        }
 
         private String get(Map<String, String> map, String key, String 
defaultValue)
         {

Modified: 
tapestry/tapestry5/trunk/tapestry-component-report/src/test/java/org/apache/tapestry/mojo/ComponentReportTest.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/src/test/java/org/apache/tapestry/mojo/ComponentReportTest.java?rev=746843&r1=746842&r2=746843&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-component-report/src/test/java/org/apache/tapestry/mojo/ComponentReportTest.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-component-report/src/test/java/org/apache/tapestry/mojo/ComponentReportTest.java
 Sun Feb 22 22:45:00 2009
@@ -178,14 +178,16 @@
                 "java.lang.Object",
                 "When it renders, it fires a 
org.apache.tapestry5.EventConstants#PREPARE_FOR_RENDER\n" +
                         " notification, followed by a 
org.apache.tapestry5.EventConstants#PREPARE",
-                false
+                false,
+                "5.1.0.0"
         );
 
         ParameterDescription paramDesc = new ParameterDescription(
                 "validationId", "String", "", "prop", false, false, true,
                 "Prefix value used when searching for validation messages and 
constraints. " +
                         "The default is the Form component's\n" +
-                        " id. This is overriden by 
org.apache.tapestry5.corelib.components.BeanEditForm."
+                        " id. This is overriden by 
org.apache.tapestry5.corelib.components.BeanEditForm.",
+                        "5.1.0.0"
         );
         classDesc.getParameters().put(paramDesc.getName(), paramDesc);
 


Reply via email to