You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2010/10/22 21:46:22 UTC

svn commit: r1026463 - in /myfaces/trinidad-maven/branches/2.0.x-branch: maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/

Author: arobinson74
Date: Fri Oct 22 19:46:22 2010
New Revision: 1026463

URL: http://svn.apache.org/viewvc?rev=1026463&view=rev
Log:
TRINIDAD-1946 - support the JSR-276 hidden property

Modified:
    myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
    myfaces/trinidad-maven/branches/2.0.x-branch/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java

Modified: myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java?rev=1026463&r1=1026462&r2=1026463&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java (original)
+++ myfaces/trinidad-maven/branches/2.0.x-branch/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java Fri Oct 22 19:46:22 2010
@@ -107,7 +107,7 @@ public class FacesConfigParser
       digester.addBeanPropertySetter("faces-config/component/component-class",
                                      "componentClass");
       digester.addBeanPropertySetter("faces-config/component/js-component-class",
-                                     "jsComponentClass");      
+                                     "jsComponentClass");
       digester.addBeanPropertySetter("faces-config/component/description");
       digester.addSetNext("faces-config/component", "addComponent",
                           ComponentBean.class.getName());
@@ -231,6 +231,7 @@ public class FacesConfigParser
     digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/value-expression", "valueExpression");
     digester.addBeanPropertySetter("faces-config/component/component-extension/component-metadata/default-event-name",
                                    "defaultEventName");
+    digester.addBeanPropertySetter("faces-config/component/facet/facet-extension/facet-metadata/hidden");
     digester.addCallMethod("faces-config/component/component-extension/component-metadata/event-names",
                            "parseEventNames", 1);
     digester.addCallParam("faces-config/component/component-extension/component-metadata/event-names", 0);
@@ -339,6 +340,7 @@ public class FacesConfigParser
                            "parsePropertyValues", 1);
     digester.addCallParam("faces-config/component/property/property-extension/property-metadata/property-values", 0);
     digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/deprecated");
+    digester.addBeanPropertySetter("faces-config/component/property/property-extension/property-metadata/hidden");
 
     digester.setRuleNamespaceURI(oldNamespace);
   }

Modified: myfaces/trinidad-maven/branches/2.0.x-branch/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/branches/2.0.x-branch/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java?rev=1026463&r1=1026462&r2=1026463&view=diff
==============================================================================
--- myfaces/trinidad-maven/branches/2.0.x-branch/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java (original)
+++ myfaces/trinidad-maven/branches/2.0.x-branch/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java Fri Oct 22 19:46:22 2010
@@ -134,13 +134,13 @@ public class TagdocReport extends Abstra
     compIter = new FilteredIterator(compIter, new SkipFilter());
     compIter = new FilteredIterator(compIter, new ComponentTagFilter());
     compIter = new FilteredIterator(compIter, new ComponentNamespaceFilter());
-    
+
     // compTypeMap holds a map of compononent types to tag names that implement that component type
-    // The map is built using getComponentType method on the component bean to determine the 
+    // The map is built using getComponentType method on the component bean to determine the
     // component type of a given tag name
     Map<String, List<QName>>  compTypeMap = new HashMap<String, List<QName>> ();
     // contractMap holds a map of contract name to tag names that satisify that contract.
-    // The map is built using the getSatisfiedContracts method API on the component bean to determine 
+    // The map is built using the getSatisfiedContracts method API on the component bean to determine
     // which contracts are satisfied for a given tagname
     Map<String, List<QName>> contractMap = new HashMap<String, List<QName>>();
     while (compIter.hasNext())
@@ -149,21 +149,21 @@ public class TagdocReport extends Abstra
       List<QName> tagNames;
       String compType = compBean.getComponentType();
       if (compType != null &&
-          compTypeMap.containsKey (compType) && 
-          compBean.getTagName() != null) 
+          compTypeMap.containsKey (compType) &&
+          compBean.getTagName() != null)
       {
         // the component type map already contains an entry for this component type
         tagNames = compTypeMap.get(compType);
-      } 
-      else 
+      }
+      else
       {
         // the component type map does not contain an entry for this component type
-        // so create a new ArrayList that will be used to store the tag names of 
+        // so create a new ArrayList that will be used to store the tag names of
         // component that have this component type
         tagNames = new ArrayList<QName>();
       }
       tagNames.add(compBean.getTagName());
