]> source.dussan.org Git - gwtquery.git/commitdiff
implement Manolo's idea : use with() method to facilitate eclipse auto-completion
authorJulien Dramaix <julien.dramaix@gmail.com>
Thu, 24 Feb 2011 21:02:42 +0000 (21:02 +0000)
committerJulien Dramaix <julien.dramaix@gmail.com>
Thu, 24 Feb 2011 21:02:42 +0000 (21:02 +0000)
25 files changed:
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/AbstractCssProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundPositionProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundRepeatProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderWidthProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty3.java [deleted file]
gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty4.java [deleted file]
gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty5.java [deleted file]
gwtquery-core/src/main/java/com/google/gwt/query/client/css/EdgePositionProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontSizeProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/LineHeightProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/MarginProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/MultipleValueCssSetter.java [new file with mode: 0644]
gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineWidthProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/PaddingProperty.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakeCssValue.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/TakesLength.java
gwtquery-core/src/main/java/com/google/gwt/query/client/css/VerticalAlignProperty.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryEventsTest.java

index d45240f8f320ac616d4b210ec7ebd5ec5e5af032..e34cf1cc4024fe1603e03a502bf1664c589114c1 100644 (file)
@@ -35,13 +35,11 @@ import com.google.gwt.dom.client.OptionElement;
 import com.google.gwt.dom.client.SelectElement;\r
 import com.google.gwt.dom.client.TextAreaElement;\r
 import com.google.gwt.dom.client.Style.Display;\r
+import com.google.gwt.dom.client.Style.HasCssName;\r
+import com.google.gwt.query.client.css.CSS;\r
 import com.google.gwt.query.client.css.CssProperty;\r
-import com.google.gwt.query.client.css.CssShorthandProperty3;\r
-import com.google.gwt.query.client.css.CssShorthandProperty4;\r
-import com.google.gwt.query.client.css.CssShorthandProperty5;\r
-import com.google.gwt.query.client.css.Length;\r
 import com.google.gwt.query.client.css.TakeCssValue;\r
-import com.google.gwt.query.client.css.TakesLength;\r
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;\r
 import com.google.gwt.query.client.impl.DocumentStyleImpl;\r
 import com.google.gwt.query.client.plugins.EventsListener;\r
 import com.google.gwt.user.client.DOM;\r
@@ -1006,16 +1004,16 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
     return this;\r
   }\r
 \r
-  /**\r
-   * Set CSS a single style property on every matched element using type-safe\r
-   * enumerations.\r
-   */\r
-  public <S, T extends TakeCssValue<S>> GQuery css(T cssProperty, S value) {\r
-    for (Element e : elements()) {\r
-      cssProperty.set(e.getStyle(), value);\r
-    }\r
-    return this;\r
-  }\r
+//  /**\r
+//   * Set CSS a single style property on every matched element using type-safe\r
+//   * enumerations.\r
+//   */\r
+//  public <S, T extends TakeCssValue<S>> GQuery css(T cssProperty, S value) {\r
+//    for (Element e : elements()) {\r
+//      cssProperty.set(e.getStyle(), value);\r
+//    }\r
+//    return this;\r
+//  }\r
   \r
   /**\r
    * Set CSS a single style property on every matched element using type-safe\r
@@ -1031,56 +1029,57 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
     return css(cssProperty.getCssName(), value);\r
   }\r
 \r
-  /**\r
-   * Set CSS a single style property on every matched element using type-safe\r
-   * enumerations.\r
-   */\r
-  public GQuery css(TakesLength cssProperty, Length value) {\r
-    for (Element e : elements()) {\r
-      cssProperty.set(e.getStyle(), value);\r
-    }\r
-    return this;\r
-  }\r
-\r
-  /**\r
-   * Set a shorthand style property taking 3 values on every matched element using type-safe\r
-   * enumerations. ex : $("#id").css(CSS.BORDER, BorderWidth.thick(),\r
-   * BorderStyle.DASHED, RGBColor.BLACK);\r
-   */\r
-  public <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> GQuery css(\r
-      T cssProperty, X value1, Y value2, Z value3) {\r
-    for (Element e : elements()) {\r
-      cssProperty.set(e.getStyle(), value1, value2, value3);\r
-    }\r
-    return this;\r
-  }\r
-  \r
-  /**\r
-   * Set a shorthand style property taking 3 values on every matched element using type-safe\r
-   * enumerations. ex : $("#id").css(CSS.BORDER, BorderWidth.thick(),\r
-   * BorderStyle.DASHED, RGBColor.BLACK);\r
-   */\r
-  public <W, X, Y, Z, T extends CssShorthandProperty4<W, X, Y, Z>> GQuery css(\r
-      T cssProperty, W value0, X value1, Y value2, Z value3) {\r
-    for (Element e : elements()) {\r
-      cssProperty.set(e.getStyle(), value0, value1, value2, value3);\r
-    }\r
-    return this;\r
-  }\r
-\r
-  /**\r
-   * Set a shorthand style property taking 5 values on every matched element using type-safe\r
-   * enumerations. ex : $("#id").css(CSS.BACKGROUND, RGBColor.TRANSPARENT,\r
-   * BackgroundImage.url("back.jpg"), BackgroundRepeat.NO_REPEAT,\r
-   * BackgroundAttachment.SCROLL, BackgroundPosition.CENTER);\r
-   */\r
-  public <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> GQuery css(\r
-      T cssProperty, V value1, W value2, X value3, Y value4, Z value5) {\r
-    for (Element e : elements()) {\r
-      cssProperty.set(e.getStyle(), value1, value2, value3, value4, value5);\r
-    }\r
-    return this;\r
-  }\r
+//  /**\r
+//   * Set CSS a single style property on every matched element using type-safe\r
+//   * enumerations.\r
+//   * \r
+//   */\r
+//  public GQuery css(TakesLength cssProperty, Length value) {\r
+//    for (Element e : elements()) {\r
+//      cssProperty.set(e.getStyle(), value);\r
+//    }\r
+//    return this;\r
+//  }\r
+//\r
+//  /**\r
+//   * Set a shorthand style property taking 3 values on every matched element using type-safe\r
+//   * enumerations. ex : $("#id").css(CSS.BORDER, BorderWidth.thick(),\r
+//   * BorderStyle.DASHED, RGBColor.BLACK);\r
+//   */\r
+//  public <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> GQuery css(\r
+//      T cssProperty, X value1, Y value2, Z value3) {\r
+//    for (Element e : elements()) {\r
+//      cssProperty.set(e.getStyle(), value1, value2, value3);\r
+//    }\r
+//    return this;\r
+//  }\r
+//  \r
+//  /**\r
+//   * Set a shorthand style property taking 3 values on every matched element using type-safe\r
+//   * enumerations. ex : $("#id").css(CSS.BORDER, BorderWidth.thick(),\r
+//   * BorderStyle.DASHED, RGBColor.BLACK);\r
+//   */\r
+//  public <W, X, Y, Z, T extends CssShorthandProperty4<W, X, Y, Z>> GQuery css(\r
+//      T cssProperty, W value0, X value1, Y value2, Z value3) {\r
+//    for (Element e : elements()) {\r
+//      cssProperty.set(e.getStyle(), value0, value1, value2, value3);\r
+//    }\r
+//    return this;\r
+//  }\r
+//\r
+//  /**\r
+//   * Set a shorthand style property taking 5 values on every matched element using type-safe\r
+//   * enumerations. ex : $("#id").css(CSS.BACKGROUND, RGBColor.TRANSPARENT,\r
+//   * BackgroundImage.url("back.jpg"), BackgroundRepeat.NO_REPEAT,\r
+//   * BackgroundAttachment.SCROLL, BackgroundPosition.CENTER);\r
+//   */\r
+//  public <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> GQuery css(\r
+//      T cssProperty, V value1, W value2, X value3, Y value4, Z value5) {\r
+//    for (Element e : elements()) {\r
+//      cssProperty.set(e.getStyle(), value1, value2, value3, value4, value5);\r
+//    }\r
+//    return this;\r
+//  }\r
 \r
   /**\r
    * Returns the numeric value of a css property.\r
@@ -2251,49 +2250,67 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
   }\r
 \r
   /**\r
-   * Set CSS property on the first element.\r
-   */\r
-  public <S, T extends TakeCssValue<S>> GQuery setCss(T cssProperty, S value) {\r
-    cssProperty.set(elements.getItem(0).getStyle(), value);\r
-    return this;\r
-  }\r
-\r
-  /**\r
-   * Set CSS property on first matched element using type-safe enumerations.\r
-   */\r
-  public GQuery setCss(TakesLength cssProperty, Length value) {\r
-    cssProperty.set(elements.getItem(0).getStyle(), value);\r
-    return this;\r
-  }\r
-\r
-  /**\r
-   * Set a multiple style property on first matched element using type-safe\r
+   * Set CSS a single style property on every matched element using type-safe\r
    * enumerations.\r
    * \r
-   * ex : $("#id").css(CSS.BORDER, BorderWidth.thick(), BorderStyle.DASHED,\r
-   * RGBColor.BLACK);\r
-   */\r
-  public <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> GQuery setCss(\r
-      T cssProperty, X value1, Y value2, Z value3) {\r
-    cssProperty.set(get(0).getStyle(), value1, value2, value3);\r
-\r
-    return this;\r
-  }\r
-\r
-  /**\r
-   * Set a multiple style property on first matched element using type-safe\r
-   * enumerations.\r
+   * The best way to use this method (i.e. to generate a CssSetter) is to take\r
+   * the desired css property defined in {@link CSS} class and call the\r
+   * {@link TakeCssValue#with(HasCssName)} method on it.\r
+   * \r
+   *  ex :\r
+   *  \r
+   *  $("#myDiv").css(CSS.TOP.with(Length.cm(15)));\r
+   *  $("#myDiv").css(CSS.BACKGROUND.with(RGBColor.SILVER, ImageValue.url(""), BackgroundRepeat.NO_REPEAT, BackgroundAttachment.FIXED, BackgroundPosition.CENTER)); \r
+   *  $("#myDiv").css(CSS.BACKGROUND_ATTACHMENT.with(BackgroundAttachment.FIXED));\r
    * \r
-   * ex : $("#id").css(CSS.BACKGROUND, RGBColor.TRANSPARENT,\r
-   * BackgroundImage.url("back.jpg"), BackgroundRepeat.NO_REPEAT,\r
-   * BackgroundAttachment.SCROLL, BackgroundPosition.CENTER);\r
    */\r
