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 2016/08/03 14:35:14 UTC

svn commit: r1755089 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/ tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfa...

Author: lofwyr
Date: Wed Aug  3 14:35:14 2016
New Revision: 1755089

URL: http://svn.apache.org/viewvc?rev=1755089&view=rev
Log:
TOBAGO-1435: New Layout: SegmentLayout which uses 12 columns (like Bootstrap)
* if nothing is defined, extraSmall="12" will be used as default

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java?rev=1755089&r1=1755088&r2=1755089&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java Wed Aug  3 14:35:14 2016
@@ -30,6 +30,9 @@ import org.apache.myfaces.tobago.interna
 
 /**
  * Renders a layout using a 12 columns grid.
+ * Find more information on how the grid works in the Twitter Bootstrap documentation.
+ *
+ * If no attribute is defined, extraSmall="12" will be used as default.
  * @since 3.0.0
  */
 @Tag(name = "segmentLayout")
@@ -43,28 +46,28 @@ import org.apache.myfaces.tobago.interna
 public interface SegmentLayoutTagDeclaration extends HasIdBindingAndRendered, IsVisual {
 
   /**
-   * TODO
+   * The semicolon-separated definition of the columns for extra small devices. The sum must be 12.
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
   void setExtraSmall(String extraSmall);
 
   /**
-   * TODO
+   * The semicolon-separated definition of the columns for small devices. The sum must be 12.
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
   void setSmall(String small);
 
   /**
-   * TODO
+   * The semicolon-separated definition of the columns for medium devices. The sum must be 12.
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
   void setMedium(String medium);
 
   /**
-   * TODO
+   * The semicolon-separated definition of the columns for large devices. The sum must be 12.
    */
   @TagAttribute
   @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java?rev=1755089&r1=1755088&r2=1755089&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java Wed Aug  3 14:35:14 2016
@@ -31,7 +31,8 @@ import java.util.List;
  */
 public final class ColumnPartition implements Serializable {
 
-  private static final Integer[] PART_12 = new Integer[]{12};
+  private static final Integer[] INTEGER_12 = new Integer[]{12};
+  public static final ColumnPartition PARTITION_12 = new ColumnPartition(INTEGER_12);
 
   private Integer[] parts;
 
@@ -56,7 +57,7 @@ public final class ColumnPartition imple
     } else if (object != null) {
       return valueOf(object.toString());
     } else {
-      return new ColumnPartition(PART_12);
+      return PARTITION_12;
     }
   }
 
@@ -84,7 +85,7 @@ public final class ColumnPartition imple
   private Integer[] createParts(List<Integer> summands) {
     List<Integer> list = new ArrayList<Integer>();
     if (summands == null || summands.size() == 0) {
-      return PART_12;
+      return INTEGER_12;
     }
     int sum = 0;
     for (int summand : summands) {

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java?rev=1755089&r1=1755088&r2=1755089&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java Wed Aug  3 14:35:14 2016
@@ -233,17 +233,21 @@ public enum BootstrapClass implements Cs
         COL_LG_9, COL_LG_10, COL_LG_11, COL_LG_12,
     };
 
-    private ColumnPartition extraSmall;
-    private ColumnPartition small;
-    private ColumnPartition medium;
-    private ColumnPartition large;
+    private final ColumnPartition extraSmall;
+    private final ColumnPartition small;
+    private final ColumnPartition medium;
+    private final ColumnPartition large;
 
     private int index = 0;
 
     public Generator(
         final ColumnPartition extraSmall, final ColumnPartition small, final ColumnPartition medium,
         final ColumnPartition large) {
-      this.extraSmall = extraSmall;
+      if (extraSmall == null && small == null && medium == null && large == null) {
+        this.extraSmall = ColumnPartition.PARTITION_12;
+      } else  {
+        this.extraSmall = extraSmall;
+      }
       this.small = small;
       this.medium = medium;
       this.large = large;