You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2005/05/16 23:46:14 UTC

svn commit: r170463 - in /myfaces/trunk: build/ src/components/org/apache/myfaces/component/ src/components/org/apache/myfaces/renderkit/html/ext/ src/myfaces/org/apache/myfaces/renderkit/html/

Author: mmarinschek
Date: Mon May 16 14:46:14 2005
New Revision: 170463

URL: http://svn.apache.org/viewcvs?rev=170463&view=rev
Log:
changes to ensure module interdependencies are correct

Removed:
    myfaces/trunk/src/components/org/apache/myfaces/component/DisplayValueOnlyCapable.java
Modified:
    myfaces/trunk/build/build.xml
    myfaces/trunk/src/components/org/apache/myfaces/renderkit/html/ext/HtmlListboxRenderer.java
    myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGridRenderer.java
    myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGroupRenderer.java

Modified: myfaces/trunk/build/build.xml
URL: http://svn.apache.org/viewcvs/myfaces/trunk/build/build.xml?rev=170463&r1=170462&r2=170463&view=diff
==============================================================================
--- myfaces/trunk/build/build.xml (original)
+++ myfaces/trunk/build/build.xml Mon May 16 14:46:14 2005
@@ -55,6 +55,7 @@
     <path id="jsfapi.class.path">
         <pathelement location="${servlet-jsp.jar}"/>
         <pathelement location="${jstl.jar}"/>
+        <pathelement location="${commons-logging.jar}"/>
     </path>
 
     <!-- classpath for compiling shared classes -->

Modified: myfaces/trunk/src/components/org/apache/myfaces/renderkit/html/ext/HtmlListboxRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/components/org/apache/myfaces/renderkit/html/ext/HtmlListboxRenderer.java?rev=170463&r1=170462&r2=170463&view=diff
==============================================================================
--- myfaces/trunk/src/components/org/apache/myfaces/renderkit/html/ext/HtmlListboxRenderer.java (original)
+++ myfaces/trunk/src/components/org/apache/myfaces/renderkit/html/ext/HtmlListboxRenderer.java Mon May 16 14:46:14 2005
@@ -18,6 +18,7 @@
 import org.apache.myfaces.component.DisplayValueOnlyCapable;
 import org.apache.myfaces.component.UserRoleUtils;
 import org.apache.myfaces.renderkit.html.HtmlRendererUtils;
+import org.apache.myfaces.renderkit.html.HtmlListboxRendererBase;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -29,7 +30,7 @@
  * @version $Revision$ $Date$
  */
 public class HtmlListboxRenderer