-  public <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> GQuery setCss(\r
-      T cssProperty, V value1, W value2, X value3, Y value4, Z value5) {\r
-    cssProperty.set(get(0).getStyle(), value1, value2, value3, value4, value5);\r
-\r
+  public GQuery setCss(CssSetter cssSetter) {\r
+    for (Element e : elements()) {\r
+      cssSetter.applyCss(e);\r
+    }\r
     return this;\r
   }\r
+//  public <S, T extends TakeCssValue<S>> GQuery setCss(T cssProperty, S value) {\r
+//    cssProperty.set(elements.getItem(0).getStyle(), value);\r
+//    return this;\r
+//  }\r
+//\r
+//  /**\r
+//   * Set CSS property on first matched element using type-safe enumerations.\r
+//   */\r
+//  public GQuery setCss(TakesLength cssProperty, Length value) {\r
+//    cssProperty.set(elements.getItem(0).getStyle(), value);\r
+//    return this;\r
+//  }\r
+//\r
+//  /**\r
+//   * Set a multiple style property on first matched element using type-safe\r
+//   * enumerations.\r
+//   * \r
+//   * ex : $("#id").css(CSS.BORDER, BorderWidth.thick(), BorderStyle.DASHED,\r
+//   * RGBColor.BLACK);\r
+//   */\r
+//  public <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> GQuery setCss(\r
+//      T cssProperty, X value1, Y value2, Z value3) {\r
+//    cssProperty.set(get(0).getStyle(), value1, value2, value3);\r
+//\r
+//    return this;\r
+//  }\r
+//\r
+//  /**\r
+//   * Set a multiple style property on first matched element using type-safe\r
+//   * enumerations.\r
+//   * \r
+//   * ex : $("#id").css(CSS.BACKGROUND, RGBColor.TRANSPARENT,\r
+//   * BackgroundImage.url("back.jpg"), BackgroundRepeat.NO_REPEAT,\r
+//   * BackgroundAttachment.SCROLL, BackgroundPosition.CENTER);\r
+//   */\r
+//  public <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> GQuery setCss(\r
+//      T cssProperty, V value1, W value2, X value3, Y value4, Z value5) {\r
+//    cssProperty.set(get(0).getStyle(), value1, value2, value3, value4, value5);\r
+//\r
+//    return this;\r
+//  }\r
 \r
   public void setPreviousObject(GQuery previousObject) {\r
     this.previousObject = previousObject;\r
index 5d915db7d4e6b3b3b15840ee39e5f8456ad8394a..38a31b24b6093d724dcd068f1ce8d670140eba87 100644 (file)
@@ -33,13 +33,11 @@ import com.google.gwt.dom.client.OptionElement;
 import com.google.gwt.dom.client.SelectElement;
 import com.google.gwt.dom.client.TextAreaElement;
 import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.HasCssName;
+import com.google.gwt.query.client.css.CSS;
 import com.google.gwt.query.client.css.CssProperty;
-import com.google.gwt.query.client.css.CssShorthandProperty3;
-import com.google.gwt.query.client.css.CssShorthandProperty4;
-import com.google.gwt.query.client.css.CssShorthandProperty5;
-import com.google.gwt.query.client.css.Length;
 import com.google.gwt.query.client.css.TakeCssValue;
-import com.google.gwt.query.client.css.TakesLength;
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;
 import com.google.gwt.query.client.impl.DocumentStyleImpl;
 import com.google.gwt.query.client.plugins.EventsListener;
 import com.google.gwt.user.client.DOM;
@@ -327,11 +325,7 @@ public interface LazyGQuery<T> extends LazyBase<T>{
    */
   LazyGQuery<T> css(String prop, String val);
 
-  /**
-   * Set CSS a single style property on every matched element using type-safe
-   * enumerations.
-   */
-  <S, T extends TakeCssValue<S>> LazyGQuery<T> css(T cssProperty, S value);
+  // <S, T extends TakeCssValue<S>> LazyGQuery<T> css(T cssProperty, S value);
 
   /**
    * Set CSS a single style property on every matched element using type-safe
@@ -345,33 +339,13 @@ public interface LazyGQuery<T> extends LazyBase<T>{
    */
   LazyGQuery<T> css(TakeCssValue<?> cssProperty, String value);
 
-  /**
-   * Set CSS a single style property on every matched element using type-safe
-   * enumerations.
-   */
-  LazyGQuery<T> css(TakesLength cssProperty, Length value);
+  // LazyGQuery<T> css(TakesLength cssProperty, Length value);
 
-  /**
-   * Set a shorthand style property taking 3 values on every matched element using type-safe
-   * enumerations. ex : $("#id").css(CSS.BORDER, BorderWidth.thick(),
-   * BorderStyle.DASHED, RGBColor.BLACK);
-   */
-  <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> LazyGQuery<T> css( T cssProperty, X value1, Y value2, Z value3);
+  // <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> LazyGQuery<T> css( // T cssProperty, X value1, Y value2, Z value3);
 
-  /**
-   * Set a shorthand style property taking 3 values on every matched element using type-safe
-   * enumerations. ex : $("#id").css(CSS.BORDER, BorderWidth.thick(),
-   * BorderStyle.DASHED, RGBColor.BLACK);
-   */
-  <W, X, Y, Z, T extends CssShorthandProperty4<W, X, Y, Z>> LazyGQuery<T> css( T cssProperty, W value0, X value1, Y value2, Z value3);
+  // <W, X, Y, Z, T extends CssShorthandProperty4<W, X, Y, Z>> LazyGQuery<T> css( // T cssProperty, W value0, X value1, Y value2, Z value3);
 
-  /**
-   * Set a shorthand style property taking 5 values on every matched element using type-safe
-   * enumerations. ex : $("#id").css(CSS.BACKGROUND, RGBColor.TRANSPARENT,
-   * BackgroundImage.url("back.jpg"), BackgroundRepeat.NO_REPEAT,
-   * BackgroundAttachment.SCROLL, BackgroundPosition.CENTER);
-   */
-  <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> LazyGQuery<T> css( T cssProperty, V value1, W value2, X value3, Y value4, Z value5);
+  // <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> LazyGQuery<T> css( // T cssProperty, V value1, W value2, X value3, Y value4, Z value5);
 
   /**
    * Returns the numeric value of a css property.
@@ -1058,33 +1032,29 @@ public interface LazyGQuery<T> extends LazyBase<T>{
   LazyGQuery<T> setArray(NodeList<Element> nodes);
 
   /**
-   * Set CSS property on the first element.
-   */
-  <S, T extends TakeCssValue<S>> LazyGQuery<T> setCss(T cssProperty, S value);
-
-  /**
-   * Set CSS property on first matched element using type-safe enumerations.
-   */
-  LazyGQuery<T> setCss(TakesLength cssProperty, Length value);
-
-  /**
-   * Set a multiple style property on first matched element using type-safe
+   * Set CSS a single style property on every matched element using type-safe
    * enumerations.
    * 
-   * ex : $("#id").css(CSS.BORDER, BorderWidth.thick(), BorderStyle.DASHED,
-   * RGBColor.BLACK);
-   */
-  <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> LazyGQuery<T> setCss( T cssProperty, X value1, Y value2, Z value3);
-
-  /**
-   * Set a multiple style property on first matched element using type-safe
-   * enumerations.
+   * The best way to use this method (i.e. to generate a CssSetter) is to take
+   * the desired css property defined in {@link CSS} class and call the
+   * {@link TakeCssValue#with(HasCssName)} method on it.
+   * 
+   *  ex :
+   *  
+   *  $("#myDiv").css(CSS.TOP.with(Length.cm(15)));
+   *  $("#myDiv").css(CSS.BACKGROUND.with(RGBColor.SILVER, ImageValue.url(""), BackgroundRepeat.NO_REPEAT, BackgroundAttachment.FIXED, BackgroundPosition.CENTER)); 
+   *  $("#myDiv").css(CSS.BACKGROUND_ATTACHMENT.with(BackgroundAttachment.FIXED));
    * 
-   * ex : $("#id").css(CSS.BACKGROUND, RGBColor.TRANSPARENT,
-   * BackgroundImage.url("back.jpg"), BackgroundRepeat.NO_REPEAT,
-   * BackgroundAttachment.SCROLL, BackgroundPosition.CENTER);
    */
-  <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> LazyGQuery<T> setCss( T cssProperty, V value1, W value2, X value3, Y value4, Z value5);
+  LazyGQuery<T> setCss(CssSetter cssSetter);
+
+  // <S, T extends TakeCssValue<S>> LazyGQuery<T> setCss(T cssProperty, S value);
+
+  // LazyGQuery<T> setCss(TakesLength cssProperty, Length value);
+
+  // <X, Y, Z, T extends CssShorthandProperty3<X, Y, Z>> LazyGQuery<T> setCss( // T cssProperty, X value1, Y value2, Z value3);
+
+  // <V, W, X, Y, Z, T extends CssShorthandProperty5<V, W, X, Y, Z>> LazyGQuery<T> setCss( // T cssProperty, V value1, W value2, X value3, Y value4, Z value5);
 
   void setPreviousObject(GQuery previousObject);
 
index 609ed483d5c82e49c56c9fee361eb9b991b8880b..ab44271fef574aef2b99c9aa34216f727f41bb8f 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.google.gwt.query.client.css;
 
+import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.HasCssName;
 
@@ -25,9 +26,39 @@ import com.google.gwt.dom.client.Style.HasCssName;
  */
 public abstract class AbstractCssProperty<T extends HasCssName> implements
     TakeCssValue<T> {
-  private String cssName;
+
+  protected class CssSetterImpl implements CssSetter {
+
+    private T cssValue;
+
+    public CssSetterImpl(T cssValue) {
+
+      this.cssValue = cssValue;
+    }
+
+    public void applyCss(Element e) {
+      assert e != null : "Impossible to apply css to a null object";
+      set(e.getStyle(), cssValue);
+    }
+  }
   
-  protected AbstractCssProperty(String cssName){
+  protected class LengthCssSetter implements CssSetter{
+    
+    private Length length;
+    
+    public LengthCssSetter(Length length) {
+      this.length = length;
+    }
+      
+    public void applyCss(Element e) {
+      assert e != null : "Impossible to apply css to a null object";
+      e.getStyle().setProperty(getCssName(), length.getCssName());   
+    }
+  }
+
+  private String cssName;
+
+  protected AbstractCssProperty(String cssName) {
     this.cssName = cssName;
   }
 
@@ -35,11 +66,15 @@ public abstract class AbstractCssProperty<T extends HasCssName> implements
     return s.getProperty(getCssName());
   }
 
-  public String getCssName(){
+  public String getCssName() {
     return cssName;
   }
 
   public void set(Style s, T value) {
     s.setProperty(getCssName(), value.getCssName());
   }
+
+  public CssSetter with(T value) {
+    return new CssSetterImpl(value);
+  }
 }
index b4b18dabdf63cd994f2368ed3b26d8d7b76cf8c8..f98c54baffd5a3336a50b210e4e93bc281e15f17 100644 (file)
@@ -136,6 +136,14 @@ public class BackgroundPositionProperty extends
       BOTTOM = new BackgroundPosition(BOTTOM_VALUE);
 
     }
+    
+    /**
+     * Return a {@link BackgroundPosition} by specifying the horizontal and
+     * vertical position. Pixel will be used as Unit
+     */
+    public static BackgroundPosition position(int xpos, int ypos) {
+      return position(xpos, ypos, Unit.PX);
+    }
 
     /**
      * Return a {@link BackgroundPosition} by specifying the horizontal and
index 1e562e03205d0436a1b20bd730860300c91fa93b..f8dcf5f6b55a95a56f0454ec1ef966c97c5200f6 100644 (file)
 package com.google.gwt.query.client.css;
 
 import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.HasCssName;
-import com.google.gwt.query.client.Properties;
 import com.google.gwt.query.client.css.BackgroundAttachmentProperty.BackgroundAttachment;
 import com.google.gwt.query.client.css.BackgroundPositionProperty.BackgroundPosition;
 import com.google.gwt.query.client.css.BackgroundRepeatProperty.BackgroundRepeat;
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;
 
 /**
  * The <i>'background'</i> property is a shorthand property for setting the
@@ -30,9 +29,7 @@ import com.google.gwt.query.client.css.BackgroundRepeatProperty.BackgroundRepeat
  * place in the style sheet.
  * 
  */
-public class BackgroundProperty
-    implements
-    CssShorthandProperty5<RGBColor, ImageValue, BackgroundRepeat, BackgroundAttachment, BackgroundPosition> {
+public class BackgroundProperty implements CssProperty {
 
   private static final String CSS_PROPERTY = "background";
 
@@ -56,31 +53,13 @@ public class BackgroundProperty
     return CSS_PROPERTY;
   }
 
-  public void set(Style s, RGBColor backgroundColor,
+  public CssSetter with(final RGBColor backgroundColor,
       ImageValue backgroundImage, BackgroundRepeat backgroundRepeat,
       BackgroundAttachment backgroundAttachment,
       BackgroundPosition backgroundPosition) {
 
-    String value = notNull(backgroundColor) + notNull(backgroundImage)
-        + notNull(backgroundRepeat) + notNull(backgroundAttachment)
-        + notNull(backgroundPosition).trim();
-    s.setProperty(CSS_PROPERTY, value);
-
-  }
-
-  private String notNull(HasCssName value) {
-    return value != null ? value.getCssName() + " " : "";
-  }
-  
-  public Properties with(RGBColor backgroundColor,
-      ImageValue backgroundImage, BackgroundRepeat backgroundRepeat,
-      BackgroundAttachment backgroundAttachment,
-      BackgroundPosition backgroundPosition) {
-    String s = getCssName() + ": \""  
-      + notNull(backgroundColor) + notNull(backgroundImage)
-      + notNull(backgroundRepeat) + notNull(backgroundAttachment)
-      + notNull(backgroundPosition).trim() +  "\"";
-    return Properties.create(s);
+    return new MultipleValueCssSetter(CSS_PROPERTY, backgroundColor,
+        backgroundImage, backgroundRepeat, backgroundAttachment,
+        backgroundPosition);
   }
-
 }
index e506c00efa389a28207396bb9c2fd5c413c73cba..80d71555cbab671ad4a22b6c4a1728c9a86eab04 100644 (file)
@@ -53,11 +53,7 @@ public class BackgroundRepeatProperty extends
   }
 
   private static final String CSS_PROPERTY = "backgroundRepeat";
-  /*private static final String NO_REPEAT_VALUE = "no-repeat";
-  private static final String REPEAT_VALUE = "repeat";
-  private static final String REPEAT_X_VALUE = "repeat-x";
 
-  private static final String REPEAT_Y_VALUE = "repeat-y";*/
 
   public static void init() {
     CSS.BACKGROUND_REPEAT = new BackgroundRepeatProperty();
index 4ca4737641b20f711e252af252b382a587f263e0..cc32be6e1f1f34da37d860965c62e189b4595b35 100644 (file)
@@ -16,9 +16,9 @@
 package com.google.gwt.query.client.css;
 
 import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.HasCssName;
 import com.google.gwt.query.client.css.BorderStyleProperty.LineStyle;
 import com.google.gwt.query.client.css.BorderWidthProperty.LineWidth;
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;
 
 /**
  * The <i>border</i> property is a shorthand property for setting the same
@@ -29,8 +29,7 @@ import com.google.gwt.query.client.css.BorderWidthProperty.LineWidth;
  * 
  * 
  */
-public class BorderProperty implements
-    CssShorthandProperty3<LineWidth, LineStyle, RGBColor> {
+public class BorderProperty implements CssProperty {
 
   private static final String BORDER_BOTTOM_PROPERTY = "borderBottom";
   private static final String BORDER_LEFT_PROPERTY = "borderLeft";
@@ -64,15 +63,14 @@ public class BorderProperty implements
     return cssProperty;
   }
 
-  public void set(Style s, LineWidth borderWidth, LineStyle borderStyle,
+  public CssSetter with(LineWidth borderWidth, LineStyle borderStyle,
       RGBColor borderColor) {
-    String value = notNull(borderWidth) + notNull(borderStyle)
-        + notNull(borderColor).trim();
-    s.setProperty(cssProperty, value);
+    return new MultipleValueCssSetter(getCssName(), borderWidth, borderStyle, borderColor);
   }
-
-  private String notNull(HasCssName value) {
-    return value != null ? value.getCssName() + " " : "";
+  
+  public CssSetter with(Length borderWidth, LineStyle borderStyle,
+      RGBColor borderColor) {
+    return new MultipleValueCssSetter(getCssName(), borderWidth, borderStyle, borderColor);
   }
 
 }
index 9c3a79f8fd067038ff3061b484b8908e41880ae8..032fed32ce2ab650d6fa2c7310f5e4134cec38c2 100644 (file)
@@ -15,9 +15,7 @@
  */
 package com.google.gwt.query.client.css;
 
-import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.HasCssName;
-import com.google.gwt.dom.client.Style.Unit;
 
 /**
  * The <i>border-width</i> property specifies the width of the border of a box.
@@ -28,52 +26,26 @@ public class BorderWidthProperty extends
   /**
    * Object allowing to specify a width of a line
    */
-  public static class LineWidth implements HasCssName {
+  public static enum LineWidth implements HasCssName {
 
     /**
      * Define a medium border.
      */
-    public static LineWidth MEDIUM;
+    MEDIUM,
 
     /**
      * Define a thick border.
      */
-    public static LineWidth THICK;
+    THICK,
 
     /**
      * Define a thin border.
      */
-    public static LineWidth THIN;
+    THIN;
 
-    static {
-      MEDIUM = new LineWidth("medium");
-      THICK = new LineWidth("thick");
-      THIN = new LineWidth("thin");
-
-    }
-
-    /**
-     * Return a {@link LineWidth} defining by an explicit value.
-     */
-    public static LineWidth length(int l, Unit unit) {
-      return new LineWidth("" + l + (unit != null ? unit.getType() : ""));
-    }
-
-    /**
-     * Return a {@link LineWidth} defining by a {@link Length}
-     */
-    public static LineWidth length(Length l) {
-      return new LineWidth(l.getCssName());
-    }
-
-    private String cssValue;
-
-    private LineWidth(String value) {
-      cssValue = value;
-    }
 
     public String getCssName() {
-      return cssValue;
+      return name().toLowerCase();
     }
 
   }
@@ -98,8 +70,7 @@ public class BorderWidthProperty extends
     super(value);
   }
 
-  public void set(Style s, Length p) {
-    s.setProperty(getCssName(), p.getCssName());
-
+  public CssSetter with(Length value) {
+    return new LengthCssSetter(value);
   }
 }
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty3.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty3.java
deleted file mode 100644 (file)
index b01290b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011, The gwtquery team.
- * 
- * Licensed 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 com.google.gwt.query.client.css;
-
-import com.google.gwt.dom.client.Style;
-
-/**
- * 
- * An enumerated CSS property with values of type X,Y,Z.
- */
-public interface CssShorthandProperty3<X, Y, Z> extends CssProperty {
-
-  /**
-   * Set the value of the css property
-   */
-  void set(Style s, X value1, Y value2, Z value3);
-
-}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty4.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty4.java
deleted file mode 100644 (file)
index d226da1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011, The gwtquery team.
- * 
- * Licensed 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 com.google.gwt.query.client.css;
-
-import com.google.gwt.dom.client.Style;
-
-/**
- * 
- * An enumerated CSS property with values of type W,X,Y,Z.
- */
-public interface CssShorthandProperty4<W, X, Y, Z> extends CssProperty{
-  
-  void set(Style s, W value0, X value1, Y value2, Z value3);
-
-}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty5.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty5.java
deleted file mode 100644 (file)
index 615acdd..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2011, The gwtquery team.
- * 
- * Licensed 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 com.google.gwt.query.client.css;
-
-import com.google.gwt.dom.client.Style;
-
-/**
- * 
- * An enumerated CSS property with values of type V, W, X,Y,Z.
- */
-public interface CssShorthandProperty5<V, W, X, Y, Z> extends CssProperty {
-
-  /**
-   * Set the value of the property.
-   */
-  void set(Style s, V value1, W value2, X value3, Y value4, Z value5);
-
-}
index 965c2a8059f308f0217a41d612b1e4dd7029ddf9..21ef54ebe509cea38a738f33a9af8de5326f03b6 100644 (file)
@@ -33,7 +33,4 @@ public class EdgePositionProperty extends AbstractCssProperty<Length> {
     super(value);
   }
   
-  public Properties with(Length value) {
-    return Properties.create(getCssName() + ":'" + value.getCssName() + "'");
-  }
 }
index 203989daa7fb7cb15cca4202f7033a24dd3e1e23..160a64bf43160133df36b4b37428f1b3f3804c7e 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.query.client.css;
 
-import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.HasCssName;
 
 /**
@@ -88,11 +87,7 @@ public class FontSizeProperty extends
     super(CSS_PROPERTY);
   }
 
-  /**
-   * Sets the font-size to a fixed size in px, cm,..
-   */
-  public void set(Style s, Length p) {
-    s.setProperty(CSS_PROPERTY, p.getCssName());
-
+  public CssSetter with(Length value) {
+    return new LengthCssSetter(value);
   }
 }
index 95000107967325848f0e0ee42dc4789d2c8fc654..fe781f39ba88813b9801375300a32e665d0b2408 100644 (file)
@@ -48,5 +48,9 @@ public class LineHeightProperty extends AbstractCssProperty<CssNumber>
     s.setProperty(CSS_PROPERTY, p.getCssName());
 
   }
+  
+  public CssSetter with(Length value) {
+    return new LengthCssSetter(value);
+  }
 
 }
index bf3a0c0800c2401e776e85245c824023d2cea180..6f4178a6f1ac11cbe391a0c386f9e1a89bfac619 100644 (file)
 package com.google.gwt.query.client.css;
 
 import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.HasCssName;
 import com.google.gwt.dom.client.Style.ListStyleType;
 import com.google.gwt.query.client.css.ListStylePositionProperty.ListStylePosition;
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;
 
 /**
  * The <i>list-style</i> property is a shorthand notation for setting the three
  * properties <i>list-style-type</i>, <i>list-style-image</i>, and
  * <i>list-style-position</i> at the same place in the style sheet.
  */
-public class ListStyleProperty implements
-    CssShorthandProperty3<ListStyleType, ListStylePosition, ImageValue> {
+public class ListStyleProperty implements CssProperty {
 
   private static final String CSS_PROPERTY = "listStyle";
 
@@ -48,15 +47,10 @@ public class ListStyleProperty implements
     return CSS_PROPERTY;
   }
 
-  public void set(Style s, ListStyleType listStyleType,
+  public CssSetter with(ListStyleType listStyleType,
       ListStylePosition listStylePosition, ImageValue listStyleImage) {
-    String value = notNull(listStyleType) + notNull(listStylePosition)
-        + notNull(listStyleImage).trim();
-    s.setProperty(CSS_PROPERTY, value);
-  }
-
-  private String notNull(HasCssName value) {
-    return value != null ? value.getCssName() + " " : "";
+    return new MultipleValueCssSetter(CSS_PROPERTY, listStyleType,
+        listStylePosition, listStyleImage);
   }
 
 }
index abf3afcc4f023ff198f0b952a31b30272a46daa2..9d2323658c56405c4e8901daa7fba26303754f4e 100644 (file)
 package com.google.gwt.query.client.css;
 
 import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.HasCssName;
 
 /**
  * The margin property sets the margins of an element.
  */
 public class MarginProperty extends AbstractCssProperty<Length> {
 
-  public static class ShorthandMarginProperty implements CssShorthandProperty4<Length, Length, Length, Length>{
+  public static class ShorthandMarginProperty implements CssProperty {
 
-    private  ShorthandMarginProperty() {
+    private ShorthandMarginProperty() {
     }
-    
+
     public String get(Style s) {
       return s.getMargin();
     }
@@ -36,18 +35,15 @@ public class MarginProperty extends AbstractCssProperty<Length> {
       return MARGIN_PROPERTY;
     }
 
-    public void set(Style s, Length margin1, Length margin2, Length margin3,
+    public CssSetter with(Length margin1, Length margin2, Length margin3,
         Length margin4) {
-      String margin = notNull(margin1)+notNull(margin2)+notNull(margin3)+notNull(margin4);
-      s.setProperty(MARGIN_PROPERTY, margin.trim());
-      
-    }
-    
-    private String notNull(HasCssName value) {
-      return value != null ? value.getCssName() + " " : "";
+      return new MultipleValueCssSetter(getCssName(), margin1, margin2,
+          margin3, margin4);
+
     }
-    
+
   }
+
   private static String MARGIN_BOTTOM_PROPERTY = "marginBottom";
   private static String MARGIN_LEFT_PROPERTY = "marginLeft";
   private static String MARGIN_PROPERTY = "margin";
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/MultipleValueCssSetter.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/MultipleValueCssSetter.java
new file mode 100644 (file)
index 0000000..cdf018f
--- /dev/null
@@ -0,0 +1,38 @@
+package com.google.gwt.query.client.css;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.HasCssName;
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;
+
+public class MultipleValueCssSetter implements CssSetter {
+
+  private String cssValue;
+  private String cssPropertyName;
+  
+  public MultipleValueCssSetter(String cssPropertyName, HasCssName... values) {
+    computeValue(values);
+    this.cssPropertyName = cssPropertyName;
+  }
+  
+  protected void computeValue(HasCssName... values){
+    StringBuilder valueBuilder = new StringBuilder();
+    
+    for (HasCssName cssValue : values){
+      valueBuilder.append(notNull(cssValue));
+    }
+
+    cssValue = valueBuilder.toString().trim();
+  }
+
+  public void applyCss(Element e) {
+    assert e != null : "Impossible to apply css to a null object";
+    e.getStyle().setProperty(cssPropertyName, cssValue);
+    
+  }
+  
+
+  private String notNull(HasCssName value) {
+    return value != null ? value.getCssName() + " " : "";
+  }
+  
+}
index 69f00979c3660053a8815c145f1aabf6fac588fa..d97d6084af726ac361e3114c55855c2be24f1f70 100644 (file)
@@ -16,9 +16,9 @@
 package com.google.gwt.query.client.css;
 
 import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.HasCssName;
 import com.google.gwt.query.client.css.BorderStyleProperty.LineStyle;
 import com.google.gwt.query.client.css.BorderWidthProperty.LineWidth;
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;
 
 /**
  * An outline is a line that is drawn around elements (outside the borders) to
@@ -28,7 +28,7 @@ import com.google.gwt.query.client.css.BorderWidthProperty.LineWidth;
  * declaration.
  */
 public class OutlineProperty implements
-    CssShorthandProperty3<RGBColor, LineStyle, LineWidth> {
+    CssProperty{
 
   private static final String CSS_PROPERTY = "outline";
 
@@ -50,15 +50,15 @@ public class OutlineProperty implements
     return CSS_PROPERTY;
   }
 
-  public void set(Style s, RGBColor outlineColor, LineStyle outlineStyle,
+  public CssSetter with(RGBColor outlineColor, LineStyle outlineStyle,
       LineWidth outlineWidth) {
-    String value = notNull(outlineColor) + notNull(outlineStyle)
-        + notNull(outlineWidth).trim();
-    s.setProperty(CSS_PROPERTY, value);
+    return new MultipleValueCssSetter(CSS_PROPERTY, outlineColor, outlineStyle, outlineWidth);
   }
 
-  private String notNull(HasCssName value) {
-    return value != null ? value.getCssName() + " " : "";
+  public CssSetter with(RGBColor outlineColor, LineStyle outlineStyle,
+      Length outlineWidth) {
+    return new MultipleValueCssSetter(CSS_PROPERTY, outlineColor, outlineStyle, outlineWidth);
   }
 
+
 }
index 5fbbc402a94c87d09e103967d7bbdca76aa2f131..c7f27e5fda5fc9fcc35ca3a36f3c1b60117f1b0b 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.query.client.css;
 
-import com.google.gwt.dom.client.Style;
 import com.google.gwt.query.client.css.BorderWidthProperty.LineWidth;
 
 /**
@@ -35,9 +34,8 @@ public class OutlineWidthProperty extends AbstractCssProperty<LineWidth>
   private OutlineWidthProperty() {
     super(CSS_PROPERTY);
   }
-
-  public void set(Style s, Length p) {
-    s.setProperty(CSS_PROPERTY, p.getCssName());
-
+  
+  public CssSetter with(Length value) {
+    return new LengthCssSetter(value);
   }
 }
index 29bee650a71901657166d8ca8abc869a4ec7f6a9..e517db07bf5a2cbf68f6f2ee24a12ce8cc564bf3 100644 (file)
@@ -16,7 +16,6 @@
 package com.google.gwt.query.client.css;
 
 import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.HasCssName;
 
 /**
  * The padding properties define the space between the element border and the
@@ -24,16 +23,16 @@ import com.google.gwt.dom.client.Style.HasCssName;
  */
 public class PaddingProperty extends AbstractCssProperty<Length> {
 
-  public static class ShorthandPaddingProperty implements CssShorthandProperty4<Length, Length, Length, Length>{
+  public static class ShorthandPaddingProperty implements CssProperty {
 
-    private  ShorthandPaddingProperty() {
+    private ShorthandPaddingProperty() {
     }
-    
-    public void set(Style s, Length margin1, Length margin2, Length margin3,
-        Length margin4) {
-      String margin = notNull(margin1)+notNull(margin2)+notNull(margin3)+notNull(margin4);
-      s.setProperty(PADDING_PROPERTY, margin.trim());
-      
+
+    public CssSetter with(Length padding1, Length padding2, Length padding3,
+        Length padding4) {
+      return new MultipleValueCssSetter(getCssName(), padding1, padding2,
+          padding3, padding4);
+
     }
 
     public String get(Style s) {
@@ -43,13 +42,9 @@ public class PaddingProperty extends AbstractCssProperty<Length> {
     public String getCssName() {
       return PADDING_PROPERTY;
     }
-    
-    private String notNull(HasCssName value) {
-      return value != null ? value.getCssName() + " " : "";
-    }
-    
+
   }
-  
+
   private static String PADDING_BOTTOM_PROPERTY = "paddingBottom";
   private static String PADDING_LEFT_PROPERTY = "paddingLeft";
   private static String PADDING_PROPERTY = "padding";
index ae02c1b01ea72310aaac1412fb4610d29137ef04..8157e8ba6847f2e5a7be8e24a3c27b4a7e187914 100644 (file)
  */
 package com.google.gwt.query.client.css;
 
-import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style.HasCssName;
 
 /**
  * An CSS property with values of type T.
  */
-public interface TakeCssValue<T> extends CssProperty {
+public interface TakeCssValue<T extends HasCssName> extends CssProperty {
 
-  /**
-   * Set the style to the given value.
-   * 
-   * @param value a value from the enumerated type T
-   */
-  void set(Style s, T value);
+  public interface CssSetter {
+    public void applyCss(Element e);
+  }
+
+
+  CssSetter with(T value);
 
 }
index b089a3bca907938b87d16770093e7b30cb9b262f..2fbe5bbd980199ee1cf0a0e1d540cb06149cfb92 100644 (file)
@@ -15,7 +15,7 @@
  */
 package com.google.gwt.query.client.css;
 
-import com.google.gwt.dom.client.Style;
+import com.google.gwt.query.client.css.TakeCssValue.CssSetter;
 
 /**
  * Interface to be implemented by properties which take length units in addition
@@ -24,5 +24,5 @@ import com.google.gwt.dom.client.Style;
  */
 public interface TakesLength {
 
-  void set(Style s, Length p);
+  CssSetter with(Length value);
 }
index 480faed1b6e187c8a441e892e2af93e6a7632964..65976168b581609e2cbaea84d66b35381e9c65ab 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.google.gwt.query.client.css;
 
-import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.VerticalAlign;
 
 /**
@@ -35,8 +34,8 @@ public class VerticalAlignProperty extends AbstractCssProperty<VerticalAlign>
     super(CSS_PROPERTY);
   }
 
-  public void set(Style s, Length p) {
-    s.setProperty(CSS_PROPERTY, p.getCssName());
+  public CssSetter with(Length value) {
+    return new LengthCssSetter(value);
   }
 
 }
index ebf1c7ab1bc689646591d68ebb10c4883f1555fd..f5f5b90dcb72f3e1f87cd6a9d94f792e52d83eb3 100644 (file)
@@ -84,12 +84,14 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BACKGROUND_ATTACHMENT, BackgroundAttachment.FIXED);
+    $("#test").setCss(
+        CSS.BACKGROUND_ATTACHMENT.with(BackgroundAttachment.FIXED));
 
     assertEquals("fixed", $("#test").css("backgroundAttachment"));
     assertEquals("fixed", $("#test").css(CSS.BACKGROUND_ATTACHMENT));
 
-    $("#test").css(CSS.BACKGROUND_ATTACHMENT, BackgroundAttachment.SCROLL);
+    $("#test").setCss(
+        CSS.BACKGROUND_ATTACHMENT.with(BackgroundAttachment.SCROLL));
 
     assertEquals("scroll", $("#test").css("backgroundAttachment"));
     assertEquals("scroll", $("#test").css(CSS.BACKGROUND_ATTACHMENT));
@@ -100,17 +102,17 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BACKGROUND_COLOR, RGBColor.AQUA);
+    $("#test").setCss(CSS.BACKGROUND_COLOR.with(RGBColor.AQUA));
 
     assertEquals("aqua", $("#test").css("backgroundColor"));
     assertEquals("aqua", $("#test").css(CSS.BACKGROUND_COLOR));
 
-    $("#test").css(CSS.BACKGROUND_COLOR, RGBColor.rgb("#112233"));
+    $("#test").setCss(CSS.BACKGROUND_COLOR.with(RGBColor.rgb("#112233")));
 
     assertEquals("#112233", $("#test").css("backgroundColor"));
     assertEquals("#112233", $("#test").css(CSS.BACKGROUND_COLOR));
 
-    $("#test").css(CSS.BACKGROUND_COLOR, RGBColor.rgb(35, 45, 55));
+    $("#test").setCss(CSS.BACKGROUND_COLOR.with(RGBColor.rgb(35, 45, 55)));
     assertEquals("rgb(35,45,55)", $("#test").css("backgroundColor"));
     assertEquals("rgb(35,45,55)", $("#test").css(CSS.BACKGROUND_COLOR));
 
@@ -120,7 +122,7 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BACKGROUND_IMAGE, ImageValue.url("image.jpg"));
+    $("#test").setCss(CSS.BACKGROUND_IMAGE.with(ImageValue.url("image.jpg")));
 
     assertEquals("url('image.jpg')", $("#test").css("backgroundImage"));
     assertEquals("url('image.jpg')", $("#test").css(CSS.BACKGROUND_IMAGE));
@@ -130,49 +132,59 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.CENTER);
+    $("#test").setCss(CSS.BACKGROUND_POSITION.with(BackgroundPosition.CENTER));
     assertEquals("center", $("#test").css("backgroundPosition"));
     assertEquals("center", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.CENTER_CENTER);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.CENTER_CENTER));
     assertEquals("center center", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.CENTER_TOP);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.CENTER_TOP));
     assertEquals("center top", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.CENTER_BOTTOM);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.CENTER_BOTTOM));
     assertEquals("center bottom", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.LEFT);
+    $("#test").setCss(CSS.BACKGROUND_POSITION.with(BackgroundPosition.LEFT));
     assertEquals("left", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.LEFT_TOP);
+    $("#test").setCss(CSS.BACKGROUND_POSITION.with(BackgroundPosition.LEFT_TOP));
     assertEquals("left top", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.LEFT_CENTER);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.LEFT_CENTER));
     assertEquals("left center", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.LEFT_BOTTOM);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.LEFT_BOTTOM));
     assertEquals("left bottom", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.RIGHT);
+    $("#test").setCss(CSS.BACKGROUND_POSITION.with(BackgroundPosition.RIGHT));
     assertEquals("right", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.RIGHT_TOP);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.RIGHT_TOP));
     assertEquals("right top", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.RIGHT_CENTER);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.RIGHT_CENTER));
     assertEquals("right center", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION, BackgroundPosition.RIGHT_BOTTOM);
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.RIGHT_BOTTOM));
     assertEquals("right bottom", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION,
-        BackgroundPosition.position(12, 12, Unit.PX));
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.position(12, 12,
+            Unit.PX)));
     assertEquals("12px 12px", $("#test").css(CSS.BACKGROUND_POSITION));
 
-    $("#test").css(CSS.BACKGROUND_POSITION,
-        BackgroundPosition.position(12, 12, Unit.PCT));
+    $("#test").setCss(
+        CSS.BACKGROUND_POSITION.with(BackgroundPosition.position(12, 12,
+            Unit.PCT)));
     assertEquals("12% 12%", $("#test").css(CSS.BACKGROUND_POSITION));
 
   }
@@ -181,9 +193,10 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BACKGROUND, RGBColor.TRANSPARENT,
-        ImageValue.url("back.jpg"), BackgroundRepeat.NO_REPEAT,
-        BackgroundAttachment.SCROLL, BackgroundPosition.CENTER);
+    $("#test").setCss(
+        CSS.BACKGROUND.with(RGBColor.TRANSPARENT, ImageValue.url("back.jpg"),
+            BackgroundRepeat.NO_REPEAT, BackgroundAttachment.SCROLL,
+            BackgroundPosition.CENTER));
     assertEquals("transparent url('back.jpg') no-repeat scroll center", $(
         "#test").css("background"));
     assertEquals("transparent url('back.jpg') no-repeat scroll center", $(
@@ -195,84 +208,84 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BACKGROUND_REPEAT, BackgroundRepeat.REPEAT_X);
+    $("#test").setCss(CSS.BACKGROUND_REPEAT.with(BackgroundRepeat.REPEAT_X));
 
     assertEquals("repeat-x", $("#test").css("backgroundRepeat"));
     assertEquals("repeat-x", $("#test").css(CSS.BACKGROUND_REPEAT));
   }
-  
+
   public void testBorderCollapseProperty() {
 
     $(e).html("<table id='test'><tr><td>Content<td></tr></table>");
 
-    $("#test").css(CSS.BORDER_COLLAPSE, BorderCollapse.COLLAPSE);
+    $("#test").setCss(CSS.BORDER_COLLAPSE.with(BorderCollapse.COLLAPSE));
 
     assertEquals("collapse", $("#test").css("borderCollapse"));
     assertEquals("collapse", $("#test").css(CSS.BORDER_COLLAPSE));
-    
-    $("#test").css(CSS.BORDER_COLLAPSE, BorderCollapse.SEPARATE);
+
+    $("#test").setCss(CSS.BORDER_COLLAPSE.with(BorderCollapse.SEPARATE));
 
     assertEquals("separate", $("#test").css("borderCollapse"));
     assertEquals("separate", $("#test").css(CSS.BORDER_COLLAPSE));
   }
-  
+
   public void testCaptionSideProperty() {
 
     $(e).html("<table id='test'><tr><td>Content<td></tr></table>");
 
-    $("#test").css(CSS.CAPTION_SIDE, CaptionSide.BOTTOM);
+    $("#test").setCss(CSS.CAPTION_SIDE.with(CaptionSide.BOTTOM));
     assertEquals("bottom", $("#test").css("captionSide"));
     assertEquals("bottom", $("#test").css(CSS.CAPTION_SIDE));
-    
+
   }
 
-  
   public void testEmptyCellsProperty() {
 
     $(e).html("<table id='test'><tr><td>Content<td></tr></table>");
 
-    $("#test").css(CSS.EMPTY_CELLS, EmptyCellsProperty.EmptyCells.HIDE);
+    $("#test").setCss(CSS.EMPTY_CELLS.with(EmptyCellsProperty.EmptyCells.HIDE));
     assertEquals("hide", $("#test").css("emptyCells"));
     assertEquals("hide", $("#test").css(CSS.EMPTY_CELLS));
-    
+
   }
 
-  
   public void testBorderSpacingProperty() {
 
     $(e).html("<table id='test'><tr><td>Content<td></tr></table>");
 
-    $("#test").css(CSS.BORDER_SPACING, new BorderSpacing(Length.px(15)));
+    $("#test").setCss(CSS.BORDER_SPACING.with(new BorderSpacing(Length.px(15))));
 
     assertEquals("15px 15px", $("#test").css("borderSpacing"));
     assertEquals("15px 15px", $("#test").css(CSS.BORDER_SPACING));
-    
-    $("#test").css(CSS.BORDER_SPACING, new BorderSpacing(Length.px(10), Length.em(20)));
+
+    $("#test").setCss(
+        CSS.BORDER_SPACING.with(new BorderSpacing(Length.px(10), Length.em(20))));
 
     assertEquals("10px 20em", $("#test").css("borderSpacing"));
     assertEquals("10px 20em", $("#test").css(CSS.BORDER_SPACING));
   }
+
   public void testBorderColorProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BORDER_COLOR, RGBColor.AQUA);
+    $("#test").setCss(CSS.BORDER_COLOR.with(RGBColor.AQUA));
     assertEquals("aqua", $("#test").css("borderColor"));
     assertEquals("aqua", $("#test").css(CSS.BORDER_COLOR));
 
-    $("#test").css(CSS.BORDER_BOTTOM_COLOR, RGBColor.BLACK);
+    $("#test").setCss(CSS.BORDER_BOTTOM_COLOR.with(RGBColor.BLACK));
     assertEquals("black", $("#test").css("borderBottomColor"));
     assertEquals("black", $("#test").css(CSS.BORDER_BOTTOM_COLOR));
 
-    $("#test").css(CSS.BORDER_TOP_COLOR, RGBColor.FUSCHIA);
+    $("#test").setCss(CSS.BORDER_TOP_COLOR.with(RGBColor.FUSCHIA));
     assertEquals("fuschia", $("#test").css("borderTopColor"));
     assertEquals("fuschia", $("#test").css(CSS.BORDER_TOP_COLOR));
 
-    $("#test").css(CSS.BORDER_LEFT_COLOR, RGBColor.GRAY);
+    $("#test").setCss(CSS.BORDER_LEFT_COLOR.with(RGBColor.GRAY));
     assertEquals("gray", $("#test").css("borderLeftColor"));
     assertEquals("gray", $("#test").css(CSS.BORDER_LEFT_COLOR));
 
-    $("#test").css(CSS.BORDER_RIGHT_COLOR, RGBColor.WHITE);
+    $("#test").setCss(CSS.BORDER_RIGHT_COLOR.with(RGBColor.WHITE));
     assertEquals("white", $("#test").css("borderRightColor"));
     assertEquals("white", $("#test").css(CSS.BORDER_RIGHT_COLOR));
 
@@ -282,33 +295,34 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BORDER, LineWidth.THICK, LineStyle.DASHED,
-        RGBColor.BLACK);
+    $("#test").setCss(
+        CSS.BORDER.with(LineWidth.THICK, LineStyle.DASHED, RGBColor.BLACK));
     assertEquals("thick dashed black", $("#test").css("border"));
     assertEquals("thick dashed black", $("#test").css(CSS.BORDER));
 
-    $("#test").css(CSS.BORDER, LineWidth.length(15, Unit.PX),
-        LineStyle.SOLID, RGBColor.rgb("#000000"));
+    $("#test").setCss(
+        CSS.BORDER.with(Length.px(15), LineStyle.SOLID, RGBColor.rgb("#000000")));
     assertEquals("15px solid #000000", $("#test").css("border"));
     assertEquals("15px solid #000000", $("#test").css(CSS.BORDER));
-    
-    $("#test").css(CSS.BORDER_TOP, LineWidth.MEDIUM, LineStyle.SOLID,
-        RGBColor.GRAY);
+
+    $("#test").setCss(
+        CSS.BORDER_TOP.with(LineWidth.MEDIUM, LineStyle.SOLID, RGBColor.GRAY));
     assertEquals("medium solid gray", $("#test").css("borderTop"));
     assertEquals("medium solid gray", $("#test").css(CSS.BORDER_TOP));
-    
-    $("#test").css(CSS.BORDER_BOTTOM, LineWidth.THIN, LineStyle.DOUBLE,
-        RGBColor.FUSCHIA);
+
+    $("#test").setCss(
+        CSS.BORDER_BOTTOM.with(LineWidth.THIN, LineStyle.DOUBLE,
+            RGBColor.FUSCHIA));
     assertEquals("thin double fuschia", $("#test").css("borderBottom"));
     assertEquals("thin double fuschia", $("#test").css(CSS.BORDER_BOTTOM));
-    
-    $("#test").css(CSS.BORDER_LEFT, LineWidth.THIN, LineStyle.SOLID,
-        RGBColor.BLACK);
+
+    $("#test").setCss(
+        CSS.BORDER_LEFT.with(LineWidth.THIN, LineStyle.SOLID, RGBColor.BLACK));
     assertEquals("thin solid black", $("#test").css("borderLeft"));
     assertEquals("thin solid black", $("#test").css(CSS.BORDER_LEFT));
-    
-    $("#test").css(CSS.BORDER_RIGHT, LineWidth.MEDIUM, LineStyle.DASHED,
-        RGBColor.GRAY);
+
+    $("#test").setCss(
+        CSS.BORDER_RIGHT.with(LineWidth.MEDIUM, LineStyle.DASHED, RGBColor.GRAY));
     assertEquals("medium dashed gray", $("#test").css("borderRight"));
     assertEquals("medium dashed gray", $("#test").css(CSS.BORDER_RIGHT));
 
@@ -318,23 +332,23 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BORDER_STYLE, LineStyle.DOTTED);
+    $("#test").setCss(CSS.BORDER_STYLE.with(LineStyle.DOTTED));
     assertEquals("dotted", $("#test").css("borderStyle"));
     assertEquals("dotted", $("#test").css(CSS.BORDER_STYLE));
 
-    $("#test").css(CSS.BORDER_BOTTOM_STYLE, LineStyle.DASHED);
+    $("#test").setCss(CSS.BORDER_BOTTOM_STYLE.with(LineStyle.DASHED));
     assertEquals("dashed", $("#test").css("borderBottomStyle"));
     assertEquals("dashed", $("#test").css(CSS.BORDER_BOTTOM_STYLE));
 
-    $("#test").css(CSS.BORDER_TOP_STYLE, LineStyle.DOUBLE);
+    $("#test").setCss(CSS.BORDER_TOP_STYLE.with(LineStyle.DOUBLE));
     assertEquals("double", $("#test").css("borderTopStyle"));
     assertEquals("double", $("#test").css(CSS.BORDER_TOP_STYLE));
 
-    $("#test").css(CSS.BORDER_LEFT_STYLE, LineStyle.HIDDEN);
+    $("#test").setCss(CSS.BORDER_LEFT_STYLE.with(LineStyle.HIDDEN));
     assertEquals("hidden", $("#test").css("borderLeftStyle"));
     assertEquals("hidden", $("#test").css(CSS.BORDER_LEFT_STYLE));
 
-    $("#test").css(CSS.BORDER_RIGHT_STYLE, LineStyle.SOLID);
+    $("#test").setCss(CSS.BORDER_RIGHT_STYLE.with(LineStyle.SOLID));
     assertEquals("solid", $("#test").css("borderRightStyle"));
     assertEquals("solid", $("#test").css(CSS.BORDER_RIGHT_STYLE));
 
@@ -344,32 +358,32 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.BORDER_WIDTH, LineWidth.MEDIUM);
+    $("#test").setCss(CSS.BORDER_WIDTH.with(LineWidth.MEDIUM));
     assertEquals("medium", $("#test").css("borderWidth"));
     assertEquals("medium", $("#test").css(CSS.BORDER_WIDTH));
 
-    $("#test").css(CSS.BORDER_WIDTH, Length.px(15));
+    $("#test").setCss(CSS.BORDER_WIDTH.with(Length.px(15)));
     assertEquals("15px", $("#test").css(CSS.BORDER_WIDTH));
 
-    $("#test").css(CSS.BORDER_WIDTH, LineWidth.length(Length.px(20)));
+    $("#test").setCss(CSS.BORDER_WIDTH.with(Length.px(20)));
     assertEquals("20px", $("#test").css(CSS.BORDER_WIDTH));
 
-    $("#test").css(CSS.BORDER_WIDTH, LineWidth.length(20, Unit.MM));
+    $("#test").setCss(CSS.BORDER_WIDTH.with(Length.mm(20)));
     assertEquals("20mm", $("#test").css(CSS.BORDER_WIDTH));
 
-    $("#test").css(CSS.BORDER_BOTTOM_WIDTH, LineWidth.THICK);
+    $("#test").setCss(CSS.BORDER_BOTTOM_WIDTH.with(LineWidth.THICK));
     assertEquals("thick", $("#test").css("borderBottomWidth"));
     assertEquals("thick", $("#test").css(CSS.BORDER_BOTTOM_WIDTH));
 
-    $("#test").css(CSS.BORDER_TOP_WIDTH, LineWidth.THIN);
+    $("#test").setCss(CSS.BORDER_TOP_WIDTH.with(LineWidth.THIN));
     assertEquals("thin", $("#test").css("borderTopWidth"));
     assertEquals("thin", $("#test").css(CSS.BORDER_TOP_WIDTH));
 
-    $("#test").css(CSS.BORDER_LEFT_WIDTH, LineWidth.THIN);
+    $("#test").setCss(CSS.BORDER_LEFT_WIDTH.with(LineWidth.THIN));
     assertEquals("thin", $("#test").css("borderLeftWidth"));
     assertEquals("thin", $("#test").css(CSS.BORDER_LEFT_WIDTH));
 
-    $("#test").css(CSS.BORDER_RIGHT_WIDTH, LineWidth.THICK);
+    $("#test").setCss(CSS.BORDER_RIGHT_WIDTH.with(LineWidth.THICK));
     assertEquals("thick", $("#test").css("borderRightWidth"));
     assertEquals("thick", $("#test").css(CSS.BORDER_RIGHT_WIDTH));
 
@@ -379,17 +393,17 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.CLEAR, Clear.BOTH);
+    $("#test").setCss(CSS.CLEAR.with(Clear.BOTH));
     assertEquals("both", $("#test").css("clear"));
     assertEquals("both", $("#test").css(CSS.CLEAR));
-    
-    $("#test").css(CSS.CLEAR, Clear.LEFT);
+
+    $("#test").setCss(CSS.CLEAR.with(Clear.LEFT));
     assertEquals("left", $("#test").css(CSS.CLEAR));
-    
-    $("#test").css(CSS.CLEAR, Clear.RIGHT);
+
+    $("#test").setCss(CSS.CLEAR.with(Clear.RIGHT));
     assertEquals("right", $("#test").css(CSS.CLEAR));
-    
-    $("#test").css(CSS.CLEAR, Clear.NONE);
+
+    $("#test").setCss(CSS.CLEAR.with(Clear.NONE));
     assertEquals("none", $("#test").css(CSS.CLEAR));
 
   }
@@ -398,7 +412,7 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.CLIP, Shape.rect(0, 10, 10, 0));
+    $("#test").setCss(CSS.CLIP.with(Shape.rect(0, 10, 10, 0)));
     assertEquals("rect(0px,10px,10px,0px)", $("#test").css("clip"));
     assertEquals("rect(0px,10px,10px,0px)", $("#test").css(CSS.CLIP));
   }
@@ -407,90 +421,90 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.COLOR, RGBColor.AQUA);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.AQUA));
 
     assertEquals("aqua", $("#test").css("color"));
     assertEquals("aqua", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.rgb("#112233"));
+    $("#test").setCss(CSS.COLOR.with(RGBColor.rgb("#112233")));
 
     assertEquals("#112233", $("#test").css("color"));
     assertEquals("#112233", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.rgb(35, 45, 55));
+    $("#test").setCss(CSS.COLOR.with(RGBColor.rgb(35, 45, 55)));
     assertEquals("rgb(35,45,55)", $("#test").css("color"));
     assertEquals("rgb(35,45,55)", $("#test").css(CSS.COLOR));
 
   }
-  
+
   public void testColorValue() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.COLOR, RGBColor.AQUA);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.AQUA));
     assertEquals("aqua", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.BLACK);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.BLACK));
     assertEquals("black", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.FUSCHIA);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.FUSCHIA));
     assertEquals("fuschia", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.GRAY);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.GRAY));
     assertEquals("gray", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.GREEN);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.GREEN));
     assertEquals("green", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.LIME);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.LIME));
     assertEquals("lime", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.MAROON);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.MAROON));
     assertEquals("maroon", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.NAVY);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.NAVY));
     assertEquals("navy", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.OLIVE);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.OLIVE));
     assertEquals("olive", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.ORANGE);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.ORANGE));
     assertEquals("orange", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.PURPLE);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.PURPLE));
     assertEquals("purple", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.RED);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.RED));
     assertEquals("red", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.SILVER);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.SILVER));
     assertEquals("silver", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.TEAL);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.TEAL));
     assertEquals("teal", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.TRANSPARENT);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.TRANSPARENT));
     assertEquals("transparent", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.WHITE);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.WHITE));
     assertEquals("white", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.YELLOW);
+    $("#test").setCss(CSS.COLOR.with(RGBColor.YELLOW));
     assertEquals("yellow", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.rgb("#112233"));
+    $("#test").setCss(CSS.COLOR.with(RGBColor.rgb("#112233")));
     assertEquals("#112233", $("#test").css(CSS.COLOR));
 
-    $("#test").css(CSS.COLOR, RGBColor.rgb(35, 45, 55));
+    $("#test").setCss(CSS.COLOR.with(RGBColor.rgb(35, 45, 55)));
     assertEquals("rgb(35,45,55)", $("#test").css(CSS.COLOR));
 
   }
-  
+
   public void testCursorProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.CURSOR, Cursor.WAIT);
+    $("#test").setCss(CSS.CURSOR.with(Cursor.WAIT));
 
     assertEquals("wait", $("#test").css("cursor"));
     assertEquals("wait", $("#test").css(CSS.CURSOR));
@@ -501,41 +515,40 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.DISPLAY, Display.INLINE);
+    $("#test").setCss(CSS.DISPLAY.with(Display.INLINE));
 
     assertEquals("inline", $("#test").css("display"));
     assertEquals("inline", $("#test").css(CSS.DISPLAY));
 
   }
-  
+
   public void testEdgePositionProperty() {
 
     $(e).html("<div id='test'>Content</div><");
 
-    $("#test").css(CSS.LEFT,Length.px(10));
+    $("#test").setCss(CSS.LEFT.with(Length.px(10)));
     assertEquals("10px", $("#test").css("left"));
     assertEquals("10px", $("#test").css(CSS.LEFT));
-    
-    $("#test").css(CSS.TOP,Length.px(15));
+
+    $("#test").setCss(CSS.TOP.with(Length.px(15)));
     assertEquals("15px", $("#test").css("top"));
     assertEquals("15px", $("#test").css(CSS.TOP));
-    
-    $("#test").css(CSS.RIGHT,Length.px(0));
+
+    $("#test").setCss(CSS.RIGHT.with(Length.px(0)));
     assertEquals("0px", $("#test").css("right"));
     assertEquals("0px", $("#test").css(CSS.RIGHT));
-    
-    $("#test").css(CSS.BOTTOM,Length.px(20));
+
+    $("#test").setCss(CSS.BOTTOM.with(Length.px(20)));
     assertEquals("20px", $("#test").css("bottom"));
     assertEquals("20px", $("#test").css(CSS.BOTTOM));
 
   }
 
-
   public void testFloatProperty() {
 
     $(e).html("<div><div id='test'>Content</div></div>");
 
-    $("#test").css(CSS.FLOAT, Float.LEFT);
+    $("#test").setCss(CSS.FLOAT.with(Float.LEFT));
 
     assertEquals("left", $("#test").css("float"));
     assertEquals("left", $("#test").css(CSS.FLOAT));
@@ -546,35 +559,35 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.FONT_SIZE, FontSize.LARGER);
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.LARGER));
     assertEquals("larger", $("#test").css("fontSize"));
     assertEquals("larger", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, FontSize.LARGE);
+
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.LARGE));
     assertEquals("large", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, FontSize.MEDIUM);
+
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.MEDIUM));
     assertEquals("medium", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, FontSize.SMALL);
+
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.SMALL));
     assertEquals("small", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, FontSize.SMALLER);
+
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.SMALLER));
     assertEquals("smaller", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, FontSize.X_LARGE);
+
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.X_LARGE));
     assertEquals("x-large", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, FontSize.X_SMALL);
+
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.X_SMALL));
     assertEquals("x-small", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, FontSize.XX_LARGE);
+
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.XX_LARGE));
     assertEquals("xx-large", $("#test").css(CSS.FONT_SIZE));
 
-    $("#test").css(CSS.FONT_SIZE, FontSize.XX_SMALL);
+    $("#test").setCss(CSS.FONT_SIZE.with(FontSize.XX_SMALL));
     assertEquals("xx-small", $("#test").css(CSS.FONT_SIZE));
-    
-    $("#test").css(CSS.FONT_SIZE, Length.px(16));
+
+    $("#test").setCss(CSS.FONT_SIZE.with(Length.px(16)));
     assertEquals("16px", $("#test").css(CSS.FONT_SIZE));
   }
 
@@ -582,7 +595,7 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.FONT_STYLE, FontStyle.ITALIC);
+    $("#test").setCss(CSS.FONT_STYLE.with(FontStyle.ITALIC));
     assertEquals("italic", $("#test").css("fontStyle"));
     assertEquals("italic", $("#test").css(CSS.FONT_STYLE));
 
@@ -592,7 +605,7 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.FONT_VARIANT, FontVariant.SMALL_CAPS);
+    $("#test").setCss(CSS.FONT_VARIANT.with(FontVariant.SMALL_CAPS));
     assertEquals("small-caps", $("#test").css("fontVariant"));
     assertEquals("small-caps", $("#test").css(CSS.FONT_VARIANT));
 
@@ -602,17 +615,17 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.HEIGHT, Length.px(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.px(10)));
 
     assertEquals("10px", $("#test").css("height"));
     assertEquals("10px", $("#test").css(CSS.HEIGHT));
-    
-    $("#test").css(CSS.MAX_HEIGHT, Length.px(15));
+
+    $("#test").setCss(CSS.MAX_HEIGHT.with(Length.px(15)));
 
     assertEquals("15px", $("#test").css("maxHeight"));
     assertEquals("15px", $("#test").css(CSS.MAX_HEIGHT));
-    
-    $("#test").css(CSS.MIN_HEIGHT, Length.px(5));
+
+    $("#test").setCss(CSS.MIN_HEIGHT.with(Length.px(5)));
 
     assertEquals("5px", $("#test").css("minHeight"));
     assertEquals("5px", $("#test").css(CSS.MIN_HEIGHT));
@@ -622,31 +635,31 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.HEIGHT, Length.px(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.px(10)));
     assertEquals("10px", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.cm(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.cm(10)));
     assertEquals("10cm", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.em(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.em(10)));
     assertEquals("10em", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.ex(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.ex(10)));
     assertEquals("10ex", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.in(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.in(10)));
     assertEquals("10in", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.mm(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.mm(10)));
     assertEquals("10mm", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.pc(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.pc(10)));
     assertEquals("10pc", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.pct(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.pct(10)));
     assertEquals("10%", $("#test").css(CSS.HEIGHT));
 
-    $("#test").css(CSS.HEIGHT, Length.pt(10));
+    $("#test").setCss(CSS.HEIGHT.with(Length.pt(10)));
     assertEquals("10pt", $("#test").css(CSS.HEIGHT));
 
   }
@@ -655,7 +668,7 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.LETTER_SPACING, Length.px(15));
+    $("#test").setCss(CSS.LETTER_SPACING.with(Length.px(15)));
     assertEquals("15px", $("#test").css("letterSpacing"));
     assertEquals("15px", $("#test").css(CSS.LETTER_SPACING));
 
@@ -665,14 +678,13 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.LINE_HEIGHT, Length.px(15));
+    $("#test").setCss(CSS.LINE_HEIGHT.with(Length.px(15)));
     assertEquals("15px", $("#test").css("lineHeight"));
     assertEquals("15px", $("#test").css(CSS.LINE_HEIGHT));
-    
-    $("#test").css(CSS.LINE_HEIGHT, new CssNumber(2));
+
+    $("#test").setCss(CSS.LINE_HEIGHT.with(new CssNumber(2)));
     assertEquals("2", $("#test").css("lineHeight"));
     assertEquals("2", $("#test").css(CSS.LINE_HEIGHT));
-    
 
   }
 
@@ -680,388 +692,400 @@ public class GQueryCssTest extends GWTTestCase {
 
     $(e).html("<ul id='test'><li>Content</li></ul>");
 
-    $("#test").css(CSS.LIST_STYLE_IMAGE, ImageValue.url("arrow.jpg"));
+    $("#test").setCss(CSS.LIST_STYLE_IMAGE.with(ImageValue.url("arrow.jpg")));
     assertEquals("url('arrow.jpg')", $("#test").css("listStyleImage"));
     assertEquals("url('arrow.jpg')", $("#test").css(CSS.LIST_STYLE_IMAGE));
 
   }
-  
+
   public void testListStylePositionProperty() {
 
     $(e).html("<ul id='test'><li>Content</li></ul>");
 
-    $("#test").css(CSS.LIST_STYLE_POSITION, ListStylePosition.INSIDE);
+    $("#test").setCss(CSS.LIST_STYLE_POSITION.with(ListStylePosition.INSIDE));
     assertEquals("inside", $("#test").css("listStylePosition"));
     assertEquals("inside", $("#test").css(CSS.LIST_STYLE_POSITION));
-    
-    $("#test").css(CSS.LIST_STYLE_POSITION, ListStylePosition.OUTSIDE);
+
+    $("#test").setCss(CSS.LIST_STYLE_POSITION.with(ListStylePosition.OUTSIDE));
     assertEquals("outside", $("#test").css("listStylePosition"));
     assertEquals("outside", $("#test").css(CSS.LIST_STYLE_POSITION));
 
   }
-  
+
   public void testListStyleProperty() {
 
     $(e).html("<ul id='test'><li>Content</li></ul>");
 
-    $("#test").css(CSS.LIST_STYLE, ListStyleType.DISC, ListStylePosition.OUTSIDE, ImageValue.NONE);
+    $("#test").setCss(
+        CSS.LIST_STYLE.with(ListStyleType.DISC, ListStylePosition.OUTSIDE,
+            ImageValue.NONE));
     assertEquals("disc outside none", $("#test").css("listStyle"));
     assertEquals("disc outside none", $("#test").css(CSS.LIST_STYLE));
 
-    $("#test").css(CSS.LIST_STYLE, ListStyleType.DISC, null, ImageValue.NONE);
+    $("#test").setCss(
+        CSS.LIST_STYLE.with(ListStyleType.DISC, null, ImageValue.NONE));
     assertEquals("disc none", $("#test").css("listStyle"));
     assertEquals("disc none", $("#test").css(CSS.LIST_STYLE));
 
-    $("#test").css(CSS.LIST_STYLE, null, ListStylePosition.OUTSIDE, ImageValue.NONE);
+    $("#test").setCss(
+        CSS.LIST_STYLE.with(null, ListStylePosition.OUTSIDE, ImageValue.NONE));
     assertEquals("outside none", $("#test").css("listStyle"));
     assertEquals("outside none", $("#test").css(CSS.LIST_STYLE));
 
   }
-  
+
   public void testListStyleTypeProperty() {
 
     $(e).html("<ul id='test'><li>Content</li></ul>");
 
-    $("#test").css(CSS.LIST_STYLE_TYPE, ListStyleType.DISC);
+    $("#test").setCss(CSS.LIST_STYLE_TYPE.with(ListStyleType.DISC));
     assertEquals("disc", $("#test").css("listStyleType"));
     assertEquals("disc", $("#test").css(CSS.LIST_STYLE_TYPE));
 
   }
-  
+
   public void testMarginProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.MARGIN, Length.px(10), Length.px(20), null, null);
+    $("#test").setCss(CSS.MARGIN.with(Length.px(10), Length.px(20), null, null));
 
     assertEquals("10px 20px", $("#test").css("margin"));
     assertEquals("10px 20px", $("#test").css(CSS.MARGIN));
-    
-    $("#test").css(CSS.MARGIN, Length.px(10), null, null, null);
+
+    $("#test").setCss(CSS.MARGIN.with(Length.px(10), null, null, null));
 
     assertEquals("10px", $("#test").css("margin"));
     assertEquals("10px", $("#test").css(CSS.MARGIN));
-    
-    $("#test").css(CSS.MARGIN, Length.px(10), Length.px(20), Length.px(30), Length.px(40));
+
+    $("#test").setCss(
+        CSS.MARGIN.with(Length.px(10), Length.px(20), Length.px(30),
+            Length.px(40)));
 
     assertEquals("10px 20px 30px 40px", $("#test").css("margin"));
     assertEquals("10px 20px 30px 40px", $("#test").css(CSS.MARGIN));
 
-    $("#test").css(CSS.MARGIN_TOP, Length.px(20));
+    $("#test").setCss(CSS.MARGIN_TOP.with(Length.px(20)));
 
     assertEquals("20px", $("#test").css("marginTop"));
     assertEquals("20px", $("#test").css(CSS.MARGIN_TOP));
 
-    $("#test").css(CSS.MARGIN_BOTTOM, Length.px(30));
+    $("#test").setCss(CSS.MARGIN_BOTTOM.with(Length.px(30)));
 
     assertEquals("30px", $("#test").css("marginBottom"));
     assertEquals("30px", $("#test").css(CSS.MARGIN_BOTTOM));
 
-    $("#test").css(CSS.MARGIN_LEFT, Length.px(40));
+    $("#test").setCss(CSS.MARGIN_LEFT.with(Length.px(40)));
 
     assertEquals("40px", $("#test").css("marginLeft"));
     assertEquals("40px", $("#test").css(CSS.MARGIN_LEFT));
 
-    $("#test").css(CSS.MARGIN_RIGHT, Length.px(50));
+    $("#test").setCss(CSS.MARGIN_RIGHT.with(Length.px(50)));
 
     assertEquals("50px", $("#test").css("marginRight"));
     assertEquals("50px", $("#test").css(CSS.MARGIN_RIGHT));
   }
-  
-  
-  public void testOutlineProperty(){
+
+  public void testOutlineProperty() {
     $(e).html("<div id='test'>Content</div>");
-    
-    $("#test").css(CSS.OUTLINE_WIDTH, Length.px(10));
+
+    $("#test").setCss(CSS.OUTLINE_WIDTH.with(Length.px(10)));
     assertEquals("10px", $("#test").css("outlineWidth"));
     assertEquals("10px", $("#test").css(CSS.OUTLINE_WIDTH));
-    
-    $("#test").css(CSS.OUTLINE_WIDTH, LineWidth.MEDIUM);
+
+    $("#test").setCss(CSS.OUTLINE_WIDTH.with(LineWidth.MEDIUM));
     assertEquals("medium", $("#test").css("outlineWidth"));
     assertEquals("medium", $("#test").css(CSS.OUTLINE_WIDTH));
-    
-    $("#test").css(CSS.OUTLINE_COLOR, RGBColor.GRAY);
+
+    $("#test").setCss(CSS.OUTLINE_COLOR.with(RGBColor.GRAY));
     assertEquals("gray", $("#test").css("outlineColor"));
     assertEquals("gray", $("#test").css(CSS.OUTLINE_COLOR));
-    
-    $("#test").css(CSS.OUTLINE_STYLE, LineStyle.DOTTED);
+
+    $("#test").setCss(CSS.OUTLINE_STYLE.with(LineStyle.DOTTED));
     assertEquals("dotted", $("#test").css("outlineStyle"));
     assertEquals("dotted", $("#test").css(CSS.OUTLINE_STYLE));
 
-    $("#test").css(CSS.OUTLINE, RGBColor.BLACK, LineStyle.DASHED, LineWidth.length(15, Unit.PX));
-    assertEquals("black dashed 15px", $("#test").css("outline"));
-    assertEquals("black dashed 15px", $("#test").css(CSS.OUTLINE));
-    
+    $("#test").setCss(
+        CSS.OUTLINE.with(RGBColor.BLACK, LineStyle.DASHED, LineWidth.MEDIUM));
+    assertEquals("black dashed medium", $("#test").css("outline"));
+    assertEquals("black dashed medium", $("#test").css(CSS.OUTLINE));
+
+    $("#test").setCss(
+        CSS.OUTLINE.with(RGBColor.AQUA, LineStyle.DOUBLE, Length.px(15)));
+    assertEquals("aqua double 15px", $("#test").css("outline"));
+    assertEquals("aqua double 15px", $("#test").css(CSS.OUTLINE));
+
   }
-  
-  public void testOverflowProperty(){
+
+  public void testOverflowProperty() {
     $(e).html("<div id='test'>Content</div>");
-    
-    $("#test").css(CSS.OVERFLOW, Overflow.HIDDEN);
+
+    $("#test").setCss(CSS.OVERFLOW.with(Overflow.HIDDEN));
     assertEquals("hidden", $("#test").css("overflow"));
     assertEquals("hidden", $("#test").css(CSS.OVERFLOW));
-    
-    $("#test").css(CSS.OVERFLOW, Overflow.SCROLL);
+
+    $("#test").setCss(CSS.OVERFLOW.with(Overflow.SCROLL));
     assertEquals("scroll", $("#test").css("overflow"));
     assertEquals("scroll", $("#test").css(CSS.OVERFLOW));
-    
-    $("#test").css(CSS.OVERFLOW, Overflow.VISIBLE);
+
+    $("#test").setCss(CSS.OVERFLOW.with(Overflow.VISIBLE));
     assertEquals("visible", $("#test").css("overflow"));
     assertEquals("visible", $("#test").css(CSS.OVERFLOW));
-    
+
   }
-  
+
   public void testPaddingProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.PADDING, Length.px(10), null, null, null);
+    $("#test").setCss(CSS.PADDING.with(Length.px(10), null, null, null));
 
     assertEquals("10px", $("#test").css("padding"));
     assertEquals("10px", $("#test").css(CSS.PADDING));
-    
-    $("#test").css(CSS.PADDING, Length.px(10), Length.px(20), null, null);
+
+    $("#test").setCss(
+        CSS.PADDING.with(Length.px(10), Length.px(20), null, null));
 
     assertEquals("10px 20px", $("#test").css("padding"));
     assertEquals("10px 20px", $("#test").css(CSS.PADDING));
-    
-    $("#test").css(CSS.PADDING, Length.px(10), Length.px(20), Length.px(30), null);
+
+    $("#test").setCss(
+        CSS.PADDING.with(Length.px(10), Length.px(20), Length.px(30), null));
 
     assertEquals("10px 20px 30px", $("#test").css("padding"));
     assertEquals("10px 20px 30px", $("#test").css(CSS.PADDING));
-    
-    $("#test").css(CSS.PADDING, Length.px(10), Length.px(20), Length.px(30), Length.px(40));
+
+    $("#test").setCss(
+        CSS.PADDING.with(Length.px(10), Length.px(20), Length.px(30),
+            Length.px(40)));
 
     assertEquals("10px 20px 30px 40px", $("#test").css("padding"));
     assertEquals("10px 20px 30px 40px", $("#test").css(CSS.PADDING));
 
-    $("#test").css(CSS.PADDING_TOP, Length.px(20));
+    $("#test").setCss(CSS.PADDING_TOP.with(Length.px(20)));
 
     assertEquals("20px", $("#test").css("paddingTop"));
     assertEquals("20px", $("#test").css(CSS.PADDING_TOP));
 
-    $("#test").css(CSS.PADDING_BOTTOM, Length.px(30));
+    $("#test").setCss(CSS.PADDING_BOTTOM.with(Length.px(30)));
 
     assertEquals("30px", $("#test").css("paddingBottom"));
     assertEquals("30px", $("#test").css(CSS.PADDING_BOTTOM));
 
-    $("#test").css(CSS.PADDING_LEFT, Length.px(40));
+    $("#test").setCss(CSS.PADDING_LEFT.with(Length.px(40)));
 
     assertEquals("40px", $("#test").css("paddingLeft"));
     assertEquals("40px", $("#test").css(CSS.PADDING_LEFT));
 
-    $("#test").css(CSS.PADDING_RIGHT, Length.px(50));
+    $("#test").setCss(CSS.PADDING_RIGHT.with(Length.px(50)));
 
     assertEquals("50px", $("#test").css("paddingRight"));
     assertEquals("50px", $("#test").css(CSS.PADDING_RIGHT));
   }
-  
+
   public void testPositionProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.POSITION, Position.ABSOLUTE);
+    $("#test").setCss(CSS.POSITION.with(Position.ABSOLUTE));
     assertEquals("absolute", $("#test").css("position"));
     assertEquals("absolute", $("#test").css(CSS.POSITION));
 
-    $("#test").css(CSS.POSITION, Position.FIXED);
+    $("#test").setCss(CSS.POSITION.with(Position.FIXED));
     assertEquals("fixed", $("#test").css("position"));
     assertEquals("fixed", $("#test").css(CSS.POSITION));
-    
-    $("#test").css(CSS.POSITION, Position.RELATIVE);
+
+    $("#test").setCss(CSS.POSITION.with(Position.RELATIVE));
     assertEquals("relative", $("#test").css("position"));
     assertEquals("relative", $("#test").css(CSS.POSITION));
-    
-    $("#test").css(CSS.POSITION, Position.STATIC);
+
+    $("#test").setCss(CSS.POSITION.with(Position.STATIC));
     assertEquals("static", $("#test").css("position"));
     assertEquals("static", $("#test").css(CSS.POSITION));
 
   }
-  
+
   public void testTextAlignProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.TEXT_ALIGN, TextAlign.CENTER);
+    $("#test").setCss(CSS.TEXT_ALIGN.with(TextAlign.CENTER));
     assertEquals("center", $("#test").css("textAlign"));
     assertEquals("center", $("#test").css(CSS.TEXT_ALIGN));
 
-    $("#test").css(CSS.TEXT_ALIGN, TextAlign.JUSTIFY);
+    $("#test").setCss(CSS.TEXT_ALIGN.with(TextAlign.JUSTIFY));
     assertEquals("justify", $("#test").css("textAlign"));
     assertEquals("justify", $("#test").css(CSS.TEXT_ALIGN));
 
-    $("#test").css(CSS.TEXT_ALIGN, TextAlign.LEFT);
+    $("#test").setCss(CSS.TEXT_ALIGN.with(TextAlign.LEFT));
     assertEquals("left", $("#test").css("textAlign"));
     assertEquals("left", $("#test").css(CSS.TEXT_ALIGN));
 
-    $("#test").css(CSS.TEXT_ALIGN, TextAlign.RIGHT);
+    $("#test").setCss(CSS.TEXT_ALIGN.with(TextAlign.RIGHT));
     assertEquals("right", $("#test").css("textAlign"));
     assertEquals("right", $("#test").css(CSS.TEXT_ALIGN));
 
   }
-  
+
   public void testTextDecorationProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.TEXT_DECORATION, TextDecoration.LINE_THROUGH);
+    $("#test").setCss(CSS.TEXT_DECORATION.with(TextDecoration.LINE_THROUGH));
     assertEquals("line-through", $("#test").css("textDecoration"));
     assertEquals("line-through", $("#test").css(CSS.TEXT_DECORATION));
-   
+
   }
 
   public void testTextIdentProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.TEXT_IDENT, Length.px(15));
+    $("#test").setCss(CSS.TEXT_IDENT.with(Length.px(15)));
     assertEquals("15px", $("#test").css("textIdent"));
     assertEquals("15px", $("#test").css(CSS.TEXT_IDENT));
-   
+
   }
-  
+
   public void testTextTransformProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.TEXT_TRANSFORM, TextTransform.UPPERCASE);
+    $("#test").setCss(CSS.TEXT_TRANSFORM.with(TextTransform.UPPERCASE));
     assertEquals("uppercase", $("#test").css("textTransform"));
     assertEquals("uppercase", $("#test").css(CSS.TEXT_TRANSFORM));
-   
-    $("#test").css(CSS.TEXT_TRANSFORM, TextTransform.LOWERCASE);
+
+    $("#test").setCss(CSS.TEXT_TRANSFORM.with(TextTransform.LOWERCASE));
     assertEquals("lowercase", $("#test").css("textTransform"));
-    
-    $("#test").css(CSS.TEXT_TRANSFORM, TextTransform.CAPITALIZE);
+
+    $("#test").setCss(CSS.TEXT_TRANSFORM.with(TextTransform.CAPITALIZE));
     assertEquals("capitalize", $("#test").css("textTransform"));
   }
-  
+
   public void testUnicodeBidiProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.UNICODE_BIDI, UnicodeBidi.BIDI_OVERRIDE);
+    $("#test").setCss(CSS.UNICODE_BIDI.with(UnicodeBidi.BIDI_OVERRIDE));
     assertEquals("bidi-override", $("#test").css("unicode-bidi"));
     assertEquals("bidi-override", $("#test").css(CSS.UNICODE_BIDI));
 
-    $("#test").css(CSS.UNICODE_BIDI, UnicodeBidi.EMBED);
+    $("#test").setCss(CSS.UNICODE_BIDI.with(UnicodeBidi.EMBED));
     assertEquals("embed", $("#test").css(CSS.UNICODE_BIDI));
 
-    $("#test").css(CSS.UNICODE_BIDI, UnicodeBidi.NORMAL);
+    $("#test").setCss(CSS.UNICODE_BIDI.with(UnicodeBidi.NORMAL));
     assertEquals("normal", $("#test").css(CSS.UNICODE_BIDI));
   }
-  
+
   public void testVerticalAlignProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.BASELINE);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.BASELINE));
     assertEquals("baseline", $("#test").css("verticalAlign"));
     assertEquals("baseline", $("#test").css(CSS.VERTICAL_ALIGN));
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.BOTTOM);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.BOTTOM));
     assertEquals("bottom", $("#test").css("verticalAlign"));
     assertEquals("bottom", $("#test").css(CSS.VERTICAL_ALIGN));
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.MIDDLE);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.MIDDLE));
     assertEquals("middle", $("#test").css("verticalAlign"));
     assertEquals("middle", $("#test").css(CSS.VERTICAL_ALIGN));
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.SUB);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.SUB));
     assertEquals("sub", $("#test").css("verticalAlign"));
     assertEquals("sub", $("#test").css(CSS.VERTICAL_ALIGN));
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.SUPER);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.SUPER));
     assertEquals("super", $("#test").css("verticalAlign"));
     assertEquals("super", $("#test").css(CSS.VERTICAL_ALIGN));
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.TEXT_BOTTOM);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.TEXT_BOTTOM));
     assertEquals("text-bottom", $("#test").css("verticalAlign"));
     assertEquals("text-bottom", $("#test").css(CSS.VERTICAL_ALIGN));
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.TEXT_TOP);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.TEXT_TOP));
     assertEquals("text-top", $("#test").css("verticalAlign"));
     assertEquals("text-top", $("#test").css(CSS.VERTICAL_ALIGN));
 
-    $("#test").css(CSS.VERTICAL_ALIGN, VerticalAlign.TOP);
+    $("#test").setCss(CSS.VERTICAL_ALIGN.with(VerticalAlign.TOP));
     assertEquals("top", $("#test").css("verticalAlign"));
     assertEquals("top", $("#test").css(CSS.VERTICAL_ALIGN));
 
   }
-  
+
   public void testVisibilityProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.VISIBILITY, Visibility.HIDDEN);
+    $("#test").setCss(CSS.VISIBILITY.with(Visibility.HIDDEN));
     assertEquals("hidden", $("#test").css("visibility"));
     assertEquals("hidden", $("#test").css(CSS.VISIBILITY));
 
-    $("#test").css(CSS.VISIBILITY, Visibility.VISIBLE);
+    $("#test").setCss(CSS.VISIBILITY.with(Visibility.VISIBLE));
     assertEquals("visible", $("#test").css("visibility"));
     assertEquals("visible", $("#test").css(CSS.VISIBILITY));
 
   }
-  
+
   public void testWhiteSpaceProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.WHITE_SPACE, WhiteSpace.NORMAL);
+    $("#test").setCss(CSS.WHITE_SPACE.with(WhiteSpace.NORMAL));
     assertEquals("normal", $("#test").css("whiteSpace"));
     assertEquals("normal", $("#test").css(CSS.WHITE_SPACE));
-    
-    $("#test").css(CSS.WHITE_SPACE, WhiteSpace.NOWRAP);
+
+    $("#test").setCss(CSS.WHITE_SPACE.with(WhiteSpace.NOWRAP));
     assertEquals("nowrap", $("#test").css(CSS.WHITE_SPACE));
-    
-    $("#test").css(CSS.WHITE_SPACE, WhiteSpace.PRE);
+
+    $("#test").setCss(CSS.WHITE_SPACE.with(WhiteSpace.PRE));
     assertEquals("pre", $("#test").css(CSS.WHITE_SPACE));
-    
-    $("#test").css(CSS.WHITE_SPACE, WhiteSpace.PRE_LINE);
+
+    $("#test").setCss(CSS.WHITE_SPACE.with(WhiteSpace.PRE_LINE));
     assertEquals("pre-line", $("#test").css(CSS.WHITE_SPACE));
-    
-    $("#test").css(CSS.WHITE_SPACE, WhiteSpace.PRE_WRAP);
+
+    $("#test").setCss(CSS.WHITE_SPACE.with(WhiteSpace.PRE_WRAP));
     assertEquals("pre-wrap", $("#test").css(CSS.WHITE_SPACE));
-   
-  
+
   }
-  
+
   public void testWidthProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.WIDTH, Length.px(20));
+    $("#test").setCss(CSS.WIDTH.with(Length.px(20)));
     assertEquals("20px", $("#test").css("width"));
     assertEquals("20px", $("#test").css(CSS.WIDTH));
-    
-    $("#test").css(CSS.MIN_WIDTH, Length.px(10));
+
+    $("#test").setCss(CSS.MIN_WIDTH.with(Length.px(10)));
     assertEquals("10px", $("#test").css("minWidth"));
     assertEquals("10px", $("#test").css(CSS.MIN_WIDTH));
-    
-    $("#test").css(CSS.MAX_WIDTH, Length.px(30));
+
+    $("#test").setCss(CSS.MAX_WIDTH.with(Length.px(30)));
     assertEquals("30px", $("#test").css("maxWidth"));
     assertEquals("30px", $("#test").css(CSS.MAX_WIDTH));
 
   }
-  
+
   public void testWordSpacingProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.WORD_SPACING, Length.pt(2));
+    $("#test").setCss(CSS.WORD_SPACING.with(Length.pt(2)));
     assertEquals("2pt", $("#test").css("wordSpacing"));
     assertEquals("2pt", $("#test").css(CSS.WORD_SPACING));
-  
+
   }
-  
+
   public void testZIndexProperty() {
 
     $(e).html("<div id='test'>Content</div>");
 
-    $("#test").css(CSS.ZINDEX, new CssNumber(1000));
+    $("#test").setCss(CSS.ZINDEX.with(new CssNumber(1000)));
     assertEquals("1000", $("#test").css("zIndex"));
     assertEquals("1000", $("#test").css(CSS.ZINDEX));
 
   }
-
-  
 }
index bc1936b6603bece780dec54c542c7b4cce7a1506..497cc03a40b48f20077c2c70a68d4ed128866a3e 100644 (file)
@@ -192,7 +192,7 @@ public class GQueryEventsTest extends GWTTestCase {
     $(e).click();
     assertEquals("red", $(e).css("color"));
 
-    $(e).click(lazy().css(CSS.COLOR, RGBColor.BLACK).done());
+    $(e).click(lazy().setCss(CSS.COLOR.with(RGBColor.BLACK)).done());
     $(e).click();
     assertEquals("black", $(e).css("color"));
   }