-      compTypeMap.put (compType, tagNames);      
+      compTypeMap.put (compType, tagNames);
 
       if (compBean.hasSatisfiedContracts())
       {
@@ -173,12 +173,12 @@ public class TagdocReport extends Abstra
           String satContract = satContractsIter.next();
           if (contractMap.containsKey (satContract))
           {
-            // the contract map already contains an entry for this contract 
+            // the contract map already contains an entry for this contract
             tagNames = contractMap.get(satContract);
           }
           else
           {
-            // the contract map does not contain an entry for this contract, so 
+            // the contract map does not contain an entry for this contract, so
             // create a new ArrayList which will be used to store the tag names of
             // components that satisfy this contract
             tagNames = new ArrayList<QName>();
@@ -320,7 +320,7 @@ public class TagdocReport extends Abstra
     String header)
   {
     String formatted = null;
-    
+
     // Don't know how long this will be, but 300 should be plenty.
     StringBuffer sb = new StringBuffer(300);
     sb.append("\n");
@@ -334,7 +334,7 @@ public class TagdocReport extends Abstra
       sb.append(":</b> ");
     }
 
-    boolean gotOne = false;    
+    boolean gotOne = false;
     while (strIter.hasNext())
     {
       List<QName> tagNameList = pMap.get(strIter.next());
@@ -443,13 +443,13 @@ public class TagdocReport extends Abstra
     sink.text("Tag Name");
     sink.tableHeaderCell_();
     sink.tableRow_();
-    
+
     Iterator<String> iter = pages.iterator();
     while (iter.hasNext())
     {
       sink.tableRow();
       sink.tableCell();
-      
+
       String name = iter.next();
       String tagName = "<" + name.replace('_', ':') + ">";
 
@@ -712,7 +712,7 @@ public class TagdocReport extends Abstra
 
     // Write out the corresponding Java Script class for this component with a link to its JavaScript doc
     String jsClass = bean.getJsComponentClass();
-    if (jsClass != null && !jsClass.isEmpty()) 
+    if (jsClass != null && !jsClass.isEmpty())
     {
       out.write("<tr>\n");
       out.write("<td><b>JavaScript Class:</b></td>");
@@ -730,7 +730,7 @@ public class TagdocReport extends Abstra
 
     if (bean.hasRequiredAncestorContracts())
     {
-      String formattedAncestors = _formatTagList ( bean.requiredAncestorContracts(), 
+      String formattedAncestors = _formatTagList ( bean.requiredAncestorContracts(),
                                                    contractMap,
                                                    null);
       out.write("<tr>\n");
@@ -742,7 +742,7 @@ public class TagdocReport extends Abstra
     if (_isNamingContainer(bean))
     {
       out.write("<tr>\n");
-      out.write("<td><b>Naming Container:</b></td>"); 
+      out.write("<td><b>Naming Container:</b></td>");
       out.write("<td>Yes.  When referring to children of this " +
                 "component (\"partialTriggers\", <code>findComponent()</code>, etc.), " +
                 "you must prefix the child's ID with this component's ID and a colon (':').</td>");
@@ -792,7 +792,7 @@ public class TagdocReport extends Abstra
     out.write("<td><b>Tag Name:</b></td>");
     out.write("<td>" + _getQualifiedName(bean.getTagName()) + "&gt;</td>\n");
     out.write("</tr>\n");
-    
+
     out.write("<tr>\n");
     out.write("<td><b>Type:</b></td>");
     out.write("<td>" + bean.getValidatorId() +  "</td>\n");
@@ -893,8 +893,10 @@ public class TagdocReport extends Abstra
   private void _writeComponentAttributes(Writer out, ComponentBean bean) throws IOException
   {
     // Sort the names
-    TreeSet attributes = new TreeSet();
+    TreeSet<String> attributes = new TreeSet<String>();
     Iterator<PropertyBean> attrs = bean.properties(true);
+    attrs = new FilteredIterator(attrs, new NonHiddenFilter());
+
     while (attrs.hasNext())
     {
       PropertyBean property = attrs.next();
@@ -903,7 +905,7 @@ public class TagdocReport extends Abstra
     }
 
     // Now get a list of PropertyBeans
-    List list = new ArrayList();
+    List<PropertyBean> list = new ArrayList<PropertyBean>();
     Iterator<String> iter = attributes.iterator();
     while (iter.hasNext())
     {
@@ -911,8 +913,7 @@ public class TagdocReport extends Abstra
       list.add(bean.findProperty(attrName, true));
     }
 
-
-    TreeSet groups = new TreeSet(new GroupComparator());
+    TreeSet<String> groups = new TreeSet<String>(new GroupComparator());
     /* No current support for grouping
     // Make sure "null" is the representative for unknown groups
     Iterator iter = attributes.iterator();
@@ -937,10 +938,8 @@ public class TagdocReport extends Abstra
                                 bean.getComponentClass(),
                                 groupIter.next());
     }
-
   }
 
-
   private void _writeConverterAttributes(Writer out, ConverterBean bean) throws IOException
   {
     // Sort the names
@@ -1009,11 +1008,6 @@ public class TagdocReport extends Abstra
     while (attributes.hasNext())
     {
       PropertyBean attr = attributes.next();
-      
-      if (attr.isHidden())
-      {
-        continue;
-      }
 
       /*
       if ((group == null) || "Ungrouped".equals(group))
@@ -1120,15 +1114,15 @@ public class TagdocReport extends Abstra
         {
           out.write(valStr);
         }
-        
+
         if (defaultValueStr != null)
         {
           out.write(defaultValueStr);
         }
-        
-        // if we print out a list of possible values and/or a default value for the attribute, 
+
+        // if we print out a list of possible values and/or a default value for the attribute,
         // then enter a line break before printing out other information about the attribute.
-        if (valStr != null || defaultValueStr != null) 
+        if (valStr != null || defaultValueStr != null)
         {
           out.write("<br/>");
         }
@@ -1432,7 +1426,7 @@ public class TagdocReport extends Abstra
   // guidelines
   private void _writeAccessibilityGuidelines(Writer out, ComponentBean bean) throws IOException
   {
-    // accAttributes and accFacets are sorted lists of attributes and facets, respectively, 
+    // accAttributes and accFacets are sorted lists of attributes and facets, respectively,
     // that have an associated accessibility guideline
     TreeSet<PropertyBean> accAttributes = new TreeSet<PropertyBean>();
     TreeSet<String> accFacets = new TreeSet<String>();
@@ -1449,7 +1443,7 @@ public class TagdocReport extends Abstra
     }
 
     // see if any of the component's facets has an associated accessibility guideline
-    if (bean.hasFacets()) 
+    if (bean.hasFacets())
     {
       Iterator<FacetBean> facets = bean.facets(true);
       while (facets.hasNext())
@@ -1540,11 +1534,11 @@ public class TagdocReport extends Abstra
     out.write("    <div class=\'accGuideline\'>\n");
     out.write("<li>");
 
-    if (!"".equals(referenceName)) 
+    if (!"".equals(referenceName))
     {
       out.write("<b>");
       out.write(referenceName);
-      out.write("</b>: ");    
+      out.write("</b>: ");
     }
 
     if (desc != null)
@@ -1553,7 +1547,7 @@ public class TagdocReport extends Abstra
       {
         out.write(desc + "\n");
       }
-    } 
+    }
 
     out.write("</li>");
     out.write("    </div>\n");
@@ -1767,8 +1761,6 @@ public class TagdocReport extends Abstra
     }
   }
 
-
-
   private class ComponentNamespaceFilter extends ComponentFilter
   {
     public ComponentNamespaceFilter()
@@ -1817,8 +1809,6 @@ public class TagdocReport extends Abstra
     }
   }
 
-
-
   static final protected class TagAttributeFilter extends PropertyFilter
   {
     protected boolean accept(
@@ -1855,11 +1845,17 @@ public class TagdocReport extends Abstra
     }
   }
 
+  final protected static class NonHiddenFilter extends PropertyFilter
+  {
+    protected boolean accept(
+        PropertyBean property)
+    {
+      return (!property.isHidden());
+    }
+  }
 
   private FacesConfigBean _facesConfig;
 
-
-
   // todo: make this configurable?
   private boolean _attrDocSpansColumns = false;