-        extends org.apache.myfaces.renderkit.html.HtmlListboxRenderer
+        extends HtmlListboxRendererBase
 {
     protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent)
     {

Modified: myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGridRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGridRenderer.java?rev=170463&r1=170462&r2=170463&view=diff
==============================================================================
--- myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGridRenderer.java (original)
+++ myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGridRenderer.java Mon May 16 14:46:14 2005
@@ -39,225 +39,7 @@
  * @version $Revision$ $Date$
  */
 public class HtmlGridRenderer
-    extends HtmlRenderer
+    extends HtmlGridRendererBase
 {
-    private static final Log log = LogFactory.getLog(HtmlGridRenderer.class);
-
-    public boolean getRendersChildren()
-    {
-        return true;
-    }
-
-    public void encodeBegin(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {
-        // all work done in encodeEnd()
-    }
-
-    public void encodeChildren(FacesContext context, UIComponent component)
-        throws IOException
-    {
-        // all work done in encodeEnd()
-    }
-
-    public void encodeEnd(FacesContext facesContext, UIComponent component)
-            throws IOException
-    {
-        RendererUtils.checkParamValidity(facesContext, component, UIPanel.class);
-
-        int columns;
-        if (component instanceof HtmlPanelGrid)
-        {
-            columns = ((HtmlPanelGrid)component).getColumns();
-        }
-        else
-        {
-            Integer i = (Integer)component.getAttributes().get(JSFAttr.COLUMNS_ATTR);
-            columns = i != null ? i.intValue() : 0;
-        }
-
-        if (columns <= 0)
-        {
-            if (log.isErrorEnabled())
-            {
-                log.error("Wrong columns attribute for PanelGrid " + component.getClientId(facesContext) + ": " + columns);
-            }
-            columns = 1;
-        }
-
-        ResponseWriter writer = facesContext.getResponseWriter();
-        writer.startElement(HTML.TABLE_ELEM, component);
-        HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
-        HtmlRendererUtils.renderHTMLAttributes(writer, component, HTML.TABLE_PASSTHROUGH_ATTRIBUTES);
-
-        writer.flush();
-
-        renderHeaderOrFooter(facesContext, writer, component, columns, true);   //Header facet
-
-        renderChildren(facesContext, writer, component, columns);
-
-        renderHeaderOrFooter(facesContext, writer, component, columns, false);  //Footer facet
-
-        writer.endElement(HTML.TABLE_ELEM);
-    }
-
-
-    private void renderHeaderOrFooter(FacesContext context,
-                                      ResponseWriter writer,
-                                      UIComponent component,
-                                      int columns,
-                                      boolean header)
-        throws IOException
-    {
-        UIComponent facet = component.getFacet(header ? "header" : "footer");
-        if (facet == null) return;
-
-        HtmlRendererUtils.writePrettyLineSeparator(context);
-        writer.startElement(header ? HTML.THEAD_ELEM : HTML.TFOOT_ELEM, component);
-        writer.startElement(HTML.TR_ELEM, component);
-        writer.startElement(header ? HTML.TH_ELEM : HTML.TD_ELEM, component);
-
-        String styleClass = (component instanceof HtmlPanelGrid)
-            ? (header ?
-                         ((HtmlPanelGrid)component).getHeaderClass() :
-                         ((HtmlPanelGrid)component).getFooterClass())
-            : (header ?
-                         (String)component.getAttributes().get(JSFAttr.HEADER_CLASS_ATTR) :
-                         (String)component.getAttributes().get(JSFAttr.FOOTER_CLASS_ATTR));
-        if (styleClass != null)
-        {
-            writer.writeAttribute(HTML.CLASS_ATTR, styleClass,
-                                  header ? JSFAttr.HEADER_CLASS_ATTR : JSFAttr.FOOTER_CLASS_ATTR);
-        }
-
-        if (header)
-        {
-            writer.writeAttribute(HTML.SCOPE_ATTR, HTML.SCOPE_COLGROUP_VALUE, null);
-        }
-
-        writer.writeAttribute(HTML.COLSPAN_ATTR, Integer.toString(columns), null);
-
-        HtmlRendererUtils.writePrettyLineSeparator(context);
-        RendererUtils.renderChild(context, facet);
-
-        HtmlRendererUtils.writePrettyLineSeparator(context);
-        writer.endElement(header ? HTML.TH_ELEM : HTML.TD_ELEM);
-        writer.endElement(HTML.TR_ELEM);
-        writer.endElement(header ? HTML.THEAD_ELEM : HTML.TFOOT_ELEM);
-    }
-
-
-    private void renderChildren(FacesContext context,
-                                ResponseWriter writer,
-                                UIComponent component,
-                                int columns)
-        throws IOException
-    {
-        try
-        {
-            writer.startElement(HTML.TBODY_ELEM, component);
-
-            String columnClasses;
-            String rowClasses;
-            if (component instanceof HtmlPanelGrid)
-            {
-                columnClasses = ((HtmlPanelGrid)component).getColumnClasses();
-                rowClasses =  ((HtmlPanelGrid)component).getRowClasses();
-            }
-            else
-            {
-                columnClasses = (String)component.getAttributes().get(JSFAttr.COLUMN_CLASSES_ATTR);
-                rowClasses = (String)component.getAttributes().get(JSFAttr.ROW_CLASSES_ATTR);
-            }
-
-            String[] columnClassesArray = (columnClasses == null)
-                ? ArrayUtils.EMPTY_STRING_ARRAY
-                : StringUtils.trim(StringUtils.splitShortString(columnClasses, ','));
-            int columnClassesCount = columnClassesArray.length;
-
-            String[] rowClassesArray = (rowClasses == null)
-                ? ArrayUtils.EMPTY_STRING_ARRAY
-                : StringUtils.trim(StringUtils.splitShortString(rowClasses, ','));
-            int rowClassesCount = rowClassesArray.length;
-
-            int childCount = component.getChildCount();
-            if (childCount > 0)
-            {
-                int columnIndex = 0;
-                int rowClassIndex = 0;
-                boolean rowStarted = false;
-                for (Iterator it = component.getChildren().iterator(); it.hasNext(); )
-                {
-                    UIComponent child = (UIComponent)it.next();
-                    if (child.isRendered())
-                    {
-                        if (columnIndex == 0)
-                        {
-                            //start of new/next row
-                            if (rowStarted)
-                            {
-                                //do we have to close the last row?
-                                writer.endElement(HTML.TR_ELEM);
-                                HtmlRendererUtils.writePrettyLineSeparator(context);
-                            }
-                            writer.startElement(HTML.TR_ELEM, component);
-                            if (rowClassIndex < rowClassesCount) {
-                                writer.writeAttribute(HTML.CLASS_ATTR, rowClassesArray[rowClassIndex], null);
-                            }
-                            rowStarted = true;
-                            rowClassIndex++;
-                            if (rowClassIndex == rowClassesCount) {
-                                rowClassIndex = 0;
-                            }
-                        }
-
-                        writer.startElement(HTML.TD_ELEM, component);
-                        if (columnIndex < columnClassesCount)
-                        {
-                            writer.writeAttribute(HTML.CLASS_ATTR, columnClassesArray[columnIndex], null);
-                        }
-                        RendererUtils.renderChild(context, child);
-                        writer.endElement(HTML.TD_ELEM);
-
-                        columnIndex++;
-                        if (columnIndex >= columns) {
-                            columnIndex = 0;
-                        }
-                    }
-                }
-
-                if (rowStarted)
-                {
-                    if (columnIndex > 0)
-                    {
-                        if (log.isWarnEnabled()) log.warn("PanelGrid " + component.getClientId(context) + " has not enough children. Child count should be a multiple of the columns attribute.");
-                        //Render empty columns, so that table is correct
-                        for ( ; columnIndex < columns; columnIndex++)
-                        {
-                            writer.startElement(HTML.TD_ELEM, component);
-                            if (columnIndex < columnClassesCount)
-                            {
-                                writer.writeAttribute(HTML.CLASS_ATTR, columnClassesArray[columnIndex], null);
-                            }
-                            writer.endElement(HTML.TD_ELEM);
-                        }
-                    }
-                    writer.endElement(HTML.TR_ELEM);
-                    HtmlRendererUtils.writePrettyLineSeparator(context);
-                }
-            }
-
-            writer.endElement(HTML.TBODY_ELEM);
-        }
-        catch(IOException ex)
-        {
-            throw ex;
-        }
-        catch(RuntimeException ex2)
-        {
-            log.error("Exception while rendering children of panel-grid.",ex2);
-            throw ex2;
-        }
-    }
 
 }

Modified: myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGroupRenderer.java
URL: http://svn.apache.org/viewcvs/myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGroupRenderer.java?rev=170463&r1=170462&r2=170463&view=diff
==============================================================================
--- myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGroupRenderer.java (original)
+++ myfaces/trunk/src/myfaces/org/apache/myfaces/renderkit/html/HtmlGroupRenderer.java Mon May 16 14:46:14 2005
@@ -29,51 +29,6 @@
  * @version $Revision$ $Date$
  */
 public class HtmlGroupRenderer
-    extends HtmlRenderer
+    extends HtmlGroupRendererBase
 {
-    public boolean getRendersChildren()
-    {
-        return true;
-    }
-
-    public void encodeBegin(FacesContext context, UIComponent component)
-            throws IOException
-    {
-    }
-
-    public void encodeChildren(FacesContext context, UIComponent component)
-        throws IOException
-    {
-    }
-
-    public void encodeEnd(FacesContext context, UIComponent component)
-            throws IOException
-    {
-        ResponseWriter writer = context.getResponseWriter();
-        boolean span = false;
-
-        if(component.getId()!=null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
-        {
-            span = true;
-
-            writer.startElement(HTML.SPAN_ELEM, component);
-
-            HtmlRendererUtils.writeIdIfNecessary(writer, component, context);
-
-            HtmlRendererUtils.renderHTMLAttributes(writer, component, HTML.COMMON_PASSTROUGH_ATTRIBUTES);
-        }
-        else
-        {
-            span=HtmlRendererUtils.renderHTMLAttributesWithOptionalStartElement(writer,
-                                                                             component,
-                                                                             HTML.SPAN_ELEM,
-                                                                             HTML.COMMON_PASSTROUGH_ATTRIBUTES);
-        }
-
-        RendererUtils.renderChildren(context, component);
-        if (span)
-        {
-            writer.endElement(HTML.SPAN_ELEM);
-        }
-    }
 }