You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2017/09/28 13:52:05 UTC

[myfaces-tobago] branch master updated: TOBAGO-1811 Allow '*' and 'auto' segments for segment layout * remove old offset * 12 segments per row are no longer mandatory * implement '*' and 'auto' operator

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new b94ce4b  TOBAGO-1811 Allow '*' and 'auto' segments for segment layout * remove old offset * 12 segments per row are no longer mandatory * implement '*' and 'auto' operator
b94ce4b is described below

commit b94ce4b92b736cab9459dd4e3cd79b184b505b02
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Sep 28 15:51:54 2017 +0200

    TOBAGO-1811 Allow '*' and 'auto' segments for segment layout
    * remove old offset
    * 12 segments per row are no longer mandatory
    * implement '*' and 'auto' operator
---
 .../myfaces/tobago/component/Attributes.java       |  16 -
 .../facelets/SegmentLayoutConstraintHandler.java   |  44 ---
 .../myfaces/tobago/facelets/SegmentLayoutRule.java | 130 -------
 .../tobago/facelets/TobagoComponentHandler.java    |   4 -
 .../component/AbstractUISegmentLayout.java         |  18 +-
 .../renderkit/renderer/SegmentLayoutRenderer.java  |  11 +-
 .../SegmentLayoutConstraintTagDeclaration.java     |  47 +--
 .../component/SegmentLayoutTagDeclaration.java     |  20 +-
 .../myfaces/tobago/layout/ColumnPartition.java     | 131 -------
 .../apache/myfaces/tobago/layout/LayoutTokens.java |   6 +
 .../myfaces/tobago/layout/SegmentLayoutToken.java  |  64 ++++
 .../tobago/renderkit/css/BootstrapClass.java       | 388 ++++-----------------
 .../tobago/layout/ColumnPartitionUnitTest.java     |  59 ----
 .../tobago/layout/LayoutTokensUnitTest.java        |   8 +
 .../50-migration/96-migration/migration40.xhtml    |   3 +
 .../16-layout/30-segment/segment-layout.xhtml      | 107 +++---
 .../tobago-example-demo/src/main/webapp/main.xhtml |   2 +-
 .../tobago/apt/processor/TaglibGenerator.java      |   3 -
 .../org/apache/myfaces/tobago/apt/component.stg    |   4 -
 19 files changed, 243 insertions(+), 822 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
