You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2007/07/11 08:48:26 UTC

svn commit: r555185 - in /myfaces/trinidad/trunk/plugins: 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: matzew
Date: Tue Jul 10 23:48:25 2007
New Revision: 555185

URL: http://svn.apache.org/viewvc?view=rev&rev=555185
Log:
Trinidad-90 - Tagdoc: Unsupported Agents in component summary
Thanks to Bud Osterberg, for providing this patch

pushed patch/fix to trunk (1.0.2-plugins)

Modified:
    myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java
    myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
    myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
    myfaces/trinidad/trunk/plugins/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java

Modified: myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java?view=diff&rev=555185&r1=555184&r2=555185
==============================================================================
--- myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java (original)
+++ myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java Tue Jul 10 23:48:25 2007
@@ -219,6 +219,31 @@
   }
 
   /**
+   * Sets the unsupported agents for this component.
+   *
+   * @param unsupportedAgents  the unsupported agents
+   */
+  public void setUnsupportedAgents(
+    String[] unsupportedAgents)
+  {
+    if (unsupportedAgents == null)
+      throw new NullPointerException("unsupportedAgents");
+
+    _unsupportedAgents = unsupportedAgents;
+  }
+
+  /**
+   * Returns unsupported agents for this component.
+   *
+   * @return  the unsupported agents
+   */
+  public String[] getUnsupportedAgents()
+  {
+    return _unsupportedAgents;
+  }
+
+
+  /**
    * Returns the JSP tag handler class for this component.
    *
    * @return  the JSP tag handler class
@@ -672,6 +697,18 @@
   }
 
   /**
+   * Parses the unsupported agents for this component into a String array
+   * using space as the separator between values.
+   *
+   * @param unsupportedAgents  the unsupported agents
+   */
+  public void parseUnsupportedAgents(
+    String unsupportedAgents)
+  {
+    setUnsupportedAgents(unsupportedAgents.split(" "));
+  }
+  
+  /**
    * Adds a Java Language class modifier to the tag class.
    *
    * @param modifier  the modifier to be added
@@ -987,7 +1024,7 @@
   private Map     _events;
   private int     _componentClassModifiers;
   private int     _tagClassModifiers;
-
+  private String[] _unsupportedAgents = new String[0];
 
   static private final String _TRINIDAD_COMPONENT_BASE =
                          "org.apache.myfaces.trinidad.component.UIXComponentBase";

Modified: myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java?view=diff&rev=555185&r1=555184&r2=555185
==============================================================================
--- myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java (original)
+++ myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java Tue Jul 10 23:48:25 2007
@@ -158,6 +158,10 @@
     digester.addCallMethod("faces-config/component/component-extension/tag-class-modifier",
                            "parseTagClassModifier", 1);
     digester.addCallParam("faces-config/component/component-extension/tag-class-modifier", 0);
+    digester.addCallMethod("faces-config/component/component-extension/unsupported-agents",
+                           "parseUnsupportedAgents", 1);
+    digester.addCallParam("faces-config/component/component-extension/unsupported-agents", 0);
+
     digester.addCallMethod("faces-config/component/component-extension/component-class-modifier",
                            "parseComponentClassModifier", 1);
     digester.addCallParam("faces-config/component/component-extension/component-class-modifier", 0);
@@ -202,6 +206,10 @@
     digester.addCallMethod("faces-config/component/property/property-extension/unsupported-agents",
                            "parseUnsupportedAgents", 1);
     digester.addCallParam("faces-config/component/property/property-extension/unsupported-agents", 0);
+    digester.addCallMethod("faces-config/component/property/property-extension/unsupported-render-kits",
+                           "parseUnsupportedRenderKits", 1);
+    digester.addCallParam("faces-config/component/property/property-extension/unsupported-render-kits", 0);
+
     digester.addObjectCreate("faces-config/component/property/property-extension/method-binding-signature",
                              MethodSignatureBean.class);
     digester.addBeanPropertySetter("faces-config/component/property/property-extension/method-binding-signature/return-type",

Modified: myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java?view=diff&rev=555185&r1=555184&r2=555185
==============================================================================
--- myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java (original)
+++ myfaces/trinidad/trunk/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java Tue Jul 10 23:48:25 2007
@@ -250,6 +250,30 @@
   }
 
   /**
+   * Sets the unsupported RenderKits for this property.
+   *
+   * @param unsupportedRenderKits  the unsupported RenderKits
+   */
+  public void setUnsupportedRenderKits(
+    String[] unsupportedRenderKits)
+  {
+    if (unsupportedRenderKits == null)
+      throw new NullPointerException("unsupportedRenderKits");
+
+    _unsupportedRenderKits = unsupportedRenderKits;
+  }
+
+  /**
+   * Returns unsupported RenderKits for this property.
+   *
+   * @return  the unsupported RenderKits
+   */
+  public String[] getUnsupportedRenderKits()
+  {
+    return _unsupportedRenderKits;
+  }
+
+  /**
    * Sets the tag attribute excluded flag for this property.
    *
    * @param excluded  true,  if the tag attribute should be excluded;
@@ -283,6 +307,7 @@
     return ("javax.faces.el.MethodBinding".equals(getPropertyClass()));
   }
 
+
   /**
    * Parses the possible values for this property into a String array
    * using space as the separator between values.
@@ -307,6 +332,17 @@
     setUnsupportedAgents(unsupportedAgents.split(" "));
   }
 
+  /**
+   * Parses the unsupported RenderKits for this property into a String array
+   * using space as the separator between values.
+   *
+   * @param unsupportedRenderKits  the unsupported RenderKits
+   */
+  public void parseUnsupportedRenderKits(
+    String unsupportedRenderKits)
+  {
+    setUnsupportedRenderKits(unsupportedRenderKits.split(" "));
+  }
 
   private String  _aliasOf;
   private boolean _required;
