Author: awiner
Date: Thu Aug 17 16:21:22 2006
New Revision: 432429

URL: http://svn.apache.org/viewvc?rev=432429&view=rev
Log:
Faces-major panelBorderLayout

Added:
    
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBorderLayoutRenderer.java
Modified:
    
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelBorderLayout.xml
    
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelBorderLayout.xml
    
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseDesktopSkin.java
    
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
    
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinProperties.java
    
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/faces-bean.properties

Modified: 
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelBorderLayout.xml
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelBorderLayout.xml?rev=432429&r1=432428&r2=432429&view=diff
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelBorderLayout.xml
 (original)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelBorderLayout.xml
 Thu Aug 17 16:21:22 2006
@@ -21,7 +21,7 @@
   <component>
     <description><![CDATA[The panelBorderLayout component is a layout element 
which lays out all of its
           children consecutively in its middle, and supports the following
-          facets: top, bottom, left, right, start and end]]>
+          facets: top, bottom, left, right, start, end, innerTop, innerBottom, 
innerLeft, innerRight, innerStart, and innerEnd]]>
     </description>
     <icon>
       
<small-icon>/org/apache/myfaces/trinidad/metadata/icons/panelBorderLayout.png</small-icon>
@@ -51,7 +51,7 @@
     </facet>
     <facet>
       <description><![CDATA[Content to be rendered to the left of the children 
and
-                between any top and bottom children.]]>
+                between any top and bottom facets.]]>
       </description>
       <facet-name>left</facet-name>
       <facet-extension>
@@ -60,7 +60,7 @@
     </facet>
     <facet>
       <description><![CDATA[Content to be rendered to the right of the 
children and
-                between any top and bottom children.]]>
+                between any top and bottom facets.]]>
       </description>
       <facet-name>right</facet-name>
       <facet-extension>
@@ -69,7 +69,7 @@
     </facet>
     <facet>
       <description><![CDATA[Content to be rendered to the left of the children 
and
-                between any top and bottom children, if the reading direction 
is
+                between any top and bottom facets, if the reading direction is
                 left-to-right, on the right otherwise.]]>
       </description>
       <facet-name>start</facet-name>
@@ -82,13 +82,74 @@
     </facet>
     <facet>
       <description><![CDATA[Content to be rendered to the right of the 
children and
-                between any top and bottom children, if the reading direction 
is
+                between any top and bottom facets, if the reading direction is
                 left-to-right, on the left otherwise.]]>
       </description>
       <facet-name>end</facet-name>
       <facet-extension>
         <mfp:facet-metadata>
           <mfp:preferred>true</mfp:preferred>
+        </mfp:facet-metadata>
+        <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
+      </facet-extension>
+    </facet>
+
+    <facet>
+      <description><![CDATA[Content to be rendered above the children, inside 
of 'top'.]]>
+      </description>
+      <facet-name>innerTop</facet-name>
+      <facet-extension>
+        <mfp:facet-metadata>
+          <mfp:preferred>false</mfp:preferred>
+        </mfp:facet-metadata>
+      </facet-extension>
+    </facet>
+    <facet>
+      <description><![CDATA[Content to be rendered below the children, but 
above 'bottom'.]]>
+      </description>
+      <facet-name>innerBottom</facet-name>
+      <facet-extension>
+        <mfp:facet-metadata>
+          <mfp:preferred>false</mfp:preferred>
+        </mfp:facet-metadata>
+      </facet-extension>
+    </facet>
+    <facet>
+      <description><![CDATA[Content to be rendered to the left of the children 
and
+                between any innerTop and innerBottom facets, to the right of 
the left facet.]]>
+      </description>
+      <facet-name>innerLeft</facet-name>
+      <facet-extension>
+        <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
+      </facet-extension>
+    </facet>
+    <facet>
+      <description><![CDATA[Content to be rendered to the right of the 
children and
+                between any innerTop and innerBottom facets.]]>
+      </description>
+      <facet-name>innerRight</facet-name>
+      <facet-extension>
+        <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
+      </facet-extension>
+    </facet>
+    <facet>
+      <description><![CDATA[the equivalent of innerLeft on left-to-right 
clients and innerRight on right-to-left clients.]]>
+      </description>
+      <facet-name>innerStart</facet-name>
+      <facet-extension>
+        <mfp:facet-metadata>
+          <mfp:preferred>false</mfp:preferred>
+        </mfp:facet-metadata>
+        <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
+      </facet-extension>
+    </facet>
+    <facet>
+      <description><![CDATA[the equivalent of innerRight on left-to-right 
clients and innerLeft on right-to-left clients.]]>
+      </description>
+      <facet-name>innerEnd</facet-name>
+      <facet-extension>
+        <mfp:facet-metadata>
+          <mfp:preferred>false</mfp:preferred>
         </mfp:facet-metadata>
         <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
       </facet-extension>

