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/04/15 17:02:28 UTC

svn commit: r1673809 - in /myfaces/tobago/branches/tobago-3.0.x: tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ tobago...

Author: lofwyr
Date: Wed Apr 15 15:02:27 2015
New Revision: 1673809

URL: http://svn.apache.org/r1673809
Log:
TOBAGO-1361: New Layout Manager: Flex Box

Added:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-horizontal.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-simple.xhtml
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/FlexLayoutRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-layout.js

Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-horizontal.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-horizontal.xhtml?rev=1673809&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-horizontal.xhtml (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-horizontal.xhtml Wed Apr 15 15:02:27 2015
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+-->
+
+<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 id="page">
+    <f:facet name="layout">
+      <tc:flexLayout columns="*;auto;2*;100px"/>
+    </f:facet>
+
+    <tc:textarea value="Left"/>
+    <tc:image value="pidgeon-point.jpg"/>
+    <tc:textarea value="Right"/>
+    <tc:textarea value="222"/>
+
+  </tc:page>
+</f:view>

Added: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-simple.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-simple.xhtml?rev=1673809&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-simple.xhtml (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/flexLayout/flowLayout-simple.xhtml Wed Apr 15 15:02:27 2015
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+-->
+
+<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 id="page">
+    <f:facet name="layout">
+      <tc:flexLayout columns="*;2*"/>
+    </f:facet>
+
+    <tc:textarea value="Left"/>
+    <tc:textarea value="Right"/>
+
+  </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/FlexLayoutRenderer.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/FlexLayoutRenderer.java?rev=1673809&r1=1673808&r2=1673809&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/FlexLayoutRenderer.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/FlexLayoutRenderer.java Wed Apr 15 15:02:27 2015
@@ -61,7 +61,7 @@ public class FlexLayoutRenderer extends
           .replace("7*", "7")
           .replace("8*", "8")
           .replace("9*", "9")
-          .replace("*", "1"));
+          .replace("*", "1").replaceAll("(\\d+)px", "{\"pixel\":$1}"));
       b.append("]}");
     }
     final String rows = flexLayout.getRows();
@@ -79,7 +79,7 @@ public class FlexLayoutRenderer extends
           .replace("7*", "7")
           .replace("8*", "8")
           .replace("9*", "9")
-          .replace("*", "1"));
+          .replace("*", "1").replaceAll("(\\d+)px", "{\"pixel\":$1}"));
       b.append("]}");
     }
     boolean vertically = rows.contains(";");

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-layout.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-layout.js?rev=1673809&r1=1673808&r2=1673809&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-layout.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-layout.js Wed Apr 15 15:02:27 2015
@@ -128,6 +128,10 @@ function setLength(table, banks, i, css,
    */
 }
 
+function setLength2(banks, i, css, length) {
+  banks.eq(i).css(css, length);
+}
+
 function layoutFlex(container, horizontal) {
   var cells;
   var banks;
@@ -160,7 +164,7 @@ function layoutFlex(container, horizonta
           break;
         case "object":
           if (tokens[i].pixel) {
-            setLength(table, banks, i, css, tokens[i].pixel + "px");
+            setLength2(banks, i, css, tokens[i].pixel + "px");
           } else {
             console.warn("can't find pixel in object: '" + tokens[i] + "'");  // @DEV_ONLY
           }