You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2006/06/03 18:22:42 UTC

svn commit: r411443 - in /myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html: HTML.java HtmlTableRendererBase.java

Author: dennisbyrne
Date: Sat Jun  3 09:22:41 2006
New Revision: 411443

URL: http://svn.apache.org/viewvc?rev=411443&view=rev
Log:
MYFACES-1184 & MYFACES-1216 , patch by Chris Paulson-Ellis

Modified:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java?rev=411443&r1=411442&r2=411443&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java Sat Jun  3 09:22:41 2006
@@ -451,6 +451,7 @@
     String IMG_ELEM = "img";
     String LABEL_ELEM = "label";
     String TABLE_ELEM = "table";
+    String CAPTION_ELEM = "caption";
     String TR_ELEM = "tr";
     String TH_ELEM = "th";
     String TD_ELEM = "td";

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java?rev=411443&r1=411442&r2=411443&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java Sat Jun  3 09:22:41 2006
@@ -49,6 +49,8 @@
     /** Footer facet name. */
     protected static final String FOOTER_FACET_NAME = "footer";
 
+    protected static final String CAPTION_FACET_NAME = "caption";
+    
     /** The logger. */
     private static final Log log = LogFactory.getLog(HtmlTableRendererBase.class);
 
@@ -117,6 +119,7 @@
         beforeBody(facesContext, (UIData) component);
 
         HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+        renderCaptionFacet(facesContext, writer, component);
         writer.startElement(HTML.TBODY_ELEM, component);
         writer.writeAttribute(HTML.ID_ATTR, component.getClientId(facesContext)+":tbody_element", null);
 
@@ -127,6 +130,26 @@
         afterBody(facesContext, (UIData) component);
     }
 
+    /**
+     * Renders the caption facet.
+     * @param facesContext the <code>FacesContext</code>.
+     * @param writer the <code>ResponseWriter</code>.
+     * @param component the parent <code>UIComponent</code> containing the facets.
+     * @throws IOException if an exception occurs.
+     */
+    protected void renderCaptionFacet(FacesContext facesContext, ResponseWriter writer, UIComponent component)
+            throws IOException
+    {
+        UIComponent facet = (UIComponent) component.getFacets().get(CAPTION_FACET_NAME);
+        if (facet != null)
+        {
+            HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+            writer.startElement(HTML.CAPTION_ELEM, component);
+            RendererUtils.renderChild(facesContext, facet);
+            writer.endElement(HTML.CAPTION_ELEM);
+        }
+    }    
+    
     /**
      * Gets styles for the specified component.
      */