Modified: 
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelBorderLayout.xml
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelBorderLayout.xml?rev=432429&r1=432428&r2=432429&view=diff
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelBorderLayout.xml
 (original)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelBorderLayout.xml
 Thu Aug 17 16:21:22 2006
@@ -21,7 +21,7 @@
     <renderer>
       <component-family>org.apache.myfaces.trinidad.Panel</component-family>
       <renderer-type>org.apache.myfaces.trinidad.BorderLayout</renderer-type>
-      
<renderer-class>org.apache.myfaces.trinidadinternal.uinode.UINodeRendererBase</renderer-class>
+      
<renderer-class>org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelBorderLayoutRenderer</renderer-class>
       <renderer-extension>
         
<mfp:component-type>org.apache.myfaces.trinidad.CorePanelBorderLayout</mfp:component-type>
       </renderer-extension>

Modified: 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseDesktopSkin.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseDesktopSkin.java?rev=432429&r1=432428&r2=432429&view=diff
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseDesktopSkin.java
 (original)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseDesktopSkin.java
 Thu Aug 17 16:21:22 2006
@@ -36,9 +36,16 @@
    */
   public BaseDesktopSkin()
   {
-    // Register our icons
+
     // Register our icons
     CoreSkinUtils.registerIcons(this, _CUSTOMIZABLE_ICONS);
+    _registerSkinProperties();
+  }
+
+  private void _registerSkinProperties()
+  {
+    // Not sure where this comes from!
+    setProperty(AF_PANEL_BORDER_LAYOUT_SPACER_WIDTH, "2");
   }
 
   /**

Modified: 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java?rev=432429&r1=432428&r2=432429&view=diff
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
 (original)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/OutputUtils.java
 Thu Aug 17 16:21:22 2006
@@ -60,7 +60,7 @@
 
   public static void renderLayoutTableAttributes(
     FacesContext        context,
-    RenderingContext arc,
+    RenderingContext    arc,
     Object              cellspacing,
     Object              tableWidth
     ) throws IOException

Added: 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBorderLayoutRenderer.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBorderLayoutRenderer.java?rev=432429&view=auto
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBorderLayoutRenderer.java
 (added)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelBorderLayoutRenderer.java
 Thu Aug 17 16:21:22 2006
@@ -0,0 +1,550 @@
+/*
+ * Copyright  2000-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
+import org.apache.myfaces.trinidad.component.core.layout.CorePanelBorderLayout;
+
+import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
+import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
+
+/**
+ * @version $Name:  $ $
+ * @author Adam Winer
+ */
+public class PanelBorderLayoutRenderer extends XhtmlRenderer
+{
+  public PanelBorderLayoutRenderer()
+  {
+    super(CorePanelBorderLayout.TYPE);
+  }
+
+  @Override
+  public boolean getRendersChildren()
+  {
+    return true;
+  }
+
+  @Override
+  protected void encodeAll(
+    FacesContext        context,
+    RenderingContext arc,
+    UIComponent         component,
+    FacesBean           bean) throws IOException
+  {
+    ResponseWriter rw = context.getResponseWriter();
+    boolean hasSideFacets = _hasSideFacets(arc, component);
+    if (hasSideFacets)
+    {
+      _encodeAllWithSideFacets(context, arc, component, bean);
+    } 
+    else
+    {
+      _encodeAllInDiv(context, arc, component, bean);
+    }
+  }
+
+  private boolean _hasSideFacets(RenderingContext arc, UIComponent component)
+  {
+    // For PDAs, disavow allow knowledge of side facets (there's no space
+    // to render them).  Ideally, this would be height/width driven...
+    if (arc.getAgent().getAgentType() == TrinidadAgent.TYPE_PDA)
+      return false;
+
+    return ((getFacet(component, CorePanelBorderLayout.LEFT_FACET) != null) ||
+            (getFacet(component, CorePanelBorderLayout.START_FACET) != null) ||
+            (getFacet(component, CorePanelBorderLayout.RIGHT_FACET) != null) ||
+            (getFacet(component, CorePanelBorderLayout.END_FACET) != null) ||
+            (getFacet(component, CorePanelBorderLayout.INNER_LEFT_FACET) != 
null) ||
+            (getFacet(component, CorePanelBorderLayout.INNER_START_FACET) != 
null) ||
+            (getFacet(component, CorePanelBorderLayout.INNER_RIGHT_FACET) != 
null) ||
+            (getFacet(component, CorePanelBorderLayout.INNER_END_FACET) != 
null));
+  }
+
+
+  protected void _encodeAllWithSideFacets(
+    FacesContext        context,
+    RenderingContext arc,
+    UIComponent         component,
+    FacesBean           bean) throws IOException
+  {
+    ResponseWriter rw = context.getResponseWriter();
+    rw.startElement("table", component);
+    OutputUtils.renderLayoutTableAttributes(context, arc, "0", "100%");
+    
+    renderId(context, component);
+    renderAllAttributes(context, arc, bean);
+
+
+    Integer rowSpan = _getRowSpan(component);
+    Integer colSpan = _getColSpan(component, arc, rowSpan);
+
+    //
+    // If we have a header node, render it
+    //
+    UIComponent topFacet = getFacet(component,
+                                       CorePanelBorderLayout.TOP_FACET);
+    if (topFacet != null)
+    {
+      rw.startElement("tr", null);
+      _renderMarginSpacer(context, arc, null);
+
+      rw.startElement("td", null);
+      rw.writeAttribute("colspan", colSpan, null);
+      encodeChild(context, topFacet);
+      rw.endElement("td");
+
+      _renderMarginSpacer(context, arc, null);
+      rw.endElement("tr");
+    }
+
+    //
+    // Begin rendering the content row
+    //
+    rw.startElement("tr", null);
+
+    _renderMarginSpacer(context, arc, rowSpan);
+
+
+    //
+    // Render the left hand side
+    //
+    String leftName = _getSideFacet(component, arc, true);
+    UIComponent leftFacet = getFacet(component, leftName);
+    if (leftFacet != null)
+      renderSideFacet(context, leftFacet, rowSpan, null);
+  
+    //
+    // Render the inner left side node, if any
+    //
+    String innerleftName = _getInnerSideFacet(component, arc, true);
+    UIComponent innerLeftFacet = getFacet(component, innerleftName);
+
+    if (innerLeftFacet != null)
+    {
+      renderSideFacet(context, innerLeftFacet, rowSpan, null);
+    }
+  
+    //
+    // Render the child on the inside top of the layout
+    //
+    boolean isRightSideRendered =
+      _renderMiddleFacet(context, arc, component,
+                         CorePanelBorderLayout.INNER_TOP_FACET, rowSpan,
+                         false, true);
+
+        
+    // render the content
+    if (component.getChildCount() > 0)
+    {
+      /* if the right hand side has been rendered then we need to start a new
+         row. otherwise, we can still render on to the previous row. */
+      if (isRightSideRendered)
+      {
+        rw.startElement("tr", null);
+      }
+        
+      rw.startElement("td", null);
+      rw.writeAttribute("width", "100%", null);
+      rw.writeAttribute("valign", "top", null);
+        
+      encodeAllChildren(context, component);
+
+      rw.endElement("td");
+
+      /* if the right hand side nodes have not been rendered, then render them
+         here */
+      if (!isRightSideRendered)
+      {
+        _renderRightFacets(context, arc, component, rowSpan);
+        isRightSideRendered = true;
+      }
+
+      rw.endElement("tr");
+    }
+
+    /* render the inner bottom child. start a new TR only if the 
+       right side nodes have been rendered, and render the 
+       right side nodes if they have not been rendered.  */
+    isRightSideRendered |=
+      _renderMiddleFacet(context, arc, component,
+                         CorePanelBorderLayout.INNER_BOTTOM_FACET, rowSpan,
+                         isRightSideRendered,
+                         !isRightSideRendered);
+
+    /* if a right hand side still has not been rendered then we need
+       to render it here */
+    if (!isRightSideRendered) 
+    {
+      _renderRightFacets(context, arc, component, rowSpan);
+      rw.endElement("tr");
+    }
+
+    //
+    // render the  bottom node
+    //
+    UIComponent bottomFacet = getFacet(component,
+                                       CorePanelBorderLayout.BOTTOM_FACET);
+    if (bottomFacet != null)
+    {       
+      rw.startElement("tr", null);
+      _renderMarginSpacer(context, arc, null);
+        
+      rw.startElement("td", null);
+      rw.writeAttribute("colspan", colSpan, null);
+      encodeChild(context, bottomFacet);
+      rw.endElement("td");
+        
+      _renderMarginSpacer(context, arc, null);
+      rw.endElement("tr");
+    }
+
+    rw.endElement("table");
+  }
+
+
+  protected void _encodeAllInDiv(
+    FacesContext        context,
+    RenderingContext arc,
+    UIComponent         component,
+    FacesBean           bean) throws IOException
+  {
+    ResponseWriter rw = context.getResponseWriter();
+    rw.startElement("div", component);
+    renderId(context, component);
+    renderAllAttributes(context, arc, bean);
+
+    UIComponent top = getFacet(component, CorePanelBorderLayout.TOP_FACET);
+    if (top != null)
+      encodeChild(context, top);
+
+    rw.startElement("div", null);
+    rw.endElement("div");
+    
+    UIComponent innerTop = getFacet(component, 
CorePanelBorderLayout.INNER_TOP_FACET);
+    if (innerTop != null)
+      encodeChild(context, innerTop);
+
+    rw.startElement("div", null);
+    rw.endElement("div");
+    
+    encodeAllChildren(context, component);
+
+    rw.startElement("div", null);
+    rw.endElement("div");
+
+    UIComponent innerBottom = getFacet(component, 
CorePanelBorderLayout.INNER_BOTTOM_FACET);
+    if (innerBottom != null)
+      encodeChild(context, innerBottom);
+    
+    rw.startElement("div", null);
+    rw.endElement("div");
+
+    UIComponent bottom = getFacet(component, 
CorePanelBorderLayout.BOTTOM_FACET);
+    if (bottom != null)
+      encodeChild(context, bottom);
+
+    rw.endElement("div");
+  }
+
+  /**
+   * Renders one of the side nodes.
+   */
+  protected void renderSideFacet(
+    FacesContext context,
+    UIComponent  sideFacet,
+    Integer      rowSpan,
+    String       width
+    ) throws IOException
+  {
+    ResponseWriter writer = context.getResponseWriter();
+
+    writer.startElement("td", null);
+    writer.writeAttribute("valign", "top", null);
+    writer.writeAttribute("rowspan", rowSpan, null);
+    writer.writeAttribute("width", width, null);
+    encodeChild(context, sideFacet);
+    writer.endElement("td");
+  }
+
+
+  private boolean _renderMiddleFacet(FacesContext context,
+                                     RenderingContext arc,
+                                     UIComponent component,
+                                     String middleFacetName,
+                                     Integer rowSpan,
+                                     boolean startTableRow,
+                                     boolean renderRightFacets)
+    throws IOException
+  {
+    ResponseWriter writer = context.getResponseWriter();
+    UIComponent middleFacet = getFacet(component, middleFacetName);
+    if (middleFacet != null)
+    {
+      if (startTableRow) 
+        writer.startElement("tr", null);
+    
+      _renderInnerFacet(context, middleFacet);
+
+      if (renderRightFacets)
+        _renderRightFacets(context, arc, component, rowSpan);
+
+      writer.endElement("tr");
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * Renders the right hand side facets.
+   * @return true if at least one facet was rendered.
+   */
+  private boolean _renderRightFacets(
+    FacesContext     context,
+    RenderingContext arc,
+    UIComponent      component,
+    Integer          rowSpan
+    ) throws IOException
+  {
+    boolean facetRendered = false;
+    
+    //
+    // Render the inner right node.
+    //
+    String innerSideName = _getInnerSideFacet(component, arc, false);
+    UIComponent innerSideFacet = getFacet(component, innerSideName);
+    if (innerSideFacet != null)
+    {
+      renderSideFacet(context,
+                      innerSideFacet,
+                      rowSpan,
+                      null);
+
+      facetRendered = true;
+    }
+    
+    //
+    // Render the side node
+    //
+    String sideName = _getSideFacet(component, arc, false);
+    UIComponent sideFacet = getFacet(component, sideName);
+
+    if (sideFacet != null)
+    {
+      renderSideFacet(context, sideFacet, rowSpan, null);
+      _renderMarginSpacer(context, arc, rowSpan);
+      
+      facetRendered = true;
+    }
+    
+    return facetRendered;
+  }
+  
+
+  /**
+   * Renders one of the inner nodes.
+   */
+  private void _renderInnerFacet(
+    FacesContext context,
+    UIComponent  facet
+    ) throws IOException
+  {
+    ResponseWriter writer = context.getResponseWriter();
+
+    writer.startElement("td", null);
+    writer.writeAttribute("width", "100%", null);
+    encodeChild(context, facet);
+    writer.endElement("td");
+  }
+
+
+  private void _renderMarginSpacer(
+    FacesContext     context,
+    RenderingContext arc,
+    Integer          rowSpan
+    ) throws IOException
+  {
+    ResponseWriter writer = context.getResponseWriter();
+
+    writer.startElement("td", null);
+    writer.writeAttribute("rowspan", rowSpan, null);
+    Object spacerWidth = arc.getSkin().getProperty(
+       SkinProperties.AF_PANEL_BORDER_LAYOUT_SPACER_WIDTH);
+    if (spacerWidth != null)
+      renderSpacer(context, arc, spacerWidth.toString(), "0");
+    writer.endElement("td");
+  }
+    
+
+  /**
+   * Returns the row span to use for the left and right children
+   */
+  private Integer _getRowSpan(
+    UIComponent component
+    )
+  {
+    int rowSpan = 0;
+
+    if (getFacet(component, CorePanelBorderLayout.INNER_TOP_FACET) != null)
+      rowSpan++;
+
+    // increment the rowspan if we have any content children.
+    if (component.getChildCount() > 0)
+      rowSpan++;
+
+    if (getFacet(component, CorePanelBorderLayout.INNER_BOTTOM_FACET) != null)
+      rowSpan++;
+
+    return (rowSpan > 0) ? rowSpan : null;
+  }
+
+
+  /**
+   * Returns the column span to use for the top and bottom children.
+   */
+  private Integer _getColSpan(
+    UIComponent       component,
+    RenderingContext  arc,
+    Integer           rowSpan
+    )
+  {
+    int colSpan = 0;
+    
+    // increment the colspan if we have a left side node
+    if (getFacet(component, _getSideFacet(component, arc, true)) != null)
+    {
+      colSpan++;      
+    }
+
+    // increment the colspan if we have an inner left side node
+    if (getFacet(component, _getInnerSideFacet(component, arc, true)) != null)
+    {
+      colSpan++;      
+    }
+
+    // increment the colspan if we have any center nodes.
+    if (rowSpan != null)
+    {
+      colSpan++;
+    }
+
+    // increment the colspan if we have an inner right side node
+    if (getFacet(component, _getInnerSideFacet(component, arc, false)) != null)
+    {
+      colSpan++;
+    }
+    
+    // increment the colspan if we have a right side node
+    if (getFacet(component, _getSideFacet(component, arc, false)) != null)
+    {
+      colSpan++;
+    }
+
+    // return null if the colspan is zero
+    return (colSpan > 0) ? colSpan : null;
+  }
+
+
+  /**
+   * Returns the name of the node to use for the left or right side of the
+   * layout, following bi-di rules.
+   */
+  private String _getSideFacet(
+    UIComponent         component,
+    RenderingContext    arc,
+    boolean             getLeftName
+    )
+  {
+    boolean isRTL = arc.isRightToLeft();
+
+    //
+    // A precisely specified name wins over a dynamic name
+    //
+    // Since the browser flips for us in a bidi environment,
+    // we actually flip the left and right child if the
+    // direction is exact
+    //
+
+    String exactName = (isRTL)
+                         ? (getLeftName)
+                             ? CorePanelBorderLayout.RIGHT_FACET
+                             : CorePanelBorderLayout.LEFT_FACET
+                         : (getLeftName)
+                             ? CorePanelBorderLayout.LEFT_FACET
+                             : CorePanelBorderLayout.RIGHT_FACET;
+
+    if (getFacet(component, exactName) == null)
+    {
+      //
+      // if not exact, fall back on the start or end child
+      //
+
+      exactName = (getLeftName) ?
+        CorePanelBorderLayout.START_FACET : CorePanelBorderLayout.END_FACET;
+    }
+
+    return exactName;
+  }
+
+
+  /**
+   * Returns the name of the node to use for the left or right side of the
+   * layout, following bi-di rules.
+   */
+  private String _getInnerSideFacet(
+    UIComponent         component,
+    RenderingContext    arc,
+    boolean             getLeftName
+    )
+  {
+    boolean isRTL = arc.isRightToLeft();
+
+    //
+    // A precisely specified name wins over a dynamic name
+    //
+    // Since the browser flips for us in a bidi environment,
+    // we actually flip the left and right child if the
+    // direction is exact
+    //
+
+    String exactName = (isRTL)
+                         ? (getLeftName)
+                             ? CorePanelBorderLayout.INNER_RIGHT_FACET
+                             : CorePanelBorderLayout.INNER_LEFT_FACET
+                         : (getLeftName)
+                             ? CorePanelBorderLayout.INNER_LEFT_FACET
+                             : CorePanelBorderLayout.INNER_RIGHT_FACET;
+
+    if (getFacet(component, exactName) == null)
+    {
+      //
+      // if not exact, fall back on the start or end child
+      //
+
+      exactName = (getLeftName) ?
+        CorePanelBorderLayout.INNER_START_FACET : 
CorePanelBorderLayout.INNER_END_FACET;
+    }
+
+    return exactName;
+  }
+}

Modified: 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinProperties.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinProperties.java?rev=432429&r1=432428&r2=432429&view=diff
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinProperties.java
 (original)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinProperties.java
 Thu Aug 17 16:21:22 2006
@@ -45,4 +45,6 @@
     "af|table-ora-selection-bar-in-table";
   public static final String AF_TREE_TABLE_SPACER_WIDTH =
     "af|treeTable-ora-spacer-width";
+  public static final String AF_PANEL_BORDER_LAYOUT_SPACER_WIDTH =
+    "af|panelBorderLayout-ora-spacer-width";
 }

Modified: 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/faces-bean.properties
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/faces-bean.properties?rev=432429&r1=432428&r2=432429&view=diff
==============================================================================
--- 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/faces-bean.properties
 (original)
+++ 
incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/faces-bean.properties
 Thu Aug 17 16:21:22 2006
@@ -35,6 +35,7 @@
 
org.apache.myfaces.trinidad.component.core.CoreStyleSheet=org.apache.myfaces.trinidadinternal.bean.UIXFacesBeanImpl
 
org.apache.myfaces.trinidad.component.UIXDocument=org.apache.myfaces.trinidadinternal.bean.UIXFacesBeanImpl
 
org.apache.myfaces.trinidad.component.UIXMessage|org.apache.myfaces.trinidad.Message=org.apache.myfaces.trinidadinternal.bean.UIXFacesBeanImpl
+org.apache.myfaces.trinidad.component.UIXPanel|org.apache.myfaces.trinidad.BorderLayout=org.apache.myfaces.trinidadinternal.bean.UIXFacesBeanImpl
 
org.apache.myfaces.trinidad.component.UIXPanel|org.apache.myfaces.trinidad.FormLayout=org.apache.myfaces.trinidadinternal.bean.UIXFacesBeanImpl
 
org.apache.myfaces.trinidad.component.UIXPanel|org.apache.myfaces.trinidad.GroupLayout=org.apache.myfaces.trinidadinternal.bean.UIXFacesBeanImpl
 
org.apache.myfaces.trinidad.component.UIXPanel|org.apache.myfaces.trinidad.LabelAndMessage=org.apache.myfaces.trinidadinternal.bean.UIXFacesBeanImpl


Reply via email to