You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/10/08 16:08:29 UTC

svn commit: r1630112 - in /myfaces/tobago/branches/tobago-3.0.x: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/util/ tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/ tobago-theme/...

Author: lofwyr
Date: Wed Oct  8 14:08:29 2014
New Revision: 1630112

URL: http://svn.apache.org/r1630112
Log:
Merged from trunk
TOBAGO-939 - RenderedPartially support for sheet and tabGroup [from revision 1625968]
TOBAGO-939 - RenderedPartially support for sheet and tabGroup
- clean up [from revision 1625972]

Modified:
    myfaces/tobago/branches/tobago-3.0.x/   (props changed)
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java

Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
  Merged /myfaces/tobago/trunk:r1628953

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1630112&r1=1630111&r2=1630112&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Wed Oct  8 14:08:29 2014
@@ -272,6 +272,24 @@ public final class ComponentUtils {
   }
 
   /**
+   * Searches the component tree beneath the component and return the first component matching the type.
+   */
+  public static <T extends UIComponent> T findFacetDescendant(
+      final UIComponent component, final String facet, final Class<T> type) {
+
+    final UIComponent facetComponent = component.getFacet(facet);
+    if (facetComponent != null) {
+      if (type.isAssignableFrom(facetComponent.getClass())) {
+        return (T) facetComponent;
+      } else {
+        return findDescendant(facetComponent, type);
+      }
+    } else {
+      return null;
+    }
+  }
+
+  /**
    * Searches the children beneath the component and return the first component matching the type.
    */
   public static <T extends UIComponent> T findChild(final UIComponent component, final Class<T> type) {

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java?rev=1630112&r1=1630111&r2=1630112&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java Wed Oct  8 14:08:29 2014
@@ -31,6 +31,7 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
+import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
@@ -98,7 +99,7 @@ without shadow
     }
     writer.endElement(HtmlElements.DIV);
 
-    final UIMenuBar menuBar = getMenuBarFacet(box);
+    final UIMenuBar menuBar = ComponentUtils.findFacetDescendant(box, Facets.MENUBAR, UIMenuBar.class);
     if (menuBar != null) {
       RenderUtils.encode(facesContext, menuBar);
     }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java?rev=1630112&r1=1630111&r2=1630112&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java Wed Oct  8 14:08:29 2014
@@ -24,6 +24,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.UIMenuBar;
 import org.apache.myfaces.tobago.config.Configurable;
 import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,7 +44,7 @@ public abstract class BoxRendererBase ex
   public Measure getBorderTop(final FacesContext facesContext, final Configurable component) {
 
     Measure borderTop = super.getBorderTop(facesContext, component);
-    if (getMenuBarFacet((UIComponent) component) != null) {
+    if (ComponentUtils.findFacetDescendant((UIComponent) component, Facets.MENUBAR, UIMenuBar.class) != null) {
       borderTop = borderTop.add(19); // todo: get via theme config
     }
     return borderTop;
@@ -65,10 +66,6 @@ public abstract class BoxRendererBase ex
     return super.getMaximumHeight(facesContext, component);
   }
 
-  protected UIMenuBar getMenuBarFacet(final UIComponent component) {
-    return (UIMenuBar) component.getFacet(Facets.MENUBAR);
-  }
-
   @Override
   public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
     if (component instanceof UIBox && ((UIBox) component).isCollapsed()) {

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java?rev=1630112&r1=1630111&r2=1630112&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/BoxRenderer.java Wed Oct  8 14:08:29 2014
@@ -31,6 +31,7 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
+import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
@@ -90,7 +91,7 @@ public class BoxRenderer extends BoxRend
       writer.endElement(HtmlElements.LEGEND);
     }
 
-    final UIMenuBar menuBar = getMenuBarFacet(box);
+    final UIMenuBar menuBar = ComponentUtils.findFacetDescendant(box, Facets.MENUBAR, UIMenuBar.class);
     if (menuBar != null) {
       RenderUtils.encode(facesContext, menuBar);
     }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1630112&r1=1630111&r2=1630112&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Wed Oct  8 14:08:29 2014
@@ -337,7 +337,7 @@ public class PageRenderer extends PageRe
     }
 */
 
-    final UIMenuBar menuBar = (UIMenuBar) page.getFacet(Facets.MENUBAR);
+    final UIMenuBar menuBar = ComponentUtils.findFacetDescendant(page, Facets.MENUBAR, UIMenuBar.class);
     if (menuBar != null) {
       menuBar.getAttributes().put(Attributes.PAGE_MENU, Boolean.TRUE);
       RenderUtils.encode(facesContext, menuBar);
@@ -610,7 +610,7 @@ public class PageRenderer extends PageRe
     // XXX this is a hack. correct would be the top-border, but this would shift the content, because of the
     // XXX hack before the code: writer.writeStyleAttribute(style)
     final UIPage page = (UIPage) component;
-    final UIMenuBar menuBar = (UIMenuBar) page.getFacet(Facets.MENUBAR);
+    final UIMenuBar menuBar = ComponentUtils.findFacetDescendant(page, Facets.MENUBAR, UIMenuBar.class);
     if (menuBar != null) {
       return getResourceManager().getThemeMeasure(facesContext, page, "custom.menuBar-height");
     } else {