From da27cf1923c40686d39ec350c22c3179381895d8 Mon Sep 17 00:00:00 2001 From: Julien Dramaix Date: Tue, 8 Feb 2011 23:32:17 +0000 Subject: [PATCH] continue type safe css implementation --- .../query/client/css/AbstractCssProperty.java | 9 +- .../css/BackgroundAttachmentProperty.java | 8 +- .../client/css/BackgroundColorProperty.java | 5 +- .../client/css/BackgroundImageProperty.java | 5 +- .../css/BackgroundPositionProperty.java | 5 +- .../client/css/BackgroundRepeatProperty.java | 5 +- .../client/css/BorderCollapseProperty.java | 53 ++++ .../query/client/css/BorderColorProperty.java | 12 +- .../gwt/query/client/css/BorderProperty.java | 27 +- .../client/css/BorderSpacingProperty.java | 59 ++++ .../query/client/css/BorderStyleProperty.java | 7 +- .../query/client/css/BorderWidthProperty.java | 10 +- .../com/google/gwt/query/client/css/CSS.java | 59 +++- .../query/client/css/CaptionSideProperty.java | 51 ++++ .../gwt/query/client/css/ClearProperty.java | 5 +- .../gwt/query/client/css/ClipProperty.java | 5 +- .../gwt/query/client/css/ColorProperty.java | 5 +- .../gwt/query/client/css/CssNumber.java | 39 +++ .../gwt/query/client/css/CursorProperty.java | 5 +- .../query/client/css/DirectionProperty.java | 57 ++++ .../gwt/query/client/css/DisplayProperty.java | 5 +- .../client/css/EdgePositionProperty.java | 8 +- .../gwt/query/client/css/FloatProperty.java | 5 +- .../query/client/css/FontSizeProperty.java | 5 +- .../query/client/css/FontStyleProperty.java | 5 +- .../query/client/css/FontVariantProperty.java | 5 +- .../query/client/css/FontWeightProperty.java | 5 +- .../gwt/query/client/css/HeightProperty.java | 22 +- .../client/css/LetterSpacingProperty.java | 33 +++ .../query/client/css/LineHeightProperty.java | 40 +++ .../client/css/ListStyleImageProperty.java | 5 +- .../client/css/ListStylePositionProperty.java | 5 +- .../client/css/ListStyleTypeProperty.java | 5 +- .../gwt/query/client/css/MarginProperty.java | 8 +- .../client/css/OutlineColorProperty.java | 5 +- .../client/css/OutlineStyleProperty.java | 5 +- .../client/css/OutlineWidthProperty.java | 5 +- .../query/client/css/OverflowProperty.java | 5 +- .../gwt/query/client/css/PaddingProperty.java | 8 +- .../query/client/css/PositionProperty.java | 4 +- .../query/client/css/TextAlignProperty.java | 5 +- .../client/css/TextDecorationProperty.java | 38 +++ .../query/client/css/TextIdentProperty.java | 37 +++ .../client/css/TextTransformProperty.java | 56 ++++ .../client/css/VerticalAlignProperty.java | 5 +- .../query/client/css/VisibilityProperty.java | 4 +- .../query/client/css/WhiteSpaceProperty.java | 71 +++++ .../gwt/query/client/css/WidthProperty.java | 17 +- .../query/client/css/WordSpacingProperty.java | 33 +++ .../gwt/query/client/css/ZIndexProperty.java | 55 ++++ .../gwt/query/client/GQueryCssTest.java | 274 +++++++++++++++--- 51 files changed, 993 insertions(+), 221 deletions(-) create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderCollapseProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderSpacingProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/CaptionSideProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssNumber.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/DirectionProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/LetterSpacingProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/LineHeightProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextDecorationProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextIdentProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextTransformProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/WhiteSpaceProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/WordSpacingProperty.java create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/ZIndexProperty.java diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/AbstractCssProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/AbstractCssProperty.java index 06e79fa4..609ed483 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/AbstractCssProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/AbstractCssProperty.java @@ -25,12 +25,19 @@ import com.google.gwt.dom.client.Style.HasCssName; */ public abstract class AbstractCssProperty implements TakeCssValue { + private String cssName; + + protected AbstractCssProperty(String cssName){ + this.cssName = cssName; + } public String get(Style s) { return s.getProperty(getCssName()); } - public abstract String getCssName(); + public String getCssName(){ + return cssName; + } public void set(Style s, T value) { s.setProperty(getCssName(), value.getCssName()); diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundAttachmentProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundAttachmentProperty.java index 7974efe2..9ea18646 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundAttachmentProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundAttachmentProperty.java @@ -47,6 +47,7 @@ public class BackgroundAttachmentProperty extends public abstract String getCssName(); } + private static final String CSS_PROPERTY = "backgroundAttachment"; private static final String FIXED_VALUE = "fixed"; @@ -56,9 +57,8 @@ public class BackgroundAttachmentProperty extends CSS.BACKGROUND_ATTACHMENT = new BackgroundAttachmentProperty(); } - private BackgroundAttachmentProperty() {} - - public String getCssName() { - return CSS_PROPERTY; + private BackgroundAttachmentProperty() { + super(CSS_PROPERTY); } + } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundColorProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundColorProperty.java index e9359506..b343e0f4 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundColorProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundColorProperty.java @@ -28,9 +28,6 @@ public class BackgroundColorProperty extends AbstractCssProperty { } private BackgroundColorProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundImageProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundImageProperty.java index 11c97263..155b404d 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundImageProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundImageProperty.java @@ -27,10 +27,7 @@ public class BackgroundImageProperty extends AbstractCssProperty { } private BackgroundImageProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundPositionProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundPositionProperty.java index b5733160..b613da37 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundPositionProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundPositionProperty.java @@ -91,9 +91,6 @@ public class BackgroundPositionProperty extends } private BackgroundPositionProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundRepeatProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundRepeatProperty.java index d3810e17..6eef8eec 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundRepeatProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundRepeatProperty.java @@ -89,9 +89,6 @@ public class BackgroundRepeatProperty extends } private BackgroundRepeatProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderCollapseProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderCollapseProperty.java new file mode 100644 index 00000000..96257bcf --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderCollapseProperty.java @@ -0,0 +1,53 @@ +/* + * 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.HasCssName; + +/** + * This property describes the color of a border. + */ +public class BorderCollapseProperty extends + AbstractCssProperty { + + public static enum BorderCollapse implements HasCssName { + /** + * Borders are collapsed into a single border when possible (border-spacing + * and empty-cells properties will be ignored) + */ + COLLAPSE, + /** + * Borders are detached (border-spacing and empty-cells properties will not + * be ignored). + */ + SEPARATE; + + public String getCssName() { + return name().toLowerCase(); + } + } + + private static final String CSS_PROPERTY = "borderCollapse"; + + public static void init() { + CSS.BORDER_COLLAPSE = new BorderCollapseProperty(); + + } + + private BorderCollapseProperty() { + super(CSS_PROPERTY); + } +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderColorProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderColorProperty.java index 5785e142..18adefe1 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderColorProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderColorProperty.java @@ -16,7 +16,7 @@ package com.google.gwt.query.client.css; /** - * This property describes the foreground color of an element's text content. + * This property describes the color of a border. */ public class BorderColorProperty extends AbstractCssProperty { @@ -35,14 +35,8 @@ public class BorderColorProperty extends AbstractCssProperty { BORDER_RIGHT_COLOR_PROPERTY); CSS.BORDER_TOP_COLOR = new BorderColorProperty(BORDER_TOP_COLOR_PROPERTY); } - - private String cssName; - + private BorderColorProperty(String value) { - this.cssName = value; - } - - public String getCssName() { - return cssName; + super(value); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderProperty.java index 56b8aa5f..76767182 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderProperty.java @@ -21,37 +21,50 @@ import com.google.gwt.query.client.css.BorderStyleProperty.LineStyle; import com.google.gwt.query.client.css.BorderWidthProperty.LineWidth; /** + * The border shorthand property sets all the border properties in one + * declaration. * - * */ public class BorderProperty implements CssShorthandProperty3 { - private static final String CSS_PROPERTY = "border"; + private static final String BORDER_BOTTOM_PROPERTY = "borderBottom"; + private static final String BORDER_PROPERTY = "border"; + private static final String BORDER_LEFT_PROPERTY = "borderLeft"; + private static final String BORDER_RIGHT_PROPERTY = "borderRight"; + private static final String BORDER_TOP_PROPERTY = "borderTop"; static void init() { - CSS.BORDER = new BorderProperty(); + CSS.BORDER = new BorderProperty(BORDER_PROPERTY); + CSS.BORDER_BOTTOM = new BorderProperty(BORDER_BOTTOM_PROPERTY); + CSS.BORDER_TOP = new BorderProperty(BORDER_TOP_PROPERTY); + CSS.BORDER_RIGHT = new BorderProperty(BORDER_RIGHT_PROPERTY); + CSS.BORDER_LEFT = new BorderProperty(BORDER_LEFT_PROPERTY); + BorderColorProperty.init(); BorderStyleProperty.init(); BorderWidthProperty.init(); } - private BorderProperty() { + private String cssProperty; + + private BorderProperty(String property) { + cssProperty = property; } public String get(Style s) { - return s.getProperty(CSS_PROPERTY); + return s.getProperty(cssProperty); } public String getCssName() { - return CSS_PROPERTY; + return cssProperty; } public void set(Style s, LineWidth borderWidth, LineStyle borderStyle, RGBColor borderColor) { String value = notNull(borderWidth) + notNull(borderStyle) + notNull(borderColor).trim(); - s.setProperty(CSS_PROPERTY, value); + s.setProperty(cssProperty, value); } private String notNull(HasCssName value) { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderSpacingProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderSpacingProperty.java new file mode 100644 index 00000000..542add32 --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderSpacingProperty.java @@ -0,0 +1,59 @@ +/* + * 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.HasCssName; + +/** + * This property describes the color of a border. + */ +public class BorderSpacingProperty extends + AbstractCssProperty { + + public static class BorderSpacing implements HasCssName { + + private Length verticalSpacing; + private Length horizontalSpacing; + + public BorderSpacing(Length spacing) { + this(spacing, spacing); + } + + public BorderSpacing(Length horizontalSpacing, Length verticalSpacing) { + assert horizontalSpacing != null : "horizontal spacing cannot be null"; + assert verticalSpacing != null : "vertical spacing cannot be null"; + + this.verticalSpacing = verticalSpacing; + this.horizontalSpacing = horizontalSpacing; + } + + + public String getCssName() { + return horizontalSpacing.getCssName()+" "+verticalSpacing.getCssName(); + } + } + + private static final String CSS_PROPERTY = "borderSpacing"; + + public static void init() { + CSS.BORDER_SPACING = new BorderSpacingProperty(); + + } + + private BorderSpacingProperty() { + super(CSS_PROPERTY); + } +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderStyleProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderStyleProperty.java index c5fb2239..340deb54 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderStyleProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderStyleProperty.java @@ -111,13 +111,8 @@ public class BorderStyleProperty extends CSS.BORDER_TOP_STYLE = new BorderStyleProperty(BORDER_TOP_STYLE_PROPERTY); } - private String cssName; - private BorderStyleProperty(String value) { - this.cssName = value; + super(value); } - public String getCssName() { - return cssName; - } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderWidthProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderWidthProperty.java index 5d76c234..ef9f1791 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderWidthProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BorderWidthProperty.java @@ -76,18 +76,12 @@ public class BorderWidthProperty extends CSS.BORDER_TOP_WIDTH = new BorderWidthProperty(BORDER_TOP_WIDTH_PROPERTY); } - private String cssName; - private BorderWidthProperty(String value) { - this.cssName = value; - } - - public String getCssName() { - return cssName; + super(value); } public void set(Style s, Length p) { - s.setProperty(cssName, p.getCssName()); + s.setProperty(getCssName(), p.getCssName()); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CSS.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CSS.java index 0f67220e..fddd291d 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CSS.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CSS.java @@ -39,29 +39,41 @@ public class CSS { public static BackgroundRepeatProperty BACKGROUND_REPEAT; public static BorderProperty BORDER; - + + public static BorderProperty BORDER_BOTTOM; + public static BorderColorProperty BORDER_BOTTOM_COLOR; - + public static BorderStyleProperty BORDER_BOTTOM_STYLE; - + public static BorderWidthProperty BORDER_BOTTOM_WIDTH; + public static BorderCollapseProperty BORDER_COLLAPSE; + public static BorderColorProperty BORDER_COLOR; + public static BorderProperty BORDER_LEFT; + public static BorderColorProperty BORDER_LEFT_COLOR; public static BorderStyleProperty BORDER_LEFT_STYLE; public static BorderWidthProperty BORDER_LEFT_WIDTH; + public static BorderProperty BORDER_RIGHT; + public static BorderColorProperty BORDER_RIGHT_COLOR; public static BorderStyleProperty BORDER_RIGHT_STYLE; public static BorderWidthProperty BORDER_RIGHT_WIDTH; + public static BorderSpacingProperty BORDER_SPACING; + public static BorderStyleProperty BORDER_STYLE; + public static BorderProperty BORDER_TOP; + public static BorderColorProperty BORDER_TOP_COLOR; public static BorderStyleProperty BORDER_TOP_STYLE; @@ -69,7 +81,6 @@ public class CSS { public static BorderWidthProperty BORDER_TOP_WIDTH; public static BorderWidthProperty BORDER_WIDTH; - /** * For absolutely positioned elements, the bottom property sets the bottom * edge of an element to a unit above/below the bottom edge of its containing @@ -81,12 +92,14 @@ public class CSS { * For static positioned elements, the bottom property has no effect. */ public static EdgePositionProperty BOTTOM; + public static CaptionSideProperty CAPTION_SIDE; /** * The clear property specifies which sides of an element where other floating * elements are not allowed. */ public static ClearProperty CLEAR; + /** * The clip property lets you specify the dimensions of an absolutely * positioned element that should be visible, and the element is clipped into @@ -95,6 +108,7 @@ public class CSS { * The clip property does not work if the overflow property is set to visible. */ public static ClipProperty CLIP; + /** * This property describes the foreground color of an element's text content. */ @@ -106,6 +120,8 @@ public class CSS { */ public static CursorProperty CURSOR; + public static DirectionProperty DIRECTION; + /** * This property specifies the mechanism by which elements are rendered. */ @@ -150,6 +166,10 @@ public class CSS { */ public static EdgePositionProperty LEFT; + public static LetterSpacingProperty LETTER_SPACING; + + public static LineHeightProperty LINE_HEIGHT; + public static ListStyleProperty LIST_STYLE; public static ListStyleImageProperty LIST_STYLE_IMAGE; @@ -168,6 +188,14 @@ public class CSS { public static MarginProperty MARGIN_TOP; + public static HeightProperty MAX_HEIGHT; + + public static WidthProperty MAX_WIDTH; + + public static HeightProperty MIN_HEIGHT; + + public static WidthProperty MIN_WIDTH; + /** * An outline is a line that is drawn around elements (outside the borders) to * make the element "stand out". @@ -236,6 +264,12 @@ public class CSS { */ public static TextAlignProperty TEXT_ALIGN; + public static TextDecorationProperty TEXT_DECORATION; + + public static TextIdentProperty TEXT_IDENT; + + public static TextTransformProperty TEXT_TRANSFORM; + /** * For absolutely positioned elements, the top property sets the top edge of * an element to a unit above/below the top edge of its containing element. @@ -260,6 +294,8 @@ public class CSS { */ public static VisibilityProperty VISIBILITY; + public static WhiteSpaceProperty WHITE_SPACE; + /** * This property specifies the content width of boxes generated by block-level * and replaced elements. @@ -276,9 +312,16 @@ public class CSS { */ public static WidthProperty WIDTH; + public static WordSpacingProperty WORD_SPACING; + + public static ZIndexProperty ZINDEX; + static { BackgroundProperty.init(); BorderProperty.init(); + BorderCollapseProperty.init(); + BorderSpacingProperty.init(); + CaptionSideProperty.init(); ColorProperty.init(); CursorProperty.init(); ClearProperty.init(); @@ -291,6 +334,8 @@ public class CSS { FontWeightProperty.init(); FontSizeProperty.init(); HeightProperty.init(); + LetterSpacingProperty.init(); + LineHeightProperty.init(); ListStyleProperty.init(); MarginProperty.init(); OutlineProperty.init(); @@ -298,9 +343,15 @@ public class CSS { PaddingProperty.init(); PositionProperty.init(); TextAlignProperty.init(); + TextDecorationProperty.init(); + TextIdentProperty.init(); + TextTransformProperty.init(); VerticalAlignProperty.init(); VisibilityProperty.init(); WidthProperty.init(); + WhiteSpaceProperty.init(); + WordSpacingProperty.init(); + ZIndexProperty.init(); } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CaptionSideProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CaptionSideProperty.java new file mode 100644 index 00000000..03bbc55d --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CaptionSideProperty.java @@ -0,0 +1,51 @@ +/* + * 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.HasCssName; + +/** + * This property describes how inline content of a block is aligned. + */ +public class CaptionSideProperty extends + AbstractCssProperty { + + public enum CaptionSide implements HasCssName { + /** + * Puts the caption above the table + */ + TOP, + /** + * Puts the caption below the table + */ + BOTTOM; + + public String getCssName() { + return name().toLowerCase(); + }; + } + + private static final String CSS_PROPERTY = "captionSide"; + + public static void init() { + CSS.CAPTION_SIDE = new CaptionSideProperty(); + } + + private CaptionSideProperty() { + super(CSS_PROPERTY); + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClearProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClearProperty.java index f825db05..50efa050 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClearProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClearProperty.java @@ -87,9 +87,6 @@ public class ClearProperty extends AbstractCssProperty { } private ClearProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClipProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClipProperty.java index c9290947..8c820bc6 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClipProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ClipProperty.java @@ -52,9 +52,6 @@ public class ClipProperty extends AbstractCssProperty { } private ClipProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ColorProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ColorProperty.java index 5df4daa9..2a4b7566 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ColorProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ColorProperty.java @@ -27,9 +27,6 @@ public class ColorProperty extends AbstractCssProperty { } private ColorProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssNumber.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssNumber.java new file mode 100644 index 00000000..74e6939a --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssNumber.java @@ -0,0 +1,39 @@ +/* + * 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.HasCssName; + +/** + * Some css property take simply number as value. + */ +public class CssNumber implements HasCssName { + + private String value; + + public CssNumber(String value) { + this.value = value; + } + + public CssNumber(int value) { + this(""+value); + } + + public String getCssName() { + return value; + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CursorProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CursorProperty.java index 8bc13746..0d3671d9 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CursorProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CursorProperty.java @@ -29,9 +29,6 @@ public class CursorProperty extends AbstractCssProperty { } private CursorProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/DirectionProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/DirectionProperty.java new file mode 100644 index 00000000..ce25983e --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/DirectionProperty.java @@ -0,0 +1,57 @@ +/* + * 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.HasCssName; + +/** + * This property defines the text direction/writing direction + */ +public class DirectionProperty extends + AbstractCssProperty { + + public static enum Direction implements HasCssName { + + LTR { + public String getCssName() { + return "ltr"; + }; + }, + RTL { + public String getCssName() { + return "rtl"; + }; + }, + INHERIT { + public String getCssName() { + return "inherit"; + }; + }; + + public abstract String getCssName(); + + } + + private static final String CSS_PROPERTY = "direction"; + + public static void init() { + CSS.DIRECTION = new DirectionProperty(); + } + + private DirectionProperty() { + super(CSS_PROPERTY); + } +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/DisplayProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/DisplayProperty.java index 6b2ddf37..0c7457e5 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/DisplayProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/DisplayProperty.java @@ -29,9 +29,6 @@ public class DisplayProperty extends AbstractCssProperty { } private DisplayProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EdgePositionProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EdgePositionProperty.java index f8d3f104..392e9d4c 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EdgePositionProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EdgePositionProperty.java @@ -27,13 +27,7 @@ public class EdgePositionProperty extends AbstractCssProperty { CSS.TOP = new EdgePositionProperty("top"); } - private String cssName; - private EdgePositionProperty(String value) { - this.cssName = value; - } - - public String getCssName() { - return cssName; + super(value); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FloatProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FloatProperty.java index adf03062..84d2f585 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FloatProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FloatProperty.java @@ -32,10 +32,7 @@ public class FloatProperty extends AbstractCssProperty { } private FloatProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } @Override diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontSizeProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontSizeProperty.java index 2c498554..537cb259 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontSizeProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontSizeProperty.java @@ -128,10 +128,7 @@ public class FontSizeProperty extends } private FontSizeProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } /** diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontStyleProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontStyleProperty.java index 2bcc2b83..9276ebef 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontStyleProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontStyleProperty.java @@ -29,9 +29,6 @@ public class FontStyleProperty extends AbstractCssProperty { } private FontStyleProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontVariantProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontVariantProperty.java index eb409b56..756a6519 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontVariantProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontVariantProperty.java @@ -65,9 +65,6 @@ public class FontVariantProperty extends } private FontVariantProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontWeightProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontWeightProperty.java index 788e8aae..6169a911 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontWeightProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/FontWeightProperty.java @@ -29,9 +29,6 @@ public class FontWeightProperty extends AbstractCssProperty { } private FontWeightProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/HeightProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/HeightProperty.java index 6f23b419..11541e0d 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/HeightProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/HeightProperty.java @@ -16,25 +16,23 @@ package com.google.gwt.query.client.css; /** - * This property specifies the content height of boxes generated by block-level, - * inline-block and replaced elements. - * - * This property does not apply to non-replaced inline-level elements. See the - * section on computing heights and margins for non-replaced inline elements for - * the rules used instead. + * all height css properties : max-height, min-height, height */ public class HeightProperty extends AbstractCssProperty { - private static final String CSS_PROPERTY = "height"; + private static final String HEIGHT_PROPERTY = "height"; + private static final String MAX_HEIGHT_PROPERTY = "maxHeight"; + private static final String MIN_HEIGHT_PROPERTY = "minHeight"; public static void init() { - CSS.HEIGHT = new HeightProperty(); + CSS.HEIGHT = new HeightProperty(HEIGHT_PROPERTY); + CSS.MAX_HEIGHT = new HeightProperty(MAX_HEIGHT_PROPERTY); + CSS.MIN_HEIGHT = new HeightProperty(MIN_HEIGHT_PROPERTY); } - private HeightProperty() { + + private HeightProperty(String cssName) { + super(cssName); } - public String getCssName() { - return CSS_PROPERTY; - } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/LetterSpacingProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/LetterSpacingProperty.java new file mode 100644 index 00000000..7cb62b9f --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/LetterSpacingProperty.java @@ -0,0 +1,33 @@ +/* + * 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; + +/** + * all height css properties : max-height, min-height, height + */ +public class LetterSpacingProperty extends AbstractCssProperty { + + private static final String CSS_PROPERTY = "letterSpacing"; + + public static void init() { + CSS.LETTER_SPACING = new LetterSpacingProperty(); + } + + private LetterSpacingProperty() { + super(CSS_PROPERTY); + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/LineHeightProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/LineHeightProperty.java new file mode 100644 index 00000000..f2396ab8 --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/LineHeightProperty.java @@ -0,0 +1,40 @@ +/* + * 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; + +/** + * all height css properties : max-height, min-height, height + */ +public class LineHeightProperty extends AbstractCssProperty implements TakesLength { + + private static final String CSS_PROPERTY = "lineHeight"; + + public static void init() { + CSS.LINE_HEIGHT = new LineHeightProperty(); + } + + private LineHeightProperty() { + super(CSS_PROPERTY); + } + + public void set(Style s, Length p) { + s.setProperty(CSS_PROPERTY, p.getCssName()); + + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleImageProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleImageProperty.java index 564f4b7f..b4e8f600 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleImageProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleImageProperty.java @@ -27,9 +27,6 @@ public class ListStyleImageProperty extends AbstractCssProperty { } private ListStyleImageProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStylePositionProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStylePositionProperty.java index a3934efa..765515d1 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStylePositionProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStylePositionProperty.java @@ -68,9 +68,6 @@ public class ListStylePositionProperty extends } private ListStylePositionProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleTypeProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleTypeProperty.java index c1c6ece5..3dde5111 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleTypeProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleTypeProperty.java @@ -29,9 +29,6 @@ public class ListStyleTypeProperty extends AbstractCssProperty { } private ListStyleTypeProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/MarginProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/MarginProperty.java index f9054f4c..e9a71bf4 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/MarginProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/MarginProperty.java @@ -34,14 +34,8 @@ public class MarginProperty extends AbstractCssProperty { CSS.MARGIN_BOTTOM = new MarginProperty(MARGIN_BOTTOM_PROPERTY); } - private String cssName; - private MarginProperty(String cssName) { - this.cssName = cssName; - } - - public String getCssName() { - return cssName; + super(cssName); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineColorProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineColorProperty.java index e2a664b4..72314142 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineColorProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineColorProperty.java @@ -30,9 +30,6 @@ public class OutlineColorProperty extends AbstractCssProperty { private OutlineColorProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineStyleProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineStyleProperty.java index 7d408f4e..402cf398 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineStyleProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineStyleProperty.java @@ -32,9 +32,6 @@ public class OutlineStyleProperty extends AbstractCssProperty { private OutlineStyleProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineWidthProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineWidthProperty.java index 5510be39..5fbbc402 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineWidthProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OutlineWidthProperty.java @@ -33,10 +33,7 @@ public class OutlineWidthProperty extends AbstractCssProperty } private OutlineWidthProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } public void set(Style s, Length p) { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OverflowProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OverflowProperty.java index 1eda4cc2..363ca541 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OverflowProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/OverflowProperty.java @@ -30,9 +30,6 @@ public class OverflowProperty extends } private OverflowProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PaddingProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PaddingProperty.java index 085f5c57..7782ae28 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PaddingProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PaddingProperty.java @@ -35,14 +35,8 @@ public class PaddingProperty extends AbstractCssProperty { CSS.PADDING_BOTTOM = new PaddingProperty(PADDING_BOTTOM_PROPERTY); } - private String cssName; - private PaddingProperty(String cssName) { - this.cssName = cssName; - } - - public String getCssName() { - return cssName; + super(cssName); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PositionProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PositionProperty.java index f68e99c3..a5c54a63 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PositionProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/PositionProperty.java @@ -29,9 +29,7 @@ public class PositionProperty extends AbstractCssProperty { } private PositionProperty() { + super(CSS_PROPERTY); } - public String getCssName() { - return CSS_PROPERTY; - } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextAlignProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextAlignProperty.java index 52fa3fe2..9e438466 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextAlignProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextAlignProperty.java @@ -78,10 +78,7 @@ public class TextAlignProperty extends } private TextAlignProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextDecorationProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextDecorationProperty.java new file mode 100644 index 00000000..94662257 --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextDecorationProperty.java @@ -0,0 +1,38 @@ +/* + * 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.TextDecoration; + +/** + * This property describes how inline content of a block is aligned. + */ +public class TextDecorationProperty extends + AbstractCssProperty { + + + private static final String CSS_PROPERTY = "textDecoration"; + + + public static void init() { + CSS.TEXT_DECORATION= new TextDecorationProperty(); + } + + private TextDecorationProperty() { + super(CSS_PROPERTY); + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextIdentProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextIdentProperty.java new file mode 100644 index 00000000..641a24b5 --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextIdentProperty.java @@ -0,0 +1,37 @@ +/* + * 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; + + +/** + * This property describes how inline content of a block is aligned. + */ +public class TextIdentProperty extends + AbstractCssProperty { + + + private static final String CSS_PROPERTY = "textIdent"; + + + public static void init() { + CSS.TEXT_IDENT= new TextIdentProperty(); + } + + private TextIdentProperty() { + super(CSS_PROPERTY); + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextTransformProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextTransformProperty.java new file mode 100644 index 00000000..bf0c073d --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/TextTransformProperty.java @@ -0,0 +1,56 @@ +/* + * 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.HasCssName; + +/** + * This property describes how inline content of a block is aligned. + */ +public class TextTransformProperty extends + AbstractCssProperty { + + public enum TextTransform implements HasCssName{ + /** + * Transforms the first character of each word to uppercase + */ + CAPITALIZE, + /** + * Transforms all characters to uppercase + */ + UPPERCASE, + /** + * Transforms all characters to lowercase + */ + LOWERCASE; + + public String getCssName() { + return name().toLowerCase(); + }; + } + + private static final String CSS_PROPERTY = "textTransform"; + + + public static void init() { + CSS.TEXT_TRANSFORM= new TextTransformProperty(); + } + + private TextTransformProperty() { + super(CSS_PROPERTY); + } + +} diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VerticalAlignProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VerticalAlignProperty.java index 3ace339c..31781204 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VerticalAlignProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VerticalAlignProperty.java @@ -32,10 +32,7 @@ public class VerticalAlignProperty extends AbstractCssProperty } private VerticalAlignProperty() { - } - - public String getCssName() { - return CSS_PROPERTY; + super(CSS_PROPERTY); } public void set(Style s, Length p) { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VisibilityProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VisibilityProperty.java index 97cdaa4f..dcc0b848 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VisibilityProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/VisibilityProperty.java @@ -32,9 +32,7 @@ public class VisibilityProperty extends AbstractCssProperty { } private VisibilityProperty() { + super(CSS_PROPERTY); } - public String getCssName() { - return CSS_PROPERTY; - } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WhiteSpaceProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WhiteSpaceProperty.java new file mode 100644 index 00000000..32d4967f --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WhiteSpaceProperty.java @@ -0,0 +1,71 @@ +/* + * 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.HasCssName; + +/** + * This property describes how inline content of a block is aligned. + */ +public class WhiteSpaceProperty extends + AbstractCssProperty { + + public enum WhiteSpace implements HasCssName { + /** + * Sequences of whitespace will collapse into a single whitespace. Text will + * wrap when necessary. + */ + NORMAL, + /** + * Sequences of whitespace will collapse into a single whitespace. Text will + * never wrap to the next line. The text continues on the same line until a
+ * tag is encountered + */ + NOWRAP, + /** + * Whitespace is preserved by the browser. Text will only wrap on line + * breaks Acts like the + * + *
 tag in HTML
+     */
+    PRE,
+    /**
+     * Sequences of whitespace will collapse into a single whitespace. Text will
+     * wrap when necessary, and on line breaks
+     */
+    PRE_LINE,
+    /**
+     * Whitespace is preserved by the browser. Text will wrap when necessary,
+     * and on line breaks
+     */
+    PRE_WRAP;
+
+    public String getCssName() {
+      return name().toLowerCase().replace('_', '-');
+    };
+  }
+
+  private static final String CSS_PROPERTY = "whiteSpace";
+
+  public static void init() {
+    CSS.WHITE_SPACE = new WhiteSpaceProperty();
+  }
+
+  private WhiteSpaceProperty() {
+    super(CSS_PROPERTY);
+  }
+
+}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WidthProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WidthProperty.java
index a3c52cb4..6cb6cacf 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WidthProperty.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WidthProperty.java
@@ -30,17 +30,18 @@ package com.google.gwt.query.client.css;
  */
 public class WidthProperty extends AbstractCssProperty {
 
-  private static final String CSS_PROPERTY = "width";
+  private static final String WIDTH_PROPERTY = "width";
+  private static final String MAX_WIDTH_PROPERTY = "maxWidth";
+  private static final String MIN_WIDTH_PROPERTY = "minWidth";
 
   public static void init() {
-    CSS.WIDTH = new WidthProperty();
+    CSS.WIDTH = new WidthProperty(WIDTH_PROPERTY);
+    CSS.MAX_WIDTH = new WidthProperty(MAX_WIDTH_PROPERTY);
+    CSS.MIN_WIDTH = new WidthProperty(MIN_WIDTH_PROPERTY);
   }
-
-  private WidthProperty() {
-  }
-
-  public String getCssName() {
-    return CSS_PROPERTY;
+  
+  private WidthProperty(String cssName) {
+    super(cssName);
   }
 
 }
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WordSpacingProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WordSpacingProperty.java
new file mode 100644
index 00000000..20f4cbd6
--- /dev/null
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/WordSpacingProperty.java
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * all height css properties : max-height, min-height, height
+ */
+public class WordSpacingProperty extends AbstractCssProperty {
+
+  private static final String CSS_PROPERTY = "wordSpacing";
+
+  public static void init() {
+    CSS.WORD_SPACING = new WordSpacingProperty();
+  }
+
+  private WordSpacingProperty() {
+    super(CSS_PROPERTY);
+  }
+
+}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ZIndexProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ZIndexProperty.java
new file mode 100644
index 00000000..d5e95401
--- /dev/null
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ZIndexProperty.java
@@ -0,0 +1,55 @@
+/*
+ * 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;
+
+/**
+ * The z-index property specifies the stack order of an element.
+ * 
+ * An element with greater stack order is always in front of an element with a
+ * lower stack order.
+ * 
+ * The z-index property only works on positioned elements (position:absolute,
+ * position:relative, or position:fixed).
+ */
+public class ZIndexProperty extends AbstractCssProperty {
+
+  private static final String CSS_PROPERTY = "zIndex";
+
+  public static void init() {
+    CSS.ZINDEX = new ZIndexProperty();
+  }
+
+  private ZIndexProperty() {
+    super(CSS_PROPERTY);
+  }
+
+  @Override
+  public String get(Style s) {
+    return getZIndex(s);
+  }
+
+  /**
+   * See GWT issue 5548
+   * http://code.google.com/p/google-web-toolkit/issues/detail?id=5548
+   */
+  private native String getZIndex(Style s) /*-{
+    //force to return a string
+    return ""+s["zIndex"];
+  }-*/;
+
+}
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java
index 846279bd..8cb98138 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCssTest.java
@@ -25,25 +25,32 @@ import com.google.gwt.dom.client.Style.FontStyle;
 import com.google.gwt.dom.client.Style.ListStyleType;
 import com.google.gwt.dom.client.Style.Overflow;
 import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.dom.client.Style.TextDecoration;
 import com.google.gwt.dom.client.Style.Unit;
 import com.google.gwt.dom.client.Style.VerticalAlign;
 import com.google.gwt.dom.client.Style.Visibility;
 import com.google.gwt.junit.client.GWTTestCase;
 import com.google.gwt.query.client.css.CSS;
+import com.google.gwt.query.client.css.CssNumber;
 import com.google.gwt.query.client.css.ImageValue;
 import com.google.gwt.query.client.css.Length;
 import com.google.gwt.query.client.css.RGBColor;
 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.BorderCollapseProperty.BorderCollapse;
+import com.google.gwt.query.client.css.BorderSpacingProperty.BorderSpacing;
 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.CaptionSideProperty.CaptionSide;
 import com.google.gwt.query.client.css.ClearProperty.Clear;
 import com.google.gwt.query.client.css.ClipProperty.Shape;
 import com.google.gwt.query.client.css.FontSizeProperty.FontSize;
 import com.google.gwt.query.client.css.FontVariantProperty.FontVariant;
 import com.google.gwt.query.client.css.ListStylePositionProperty.ListStylePosition;
 import com.google.gwt.query.client.css.TextAlignProperty.TextAlign;
+import com.google.gwt.query.client.css.TextTransformProperty.TextTransform;
+import com.google.gwt.query.client.css.WhiteSpaceProperty.WhiteSpace;
 import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.RootPanel;
 
@@ -191,7 +198,46 @@ public class GQueryCssTest extends GWTTestCase {
     assertEquals("repeat-x", $("#test").css("backgroundRepeat"));
     assertEquals("repeat-x", $("#test").css(CSS.BACKGROUND_REPEAT));
   }
+  
+  public void testBorderCollapseProperty() {
+
+    $(e).html("
Content
"); + + $("#test").css(CSS.BORDER_COLLAPSE, BorderCollapse.COLLAPSE); + assertEquals("collapse", $("#test").css("borderCollapse")); + assertEquals("collapse", $("#test").css(CSS.BORDER_COLLAPSE)); + + $("#test").css(CSS.BORDER_COLLAPSE, BorderCollapse.SEPARATE); + + assertEquals("separate", $("#test").css("borderCollapse")); + assertEquals("separate", $("#test").css(CSS.BORDER_COLLAPSE)); + } + + public void testCaptionSideProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.CAPTION_SIDE, CaptionSide.BOTTOM); + assertEquals("bottom", $("#test").css("captionSide")); + assertEquals("bottom", $("#test").css(CSS.CAPTION_SIDE)); + + } + + public void testBorderSpacingProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.BORDER_SPACING, 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))); + + assertEquals("10px 20em", $("#test").css("borderSpacing")); + assertEquals("10px 20em", $("#test").css(CSS.BORDER_SPACING)); + } public void testBorderColorProperty() { $(e).html("
Content
"); @@ -231,6 +277,26 @@ public class GQueryCssTest extends GWTTestCase { 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); + 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); + 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); + 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); + assertEquals("medium dashed gray", $("#test").css("borderRight")); + assertEquals("medium dashed gray", $("#test").css(CSS.BORDER_RIGHT)); } @@ -295,6 +361,34 @@ public class GQueryCssTest extends GWTTestCase { } + public void testClearProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.CLEAR, Clear.BOTH); + assertEquals("both", $("#test").css("clear")); + assertEquals("both", $("#test").css(CSS.CLEAR)); + + $("#test").css(CSS.CLEAR, Clear.LEFT); + assertEquals("left", $("#test").css(CSS.CLEAR)); + + $("#test").css(CSS.CLEAR, Clear.RIGHT); + assertEquals("right", $("#test").css(CSS.CLEAR)); + + $("#test").css(CSS.CLEAR, Clear.NONE); + assertEquals("none", $("#test").css(CSS.CLEAR)); + + } + + public void testClipProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.CLIP, 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)); + } + public void testColorProperty() { $(e).html("
Content
"); @@ -314,7 +408,7 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("rgb(35,45,55)", $("#test").css(CSS.COLOR)); } - + public void testColorValue() { $(e).html("
Content
"); @@ -380,7 +474,7 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("rgb(35,45,55)", $("#test").css(CSS.COLOR)); } - + public void testCursorProperty() { $(e).html("
Content
"); @@ -391,34 +485,6 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("wait", $("#test").css(CSS.CURSOR)); } - - public void testClearProperty() { - - $(e).html("
Content
"); - - $("#test").css(CSS.CLEAR, Clear.BOTH); - assertEquals("both", $("#test").css("clear")); - assertEquals("both", $("#test").css(CSS.CLEAR)); - - $("#test").css(CSS.CLEAR, Clear.LEFT); - assertEquals("left", $("#test").css(CSS.CLEAR)); - - $("#test").css(CSS.CLEAR, Clear.RIGHT); - assertEquals("right", $("#test").css(CSS.CLEAR)); - - $("#test").css(CSS.CLEAR, Clear.NONE); - assertEquals("none", $("#test").css(CSS.CLEAR)); - - } - - public void testClipProperty() { - - $(e).html("
Content
"); - - $("#test").css(CSS.CLIP, 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)); - } public void testDisplayProperty() { @@ -521,7 +587,7 @@ public class GQueryCssTest extends GWTTestCase { } - public void testHeightProperty() { + public void testHeightProperties() { $(e).html("
Content
"); @@ -529,6 +595,16 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("10px", $("#test").css("height")); assertEquals("10px", $("#test").css(CSS.HEIGHT)); + + $("#test").css(CSS.MAX_HEIGHT, Length.px(15)); + + assertEquals("15px", $("#test").css("maxHeight")); + assertEquals("15px", $("#test").css(CSS.MAX_HEIGHT)); + + $("#test").css(CSS.MIN_HEIGHT, Length.px(5)); + + assertEquals("5px", $("#test").css("minHeight")); + assertEquals("5px", $("#test").css(CSS.MIN_HEIGHT)); } public void testLengthValue() { @@ -564,6 +640,31 @@ public class GQueryCssTest extends GWTTestCase { } + public void testLetterSpacingProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.LETTER_SPACING, Length.px(15)); + assertEquals("15px", $("#test").css("letterSpacing")); + assertEquals("15px", $("#test").css(CSS.LETTER_SPACING)); + + } + + public void testLineHeightProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.LINE_HEIGHT, Length.px(15)); + assertEquals("15px", $("#test").css("lineHeight")); + assertEquals("15px", $("#test").css(CSS.LINE_HEIGHT)); + + $("#test").css(CSS.LINE_HEIGHT, new CssNumber(2)); + assertEquals("2", $("#test").css("lineHeight")); + assertEquals("2", $("#test").css(CSS.LINE_HEIGHT)); + + + } + public void testListStyleImageProperty() { $(e).html("
  • Content
"); @@ -573,7 +674,7 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("url('arrow.jpg')", $("#test").css(CSS.LIST_STYLE_IMAGE)); } - + public void testListStylePositionProperty() { $(e).html("
  • Content
"); @@ -587,16 +688,6 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("outside", $("#test").css(CSS.LIST_STYLE_POSITION)); } - - public void testListStyleTypeProperty() { - - $(e).html("
  • Content
"); - - $("#test").css(CSS.LIST_STYLE_TYPE, ListStyleType.DISC); - assertEquals("disc", $("#test").css("listStyleType")); - assertEquals("disc", $("#test").css(CSS.LIST_STYLE_TYPE)); - - } public void testListStyleProperty() { @@ -616,6 +707,16 @@ public class GQueryCssTest extends GWTTestCase { } + public void testListStyleTypeProperty() { + + $(e).html("
  • Content
"); + + $("#test").css(CSS.LIST_STYLE_TYPE, ListStyleType.DISC); + assertEquals("disc", $("#test").css("listStyleType")); + assertEquals("disc", $("#test").css(CSS.LIST_STYLE_TYPE)); + + } + public void testMarginProperty() { $(e).html("
Content
"); @@ -646,6 +747,7 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("50px", $("#test").css(CSS.MARGIN_RIGHT)); } + public void testOutlineProperty(){ $(e).html("
Content
"); @@ -688,7 +790,6 @@ public class GQueryCssTest extends GWTTestCase { } - public void testPaddingProperty() { $(e).html("
Content
"); @@ -763,6 +864,41 @@ public class GQueryCssTest extends GWTTestCase { } + public void testTextDecorationProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.TEXT_DECORATION, TextDecoration.LINE_THROUGH); + assertEquals("line-through", $("#test").css("textDecoration")); + assertEquals("line-through", $("#test").css(CSS.TEXT_DECORATION)); + + } + + public void testTextIdentProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.TEXT_IDENT, Length.px(15)); + assertEquals("15px", $("#test").css("textIdent")); + assertEquals("15px", $("#test").css(CSS.TEXT_IDENT)); + + } + + public void testTextTransformProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.TEXT_TRANSFORM, TextTransform.UPPERCASE); + assertEquals("uppercase", $("#test").css("textTransform")); + assertEquals("uppercase", $("#test").css(CSS.TEXT_TRANSFORM)); + + $("#test").css(CSS.TEXT_TRANSFORM, TextTransform.LOWERCASE); + assertEquals("lowercase", $("#test").css("textTransform")); + + $("#test").css(CSS.TEXT_TRANSFORM, TextTransform.CAPITALIZE); + assertEquals("capitalize", $("#test").css("textTransform")); + } + public void testVerticalAlignProperty() { $(e).html("
Content
"); @@ -815,6 +951,29 @@ public class GQueryCssTest extends GWTTestCase { } + public void testWhiteSpaceProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.WHITE_SPACE, WhiteSpace.NORMAL); + assertEquals("normal", $("#test").css("whiteSpace")); + assertEquals("normal", $("#test").css(CSS.WHITE_SPACE)); + + $("#test").css(CSS.WHITE_SPACE, WhiteSpace.NOWRAP); + assertEquals("nowrap", $("#test").css(CSS.WHITE_SPACE)); + + $("#test").css(CSS.WHITE_SPACE, WhiteSpace.PRE); + assertEquals("pre", $("#test").css(CSS.WHITE_SPACE)); + + $("#test").css(CSS.WHITE_SPACE, WhiteSpace.PRE_LINE); + assertEquals("pre-line", $("#test").css(CSS.WHITE_SPACE)); + + $("#test").css(CSS.WHITE_SPACE, WhiteSpace.PRE_WRAP); + assertEquals("pre-wrap", $("#test").css(CSS.WHITE_SPACE)); + + + } + public void testWidthProperty() { $(e).html("
Content
"); @@ -822,7 +981,36 @@ public class GQueryCssTest extends GWTTestCase { $("#test").css(CSS.WIDTH, Length.px(20)); assertEquals("20px", $("#test").css("width")); assertEquals("20px", $("#test").css(CSS.WIDTH)); + + $("#test").css(CSS.MIN_WIDTH, Length.px(10)); + assertEquals("10px", $("#test").css("minWidth")); + assertEquals("10px", $("#test").css(CSS.MIN_WIDTH)); + + $("#test").css(CSS.MAX_WIDTH, Length.px(30)); + assertEquals("30px", $("#test").css("maxWidth")); + assertEquals("30px", $("#test").css(CSS.MAX_WIDTH)); + + } + + public void testWordSpacingProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.WORD_SPACING, Length.pt(2)); + assertEquals("2pt", $("#test").css("wordSpacing")); + assertEquals("2pt", $("#test").css(CSS.WORD_SPACING)); + + } + + public void testZIndexProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.ZINDEX, new CssNumber(1000)); + assertEquals("1000", $("#test").css("zIndex")); + assertEquals("1000", $("#test").css(CSS.ZINDEX)); } + } -- 2.39.5