index bc606b0..514b25d 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
@@ -175,22 +175,6 @@ public enum Attributes {
   /**
    * Used by a layout manager
    */
-  offsetExtraSmall,
-  /**
-   * Used by a layout manager
-   */
-  offsetLarge,
-  /**
-   * Used by a layout manager
-   */
-  offsetMedium,
-  /**
-   * Used by a layout manager
-   */
-  offsetSmall,
-  /**
-   * Used by a layout manager
-   */
   overwriteExtraLarge,
   /**
    * Used by a layout manager
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java
index af677e1..e50c8f7 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutConstraintHandler.java
@@ -31,10 +31,6 @@ import java.util.Map;
 
 public class SegmentLayoutConstraintHandler extends TagHandler {
 
-  private final TagAttribute offsetExtraSmall;
-  private final TagAttribute offsetSmall;
-  private final TagAttribute offsetMedium;
-  private final TagAttribute offsetLarge;
   private final TagAttribute overwriteExtraSmall;
   private final TagAttribute overwriteSmall;
   private final TagAttribute overwriteMedium;
@@ -43,10 +39,6 @@ public class SegmentLayoutConstraintHandler extends TagHandler {
 
   public SegmentLayoutConstraintHandler(TagConfig config) {
     super(config);
-    offsetExtraSmall = getAttribute(Attributes.offsetExtraSmall.getName());
-    offsetSmall = getAttribute(Attributes.offsetSmall.getName());
-    offsetMedium = getAttribute(Attributes.offsetMedium.getName());
-    offsetLarge = getAttribute(Attributes.offsetLarge.getName());
     overwriteExtraSmall = getAttribute(Attributes.extraSmall.getName());
     overwriteSmall = getAttribute(Attributes.small.getName());
     overwriteMedium = getAttribute(Attributes.medium.getName());
@@ -58,42 +50,6 @@ public class SegmentLayoutConstraintHandler extends TagHandler {
   public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException {
     final Map<String, Object> attributes = parent.getAttributes();
 
-    if (offsetExtraSmall != null) {
-      if (offsetExtraSmall.isLiteral()) {
-        attributes.put(Attributes.offsetExtraSmall.getName(), offsetExtraSmall.getValue());
-      } else {
-        parent.setValueExpression(Attributes.offsetExtraSmall.getName(),
-            offsetExtraSmall.getValueExpression(faceletContext, Integer.TYPE));
-      }
-    }
-
-    if (offsetSmall != null) {
-      if (offsetSmall.isLiteral()) {
-        attributes.put(Attributes.offsetSmall.getName(), offsetSmall.getValue());
-      } else {
-        parent.setValueExpression(Attributes.offsetSmall.getName(),
-            offsetSmall.getValueExpression(faceletContext, Integer.TYPE));
-      }
-    }
-
-    if (offsetMedium != null) {
-      if (offsetMedium.isLiteral()) {
-        attributes.put(Attributes.offsetMedium.getName(), offsetMedium.getValue());
-      } else {
-        parent.setValueExpression(Attributes.offsetMedium.getName(),
-            offsetMedium.getValueExpression(faceletContext, Integer.TYPE));
-      }
-    }
-
-    if (offsetLarge != null) {
-      if (offsetLarge.isLiteral()) {
-        attributes.put(Attributes.offsetLarge.getName(), offsetLarge.getValue());
-      } else {
-        parent.setValueExpression(Attributes.offsetLarge.getName(),
-            offsetLarge.getValueExpression(faceletContext, Integer.TYPE));
-      }
-    }
-
     if (overwriteExtraSmall != null) {
       if (overwriteExtraSmall.isLiteral()) {
         attributes.put(Attributes.overwriteExtraSmall.getName(), overwriteExtraSmall.getValue());
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutRule.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutRule.java
deleted file mode 100644
index 9c039de..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SegmentLayoutRule.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.myfaces.tobago.facelets;
-
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.UISegmentLayout;
-import org.apache.myfaces.tobago.layout.ColumnPartition;
-
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-
-public class SegmentLayoutRule extends MetaRule {
-
-  public static final SegmentLayoutRule INSTANCE = new SegmentLayoutRule();
-
-  @Override
-  public Metadata applyRule(final String name, final TagAttribute attribute, final MetadataTarget metadataTarget) {
-    if (metadataTarget.isTargetInstanceOf(UISegmentLayout.class)) {
-      if (attribute.isLiteral()) {
-        Attributes a = Attributes.valueOfFailsafe(name);
-        if (Attributes.extraSmall == a) {
-          return new ExtraSmallMapper(attribute);
-        }
-        if (Attributes.small == a) {
-          return new SmallMapper(attribute);
-        }
-        if (Attributes.medium == a) {
-          return new MediumMapper(attribute);
-        }
-        if (Attributes.large == a) {
-          return new LargeMapper(attribute);
-        }
-        if (Attributes.extraLarge == a) {
-          return new ExtraLargeMapper(attribute);
-        }
-      }
-    }
-    return null;
-  }
-
-  static final class ExtraSmallMapper extends Metadata {
-    private final TagAttribute attribute;
-
-    ExtraSmallMapper(final TagAttribute attribute) {
-      this.attribute = attribute;
-    }
-
-    @Override
-    public void applyMetadata(final FaceletContext ctx, final Object instance) {
-      final UISegmentLayout gridLayout = (UISegmentLayout) instance;
-      gridLayout.setExtraSmall(ColumnPartition.valueOf(attribute.getValue()));
-    }
-  }
-
-  static final class SmallMapper extends Metadata {
-    private final TagAttribute attribute;
-
-    SmallMapper(final TagAttribute attribute) {
-      this.attribute = attribute;
-    }
-
-    @Override
-    public void applyMetadata(final FaceletContext ctx, final Object instance) {
-      final UISegmentLayout gridLayout = (UISegmentLayout) instance;
-      gridLayout.setSmall(ColumnPartition.valueOf(attribute.getValue()));
-    }
-  }
-
-  static final class MediumMapper extends Metadata {
-    private final TagAttribute attribute;
-
-    MediumMapper(final TagAttribute attribute) {
-      this.attribute = attribute;
-    }
-
-    @Override
-    public void applyMetadata(final FaceletContext ctx, final Object instance) {
-      final UISegmentLayout gridLayout = (UISegmentLayout) instance;
-      gridLayout.setMedium(ColumnPartition.valueOf(attribute.getValue()));
-    }
-  }
-
-  static final class LargeMapper extends Metadata {
-    private final TagAttribute attribute;
-
-    LargeMapper(final TagAttribute attribute) {
-      this.attribute = attribute;
-    }
-
-    @Override
-    public void applyMetadata(final FaceletContext ctx, final Object instance) {
-      final UISegmentLayout gridLayout = (UISegmentLayout) instance;
-      gridLayout.setLarge(ColumnPartition.valueOf(attribute.getValue()));
-    }
-  }
-
-  static final class ExtraLargeMapper extends Metadata {
-    private final TagAttribute attribute;
-
-    ExtraLargeMapper(final TagAttribute attribute) {
-      this.attribute = attribute;
-    }
-
-    @Override
-    public void applyMetadata(final FaceletContext ctx, final Object instance) {
-      final UISegmentLayout gridLayout = (UISegmentLayout) instance;
-      gridLayout.setExtraLarge(ColumnPartition.valueOf(attribute.getValue()));
-    }
-  }
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
index 937c00f..006b6a4 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
@@ -25,7 +25,6 @@ import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.event.SheetStateChangeSource;
 import org.apache.myfaces.tobago.event.SortActionSource;
 import org.apache.myfaces.tobago.event.TabChangeSource;
-import org.apache.myfaces.tobago.internal.component.AbstractUISegmentLayout;
 import org.apache.myfaces.tobago.internal.config.TobagoConfigImpl;
 
 import javax.faces.component.EditableValueHolder;
@@ -52,9 +51,6 @@ public class TobagoComponentHandler extends ComponentHandler {
     if (SortActionSource.class.isAssignableFrom(aClass)) {
       metaRuleset.addRule(SortActionSourceRule.INSTANCE);
     }
-    if (AbstractUISegmentLayout.class.isAssignableFrom(aClass)) {
-      metaRuleset.addRule(SegmentLayoutRule.INSTANCE);
-    }
     if (TabChangeSource.class.isAssignableFrom(aClass)) {
       metaRuleset.addRule(TabChangeSourceRule.INSTANCE);
     }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISegmentLayout.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISegmentLayout.java
index 492d8b0..e2daf32 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISegmentLayout.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISegmentLayout.java
@@ -20,7 +20,6 @@
 package org.apache.myfaces.tobago.internal.component;
 
 import org.apache.myfaces.tobago.component.Visual;
-import org.apache.myfaces.tobago.layout.ColumnPartition;
 
 /**
  * {@link org.apache.myfaces.tobago.internal.taglib.component.SegmentLayoutTagDeclaration}
@@ -33,7 +32,7 @@ public abstract class AbstractUISegmentLayout extends AbstractUILayoutBase imple
 
   @Override
   public String toString() {
-    StringBuilder builder  =new StringBuilder(getClass().getSimpleName());
+    StringBuilder builder = new StringBuilder(getClass().getSimpleName());
     if (getExtraSmall() != null) {
       builder.append("\n        extraSmall=");
       builder.append(getExtraSmall());
@@ -50,15 +49,20 @@ public abstract class AbstractUISegmentLayout extends AbstractUILayoutBase imple
       builder.append("\n        large=");
       builder.append(getLarge());
     }
+    if (getLarge() != null) {
+      builder.append("\n        extraLarge=");
+      builder.append(getExtraLarge());
+    }
     return builder.toString();
   }
 
-  public abstract ColumnPartition getExtraSmall();
+  public abstract String getExtraSmall();
 
-  public abstract ColumnPartition getSmall();
+  public abstract String getSmall();
 
-  public abstract ColumnPartition getMedium();
+  public abstract String getMedium();
 
-  public abstract ColumnPartition getLarge();
+  public abstract String getLarge();
 
-  }
+  public abstract String getExtraLarge();
+}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SegmentLayoutRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SegmentLayoutRenderer.java
index 0e61de8..ad60cab 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SegmentLayoutRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SegmentLayoutRenderer.java
@@ -23,6 +23,7 @@ import org.apache.myfaces.tobago.component.LabelLayout;
 import org.apache.myfaces.tobago.component.SupportsLabelLayout;
 import org.apache.myfaces.tobago.component.UISegmentLayout;
 import org.apache.myfaces.tobago.internal.component.AbstractUISegmentLayout;
+import org.apache.myfaces.tobago.layout.LayoutTokens;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
 import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
@@ -75,11 +76,11 @@ public class SegmentLayoutRenderer extends RendererBase {
 
     final List<UIComponent> children = segmentLayout.getChildren();
     final BootstrapClass.Generator generator = new BootstrapClass.Generator(
-        segmentLayout.getExtraSmall(),
-        segmentLayout.getSmall(),
-        segmentLayout.getMedium(),
-        segmentLayout.getLarge(),
-        segmentLayout.getExtraLarge());
+        LayoutTokens.parse(segmentLayout.getExtraSmall()),
+        LayoutTokens.parse(segmentLayout.getSmall()),
+        LayoutTokens.parse(segmentLayout.getMedium()),
+        LayoutTokens.parse(segmentLayout.getLarge()),
+        LayoutTokens.parse(segmentLayout.getExtraLarge()));
     for (UIComponent child : children) {
       if (child.isRendered()) {
         encodeChild(facesContext, writer, generator, child);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java
index 89365de..3cf0bad 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutConstraintTagDeclaration.java
@@ -33,64 +33,37 @@ import javax.el.ValueExpression;
 public interface SegmentLayoutConstraintTagDeclaration {
 
   /**
-   * The number of columns this component moves to the right for extra small devices.
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  @TagAttribute(type = "java.lang.Integer")
-  void setOffsetExtraSmall(final ValueExpression offsetExtraSmall);
-
-  /**
-   * The number of columns this component moves to the right for small devices.
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  @TagAttribute(type = "java.lang.Integer")
-  void setOffsetSmall(final ValueExpression offsetSmall);
-
-  /**
-   * The number of columns this component moves to the right for medium devices.
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  @TagAttribute(type = "java.lang.Integer")
-  void setOffsetMedium(final ValueExpression offsetMedium);
-
-  /**
-   * The number of columns this component moves to the right for large devices.
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  @TagAttribute(type = "java.lang.Integer")
-  void setOffsetLarge(final ValueExpression offsetLarge);
-
-  /**
    * Overwrite the default layout for extra small devices.
+   * Possible values are: integer value > 0, 'auto' or '*'.
    */
-  @TagAttribute(type = "java.lang.Integer")
+  @TagAttribute
   void setExtraSmall(final ValueExpression extraSmall);
 
   /**
    * Overwrite the default layout for small devices.
+   * Possible values are: integer value > 0, 'auto' or '*'.
    */
-  @TagAttribute(type = "java.lang.Integer")
+  @TagAttribute
   void setSmall(final ValueExpression small);
 
   /**
    * Overwrite the default layout for medium devices.
+   * Possible values are: integer value > 0, 'auto' or '*'.
    */
-  @TagAttribute(type = "java.lang.Integer")
+  @TagAttribute
   void setMedium(final ValueExpression medium);
 
   /**
    * Overwrite the default layout for large devices.
+   * Possible values are: integer value > 0, 'auto' or '*'.
    */
-  @TagAttribute(type = "java.lang.Integer")
+  @TagAttribute
   void setLarge(final ValueExpression large);
 
   /**
    * Overwrite the default layout for extra large devices.
+   * Possible values are: integer value > 0, 'auto' or '*'.
    */
-  @TagAttribute(type = "java.lang.Integer")
+  @TagAttribute
   void setExtraLarge(final ValueExpression extraLarge);
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java
index eb94abd..1243d1b 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SegmentLayoutTagDeclaration.java
@@ -50,36 +50,46 @@ public interface SegmentLayoutTagDeclaration extends HasIdBindingAndRendered, Is
 
   /**
    * The semicolon-separated definition of the columns for extra small devices.
+   * Possible values are: integer values > 0, 'auto' and '*'.
+   * Example: '1;5;*;auto'
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
+  @UIComponentTagAttribute
   void setExtraSmall(String extraSmall);
 
   /**
    * The semicolon-separated definition of the columns for small devices.
+   * Possible values are: integer values > 0, 'auto' and '*'.
+   * Example: '1;5;*;auto'
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
+  @UIComponentTagAttribute
   void setSmall(String small);
 
   /**
    * The semicolon-separated definition of the columns for medium devices.
+   * Possible values are: integer values > 0, 'auto' and '*'.
+   * Example: '1;5;*;auto'
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
+  @UIComponentTagAttribute
   void setMedium(String medium);
 
   /**
    * The semicolon-separated definition of the columns for large devices.
+   * Possible values are: integer values > 0, 'auto' and '*'.
+   * Example: '1;5;*;auto'
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
+  @UIComponentTagAttribute
   void setLarge(String large);
 
   /**
    * The semicolon-separated definition of the columns for extra large devices.
+   * Possible values are: integer values > 0, 'auto' and '*'.
+   * Example: '1;5;*;auto'
    */
   @TagAttribute
-  @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.ColumnPartition")
+  @UIComponentTagAttribute
   void setExtraLarge(String extraLarge);
 }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java
