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/06/24 17:33:48 UTC

svn commit: r1687309 - /myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java

Author: lofwyr
Date: Wed Jun 24 15:33:47 2015
New Revision: 1687309

URL: http://svn.apache.org/r1687309
Log:
TOBAGO-1435: New Layout: ColumnLayout which uses 12 columns (like Bootstrap) 
ColumnPartition needs to be storable in the state

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java?rev=1687309&r1=1687308&r2=1687309&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java Wed Jun 24 15:33:47 2015
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.layout
 
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -28,18 +29,17 @@ import java.util.List;
 /**
  * A list of positive integers with sum 12 (separated by a semicolon ";"). Is used for the 12 columns partitioning.
  */
-public final class ColumnPartition {
+public final class ColumnPartition implements Serializable {
 
   private static final Integer[] PART_12 = new Integer[]{12};
 
-  private final Integer[] parts;
+  private Integer[] parts;
+
+  public ColumnPartition() {
+  }
 
   public ColumnPartition(Integer... parts) {
-    if (checkSum(parts)) {
-      this.parts = parts;
-    } else {
-      this.parts = createParts(parts);
-    }
+    setParts(parts);
   }
 
   public static ColumnPartition valueOf(String string) {
@@ -106,6 +106,14 @@ public final class ColumnPartition {
     return parts;
   }
 
+  private void setParts(Integer[] parts) {
+    if (checkSum(parts)) {
+      this.parts = parts;
+    } else {
+      this.parts = createParts(parts);
+    }
+  }
+
   public int getSize() {
     return parts.length;
   }