@@ -317,6 +353,7 @@
   private boolean _tagAttributeExcluded;
   private String[] _propertyValues;
   private String[] _unsupportedAgents = _EMPTY_ARRAY;
+  private String[] _unsupportedRenderKits = _EMPTY_ARRAY;
 
   static private String[] _EMPTY_ARRAY = new String[0];
 }

Modified: myfaces/trinidad/trunk/plugins/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/plugins/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java?view=diff&rev=555185&r1=555184&r2=555185
==============================================================================
--- myfaces/trinidad/trunk/plugins/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java (original)
+++ myfaces/trinidad/trunk/plugins/maven-tagdoc-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/tagdoc/TagdocReport.java Tue Jul 10 23:48:25 2007
@@ -243,11 +243,66 @@
     return set;
   }
 
+  private String _formatPropList(
+    String[] pList, 
+    String   header)
+  {
+    String[] nullList = {};
+    return _formatPropList(pList, header, nullList);
+  }
+
+  private String _formatPropList(
+    String[] pList, 
+    String   header,
+    String[] ignores)
+  {
+    String formatted = null;
+    if ((pList != null) && (pList.length > 0))
+    {
+      // Don't know how long this will be, but 100 should be plenty.
+      StringBuffer sb = new StringBuffer(100);
+      sb.append("\n");
+      sb.append("<b>");
+      sb.append(header);
+      sb.append(":</b> ");
+
+      boolean gotOne = false;
+
+      for (int arrInd = 0; arrInd < pList.length; arrInd++)
+      {
+        String curStr = pList[arrInd];
+        outer:
+        if (curStr != null)
+        {
+          for (int i = 0; i < ignores.length; i++)
+          {
+            String s = ignores[i];
+            if ((s != null) && (s.equalsIgnoreCase(curStr)))
+              break outer;
+          }
+
+          if (gotOne)
+          {
+            sb.append(", ");
+          }
+          gotOne = true;
+          sb.append(curStr);
+        }
+      }
+      if (gotOne)
+      {
+        sb.append("<br/>\n");
+        formatted = sb.toString();
+      }
+    }
+    return formatted;
+  }
+
   private void _writeIndexSection(Sink sink, Set pages, String title)
   {
     if (pages.isEmpty())
       return;
-    
+
     sink.sectionTitle1();
     sink.text(title);
     sink.sectionTitle1_();
@@ -493,6 +548,14 @@
     out.write("   <b>Component type:</b> " + bean.getComponentType() +  "\n");
     out.write("   <br/>\n");
 
+    String fmtd = _formatPropList(bean.getUnsupportedAgents(),
+                                  "Unsupported agents",
+                                  _NON_DOCUMENTED_AGENTS);
+    if (fmtd != null)
+    {
+      out.write("   " + fmtd);
+    }
+
     String doc = bean.getLongDescription();
     if (doc == null)
       doc = bean.getDescription();
@@ -778,48 +841,46 @@
 
       if (attr.getDescription()  != null)
       {
-        String[] values = attr.getPropertyValues();
-        String valStr = null;
-
-        if ((values != null) && (values.length > 0))
-        {
-          // Don't know how long this will be, but 100 should be plenty.
-          StringBuffer sb = new StringBuffer(100);
-          sb.append("\n<p><b>Valid Values: </b>");
-
-          for (int arrInd = 0; arrInd < values.length; arrInd++)
-          {
-            if (arrInd != 0)
-            {
-              sb.append(", ");
-            }
-            sb.append(values[arrInd]);
-          }
-          sb.append("</p>\n");
-          valStr = sb.toString();
-        }
+        String valStr = _formatPropList(attr.getPropertyValues(),
+                                        "Valid Values");
+        String unsupAgentsStr =
+          _formatPropList(attr.getUnsupportedAgents(),
+                          "Not supported on the following agents",
+                          _NON_DOCUMENTED_AGENTS);
+        String unsupRkStr =
+          _formatPropList(attr.getUnsupportedRenderKits(),
+                          "Not supported on the following renderkits");
 
         if (_attrDocSpansColumns)
         {
           out.write("</tr>\n");
           out.write("<tr>\n");
           out.write("<td colspan=\"3\">\n");
-          //        out.write(EscapeUtils.escapeElementValue(doc.doc));
-          if (valStr != null)
-            out.write(valStr);
-          out.write(attr.getDescription());
-          //out.write(EscapeUtils.escapeAmpersands(doc.doc));
-          out.write("</td>\n");
         }
         else
         {
           out.write("<td>\n");
-          if (valStr != null)
-            out.write(valStr);
-          out.write(attr.getDescription());
-          //out.write(EscapeUtils.escapeAmpersands(doc.doc));
-          out.write("</td>\n");
         }
+        
+        //        out.write(EscapeUtils.escapeElementValue(doc.doc));
+        if (valStr != null)
+        {
+          out.write(valStr);
+          out.write("<br/>");
+        }
+        out.write(attr.getDescription());
+        if (unsupAgentsStr != null)
+        {
+          out.write("<br/>");
+          out.write(unsupAgentsStr);
+        }
+        if (unsupRkStr != null)
+        {
+          out.write("<br/>");
+          out.write(unsupRkStr);
+        }
+        //out.write(EscapeUtils.escapeAmpersands(doc.doc));
+        out.write("</td>\n");
       }
 
       out.write("</tr>\n");
@@ -1287,4 +1348,6 @@
   private SiteRenderer siteRenderer;
 
   static private final String _DOC_SUBDIRECTORY = "tagdoc";
-}
+  static private final String[] _NON_DOCUMENTED_AGENTS = {"phone", "voice"};
+
+}
\ No newline at end of file