myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1793808 - in /myfaces/tobago/trunk/tobago-core/src: main/java/org/apache/myfaces/tobago/facelets/ main/java/org/apache/myfaces/tobago/renderkit/css/ test/java/org/apache/myfaces/tobago/renderkit/css/
Date Thu, 04 May 2017 14:10:25 GMT
Author: lofwyr
Date: Thu May  4 14:10:25 2017
New Revision: 1793808

URL: http://svn.apache.org/viewvc?rev=1793808&view=rev
Log:
TOBAGO-1737: Dynamic CSS in <tc:style> support inside of <tc:sheet> and <ui:repeat>

Added:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java
      - copied, changed from r1793638, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/DataAttributeHandler.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CustomClass.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/CustomClassUnitTest.java
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/StyleUnitTest.java

Copied: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java (from r1793638, myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/DataAttributeHandler.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java?p2=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java&p1=myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/DataAttributeHandler.java&r1=1793638&r2=1793808&rev=1793808&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/DataAttributeHandler.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/StyleHandler.java Thu May  4 14:10:25 2017
@@ -20,7 +20,16 @@
 package org.apache.myfaces.tobago.facelets;
 
 import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.component.Visual;
+import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
+import org.apache.myfaces.tobago.internal.util.StringUtils;
+import org.apache.myfaces.tobago.layout.Display;
+import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.Overflow;
+import org.apache.myfaces.tobago.layout.Position;
+import org.apache.myfaces.tobago.layout.TextAlign;
+import org.apache.myfaces.tobago.renderkit.css.CustomClass;
+import org.apache.myfaces.tobago.renderkit.css.Style;
 
 import javax.el.ELException;
 import javax.faces.component.UIComponent;
@@ -31,33 +40,516 @@ import javax.faces.view.facelets.TagConf
 import javax.faces.view.facelets.TagException;
 import javax.faces.view.facelets.TagHandler;
 
-public final class DataAttributeHandler extends TagHandler {
+public final class StyleHandler extends TagHandler {
 
-  private final TagAttribute name;
+  private final TagAttribute file;
 
-  private final TagAttribute value;
+  private final TagAttribute customClass;
 
-  public DataAttributeHandler(final TagConfig config) {
+  private final TagAttribute width;
+  private final TagAttribute height;
+  private final TagAttribute minWidth;
+  private final TagAttribute minHeight;
+  private final TagAttribute maxWidth;
+  private final TagAttribute maxHeight;
+  private final TagAttribute left;
+  private final TagAttribute right;
+  private final TagAttribute top;
+  private final TagAttribute bottom;
+  private final TagAttribute paddingLeft;
+  private final TagAttribute paddingRight;
+  private final TagAttribute paddingTop;
+  private final TagAttribute paddingBottom;
+  private final TagAttribute marginLeft;
+  private final TagAttribute marginRight;
+  private final TagAttribute marginTop;
+  private final TagAttribute marginBottom;
+  private final TagAttribute overflowX;
+  private final TagAttribute overflowY;
+  private final TagAttribute display;
+  private final TagAttribute position;
+  private final TagAttribute textAlign;
+
+
+  public StyleHandler(final TagConfig config) {
     super(config);
-    this.name = getRequiredAttribute(Attributes.name.getName());
-    this.value = getRequiredAttribute(Attributes.value.getName());
+
+    this.file = getAttribute(Attributes.file.getName());
+
+    this.customClass = getAttribute(Attributes.customClass.getName());
+
+    this.width = getAttribute(Attributes.width.getName());
+    this.height = getAttribute(Attributes.height.getName());
+    this.minWidth = getAttribute(Attributes.minWidth.getName());
+    this.minHeight = getAttribute(Attributes.minHeight.getName());
+    this.maxWidth = getAttribute(Attributes.maxWidth.getName());
+    this.maxHeight = getAttribute(Attributes.maxHeight.getName());
+    this.left = getAttribute(Attributes.left.getName());
+    this.right = getAttribute(Attributes.right.getName());
+    this.top = getAttribute(Attributes.top.getName());
+    this.bottom = getAttribute(Attributes.bottom.getName());
+    this.paddingLeft = getAttribute(Attributes.paddingLeft.getName());
+    this.paddingRight = getAttribute(Attributes.paddingRight.getName());
+    this.paddingTop = getAttribute(Attributes.paddingTop.getName());
+    this.paddingBottom = getAttribute(Attributes.paddingBottom.getName());
+    this.marginLeft = getAttribute(Attributes.marginLeft.getName());
+    this.marginRight = getAttribute(Attributes.marginRight.getName());
+    this.marginTop = getAttribute(Attributes.marginTop.getName());
+    this.marginBottom = getAttribute(Attributes.marginBottom.getName());
+    this.overflowX = getAttribute(Attributes.overflowX.getName());
+    this.overflowY = getAttribute(Attributes.overflowY.getName());
+    this.display = getAttribute(Attributes.display.getName());
+    this.position = getAttribute(Attributes.position.getName());
+    this.textAlign = getAttribute(Attributes.textAlign.getName());
   }
 
   @Override
   public void apply(final FaceletContext faceletContext, final UIComponent parent) throws ELException {
-    if (parent == null) {
-      throw new TagException(tag, "Parent UIComponent was null");
-    }
 
     if (ComponentHandler.isNew(parent)) {
 
-      final Object attributeName = name.isLiteral()
-          ? (Object) name.getValue(faceletContext)
-          : name.getValueExpression(faceletContext, Object.class);
-      final Object attributeValue = value.isLiteral()
-          ? (Object) value.getValue(faceletContext)
-          : value.getValueExpression(faceletContext, Object.class);
-      ComponentUtils.putDataAttribute(parent, attributeName, attributeValue);
+      // file
+      if (file != null) {
+        final String value = file.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          FacesContextUtils.addStyleFile(faceletContext.getFacesContext(), value);
+        }
+      }
+
+      // custom class
+      if (customClass != null) {
+        final CustomClass customClassAttribute;
+        if (customClass.isLiteral()) {
+          final String value = customClass.getValue(faceletContext);
+          if (StringUtils.isNotBlank(value)) {
+            customClassAttribute = new CustomClass(value);
+          } else {
+            customClassAttribute = null;
+          }
+        } else {
+          customClassAttribute = new CustomClass(customClass.getValueExpression(faceletContext, Object.class));
+        }
+        ((Visual) parent).setCustomClass(customClassAttribute);
+      }
+
+      // style
+      Style style = null;
+      style = applyAttributes1(faceletContext, style);
+      style = applyAttributes2(faceletContext, style);
+
+      // XXX the applyAttributes1() and applyAttributes2() methods are only, because the checkstyle check requires
+      // XXX methods smaller than 250 lines. A better resolution might be possible with Java 8 lambdas.
+
+      if (style != null) {
+        if (parent instanceof Visual) {
+          ((Visual) parent).setStyle(style);
+        } else {
+          throw new TagException(tag, "Parent component is not of type Visual, so no style can be set!");
+        }
+      }
+    }
+  }
+
+  private Style applyAttributes1(final FaceletContext faceletContext, final Style parameter) {
+
+    Style style = parameter;
+
+    if (width != null) {
+      if (width.isLiteral()) {
+        final String value = width.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setWidth(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setWidth(width.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (height != null) {
+      if (height.isLiteral()) {
+        final String value = height.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setHeight(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setHeight(height.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (minWidth != null) {
+      if (minWidth.isLiteral()) {
+        final String value = minWidth.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMinWidth(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMinWidth(minWidth.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (minHeight != null) {
+      if (minHeight.isLiteral()) {
+        final String value = minHeight.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMinHeight(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMinHeight(minHeight.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (maxWidth != null) {
+      if (maxWidth.isLiteral()) {
+        final String value = maxWidth.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMaxWidth(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMaxWidth(maxWidth.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (maxHeight != null) {
+      if (maxHeight.isLiteral()) {
+        final String value = maxHeight.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMaxHeight(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMaxHeight(maxHeight.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (left != null) {
+      if (left.isLiteral()) {
+        final String value = left.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setLeft(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setLeft(left.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (right != null) {
+      if (right.isLiteral()) {
+        final String value = right.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setRight(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setRight(right.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (top != null) {
+      if (top.isLiteral()) {
+        final String value = top.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setTop(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setTop(top.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (bottom != null) {
+      if (bottom.isLiteral()) {
+        final String value = bottom.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setBottom(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setBottom(bottom.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (paddingLeft != null) {
+      if (paddingLeft.isLiteral()) {
+        final String value = paddingLeft.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setPaddingLeft(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setPaddingLeft(paddingLeft.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (paddingRight != null) {
+      if (paddingRight.isLiteral()) {
+        final String value = paddingRight.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setPaddingRight(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setPaddingRight(paddingRight.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (paddingTop != null) {
+      if (paddingTop.isLiteral()) {
+        final String value = paddingTop.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setPaddingTop(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setPaddingTop(paddingTop.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (paddingBottom != null) {
+      if (paddingBottom.isLiteral()) {
+        final String value = paddingBottom.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setPaddingBottom(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setPaddingBottom(paddingBottom.getValueExpression(faceletContext, Object.class));
+      }
+    }
+    return style;
+  }
+
+  private Style applyAttributes2(FaceletContext faceletContext, Style parameter) {
+
+    Style style = parameter;
+
+    if (marginLeft != null) {
+      if (marginLeft.isLiteral()) {
+        final String value = marginLeft.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMarginLeft(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMarginLeft(marginLeft.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (marginRight != null) {
+      if (marginRight.isLiteral()) {
+        final String value = marginRight.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMarginRight(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMarginRight(marginRight.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (marginTop != null) {
+      if (marginTop.isLiteral()) {
+        final String value = marginTop.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMarginTop(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMarginTop(marginTop.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (marginBottom != null) {
+      if (marginBottom.isLiteral()) {
+        final String value = marginBottom.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setMarginBottom(Measure.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setMarginBottom(marginBottom.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (overflowX != null) {
+      if (overflowX.isLiteral()) {
+        final String value = overflowX.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setOverflowX(Overflow.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setOverflowX(overflowX.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (overflowY != null) {
+      if (overflowY.isLiteral()) {
+        final String value = overflowY.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setOverflowY(Overflow.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setOverflowY(overflowY.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (display != null) {
+      if (display.isLiteral()) {
+        final String value = display.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setDisplay(Display.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setDisplay(display.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (position != null) {
+      if (position.isLiteral()) {
+        final String value = position.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setPosition(Position.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setPosition(position.getValueExpression(faceletContext, Object.class));
+      }
+    }
+
+    if (textAlign != null) {
+      if (textAlign.isLiteral()) {
+        final String value = textAlign.getValue(faceletContext);
+        if (StringUtils.isNotBlank(value)) {
+          if (style == null) {
+            style = new Style();
+          }
+          style.setTextAlign(TextAlign.valueOf(value));
+        }
+      } else {
+        if (style == null) {
+          style = new Style();
+        }
+        style.setTextAlign(textAlign.getValueExpression(faceletContext, Object.class));
+      }
     }
+    return style;
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CustomClass.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CustomClass.java?rev=1793808&r1=1793807&r2=1793808&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CustomClass.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CustomClass.java Thu May  4 14:10:25 2017
@@ -22,8 +22,9 @@ package org.apache.myfaces.tobago.render
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.ArrayList;
-import java.util.List;
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
 import java.util.StringTokenizer;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -37,51 +38,52 @@ public class CustomClass implements CssI
 
   private static final Pattern CSS_CLASS_PATTERN = Pattern.compile("[\\w-]+");
 
-  private final String[] classes;
+  private String name;
+  private ValueExpression valueExpression;
 
-  private CustomClass(List<String> list) {
-    classes = list.toArray(new String[list.size()]);
+  public CustomClass(final String name) {
+    this.name = name;
   }
 
-  public static CustomClass valueOf(String text) {
+  public CustomClass(final ValueExpression valueExpression) {
+    this.valueExpression = valueExpression;
+  }
+
+  @Override
+  public String getName() {
+    String string;
+    if (name != null) {
+      string = name;
+    } else {
+      final FacesContext facesContext = FacesContext.getCurrentInstance();
+      final ELContext elContext = facesContext.getELContext();
+      string = valueExpression.getValue(elContext).toString();
+    }
 
-    final StringTokenizer tokenizer = new StringTokenizer(text, " ");
-    final List<String> result = new ArrayList<String>(tokenizer.countTokens());
+    final StringTokenizer tokenizer = new StringTokenizer(string, " ");
+    final StringBuilder result = new StringBuilder();
+    boolean first = true;
     while (tokenizer.hasMoreTokens()) {
       final String token = tokenizer.nextToken();
       final Matcher matcher = CSS_CLASS_PATTERN.matcher(token);
       if (matcher.matches()) {
-        if (!result.contains(token)) {
-          result.add(token);
-        } else {
-          LOG.warn("Duplicate CSS class name: '{}' which is part of '{}'", token, text);
+        if (!first) {
+          result.append(' ');
         }
+        result.append(token);
+        first = false;
       } else {
-        LOG.error("Invalid CSS class name: '{}' which is part of '{}'", token, text);
+        LOG.error("Invalid CSS class name: '{}' which is part of '{}'", token, string);
       }
     }
-    if (result.size() > 0) {
-      return new CustomClass(result);
-    } else {
-      return null;
-    }
-
+    return result.length() > 0 ? result.toString() : null;
   }
 
-  @Override
-  public String getName() {
-    switch (classes.length) {
-      case 0:
-        return "";
-      case 1:
-        return classes[0];
-      default:
-        final StringBuilder builder = new StringBuilder(classes[0]);
-        for (int i = 1; i < classes.length; i++) {
-          builder.append(' ');
-          builder.append(classes[i]);
-        }
-        return builder.toString();
-    }
+  /**
+   * @deprecated since 3.1.0
+   */
+  @Deprecated
+  public static CustomClass valueOf(String text) {
+    return new CustomClass(text);
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java?rev=1793808&r1=1793807&r2=1793808&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java Thu May  4 14:10:25 2017
@@ -26,6 +26,9 @@ import org.apache.myfaces.tobago.layout.
 import org.apache.myfaces.tobago.layout.Position;
 import org.apache.myfaces.tobago.layout.TextAlign;
 
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
 import java.io.Serializable;
 
 /**
@@ -33,46 +36,82 @@ import java.io.Serializable;
  */
 public class Style implements Serializable {
 
-  private static final long serialVersionUID = 5L;
+  private static final long serialVersionUID = 6L;
 
   private Measure width;
+  private ValueExpression widthVE;
   private Measure height;
+  private ValueExpression heightVE;
 
   private Measure minWidth;
+  private ValueExpression minWidthVE;
   private Measure minHeight;
+  private ValueExpression minHeightVE;
   private Measure maxWidth;
+  private ValueExpression maxWidthVE;
   private Measure maxHeight;
+  private ValueExpression maxHeightVE;
 
   private Measure left;
+  private ValueExpression leftVE;
   private Measure right;
+  private ValueExpression rightVE;
   private Measure top;
+  private ValueExpression topVE;
   private Measure bottom;
+  private ValueExpression bottomVE;
 
   private Measure paddingLeft;
+  private ValueExpression paddingLeftVE;
   private Measure paddingRight;
+  private ValueExpression paddingRightVE;
   private Measure paddingTop;
+  private ValueExpression paddingTopVE;
   private Measure paddingBottom;
+  private ValueExpression paddingBottomVE;
 
   private Measure marginLeft;
+  private ValueExpression marginLeftVE;
   private Measure marginRight;
+  private ValueExpression marginRightVE;
   private Measure marginTop;
+  private ValueExpression marginTopVE;
   private Measure marginBottom;
+  private ValueExpression marginBottomVE;
 
   private Overflow overflowX;
+  private ValueExpression overflowXVE;
   private Overflow overflowY;
+  private ValueExpression overflowYVE;
   private Display display;
+  private ValueExpression displayVE;
   private Position position;
+  private ValueExpression positionVE;
 
+  // tbd
   private String backgroundImage;
+  // tbd
+  private ValueExpression backgroundImageVE;
+  // tbd
   private String backgroundPosition;
-  private Integer zIndex; // TBD
+  // tbd
+  private ValueExpression backgroundPositionVE;
+  // tbd
+  private Integer zIndex;
+  // tbd
+  private ValueExpression zIndexVE;
   private TextAlign textAlign;
+  private ValueExpression textAlignVE;
 
   private Boolean empty;
 
   public Style() {
   }
 
+  /**
+   * @deprecated since 3.1.0
+   */
+  @Deprecated
   public Style(final UIStyle style) {
 
     width = style.getWidth();
@@ -164,8 +203,15 @@ public class Style implements Serializab
   }
 
   public String encode() {
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    final ELContext elContext = facesContext.getELContext();
     final StringBuilder buf = new StringBuilder();
-    if (width != null) {
+
+    if (widthVE != null) {
+      buf.append("width:");
+      buf.append(Measure.valueOf(widthVE.getValue(elContext)).serialize());
+      buf.append(';');
+    } else if (width != null) {
       buf.append("width:");
       buf.append(width.serialize());
       buf.append(';');
@@ -301,131 +347,161 @@ public class Style implements Serializab
 
   public String encodeJson() {
     final StringBuilder buf = new StringBuilder("{");
+
+    final Measure width = getWidth();
     if (width != null) {
       buf.append("\"width\":\"");
       buf.append(width.serialize());
       buf.append("\",");
     }
+    final Measure height = getHeight();
     if (height != null) {
       buf.append("\"height\":\"");
       buf.append(height.serialize());
       buf.append("\",");
     }
+    final Measure minWidth = getMinWidth();
     if (minWidth != null) {
       buf.append("\"minWidth\":\"");
       buf.append(minWidth.serialize());
       buf.append("\",");
     }
+    final Measure minHeight = getMinHeight();
     if (minHeight != null) {
       buf.append("\"minHeight\":\"");
       buf.append(minHeight.serialize());
       buf.append("\",");
     }
+    final Measure maxWidth = getMaxWidth();
     if (maxWidth != null) {
       buf.append("\"maxWidth\":\"");
       buf.append(maxWidth.serialize());
       buf.append("\",");
     }
+    final Measure maxHeight = getMaxHeight();
     if (maxHeight != null) {
       buf.append("\"maxHeight\":\"");
       buf.append(maxHeight.serialize());
       buf.append("\",");
     }
+    final Measure left = getLeft();
     if (left != null) {
       buf.append("\"left\":\"");
       buf.append(left.serialize());
       buf.append("\",");
     }
+    final Measure right = getRight();
     if (right != null) {
       buf.append("\"right\":\"");
       buf.append(right.serialize());
       buf.append("\",");
     }
+    final Measure top = getTop();
     if (top != null) {
       buf.append("\"top\":\"");
       buf.append(top.serialize());
       buf.append("\",");
     }
+    final Measure bottom = getBottom();
     if (bottom != null) {
       buf.append("\"bottom\":\"");
       buf.append(bottom.serialize());
       buf.append("\",");
     }
+    final Measure paddingLeft = getPaddingLeft();
     if (paddingLeft != null) {
       buf.append("\"paddingLeft\":\"");
       buf.append(paddingLeft.serialize());
       buf.append("\",");
     }
+    final Measure paddingRight = getPaddingRight();
     if (paddingRight != null) {
       buf.append("\"paddingRight\":\"");
       buf.append(paddingRight.serialize());
       buf.append("\",");
     }
+    final Measure paddingTop = getPaddingTop();
     if (paddingTop != null) {
       buf.append("\"paddingTop\":\"");
       buf.append(paddingTop.serialize());
       buf.append("\",");
     }
+    final Measure paddingBottom = getPaddingBottom();
     if (paddingBottom != null) {
       buf.append("\"paddingBottom\":\"");
       buf.append(paddingBottom.serialize());
       buf.append("\",");
     }
+    final Measure marginLeft = getMarginLeft();
     if (marginLeft != null) {
       buf.append("\"marginLeft\":\"");
       buf.append(marginLeft.serialize());
       buf.append("\",");
     }
+    final Measure marginRight = getMarginRight();
     if (marginRight != null) {
       buf.append("\"marginRight\":\"");
       buf.append(marginRight.serialize());
       buf.append("\",");
     }
+    final Measure marginTop = getMarginTop();
     if (marginTop != null) {
       buf.append("\"marginTop\":\"");
       buf.append(marginTop.serialize());
       buf.append("\",");
     }
+    final Measure marginBottom = getMarginBottom();
     if (marginBottom != null) {
       buf.append("\"marginBottom\":\"");
       buf.append(marginBottom.serialize());
       buf.append("\",");
     }
+    final Overflow overflowX = getOverflowX();
     if (overflowX != null) {
       buf.append("\"overflowX\":\"");
       buf.append(overflowX.name());
       buf.append("\",");
     }
+    final Overflow overflowY = getOverflowY();
     if (overflowY != null) {
       buf.append("\"overflowY\":\"");
       buf.append(overflowY.name());
       buf.append("\",");
     }
+    final Display display = getDisplay();
     if (display != null) {
       buf.append("\"display\":\"");
       buf.append(display.name());
       buf.append("\",");
     }
+    final Position position = getPosition();
     if (position != null) {
       buf.append("\"position\":\"");
       buf.append(position.name());
       buf.append("\",");
     }
+    // tbd
+    final String backgroundImage = getBackgroundImage();
     if (backgroundImage != null) {
       buf.append("\"backgroundImage\":\"");
       buf.append(backgroundImage);
       buf.append("\",");
     }
+    // tbd
+    final String backgroundPosition = getBackgroundPosition();
     if (backgroundPosition != null) {
       buf.append("\"backgroundPosition\":\"");
       buf.append(backgroundPosition);
       buf.append("\",");
     }
+    // tbd
+    final Integer zIndex = getZIndex();
     if (zIndex != null) {
       buf.append("\"zIndex\":");
       buf.append(zIndex);
       buf.append(",");
     }
+    final TextAlign textAlign = getTextAlign();
     if (textAlign != null) {
       buf.append("\"textAlign\":\"");
       buf.append(textAlign.name());
@@ -441,7 +517,13 @@ public class Style implements Serializab
   }
 
   public Measure getWidth() {
-    return width;
+    if (widthVE != null) {
+      return Measure.valueOf(widthVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (width != null) {
+      return width;
+    } else {
+      return null;
+    }
   }
 
   public void setWidth(final Measure width) {
@@ -449,8 +531,19 @@ public class Style implements Serializab
     this.width = width;
   }
 
+  public void setWidth(final ValueExpression width) {
+    empty = null;
+    this.widthVE = width;
+  }
+
   public Measure getHeight() {
-    return height;
+    if (heightVE != null) {
+      return Measure.valueOf(heightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (height != null) {
+      return height;
+    } else {
+      return null;
+    }
   }
 
   public void setHeight(final Measure height) {
@@ -458,44 +551,99 @@ public class Style implements Serializab
     this.height = height;
   }
 
+  public void setHeight(final ValueExpression height) {
+    empty = null;
+    this.heightVE = height;
+  }
+
   public Measure getMinWidth() {
-    return minWidth;
+    if (minWidthVE != null) {
+      return Measure.valueOf(minWidthVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (minWidth != null) {
+      return minWidth;
+    } else {
+      return null;
+    }
   }
 
-  public void setMinWidth(Measure minWidth) {
+  public void setMinWidth(final Measure minWidth) {
     empty = null;
     this.minWidth = minWidth;
   }
 
+  public void setMinWidth(final ValueExpression minWidth) {
+    empty = null;
+    this.minWidthVE = minWidth;
+  }
+
   public Measure getMinHeight() {
-    return minHeight;
+    if (minHeightVE != null) {
+      return Measure.valueOf(minHeightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (minHeight != null) {
+      return minHeight;
+    } else {
+      return null;
+    }
   }
 
-  public void setMinHeight(Measure minHeight) {
+  public void setMinHeight(final Measure minHeight) {
     empty = null;
     this.minHeight = minHeight;
   }
 
+  public void setMinHeight(final ValueExpression minHeight) {
+    empty = null;
+    this.minHeightVE = minHeight;
+  }
+
   public Measure getMaxWidth() {
-    return maxWidth;
+    if (maxWidthVE != null) {
+      return Measure.valueOf(maxWidthVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (maxWidth != null) {
+      return maxWidth;
+    } else {
+      return null;
+    }
   }
 
-  public void setMaxWidth(Measure maxWidth) {
+  public void setMaxWidth(final Measure maxWidth) {
     empty = null;
     this.maxWidth = maxWidth;
   }
 
+  public void setMaxWidth(final ValueExpression maxWidth) {
+    empty = null;
+    this.maxWidthVE = maxWidth;
+  }
+
   public Measure getMaxHeight() {
-    return maxHeight;
+    if (maxHeightVE != null) {
+      return Measure.valueOf(maxHeightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (maxHeight != null) {
+      return maxHeight;
+    } else {
+      return null;
+    }
   }
 
-  public void setMaxHeight(Measure maxHeight) {
+  public void setMaxHeight(final Measure maxHeight) {
     empty = null;
     this.maxHeight = maxHeight;
   }
 
+  public void setMaxHeight(final ValueExpression maxHeight) {
+    empty = null;
+    this.maxHeightVE = maxHeight;
+  }
+
   public Measure getLeft() {
-    return left;
+    if (leftVE != null) {
+      return Measure.valueOf(leftVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (left != null) {
+      return left;
+    } else {
+      return null;
+    }
   }
 
   public void setLeft(final Measure left) {
@@ -503,17 +651,39 @@ public class Style implements Serializab
     this.left = left;
   }
 
+  public void setLeft(final ValueExpression left) {
+    empty = null;
+    this.leftVE = left;
+  }
+
   public Measure getRight() {
-    return right;
+    if (rightVE != null) {
+      return Measure.valueOf(rightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (right != null) {
+      return right;
+    } else {
+      return null;
+    }
   }
 
-  public void setRight(Measure right) {
+  public void setRight(final Measure right) {
     empty = null;
     this.right = right;
   }
 
+  public void setRight(final ValueExpression right) {
+    empty = null;
+    this.rightVE = right;
+  }
+
   public Measure getTop() {
-    return top;
+    if (topVE != null) {
+      return Measure.valueOf(topVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (top != null) {
+      return top;
+    } else {
+      return null;
+    }
   }
 
   public void setTop(final Measure top) {
@@ -521,53 +691,119 @@ public class Style implements Serializab
     this.top = top;
   }
 
+  public void setTop(final ValueExpression top) {
+    empty = null;
+    this.topVE = top;
+  }
+
   public Measure getBottom() {
-    return bottom;
+    if (bottomVE != null) {
+      return Measure.valueOf(bottomVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (bottom != null) {
+      return bottom;
+    } else {
+      return null;
+    }
   }
 
-  public void setBottom(Measure bottom) {
+  public void setBottom(final Measure bottom) {
     empty = null;
     this.bottom = bottom;
   }
 
-  public Display getDisplay() {
-    return display;
+  public void setBottom(final ValueExpression bottom) {
+    empty = null;
+    this.bottomVE = bottom;
   }
 
-  public void setDisplay(final Display display) {
+  public Measure getPaddingLeft() {
+    if (paddingLeftVE != null) {
+      return Measure.valueOf(paddingLeftVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (paddingLeft != null) {
+      return paddingLeft;
+    } else {
+      return null;
+    }
+  }
+
+  public void setPaddingLeft(final Measure paddingLeft) {
     empty = null;
-    this.display = display;
+    this.paddingLeft = paddingLeft;
   }
 
-  public Position getPosition() {
-    return position;
+  public void setPaddingLeft(final ValueExpression paddingLeft) {
+    empty = null;
+    this.paddingLeftVE = paddingLeft;
   }
 
-  public void setPosition(final Position position) {
+  public Measure getPaddingRight() {
+    if (paddingRightVE != null) {
+      return Measure.valueOf(paddingRightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (paddingRight != null) {
+      return paddingRight;
+    } else {
+      return null;
+    }
+  }
+
+  public void setPaddingRight(final Measure paddingRight) {
     empty = null;
-    this.position = position;
+    this.paddingRight = paddingRight;
   }
 
-  public Overflow getOverflowX() {
-    return overflowX;
+  public void setPaddingRight(final ValueExpression paddingRight) {
+    empty = null;
+    this.paddingRightVE = paddingRight;
   }
 
-  public void setOverflowX(final Overflow overflowX) {
+  public Measure getPaddingTop() {
+    if (paddingTopVE != null) {
+      return Measure.valueOf(paddingTopVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (paddingTop != null) {
+      return paddingTop;
+    } else {
+      return null;
+    }
+  }
+
+  public void setPaddingTop(final Measure paddingTop) {
     empty = null;
-    this.overflowX = overflowX;
+    this.paddingTop = paddingTop;
   }
 
-  public Overflow getOverflowY() {
-    return overflowY;
+  public void setPaddingTop(final ValueExpression paddingTop) {
+    empty = null;
+    this.paddingTopVE = paddingTop;
   }
 
-  public void setOverflowY(final Overflow overflowY) {
+  public Measure getPaddingBottom() {
+    if (paddingBottomVE != null) {
+      return Measure.valueOf(paddingBottomVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (paddingBottom != null) {
+      return paddingBottom;
+    } else {
+      return null;
+    }
+  }
+
+  public void setPaddingBottom(final Measure paddingBottom) {
     empty = null;
-    this.overflowY = overflowY;
+    this.paddingBottom = paddingBottom;
+  }
+
+  public void setPaddingBottom(final ValueExpression paddingBottom) {
+    empty = null;
+    this.paddingBottomVE = paddingBottom;
   }
 
   public Measure getMarginLeft() {
-    return marginLeft;
+    if (marginLeftVE != null) {
+      return Measure.valueOf(marginLeftVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (marginLeft != null) {
+      return marginLeft;
+    } else {
+      return null;
+    }
   }
 
   public void setMarginLeft(final Measure marginLeft) {
@@ -575,8 +811,19 @@ public class Style implements Serializab
     this.marginLeft = marginLeft;
   }
 
+  public void setMarginLeft(final ValueExpression marginLeft) {
+    empty = null;
+    this.marginLeftVE = marginLeft;
+  }
+
   public Measure getMarginRight() {
-    return marginRight;
+    if (marginRightVE != null) {
+      return Measure.valueOf(marginRightVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (marginRight != null) {
+      return marginRight;
+    } else {
+      return null;
+    }
   }
 
   public void setMarginRight(final Measure marginRight) {
@@ -584,8 +831,19 @@ public class Style implements Serializab
     this.marginRight = marginRight;
   }
 
+  public void setMarginRight(final ValueExpression marginRight) {
+    empty = null;
+    this.marginRightVE = marginRight;
+  }
+
   public Measure getMarginTop() {
-    return marginTop;
+    if (marginTopVE != null) {
+      return Measure.valueOf(marginTopVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (marginTop != null) {
+      return marginTop;
+    } else {
+      return null;
+    }
   }
 
   public void setMarginTop(final Measure marginTop) {
@@ -593,8 +851,19 @@ public class Style implements Serializab
     this.marginTop = marginTop;
   }
 
+  public void setMarginTop(final ValueExpression marginTop) {
+    empty = null;
+    this.marginTopVE = marginTop;
+  }
+
   public Measure getMarginBottom() {
-    return marginBottom;
+    if (marginBottomVE != null) {
+      return Measure.valueOf(marginBottomVE.getValue(FacesContext.getCurrentInstance().getELContext()));
+    } else if (marginBottom != null) {
+      return marginBottom;
+    } else {
+      return null;
+    }
   }
 
   public void setMarginBottom(final Measure marginBottom) {
@@ -602,69 +871,210 @@ public class Style implements Serializab
     this.marginBottom = marginBottom;
   }
 
-  public Measure getPaddingLeft() {
-    return paddingLeft;
+  public void setMarginBottom(final ValueExpression marginBottom) {
+    empty = null;
+    this.marginBottomVE = marginBottom;
   }
 
-  public void setPaddingLeft(final Measure paddingLeft) {
+  public Overflow getOverflowX() {
+    if (overflowXVE != null) {
+      final Object value = overflowXVE.getValue(FacesContext.getCurrentInstance().getELContext());
+      if (value instanceof Overflow) {
+        return (Overflow) value;
+      } else if (value != null) {
+        return Overflow.valueOf(value.toString());
+      } else {
+        return null;
+      }
+    } else if (overflowX != null) {
+      return overflowX;
+    } else {
+      return null;
+    }
+  }
+
+  public void setOverflowX(final Overflow overflowX) {
     empty = null;
-    this.paddingLeft = paddingLeft;
+    this.overflowX = overflowX;
   }
 
-  public Measure getPaddingRight() {
-    return paddingRight;
+  public void setOverflowX(final ValueExpression overflowX) {
+    empty = null;
+    this.overflowXVE = overflowX;
   }
 
-  public void setPaddingRight(final Measure paddingRight) {
+  public Overflow getOverflowY() {
+    if (overflowYVE != null) {
+      final Object value = overflowYVE.getValue(FacesContext.getCurrentInstance().getELContext());
+      if (value instanceof Overflow) {
+        return (Overflow) value;
+      } else if (value != null) {
+        return Overflow.valueOf(value.toString());
+      } else {
+        return null;
+      }
+    } else if (overflowY != null) {
+      return overflowY;
+    } else {
+      return null;
+    }
+  }
+
+  public void setOverflowY(final Overflow overflowY) {
     empty = null;
-    this.paddingRight = paddingRight;
+    this.overflowY = overflowY;
   }
 
-  public Measure getPaddingTop() {
-    return paddingTop;
+  public void setOverflowY(final ValueExpression overflowY) {
+    empty = null;
+    this.overflowYVE = overflowY;
   }
 
-  public void setPaddingTop(final Measure paddingTop) {
+  public Display getDisplay() {
+    if (displayVE != null) {
+      final Object value = displayVE.getValue(FacesContext.getCurrentInstance().getELContext());
+      if (value instanceof Display) {
+        return (Display) value;
+      } else if (value != null) {
+        return Display.valueOf(value.toString());
+      } else {
+        return null;
+      }
+    } else if (display != null) {
+      return display;
+    } else {
+      return null;
+    }
+  }
+
+  public void setDisplay(final Display display) {
     empty = null;
-    this.paddingTop = paddingTop;
+    this.display = display;
   }
 
-  public Measure getPaddingBottom() {
-    return paddingBottom;
+  public void setDisplay(final ValueExpression display) {
+    empty = null;
+    this.displayVE = display;
   }
 
-  public void setPaddingBottom(final Measure paddingBottom) {
+  public Position getPosition() {
+    if (positionVE != null) {
+      final Object value = positionVE.getValue(FacesContext.getCurrentInstance().getELContext());
+      if (value instanceof Position) {
+        return (Position) value;
+      } else if (value != null) {
+        return Position.valueOf(value.toString());
+      } else {
+        return null;
+      }
+    } else if (position != null) {
+      return position;
+    } else {
+      return null;
+    }
+  }
+
+  public void setPosition(final Position position) {
     empty = null;
-    this.paddingBottom = paddingBottom;
+    this.position = position;
+  }
+
+  public void setPosition(final ValueExpression position) {
+    empty = null;
+    this.positionVE = position;
   }
 
+  // tbd
   public String getBackgroundImage() {
-    return backgroundImage;
+    if (backgroundImageVE != null) {
+      return (String) backgroundImageVE.getValue(FacesContext.getCurrentInstance().getELContext());
+    } else if (backgroundImage != null) {
+      return backgroundImage;
+    } else {
+      return null;
+    }
   }
 
-  public void setBackgroundImage(String backgroundImage) {
+  // tbd
+  public void setBackgroundImage(final String backgroundImage) {
+    empty = null;
     this.backgroundImage = backgroundImage;
   }
 
+  // tbd
+  public void setBackgroundImage(final ValueExpression backgroundImage) {
+    empty = null;
+    this.backgroundImageVE = backgroundImage;
+  }
+
+  // tbd
   public String getBackgroundPosition() {
-    return backgroundPosition;
+    if (backgroundPositionVE != null) {
+      return (String) backgroundPositionVE.getValue(FacesContext.getCurrentInstance().getELContext());
+    } else if (backgroundPosition != null) {
+      return backgroundPosition;
+    } else {
+      return null;
+    }
   }
 
-  public void setBackgroundPosition(String backgroundPosition) {
+  // tbd
+  public void setBackgroundPosition(final String backgroundPosition) {
+    empty = null;
     this.backgroundPosition = backgroundPosition;
   }
 
+  // tbd
+  public void setBackgroundPosition(final ValueExpression backgroundPosition) {
+    empty = null;
+    this.backgroundPositionVE = backgroundPosition;
+  }
+
+  // tbd
   public Integer getZIndex() {
-    return zIndex;
+    if (zIndexVE != null) {
+      final Object value = zIndexVE.getValue(FacesContext.getCurrentInstance().getELContext());
+      if (value instanceof Number) {
+        return (Integer) value;
+      } else if (value != null) {
+        return Integer.parseInt(value.toString());
+      } else {
+        return null;
+      }
+    } else if (zIndex != null) {
+      return zIndex;
+    } else {
+      return null;
+    }
   }
 
+  // tbd
   public void setZIndex(final Integer zIndex) {
     empty = null;
     this.zIndex = zIndex;
   }
 
+  // tbd
+  public void setZIndex(final ValueExpression zIndex) {
+    empty = null;
+    this.zIndexVE = zIndex;
+  }
+
   public TextAlign getTextAlign() {
-    return textAlign;
+    if (textAlignVE != null) {
+      final Object value = textAlignVE.getValue(FacesContext.getCurrentInstance().getELContext());
+      if (value instanceof TextAlign) {
+        return (TextAlign) value;
+      } else if (value != null) {
+        return TextAlign.valueOf(value.toString());
+      } else {
+        return null;
+      }
+    } else if (textAlign != null) {
+      return textAlign;
+    } else {
+      return null;
+    }
   }
 
   public void setTextAlign(final TextAlign textAlign) {
@@ -672,6 +1082,11 @@ public class Style implements Serializab
     this.textAlign = textAlign;
   }
 
+  public void setTextAlign(final ValueExpression textAlign) {
+    empty = null;
+    this.textAlignVE = textAlign;
+  }
+
   @Override
   public String toString() {
     return encode();

Modified: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/CustomClassUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/CustomClassUnitTest.java?rev=1793808&r1=1793807&r2=1793808&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/CustomClassUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/CustomClassUnitTest.java Thu May  4 14:10:25 2017
@@ -26,18 +26,16 @@ public class CustomClassUnitTest {
 
   @Test
   public void test() {
-    Assert.assertEquals("simple", "test", CustomClass.valueOf("test").getName());
-    Assert.assertEquals("number", "test2", CustomClass.valueOf("test2").getName());
-    Assert.assertEquals("list", "test3 and test4", CustomClass.valueOf("test3 and test4").getName());
-    Assert.assertEquals("space", "test5 test6", CustomClass.valueOf("     test5     test6       ").getName());
-    Assert.assertEquals("double", "test7", CustomClass.valueOf("test7 test7").getName());
-    Assert.assertEquals("-", "test-8", CustomClass.valueOf("test-8").getName());
-    Assert.assertEquals("_", "__t_e_s_t-9 _d", CustomClass.valueOf("__t_e_s_t-9 _d").getName());
-
-    Assert.assertEquals(".", null, CustomClass.valueOf("test.10"));
-    Assert.assertEquals("tab", null, CustomClass.valueOf("test\t11"));
-    Assert.assertEquals(":", null, CustomClass.valueOf("test:12"));
+    Assert.assertEquals("simple", "test", new CustomClass("test").getName());
+    Assert.assertEquals("number", "test2", new CustomClass("test2").getName());
+    Assert.assertEquals("list", "test3 and test4", new CustomClass("test3 and test4").getName());
+    Assert.assertEquals("space", "test5 test6", new CustomClass("     test5     test6       ").getName());
+    Assert.assertEquals("-", "test-8", new CustomClass("test-8").getName());
+    Assert.assertEquals("_", "__t_e_s_t-9 _d", new CustomClass("__t_e_s_t-9 _d").getName());
 
+    Assert.assertEquals(".", null, new CustomClass("test.10").getName());
+    Assert.assertEquals("tab", null, new CustomClass("test\t11").getName());
+    Assert.assertEquals(":", null, new CustomClass("test:12").getName());
   }
 
 }

Modified: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/StyleUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/StyleUnitTest.java?rev=1793808&r1=1793807&r2=1793808&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/StyleUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/css/StyleUnitTest.java Thu May  4 14:10:25 2017
@@ -19,6 +19,7 @@
 
 package org.apache.myfaces.tobago.renderkit.css;
 
+import org.apache.myfaces.test.base.junit4.AbstractJsfTestCase;
 import org.apache.myfaces.tobago.layout.Display;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.layout.Overflow;
@@ -27,7 +28,7 @@ import org.apache.myfaces.tobago.layout.
 import org.junit.Assert;
 import org.junit.Test;
 
-public class StyleUnitTest {
+public class StyleUnitTest extends AbstractJsfTestCase {
 
   @Test
   public void testEncodedEmpty() {



Mime
View raw message