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 2015/07/01 10:07:31 UTC

svn commit: r1688581 - in /myfaces/tobago/branches/tobago-3.0.x: tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/ tobago-example/tobago-example-test/src/main/webapp/test/in/ tobago-theme/tobago-theme-standard/src/main/java/org/a...

Author: lofwyr
Date: Wed Jul  1 08:07:30 2015
New Revision: 1688581

URL: http://svn.apache.org/r1688581
Log:
TOBAGO-1435: New Layout: ColumnLayout which uses 12 columns (like Bootstrap)
- layout should be used as an own container, not only as a facet...

Added:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1-as-facet.xhtml
      - copied, changed from r1687486, myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-2-as-facet.xhtml
      - copied unchanged from r1687486, myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-2.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-3-as-facet.xhtml
      - copied unchanged from r1687486, myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-3.xhtml
Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-2.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-3.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/in.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ColumnLayoutRenderer.java

Copied: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1-as-facet.xhtml (from r1687486, myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1-as-facet.xhtml?p2=myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1-as-facet.xhtml&p1=myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml&r1=1687486&r2=1688581&rev=1688581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1-as-facet.xhtml Wed Jul  1 08:07:30 2015
@@ -21,7 +21,8 @@
     xmlns:tx="http://myfaces.apache.org/tobago/extension"
     xmlns:f="http://java.sun.com/jsf/core">
 
-  <tc:page id="page">
+  <tc:page id="page" label="Layout (old)">
+
     <f:facet name="layout">
       <tc:columnLayout medium="2;4;2;4" small="6;6"/>
     </f:facet>

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml?rev=1688581&r1=1688580&r2=1688581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-1.xhtml Wed Jul  1 08:07:30 2015
@@ -21,15 +21,12 @@
     xmlns:tx="http://myfaces.apache.org/tobago/extension"
     xmlns:f="http://java.sun.com/jsf/core">
 
-  <tc:page id="page">
-    <f:facet name="layout">
-      <tc:columnLayout medium="2;4;2;4" small="6;6"/>
-    </f:facet>
-
-    <tx:in label="1st label" value="a aa aaa aaaa aaaaa"/>
-    <tx:in label="2nd label" value="b bb bbb bbbb bbbbb b bb bbb bbbb bbbbb b bb bbb bbbb bbb bbbb bbbbb "/>
-    <tx:textarea label="3rd label" value="c cc ccc cccc ccccc"/>
-    <tx:textarea label="4th label" value="d dd ddd dddd ddddd"/>
-
+  <tc:page id="page" label="Layout">
+    <tc:columnLayout medium="2;4;2;4" small="6;6">
+      <tx:in label="1st label" value="a aa aaa aaaa aaaaa"/>
+      <tx:in label="2nd label" value="b bb bbb bbbb bbbbb b bb bbb bbbb bbbbb b bb bbb bbbb bbb bbbb bbbbb "/>
+      <tx:textarea label="3rd label" value="c cc ccc cccc ccccc"/>
+      <tx:textarea label="4th label" value="d dd ddd dddd ddddd"/>
+    </tc:columnLayout>
   </tc:page>
 </f:view>

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-2.xhtml?rev=1688581&r1=1688580&r2=1688581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-2.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-2.xhtml Wed Jul  1 08:07:30 2015
@@ -26,21 +26,13 @@
   -->
 
   <tc:page id="page">
-    <tc:panel>
-      <f:facet name="layout">
-        <tc:columnLayout medium="2;4;2;4" small="6;6"/>
-      </f:facet>
-
+    <tc:columnLayout medium="2;4;2;4" small="6;6">
       <tx:in label="1st label" value="a aa aaa aaaa aaaaa"/>
       <tx:in label="2nd label" value="b bb bbb bbbb bbbbb b bb bbb bbbb bbbbb b bb bbb bbbb bbb bbbb bbbbb "/>
-    </tc:panel>
-    <tc:panel>
-      <f:facet name="layout">
-        <tc:columnLayout medium="2;4;2;4" small="6;6"/>
-      </f:facet>
-
+    </tc:columnLayout>
+    <tc:columnLayout medium="2;4;2;4" small="6;6">
       <tx:textarea label="3rd label" value="c cc ccc cccc ccccc"/>
       <tx:textarea label="4th label" value="d dd ddd dddd ddddd"/>
-    </tc:panel>
+    </tc:columnLayout>
   </tc:page>
 </f:view>

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-3.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-3.xhtml?rev=1688581&r1=1688580&r2=1688581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-3.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/bootstrapLayout/simple-3.xhtml Wed Jul  1 08:07:30 2015
@@ -22,32 +22,22 @@
     xmlns:f="http://java.sun.com/jsf/core">
 
   <tc:page id="page">
-    <tc:panel>
-      <f:facet name="layout">
-        <tc:columnLayout medium="2;4;2;4" small="6;6"/>
-      </f:facet>
 
+    <tc:columnLayout medium="2;4;2;4" small="6;6">
       <tx:in label="1st label" value="#{bootstrap.value}"/>
       <tx:in label="2nd label" value="b bb bbb bbbb bbbbb b bb bbb bbbb bbbbb b bb bbb bbbb bbb bbbb bbbbb "/>
-    </tc:panel>
-    <tc:panel>
-      <f:facet name="layout">
-        <tc:columnLayout medium="2;4;2;4" small="6;6"/>
-      </f:facet>
+    </tc:columnLayout>
 
+    <tc:columnLayout medium="2;4;2;4" small="6;6">
       <tx:textarea label="3rd label" value="c cc ccc cccc ccccc"/>
       <tx:textarea label="4th label" value="d dd ddd dddd ddddd"/>
+    </tc:columnLayout>
 
-    </tc:panel>
-    <tc:panel>
-      <f:facet name="layout">
-        <tc:columnLayout medium="1;1;1" extraSmall="4;4;4"/>
-      </f:facet>
-
+    <tc:columnLayout medium="1;1;1" extraSmall="4;4;4">
       <tc:button id="cancel" label="Cancel" action="#{bootstrap.reset}"/>
       <tc:button id="save" label="Save" action="#{bootstrap.save}"/>
       <tc:button id="delete" label="Delete" action="#{bootstrap.delete}"/>
-    </tc:panel>
+    </tc:columnLayout>
 
   </tc:page>
 </f:view>

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/in.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/in.xhtml?rev=1688581&r1=1688580&r2=1688581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/in.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/in/in.xhtml Wed Jul  1 08:07:30 2015
@@ -19,23 +19,20 @@
 <f:view
     xmlns:tc="http://myfaces.apache.org/tobago/component"
     xmlns:tx="http://myfaces.apache.org/tobago/extension"
-    xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:f="http://java.sun.com/jsf/core">
 
   <tc:page>
-    <f:facet name="layout">
-      <tc:gridLayout rows="auto;auto;auto;auto;*"/>
-    </f:facet>
-    <tc:gridLayoutConstraint width="600px" height="300px"/>
 
-    <tc:messages/>
+    <tc:columnLayout large="8;4">
 
-    <tx:in label="First Value" labelWidth="250px" value="#{in.first}"/>
-    <tx:in label="Second Value (Required)" labelWidth="250px" value="#{in.second}" required="true"/>
 
-    <tc:button label="submit"/>
+      <tc:in label="First Value" value="#{in.first}"/>
+      <tc:in label="Second Value (Required)" value="#{in.second}" required="true"/>
+      <tc:date label="Second Value (Required)" value="#{in.second}" required="true"/>
 
-    <tc:panel/>
+      <tc:button label="submit"/>
+
+    </tc:columnLayout>
 
   </tc:page>
 </f:view>

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/ColumnLayoutRenderer.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/ColumnLayoutRenderer.java?rev=1688581&r1=1688580&r2=1688581&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/ColumnLayoutRenderer.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/ColumnLayoutRenderer.java Wed Jul  1 08:07:30 2015
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
 
+import org.apache.myfaces.tobago.component.Facets;
 import org.apache.myfaces.tobago.component.UIColumnLayout;
 import org.apache.myfaces.tobago.component.UIExtensionPanel;
 import org.apache.myfaces.tobago.component.UILabel;
@@ -48,6 +49,11 @@ public class ColumnLayoutRenderer extend
   private static final Logger LOG = LoggerFactory.getLogger(ColumnLayoutRenderer.class);
 
   @Override
+  public boolean getRendersChildren() {
+    return true;
+  }
+
+  @Override
   public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
     final AbstractUIColumnLayout columnLayout = (AbstractUIColumnLayout) component;
     final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
@@ -63,7 +69,16 @@ public class ColumnLayoutRenderer extend
   public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
     final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
     final UIColumnLayout columnLayout = (UIColumnLayout) component;
-    final UIComponent container = columnLayout.getParent();
+
+    UIComponent container = columnLayout.getParent();
+    if (container.getFacet(Facets.LAYOUT) == columnLayout) {
+      // case (old style): layout manager over facet
+      LOG.warn("Using this layout via a facet is deprecated. Please put the layout around the components.");
+    } else {
+      // case (modern style): the columnLayout contains the content to be layed out.
+      container = columnLayout;
+    }
+
     if (container instanceof LayoutContainer && !((LayoutContainer) container).isLayoutChildren()) {
       return;
     }