deleted file mode 100644
index b3b1c22..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/ColumnPartition.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.
- */
-
-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;
-
-/**
- * A list of positive integers with sum 12 (separated by a semicolon ";"). Is used for the 12 columns partitioning.
- */
-public final class ColumnPartition implements Serializable {
-
-  private static final Integer[] INTEGER_12 = new Integer[]{12};
-  public static final ColumnPartition PARTITION_12 = new ColumnPartition(INTEGER_12);
-
-  private Integer[] parts;
-
-  public ColumnPartition() {
-    this(new Integer[0]);
-  }
-
-  public ColumnPartition(Integer... parts) {
-    setParts(parts);
-  }
-
-  public static ColumnPartition valueOf(String string) {
-    final List<Integer> integers = StringUtils.parseIntegerList(string, ";");
-    return new ColumnPartition(integers.toArray(new Integer[integers.size()]));
-  }
-
-  public static ColumnPartition valueOf(Object object) {
-    if (object instanceof String) {
-      return valueOf((String) object);
-    } else if (object instanceof Integer[]) {
-      return new ColumnPartition((Integer[]) object);
-    } else if (object != null) {
-      return valueOf(object.toString());
-    } else {
-      return PARTITION_12;
-    }
-  }
-
-  private boolean checkSum(final Integer[] summands) {
-    if (summands == null || summands.length == 0) {
-      return false;
-    }
-    int sum = 0;
-    for (int summand : summands) {
-      if (summand < 1) {
-        return false;
-      }
-      sum += summand;
-      if (sum > 12) {
-        return false;
-      }
-    }
-    return sum == 12;
-  }
-
-  private Integer[] createParts(Integer[] summands) {
-    return createParts(Arrays.asList(summands));
-  }
-
-  private Integer[] createParts(List<Integer> summands) {
-    List<Integer> list = new ArrayList<>();
-    if (summands == null || summands.size() == 0) {
-      return INTEGER_12;
-    }
-    int sum = 0;
-    for (int summand : summands) {
-      if (summand < 1) {
-        summand = 1;
-      }
-      if (sum + summand > 12) {
-        break;
-      }
-      sum += summand;
-      list.add(summand);
-    }
-    if (sum < 12) {
-      list.add(12 - sum);
-    }
-    return list.toArray(new Integer[list.size()]);
-  }
-
-  public Integer[] getParts() {
-    return parts;
-  }
-
-  private void setParts(Integer[] parts) {
-    if (checkSum(parts)) {
-      this.parts = parts;
-    } else {
-      this.parts = createParts(parts);
-    }
-  }
-
-  public int getSize() {
-    return parts.length;
-  }
-
-  public int getPart(final int column) {
-    return parts[column];
-  }
-
-  @Override
-  public String toString() {
-    return Arrays.toString(parts);
-  }
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/LayoutTokens.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/LayoutTokens.java
index f4eb238..7baf60d 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/LayoutTokens.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/LayoutTokens.java
@@ -113,6 +113,8 @@ public final class LayoutTokens implements Iterable<LayoutToken> {
         return new MinimumLayoutToken();
       } else if (isRelativeToken(token)) {
         return new RelativeLayoutToken(Integer.parseInt(removeSuffix(token, RelativeLayoutToken.SUFFIX)));
+      } else if(isSegmentLayoutToken(token)) {
+        return new SegmentLayoutToken(Integer.parseInt(token));
       } else {
         return new MeasureLayoutToken(token);
       }
@@ -130,6 +132,10 @@ public final class LayoutTokens implements Iterable<LayoutToken> {
     return token.endsWith(suffix) && NumberUtils.isDigits(removeSuffix(token, suffix));
   }
 
+  static boolean isSegmentLayoutToken(final String token) {
+    return NumberUtils.isDigits(token);
+  }
+
   private static String removeSuffix(final String token, final String suffix) {
     return token.substring(0, token.length() - suffix.length());
   }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/SegmentLayoutToken.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/SegmentLayoutToken.java
new file mode 100644
index 0000000..a48eab3
--- /dev/null
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/SegmentLayoutToken.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.tobago.layout;
+
+public class SegmentLayoutToken extends LayoutToken {
+
+  private int columnSize = 1;
+
+  public SegmentLayoutToken(final int columnSize) {
+    if (columnSize < 1) {
+      this.columnSize = 1;
+    } else if (columnSize > 12) {
+      this.columnSize = 12;
+    } else {
+      this.columnSize = columnSize;
+    }
+  }
+
+  public int getColumnSize() {
+    return columnSize;
+  }
+
+  public String toString() {
+    return String.valueOf(columnSize);
+  }
+
+  public boolean equals(final Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+
+    final SegmentLayoutToken that = (SegmentLayoutToken) o;
+
+    if (columnSize != that.columnSize) {
+      return false;
+    }
+
+    return true;
+  }
+
+  public int hashCode() {
+    return columnSize;
+  }
+}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
index fdabcc0..9b7bd96 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/BootstrapClass.java
@@ -21,8 +21,12 @@ package org.apache.myfaces.tobago.renderkit.css;
 
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.layout.AlignItems;
-import org.apache.myfaces.tobago.layout.ColumnPartition;
+import org.apache.myfaces.tobago.layout.AutoLayoutToken;
 import org.apache.myfaces.tobago.layout.JustifyContent;
+import org.apache.myfaces.tobago.layout.LayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutTokens;
+import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
+import org.apache.myfaces.tobago.layout.SegmentLayoutToken;
 import org.apache.myfaces.tobago.layout.TextAlign;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.slf4j.Logger;
@@ -90,6 +94,7 @@ public enum BootstrapClass implements CssItem {
   CLOSE("close"),
   COLLAPSE("collapse"),
   COL_FORM_LABEL("col-form-label"),
+  COL_LG("col-lg"),
   COL_LG_1("col-lg-1"),
   COL_LG_2("col-lg-2"),
   COL_LG_3("col-lg-3"),
@@ -102,6 +107,8 @@ public enum BootstrapClass implements CssItem {
   COL_LG_10("col-lg-10"),
   COL_LG_11("col-lg-11"),
   COL_LG_12("col-lg-12"),
+  COL_LG_AUTO("col-lg-auto"),
+  COL_MD("col-md"),
   COL_MD_1("col-md-1"),
   COL_MD_2("col-md-2"),
   COL_MD_3("col-md-3"),
@@ -114,6 +121,8 @@ public enum BootstrapClass implements CssItem {
   COL_MD_10("col-md-10"),
   COL_MD_11("col-md-11"),
   COL_MD_12("col-md-12"),
+  COL_MD_AUTO("col-md-auto"),
+  COL_SM("col-sm"),
   COL_SM_1("col-sm-1"),
   COL_SM_2("col-sm-2"),
   COL_SM_3("col-sm-3"),
@@ -126,6 +135,8 @@ public enum BootstrapClass implements CssItem {
   COL_SM_10("col-sm-10"),
   COL_SM_11("col-sm-11"),
   COL_SM_12("col-sm-12"),
+  COL_SM_AUTO("col-sm-auto"),
+  COL_XL("col-xl"),
   COL_XL_1("col-xl-1"),
   COL_XL_2("col-xl-2"),
   COL_XL_3("col-xl-3"),
@@ -138,6 +149,8 @@ public enum BootstrapClass implements CssItem {
   COL_XL_10("col-xl-10"),
   COL_XL_11("col-xl-11"),
   COL_XL_12("col-xl-12"),
+  COL_XL_AUTO("col-xl-auto"),
+  COL("col"),
   COL_1("col-1"),
   COL_2("col-2"),
   COL_3("col-3"),
@@ -150,6 +163,7 @@ public enum BootstrapClass implements CssItem {
   COL_10("col-10"),
   COL_11("col-11"),
   COL_12("col-12"),
+  COL_AUTO("col-auto"),
   /**
    * @deprecated since 4.0.0, please use {@link #COL_1}
    */
@@ -337,241 +351,6 @@ public enum BootstrapClass implements CssItem {
   @Deprecated
   NAVBAR_TOGGLER_RIGHT("navbar-toggler-right"),
   /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_0("offset-lg-0"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_1("offset-lg-1"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_2("offset-lg-2"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_3("offset-lg-3"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_4("offset-lg-4"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_5("offset-lg-5"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_6("offset-lg-6"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_7("offset-lg-7"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_8("offset-lg-8"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_9("offset-lg-9"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_10("offset-lg-10"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_LG_11("offset-lg-11"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_0("offset-md-0"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_1("offset-md-1"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_2("offset-md-2"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_3("offset-md-3"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_4("offset-md-4"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_5("offset-md-5"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_6("offset-md-6"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_7("offset-md-7"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_8("offset-md-8"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_9("offset-md-9"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_10("offset-md-10"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_MD_11("offset-md-11"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_0("offset-sm-0"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_1("offset-sm-1"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_2("offset-sm-2"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_3("offset-sm-3"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_4("offset-sm-4"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_5("offset-sm-5"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_6("offset-sm-6"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_7("offset-sm-7"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_8("offset-sm-8"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_9("offset-sm-9"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_10("offset-sm-10"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_SM_11("offset-sm-11"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_1("offset-1"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_2("offset-2"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_3("offset-3"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_4("offset-4"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_5("offset-5"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_6("offset-6"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_7("offset-7"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_8("offset-8"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_9("offset-9"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_10("offset-10"),
-  /**
-   * @deprecated since 4.0.0
-   */
-  @Deprecated
-  OFFSET_11("offset-11"),
-  /**
    * @deprecated since 4.0.0, please use {@link #SHOW}
    */
   @Deprecated
@@ -670,61 +449,18 @@ public enum BootstrapClass implements CssItem {
 
   public static class Generator {
 
-    private static final BootstrapClass[] EXTRA_SMALL = new BootstrapClass[]{
-        COL_1, COL_2, COL_3, COL_4,
-        COL_5, COL_6, COL_7, COL_8,
-        COL_9, COL_10, COL_11, COL_12,
-    };
-    private static final BootstrapClass[] SMALL = new BootstrapClass[]{
-        COL_SM_1, COL_SM_2, COL_SM_3, COL_SM_4,
-        COL_SM_5, COL_SM_6, COL_SM_7, COL_SM_8,
-        COL_SM_9, COL_SM_10, COL_SM_11, COL_SM_12,
-    };
-    private static final BootstrapClass[] MEDIUM = new BootstrapClass[]{
-        COL_MD_1, COL_MD_2, COL_MD_3, COL_MD_4,
-        COL_MD_5, COL_MD_6, COL_MD_7, COL_MD_8,
-        COL_MD_9, COL_MD_10, COL_MD_11, COL_MD_12,
-    };
-    private static final BootstrapClass[] LARGE = new BootstrapClass[]{
-        COL_LG_1, COL_LG_2, COL_LG_3, COL_LG_4,
-        COL_LG_5, COL_LG_6, COL_LG_7, COL_LG_8,
-        COL_LG_9, COL_LG_10, COL_LG_11, COL_LG_12,
-    };
-    private static final BootstrapClass[] EXTRA_LARGE = new BootstrapClass[]{
-        COL_XL_1, COL_XL_2, COL_XL_3, COL_XL_4,
-        COL_XL_5, COL_XL_6, COL_XL_7, COL_XL_8,
-        COL_XL_9, COL_XL_10, COL_XL_11, COL_XL_12,
-    };
-    private static final BootstrapClass[] OFFSET_EXTRA_SMALL = new BootstrapClass[]{
-        null, OFFSET_1, OFFSET_2, OFFSET_3, OFFSET_4, OFFSET_5,
-        OFFSET_6, OFFSET_7, OFFSET_8, OFFSET_9, OFFSET_10, OFFSET_11
-    };
-    private static final BootstrapClass[] OFFSET_SMALL = new BootstrapClass[]{
-        OFFSET_SM_0, OFFSET_SM_1, OFFSET_SM_2, OFFSET_SM_3, OFFSET_SM_4, OFFSET_SM_5,
-        OFFSET_SM_6, OFFSET_SM_7, OFFSET_SM_8, OFFSET_SM_9, OFFSET_SM_10, OFFSET_SM_11
-    };
-    private static final BootstrapClass[] OFFSET_MEDIUM = new BootstrapClass[]{
-        OFFSET_MD_0, OFFSET_MD_1, OFFSET_MD_2, OFFSET_MD_3, OFFSET_MD_4, OFFSET_MD_5,
-        OFFSET_MD_6, OFFSET_MD_7, OFFSET_MD_8, OFFSET_MD_9, OFFSET_MD_10, OFFSET_MD_11
-    };
-    private static final BootstrapClass[] OFFSET_LARGE = new BootstrapClass[]{
-        OFFSET_LG_0, OFFSET_LG_1, OFFSET_LG_2, OFFSET_LG_3, OFFSET_LG_4, OFFSET_LG_5,
-        OFFSET_LG_6, OFFSET_LG_7, OFFSET_LG_8, OFFSET_LG_9, OFFSET_LG_10, OFFSET_LG_11
-    };
-
-    private final ColumnPartition extraSmall;
-    private final ColumnPartition small;
-    private final ColumnPartition medium;
-    private final ColumnPartition large;
-    private final ColumnPartition extraLarge;
+    private final LayoutTokens extraSmall;
+    private final LayoutTokens small;
+    private final LayoutTokens medium;
+    private final LayoutTokens large;
+    private final LayoutTokens extraLarge;
 
     private int index = 0;
 
-    public Generator(
-        final ColumnPartition extraSmall, final ColumnPartition small, final ColumnPartition medium,
-        final ColumnPartition large, final ColumnPartition extraLarge) {
-      if (extraSmall == null && small == null && medium == null && large == null) {
-        this.extraSmall = ColumnPartition.PARTITION_12;
+    public Generator(final LayoutTokens extraSmall, final LayoutTokens small, final LayoutTokens medium,
+        final LayoutTokens large, final LayoutTokens extraLarge) {
+      if (extraSmall == null && small == null && medium == null && large == null && extraLarge == null) {
+        this.extraSmall = LayoutTokens.parse("*");
       } else {
         this.extraSmall = extraSmall;
       }
@@ -743,41 +479,65 @@ public enum BootstrapClass implements CssItem {
     }
 
     public BootstrapClass[] generate(final UIComponent child) {
-      ArrayList<BootstrapClass> result = new ArrayList<>(4);
+      ArrayList<BootstrapClass> result = new ArrayList<>(5);
       final Map<String, Object> attributes = child.getAttributes();
-      generate(result, extraSmall, EXTRA_SMALL, attributes.get(Attributes.overwriteExtraSmall.name()));
-      generate(result, small, SMALL, attributes.get(Attributes.overwriteSmall.name()));
-      generate(result, medium, MEDIUM, attributes.get(Attributes.overwriteMedium.name()));
-      generate(result, large, LARGE, attributes.get(Attributes.overwriteLarge.name()));
-      generate(result, extraLarge, EXTRA_LARGE, attributes.get(Attributes.overwriteExtraLarge.name()));
-      generateOffset(result, attributes.get(Attributes.offsetExtraSmall.name()), OFFSET_EXTRA_SMALL);
-      generateOffset(result, attributes.get(Attributes.offsetSmall.name()), OFFSET_SMALL);
-      generateOffset(result, attributes.get(Attributes.offsetMedium.name()), OFFSET_MEDIUM);
-      generateOffset(result, attributes.get(Attributes.offsetLarge.name()), OFFSET_LARGE);
+      generate(result, extraSmall, Attributes.extraSmall, attributes.get(Attributes.overwriteExtraSmall.name()));
+      generate(result, small, Attributes.small, attributes.get(Attributes.overwriteSmall.name()));
+      generate(result, medium, Attributes.medium, attributes.get(Attributes.overwriteMedium.name()));
+      generate(result, large, Attributes.large, attributes.get(Attributes.overwriteLarge.name()));
+      generate(result, extraLarge, Attributes.extraLarge, attributes.get(Attributes.overwriteExtraLarge.name()));
       return result.toArray(new BootstrapClass[result.size()]);
     }
 
-    private void generate(
-        final List<BootstrapClass> result, final ColumnPartition partition, final BootstrapClass[] values,
+    private void generate(final List<BootstrapClass> result, final LayoutTokens tokens, Attributes attributes,
         final Object overwrite) {
+      final BootstrapClass bootstrapClass;
+
       if (overwrite != null) {
-        int overwriteIndex = Integer.valueOf((String) overwrite);
-        overwriteIndex = overwriteIndex < 1 ? 1 : overwriteIndex;
-        overwriteIndex = overwriteIndex > 12 ? 12 : overwriteIndex;
-        result.add(values[overwriteIndex - 1]);
-      } else if (partition != null) {
-        result.add(values[partition.getPart(index % partition.getSize()) - 1]);
+        final LayoutTokens layoutTokens = LayoutTokens.parse((String) overwrite);
+        bootstrapClass = valueOf(layoutTokens.get(0), attributes);
+      } else if (tokens != null) {
+        final LayoutToken layoutToken = tokens.get(index % tokens.getSize());
+        bootstrapClass = valueOf(layoutToken, attributes);
+      } else {
+        bootstrapClass = null;
+      }
+      if (bootstrapClass != null) {
+        result.add(bootstrapClass);
       }
     }
+  }
 
-    private void generateOffset(final List<BootstrapClass> result, final Object offset, final BootstrapClass[] values) {
-      if (offset != null) {
-        int offsetIndex = Integer.valueOf((String) offset);
-        if (offsetIndex >= 0) {
-          offsetIndex = offsetIndex > 11 ? 11 : offsetIndex;
-          result.add(values[offsetIndex]);
-        }
-      }
+  public static BootstrapClass valueOf(LayoutToken layoutToken, Attributes attributes) {
+    final String size;
+
+    switch (attributes) {
+      case extraLarge:
+        size = "_XL";
+        break;
+      case large:
+        size = "_LG";
+        break;
+      case medium:
+        size = "_MD";
+        break;
+      case small:
+        size = "_SM";
+        break;
+      case extraSmall:
+      default:
+        size = "";
+    }
+
+    if (layoutToken instanceof RelativeLayoutToken) {
+      return valueOf("COL" + size);
+    } else if (layoutToken instanceof AutoLayoutToken) {
+      return valueOf("COL" + size + "_AUTO");
+    } else if (layoutToken instanceof SegmentLayoutToken) {
+      SegmentLayoutToken segmentLayoutToken = (SegmentLayoutToken) layoutToken;
+      return valueOf("COL" + size + "_" + segmentLayoutToken.getColumnSize());
+    } else {
+      return null;
     }
   }
 
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/ColumnPartitionUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/ColumnPartitionUnitTest.java
deleted file mode 100644
index 1a633d6..0000000
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/ColumnPartitionUnitTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.myfaces.tobago.layout;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class ColumnPartitionUnitTest {
-
-  @Test
-  public void testArray() {
-    Assert.assertArrayEquals(
-        new Integer[]{12}, new ColumnPartition().getParts()); // will be fixed
-    Assert.assertArrayEquals(
-        new Integer[]{12}, new ColumnPartition(12).getParts());
-    Assert.assertArrayEquals(
-        new Integer[]{1, 11}, new ColumnPartition(1, 11).getParts());
-    Assert.assertArrayEquals(
-        new Integer[]{1, 11}, new ColumnPartition(1, 12).getParts()); // will be fixed
-    Assert.assertArrayEquals(
-        new Integer[]{1, 2, 3, 4, 2}, new ColumnPartition(1, 2, 3, 4, 5).getParts()); // will be fixed
-    Assert.assertArrayEquals(
-        new Integer[]{1, 1, 1, 1, 1, 7}, new ColumnPartition(-1, -2, -3, -4, -5).getParts()); // will be fixed
-  }
-
-  @Test
-  public void testString() {
-    Assert.assertArrayEquals(
-        new Integer[]{12}, ColumnPartition.valueOf("").getParts()); // will be fixed
-    Assert.assertArrayEquals(
-        new Integer[]{12}, ColumnPartition.valueOf("12").getParts());
-    Assert.assertArrayEquals(
-        new Integer[]{1, 11}, ColumnPartition.valueOf("1;11").getParts());
-    Assert.assertArrayEquals(
-        new Integer[]{1, 11}, ColumnPartition.valueOf("1;12").getParts()); // will be fixed
-    Assert.assertArrayEquals(
-        new Integer[]{1, 2, 3, 4, 2}, ColumnPartition.valueOf("1;2;3;4;5").getParts()); // will be fixed
-    Assert.assertArrayEquals(
-        new Integer[]{1, 1, 1, 1, 1, 7}, ColumnPartition.valueOf("-1;-2;-3;-4;-5").getParts()); // will be fixed
-  }
-
-}
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/LayoutTokensUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/LayoutTokensUnitTest.java
index 96d8a7b..30c9ebb 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/LayoutTokensUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/LayoutTokensUnitTest.java
@@ -37,6 +37,13 @@ public class LayoutTokensUnitTest {
   }
 
   @Test
+  public void testIsSegmentLayoutToken() {
+    Assert.assertTrue(LayoutTokens.isSegmentLayoutToken("3"));
+    Assert.assertFalse(LayoutTokens.isSegmentLayoutToken("3*"));
+    Assert.assertFalse(LayoutTokens.isSegmentLayoutToken("3cm"));
+  }
+
+  @Test
   public void testParseToken() {
     Assert.assertEquals(AutoLayoutToken.INSTANCE, LayoutTokens.parseToken(null));
     Assert.assertEquals(RelativeLayoutToken.DEFAULT_INSTANCE, LayoutTokens.parseToken("*"));
@@ -44,5 +51,6 @@ public class LayoutTokensUnitTest {
     Assert.assertEquals(new MeasureLayoutToken("33%"), LayoutTokens.parseToken("33%"));
     Assert.assertEquals(new MeasureLayoutToken("120px"), LayoutTokens.parseToken("120px"));
     Assert.assertEquals(new MeasureLayoutToken("0px"), LayoutTokens.parseToken("0px"));
+    Assert.assertEquals(new SegmentLayoutToken(8), LayoutTokens.parseToken("8"));
   }
 }
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
index 011caef..53555f2 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
@@ -122,6 +122,9 @@
         <li>
           <code>&lt;tc:bar&gt;</code>
         </li>
+        <li>
+          <code>&lt;tc:segmentLayout&gt;</code>
+        </li>
       </ul>
       <p>
         Here you may need modifications only, if you have own CSS with are related with these tags.
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml
index dbdf18b..26e12e7 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/16-layout/30-segment/segment-layout.xhtml
@@ -25,36 +25,54 @@
   <p>The segment layout is a grid with 12 columns.
     The number and the proportion of the columns can be set with the attributes
     <code>extraSmall</code>, <code>small</code>, <code>medium</code>, <code>large</code> and <code>extraLarge</code>.
-    Every attribute has a different css class, but the usage is the same.
-    The value is a semicolon separated list of integers, which sum must be '12' or less.
-    A value of n will use n columns from the grid.</p>
+    The value is a semicolon separated list. Allowed values are integers from 1 to 12, 'auto' and '*'.</p>
   <tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png"
            link="#{demoBundle.tagDocUrl}/#{info.stableVersion}/tld/tc/segmentLayout.html"/>
 
   <tc:section label="Basics">
-    <p>This example show a segment layout with four columns and a segment layout with three columns.
-      The numbers are displayed via the <code class="language-markup">&lt;tc:label/></code> tag.
-      The space is set via the <code class="language-markup">&lt;tc:hidden/></code> tag.</p>
+    <p>This example show a segment layout with four and three columns and a segment layout with 'auto' and '*'.</p>
     <tc:section label="4 Columns">
-      <pre><code class="language-markup">&lt;tc:segmentLayout medium="1;6;2;3"></code></pre>
-      <tc:segmentLayout medium="1;6;2;3">
-        <tc:in value="1"/>
+      <p>The sum of the values is 12.</p>
+      <pre><code class="language-markup">&lt;tc:segmentLayout extraSmall="2;3;4;3"></code></pre>
+      <tc:segmentLayout extraSmall="2;3;4;3">
         <tc:in value="2"/>
         <tc:in value="3"/>
         <tc:in value="4"/>
-        <tc:hidden/>
-        <tc:in value="5"/>
+        <tc:in value="3"/>
+        <tc:in value="2"/>
+        <tc:in value="3"/>
+        <tc:in value="4"/>
+        <tc:in value="3"/>
       </tc:segmentLayout>
     </tc:section>
-    <tc:section label="3 Columns">
-      <pre><code class="language-markup">&lt;tc:segmentLayout medium="2;4;6"></code></pre>
-      <tc:segmentLayout medium="2;4;6">
-        <tc:in value="1"/>
+    <tc:section label="5 Columns">
+      <p>The sum of the values is 8. After the third element, the sequence starts from the beginning.
+        So the fourth element got a value of 2.</p>
+      <pre><code class="language-markup">&lt;tc:segmentLayout extraSmall="2;2;4"></code></pre>
+      <tc:segmentLayout extraSmall="2;2;4">
+        <tc:in value="2"/>
+        <tc:in value="2"/>
+        <tc:in value="4"/>
+        <tc:in value="2"/>
         <tc:in value="2"/>
-        <tc:in value="3"/>
         <tc:in value="4"/>
-        <tc:hidden/>
-        <tc:in value="5"/>
+      </tc:segmentLayout>
+    </tc:section>
+    <tc:section label="'auto' and '*'">
+      <pre><code class="language-markup">&lt;tc:segmentLayout extraSmall="*;auto;*"></code></pre>
+      <tc:segmentLayout extraSmall="*;auto;*">
+        <tc:panel>
+          <tc:style customClass="blue"/>
+          <p>the remaining space</p>
+        </tc:panel>
+        <tc:panel>
+          <tc:style customClass="old-planet"/>
+          <p>width of the content</p>
+        </tc:panel>
+        <tc:panel>
+          <tc:style customClass="blue"/>
+          <p>the remaining space</p>
+        </tc:panel>
       </tc:segmentLayout>
     </tc:section>
   </tc:section>
@@ -67,12 +85,11 @@
       <code>small</code> and <code>extraSmall</code>.</p>
     <p>In the following example, all attributes are used. If you are on a desktop you can see the different
       behavior by changing the size of the browser window.</p>
-    <pre><code class="language-markup">&lt;tc:segmentLayout extraLarge="1;1;1;1;1;1;1;1;1;1;1;1" large="2;2;2;2;2;2"
-  medium="3;3;3;3" small="4;4;4" extraSmall="6;6">
+    <pre><code class="language-markup">&lt;tc:segmentLayout extraLarge="1" large="2"
+      medium="3" small="4" extraSmall="6">
     ...</code></pre>
 
-    <tc:segmentLayout extraLarge="1;1;1;1;1;1;1;1;1;1;1;1" large="2;2;2;2;2;2" medium="3;3;3;3" small="4;4;4"
-                      extraSmall="6;6">
+    <tc:segmentLayout extraLarge="1" large="2" medium="3" small="4" extraSmall="6">
       <tc:in value="1"/>
       <tc:in value="2"/>
       <tc:in value="3"/>
@@ -88,45 +105,11 @@
     </tc:segmentLayout>
   </tc:section>
 
-  <tc:section label="Offset">
-    <p>An offset can be set for the different proportions with the
-      <code class="language-markup">&lt;tc:segmentLayoutConstraint/></code> tag which can have the attributes
-      <code>offsetExtraSmall</code>, <code>offsetSmall</code>,<code>offsetMedium</code> and
-      <code>offsetLarge</code>.</p>
-    <p>Possible values are from 1 to 11 for <code>offsetExtraSmall</code>.<br/>
-      For the other attributes possible values are from 0 to 11.<br/>
-      A <code>offsetMedium="0"</code> overwrite the offset from smaller proportions.</p>
-    <p>In the following example an offset is set for all proportions.</p>
-    <pre><code class="language-markup">&lt;tc:segmentLayout extraSmall="4;4;4" small="3;3;3;3" medium="2;2;2;2;2;2" large="1;1;1;1;1;1;1;1;1;1;1;1">
-  &lt;tc:in value="1"/>
-  &lt;tc:in value="2">
-    &lt;tc:segmentLayoutConstraint offsetExtraSmall="4" offsetSmall="6" offsetMedium="8" offsetLarge="10"/>
-  &lt;/tc:in>
-  &lt;tc:in value="3"/>
-  ...
-&lt;/tc:segmentLayout></code></pre>
-    <tc:segmentLayout extraSmall="4;4;4" small="3;3;3;3" medium="2;2;2;2;2;2" large="1;1;1;1;1;1;1;1;1;1;1;1">
-      <tc:in value="1"/>
-      <tc:in value="2">
-        <tc:segmentLayoutConstraint offsetExtraSmall="4" offsetSmall="6" offsetMedium="8" offsetLarge="10"/>
-      </tc:in>
-      <tc:in value="3"/>
-      <tc:in value="4"/>
-      <tc:in value="5"/>
-      <tc:in value="6"/>
-      <tc:in value="7"/>
-      <tc:in value="8"/>
-      <tc:in value="9"/>
-      <tc:in value="10"/>
-      <tc:in value="11"/>
-      <tc:in value="12"/>
-    </tc:segmentLayout>
-  </tc:section>
-
   <tc:section label="Overwrite default layout">
     <p>The default layout can be overwritten by the
       <code class="language-markup">&lt;tc:segmentLayoutConstraint/></code> tag.
-      Possible values are <code>extraSmall</code>, <code>small</code>,<code>medium</code> and <code>large</code>.</p>
+      Possible attributes are <code>extraSmall</code>, <code>small</code>,<code>medium</code> and
+      <code>large</code>.</p>
     <p>In the following example the medium default layout of the third input field is overwritter with '3'.</p>
     <pre><code class="language-markup">&lt;tc:segmentLayout medium="4;8">
   &lt;tc:in/>
@@ -137,12 +120,12 @@
   &lt;tc:in/>
 &lt;/tc:segmentLayout></code></pre>
     <tc:segmentLayout medium="4;8">
-      <tc:in/>
-      <tc:in/>
-      <tc:in>
+      <tc:in value="4"/>
+      <tc:in value="8"/>
+      <tc:in value="3">
         <tc:segmentLayoutConstraint medium="3"/>
       </tc:in>
-      <tc:in/>
+      <tc:in value="8"/>
     </tc:segmentLayout>
   </tc:section>
 </ui:composition>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
index cfe24e9..fe59984 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
@@ -39,7 +39,7 @@
 
       <ui:include src="/menu.xhtml"/>
 
-      <tc:segmentLayout large="#{tc:columnPartition(navigationState.viewSource ? '8;4' : '12')}">
+      <tc:segmentLayout large="#{navigationState.viewSource ? '8;4' : '12'}">
 
         <tc:panel><!-- xxx this panel is needed currently because of a bug -->
 
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
index 5495c84..24e9303 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
@@ -130,9 +130,6 @@ public class TaglibGenerator extends AbstractGenerator {
 
     // XXX hack: should be configurable or generated from annotations.
     if ("http://myfaces.apache.org/tobago/component".equals(taglibAnnotation.uri())) {
-      addFunction(document, taglib, "columnPartition", "org.apache.myfaces.tobago.layout.ColumnPartition",
-          "org.apache.myfaces.tobago.layout.ColumnPartition valueOf(java.lang.String)");
-
       for (int i = 1; i < 10; i++) {
         addFunction(document, taglib, "format" + i, "org.apache.myfaces.tobago.util.MessageFormat",
             "java.lang.String format(java.lang.String"+ StringUtils.repeat(", java.lang.Object", i) +")");
diff --git a/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg b/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
index 0a47d87..6fee1a2 100644
--- a/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
+++ b/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component.stg
@@ -392,10 +392,6 @@ CharacterProperty(property) ::= <<
 <NormalProperty(property)>
 >>
 
-ColumnPartitionProperty(property) ::= <<
-<NormalProperty(property)>
->>
-
 LabelLayoutProperty(property) ::= <<
 <NormalProperty(property)>
 >>

-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].