From 4a98a73baf6aa3387693e402c34f8a1cabd9d1a0 Mon Sep 17 00:00:00 2001 From: Julien Dramaix Date: Thu, 17 Feb 2011 21:56:25 +0000 Subject: [PATCH] finalize CSS2 part of gwtquery --- .../com/google/gwt/query/client/GQuery.java | 14 +++ .../google/gwt/query/client/LazyGQuery.java | 12 +++ .../css/BackgroundAttachmentProperty.java | 6 +- .../client/css/BackgroundColorProperty.java | 5 +- .../css/BackgroundPositionProperty.java | 88 +++++++++++++++-- .../query/client/css/BackgroundProperty.java | 8 ++ .../client/css/BackgroundRepeatProperty.java | 65 ++++--------- .../client/css/BorderCollapseProperty.java | 5 +- .../query/client/css/BorderColorProperty.java | 7 +- .../gwt/query/client/css/BorderProperty.java | 10 +- .../client/css/BorderSpacingProperty.java | 34 +++++-- .../query/client/css/BorderStyleProperty.java | 95 +++++-------------- .../query/client/css/BorderWidthProperty.java | 26 ++++- .../com/google/gwt/query/client/css/CSS.java | 48 +++++++--- .../query/client/css/CaptionSideProperty.java | 7 ++ .../gwt/query/client/css/ClearProperty.java | 49 +++------- .../gwt/query/client/css/ClipProperty.java | 16 +++- .../gwt/query/client/css/ColorProperty.java | 3 +- .../client/css/CssShorthandProperty3.java | 7 +- .../client/css/CssShorthandProperty5.java | 3 + .../gwt/query/client/css/CursorProperty.java | 3 +- .../query/client/css/DirectionProperty.java | 24 ++++- .../query/client/css/EmptyCellsProperty.java | 4 + .../query/client/css/FontSizeProperty.java | 87 +++++------------ .../query/client/css/FontStyleProperty.java | 3 +- .../query/client/css/FontVariantProperty.java | 40 +++----- .../query/client/css/FontWeightProperty.java | 2 +- .../gwt/query/client/css/HeightProperty.java | 4 +- .../gwt/query/client/css/ImageValue.java | 8 +- .../client/css/LetterSpacingProperty.java | 3 +- .../query/client/css/LineHeightProperty.java | 18 +++- .../client/css/ListStyleImageProperty.java | 4 +- .../client/css/ListStylePositionProperty.java | 37 +++----- .../query/client/css/ListStyleProperty.java | 4 +- .../client/css/ListStyleTypeProperty.java | 7 +- .../gwt/query/client/css/MarginProperty.java | 14 +-- .../client/css/OutlineStyleProperty.java | 1 - .../query/client/css/OverflowProperty.java | 7 +- .../query/client/css/PositionProperty.java | 3 +- .../google/gwt/query/client/css/RGBColor.java | 2 - .../query/client/css/TextAlignProperty.java | 47 ++++----- .../client/css/TextDecorationProperty.java | 19 ++-- .../query/client/css/TextIdentProperty.java | 14 +-- .../client/css/TextTransformProperty.java | 17 ++-- .../query/client/css/UnicodeBidiProperty.java | 39 +++++++- .../client/css/VerticalAlignProperty.java | 4 +- .../query/client/css/VisibilityProperty.java | 8 +- .../query/client/css/WhiteSpaceProperty.java | 8 +- .../gwt/query/client/css/WidthProperty.java | 14 +-- .../query/client/css/WordSpacingProperty.java | 2 +- .../gwt/query/client/GQueryCssTest.java | 19 +++- 51 files changed, 545 insertions(+), 429 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index 5ea3f159..dc8fd780 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -1010,6 +1010,20 @@ public class GQuery implements Lazy { } return this; } + + /** + * Set CSS a single style property on every matched element using type-safe + * enumerations. This method allows you to set manually the value or set + * inherit value + * + * ex : + *
+   * $(#myId).css(CSS.TEXT_DECORATION, CSS.INHERIT);
+   * 
+ */ + public GQuery css(TakeCssValue cssProperty, String value) { + return css(cssProperty.getCssName(), value); + } /** * Set CSS a single style property on every matched element using type-safe diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java index 4e62f506..5d915db7 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java @@ -333,6 +333,18 @@ public interface LazyGQuery extends LazyBase{ */ > LazyGQuery css(T cssProperty, S value); + /** + * Set CSS a single style property on every matched element using type-safe + * enumerations. This method allows you to set manually the value or set + * inherit value + * + * ex : + *
+   * $(#myId).css(CSS.TEXT_DECORATION, CSS.INHERIT);
+   * 
+ */ + LazyGQuery css(TakeCssValue cssProperty, String value); + /** * Set CSS a single style property on every matched element using type-safe * enumerations. 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 9ea18646..03f16713 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 @@ -18,8 +18,9 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * This property affects the vertical positioning inside a line box of the boxes - * generated by an inline-level element. + * If a background image is specified, this property specifies whether it is + * fixed with regard to the viewport ('fixed') or scrolls along with the + * containing block ('scroll'). */ public class BackgroundAttachmentProperty extends AbstractCssProperty { @@ -50,7 +51,6 @@ public class BackgroundAttachmentProperty extends private static final String CSS_PROPERTY = "backgroundAttachment"; private static final String FIXED_VALUE = "fixed"; - private static final String SCROLL_VALUE = "scroll"; public static void init() { 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 b343e0f4..bbcfa58e 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 @@ -16,8 +16,9 @@ package com.google.gwt.query.client.css; /** - * This property sets the background color of an element, either a value - * or the keyword 'transparent', to make the underlying colors shine through. + * This property sets the background color of an element, either a color + * value or the keyword 'transparent', to make the underlying colors shine + * through. */ public class BackgroundColorProperty extends AbstractCssProperty { 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 b613da37..b4b18dab 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 @@ -15,33 +15,103 @@ */ package com.google.gwt.query.client.css; -import static com.google.gwt.query.client.css.CSS.INHERIT_VALUE; - import com.google.gwt.dom.client.Style.HasCssName; import com.google.gwt.dom.client.Style.Unit; /** - * The {@link BackgroundPositionProperty} define the position of a - * background-image. + * If a background image has been specified, this property specifies its initial + * position. */ public class BackgroundPositionProperty extends AbstractCssProperty { + /** + * Value for background-position property. + * + * @author Julien Dramaix (julien.dramaix@gmail.com) + * + */ public static class BackgroundPosition implements HasCssName { + + /** + * Equivalent to {@link BackgroundPosition#CENTER_BOTTOM} + */ + public static BackgroundPosition BOTTOM; + + /** + * Equivalent to {@link BackgroundPosition#CENTER_CENTER} + */ public static BackgroundPosition CENTER; + + /** + * Equivalent to '50%' for the horizontal position and '100%' for the + * vertical position. + */ public static BackgroundPosition CENTER_BOTTOM; + + /** + * Equivalent to '50%' for the horizontal position and '50%' for the + * vertical position. + */ public static BackgroundPosition CENTER_CENTER; + + /** + * Equivalent to '50%' for the horizontal position and '0%' for the vertical + * position. + */ public static BackgroundPosition CENTER_TOP; - public static BackgroundPosition INHERIT; + + /** + * Equivalent to {@link BackgroundPosition#LEFT_CENTER} + */ public static BackgroundPosition LEFT; + + /** + * Equivalent to '0%' for the horizontal position and '100%' for the + * vertical position. + */ public static BackgroundPosition LEFT_BOTTOM; + + /** + * Equivalent to '0%' for the horizontal position and '50%' for the vertical + * position. + */ public static BackgroundPosition LEFT_CENTER; + + /** + * Equivalent to '0%' for the horizontal position and '0%' for the vertical + * position. + */ public static BackgroundPosition LEFT_TOP; + + /** + * Equivalent to {@link BackgroundPosition#RIGHT_CENTER} + */ public static BackgroundPosition RIGHT; + + /** + * Equivalent to '100%' for the horizontal position and '100%' for the + * vertical position. + */ public static BackgroundPosition RIGHT_BOTTOM; + + /** + * Equivalent to '100%' for the horizontal position and '50%' for the + * vertical position. + */ public static BackgroundPosition RIGHT_CENTER; + + /** + * Equivalent to '100%' for the horizontal position and '0%' for the + * vertical position. + */ public static BackgroundPosition RIGHT_TOP; + /** + * Equivalent to {@link BackgroundPosition#CENTER_TOP} + */ + public static BackgroundPosition TOP; + private static final String BOTTOM_VALUE = "bottom"; private static final String CENTER_VALUE = "center"; private static final String LEFT_VALUE = "left"; @@ -62,9 +132,15 @@ public class BackgroundPositionProperty extends RIGHT_CENTER = new BackgroundPosition(RIGHT_VALUE + " " + CENTER_VALUE); RIGHT = new BackgroundPosition(RIGHT_VALUE); RIGHT_TOP = new BackgroundPosition(RIGHT_VALUE + " " + TOP_VALUE); - INHERIT = new BackgroundPosition(INHERIT_VALUE); + TOP = new BackgroundPosition(TOP_VALUE); + BOTTOM = new BackgroundPosition(BOTTOM_VALUE); + } + /** + * Return a {@link BackgroundPosition} by specifying the horizontal and + * vertical position. + */ public static BackgroundPosition position(int xpos, int ypos, Unit unit) { if (unit == null) { unit = Unit.PX; diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundProperty.java index 32e681dd..b1d3cd1c 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/BackgroundProperty.java @@ -21,6 +21,14 @@ import com.google.gwt.query.client.css.BackgroundAttachmentProperty.BackgroundAt import com.google.gwt.query.client.css.BackgroundPositionProperty.BackgroundPosition; import com.google.gwt.query.client.css.BackgroundRepeatProperty.BackgroundRepeat; +/** + * The 'background' property is a shorthand property for setting the + * individual background properties (i.e., 'background-color', + * 'background-image', 'background-repeat', + * 'background-attachment' and 'background-position') at the same + * place in the style sheet. + * + */ public class BackgroundProperty implements CssShorthandProperty5 { 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 6eef8eec..e506c00e 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 @@ -18,71 +18,46 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * The background-repeat property sets if/how a background image will be - * repeated. By default, a background-image is repeated both vertically and - * horizontally. + * If a background image is specified, this property specifies whether the image + * is repeated (tiled), and how. All tiling covers the content and padding areas + * of a box */ public class BackgroundRepeatProperty extends AbstractCssProperty { + /** + * Define possible values for backgroung-repeat property. + * + */ public static enum BackgroundRepeat implements HasCssName { /** - * Specifies that the setting of the background-repeat property should be - * inherited from the parent element + * The image is not repeated: only one copy of the image is drawn. */ - INHERIT { - @Override - public String getCssName() { - return INHERIT_VALUE; - } - }, + NO_REPEAT, /** - * The background-image will not be repeated + * The image is repeated both horizontally and vertically. */ - NO_REPEAT { - @Override - public String getCssName() { - return NO_REPEAT_VALUE; - } - }, + REPEAT, /** - * The background image will be repeated both vertically and horizontally. + * The image is repeated horizontally only. */ - REPEAT { - @Override - public String getCssName() { - return REPEAT_VALUE; - } - }, + REPEAT_X, /** - * The background image will be repeated only horizontally + * The image is repeated vertically only. */ - REPEAT_X { - @Override - public String getCssName() { - return REPEAT_X_VALUE; - } - }, - /** - * The background image will be repeated only vertically - */ - REPEAT_Y { - @Override - public String getCssName() { - return REPEAT_Y_VALUE; - } - }; + REPEAT_Y; - public abstract String getCssName(); + public String getCssName(){ + return name().toLowerCase().replace('_', '-'); + } } private static final String CSS_PROPERTY = "backgroundRepeat"; - private static final String INHERIT_VALUE = "inherit"; - private static final String NO_REPEAT_VALUE = "no-repeat"; + /*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"; + private static final String REPEAT_Y_VALUE = "repeat-y";*/ public static void init() { CSS.BACKGROUND_REPEAT = new BackgroundRepeatProperty(); 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 index 96257bcf..8cbf135d 100644 --- 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 @@ -18,7 +18,7 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * This property describes the color of a border. + *The border-collapse selects a table's border model. */ public class BorderCollapseProperty extends AbstractCssProperty { @@ -29,12 +29,13 @@ public class BorderCollapseProperty extends * 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(); } 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 18adefe1..98f0bfb4 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,8 @@ package com.google.gwt.query.client.css; /** - * This property describes the color of a border. + * The border-color property specifies the color of a border of a + * box. */ public class BorderColorProperty extends AbstractCssProperty { @@ -35,8 +36,8 @@ public class BorderColorProperty extends AbstractCssProperty { BORDER_RIGHT_COLOR_PROPERTY); CSS.BORDER_TOP_COLOR = new BorderColorProperty(BORDER_TOP_COLOR_PROPERTY); } - + private BorderColorProperty(String value) { - super(value); + 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 76767182..4ca47376 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,16 +21,20 @@ 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. + * The border property is a shorthand property for setting the same + * width, color, and style for all four borders of a box. Unlike the shorthand + * margin and padding properties, the border property + * cannot set different values on the four borders. To do so, one or more of the + * other border properties must be used. + * * */ public class BorderProperty implements CssShorthandProperty3 { 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_PROPERTY = "border"; private static final String BORDER_RIGHT_PROPERTY = "borderRight"; private static final String BORDER_TOP_PROPERTY = "borderTop"; 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 index 542add32..c2b6189e 100644 --- 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 @@ -18,31 +18,47 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * This property describes the color of a border. + * The border-spacing property specifies the distance that separates + * adjacent cell borders in a table context. If one length is specified, it + * gives both the horizontal and vertical spacing. If two are specified, the + * first gives the horizontal spacing and the second the vertical spacing. + * Lengths may not be negative. */ public class BorderSpacingProperty extends AbstractCssProperty { + /** + * value for border-spacing property. + * + */ public static class BorderSpacing implements HasCssName { - - private Length verticalSpacing; + private Length horizontalSpacing; - + private Length verticalSpacing; + + /** + * Construct a {@link BorderSpacing} object with same horizontal and + * vertical spacing + */ public BorderSpacing(Length spacing) { this(spacing, spacing); } - + + /** + * Construct a {@link BorderSpacing} object by specifying a horizontal and + * avertical spacings. + */ 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(); + return horizontalSpacing.getCssName() + " " + + verticalSpacing.getCssName(); } } 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 6055b250..b7cec26a 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 @@ -18,8 +18,8 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * The border style properties specify the line style of a box's border (solid, - * double, dashed, etc.). + * The border-style property specifies the line style of a box's border + * (solid, double, dashed, etc.). */ public class BorderStyleProperty extends AbstractCssProperty { @@ -28,107 +28,62 @@ public class BorderStyleProperty extends /** * The border is a series of short line segments. */ - DASHED { - @Override - public String getCssName() { - return "dashed"; - } - }, + DASHED, + /** * The border is a series of dots. */ - DOTTED { - @Override - public String getCssName() { - return "dotted"; - } - }, + DOTTED, + /** * The border is two solid lines. The sum of the two lines and the space * between them equals the value of 'border-width'. */ - DOUBLE { - @Override - public String getCssName() { - return "double"; - } - }, + DOUBLE, + /** * The border looks as though it were carved into the canvas. */ - GROOVE { - @Override - public String getCssName() { - return "groove"; - } - }, + GROOVE, + /** * Same as NONE, except in terms of border conflict resolution for table * elements. */ - HIDDEN { - @Override - public String getCssName() { - return "hidden"; - } - }, - INHERIT { - @Override - public String getCssName() { - return CSS.INHERIT_VALUE; - } - }, + HIDDEN, + /** * The border makes the entire box look as though it were embedded in the * canvas. */ - INSET { - @Override - public String getCssName() { - return "inset"; - } - }, + INSET, + /** * No border. This value forces the computed value of border-width to * be '0'. */ - NONE { - @Override - public String getCssName() { - return "none"; - } - }, + NONE, + /** * The opposite of INSET: the border makes the entire box look as though it * were coming out of the canvas. */ - OUTSET { - @Override - public String getCssName() { - return "outset"; - } - }, + OUTSET, + /** * The opposite of GROOVE: the border looks as though it were coming out of * the canvas. */ - RIDGE { - @Override - public String getCssName() { - return "ridge"; - } - }, + RIDGE, + /** * The border is a single line segment. */ - SOLID { - @Override - public String getCssName() { - return "solid"; - } - }; - - public abstract String getCssName(); + SOLID; + + public String getCssName() { + return name().toLowerCase(); + } } private static final String BORDER_BOTTOM_STYLE_PROPERTY = "borderBottomStyle"; 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 ef9f1791..9c3a79f8 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 @@ -20,30 +20,48 @@ import com.google.gwt.dom.client.Style.HasCssName; import com.google.gwt.dom.client.Style.Unit; /** - * This property set the width of an element's border. + * The border-width property specifies the width of the border of a box. */ public class BorderWidthProperty extends AbstractCssProperty implements TakesLength { + /** + * Object allowing to specify a width of a line + */ public static class LineWidth implements HasCssName { - public static LineWidth INHERIT; + /** + * Define a medium border. + */ public static LineWidth MEDIUM; + + /** + * Define a thick border. + */ public static LineWidth THICK; + + /** + * Define a thin border. + */ public static LineWidth THIN; static { MEDIUM = new LineWidth("medium"); THICK = new LineWidth("thick"); THIN = new LineWidth("thin"); - INHERIT = new LineWidth(CSS.INHERIT_VALUE); } + /** + * 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()); } @@ -77,7 +95,7 @@ public class BorderWidthProperty extends } private BorderWidthProperty(String value) { - super(value); + super(value); } public void set(Style s, Length p) { 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 40875163..39348310 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 @@ -44,6 +44,7 @@ import com.google.gwt.query.client.css.MarginProperty.ShorthandMarginProperty; import com.google.gwt.query.client.css.PaddingProperty.ShorthandPaddingProperty; 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.UnicodeBidiProperty.UnicodeBidi; import com.google.gwt.query.client.css.WhiteSpaceProperty.WhiteSpace; /** @@ -138,7 +139,7 @@ public class CSS { /** *

* If a background image has been specified, this property specifies its - * initial position. Values have the following meanings: + * initial position. *

* *

@@ -738,6 +739,21 @@ public class CSS { */ public static DirectionProperty DIRECTION; + /** + *

+ * This property takes a {@link UnicodeBidi} object as value. + *

+ * + *

Example:

+ * + *
+   * // set the display property to the element with id 'myId'
+   * $("#myId").css(CSS.DISPLAY, Display.INLINE);
+   * // retrieve the display property of the element with id 'myId'
+   * String display = $("#myId").css(CSS.DISPLAY);
+   *
+   * 
+ */ public static UnicodeBidiProperty UNICODE_BIDI; /** @@ -769,15 +785,16 @@ public class CSS { * have no visible content. Visible content includes " " and other * whitespace except ASCII CR ("\0D"), LF ("\0A"), tab ("\09"), and space * ("\20"). - * - * When this property has the value 'show', borders are drawn around empty - * cells (like normal cells). - * - * A value of 'hide' means that no borders are drawn around empty cells. - * Furthermore, if all the cells in a row have a value of 'hide' and have no - * visible content, the entire row behaves as if it had 'display: none'. - * - * + *

+ *

+ * When this property has the value show, borders are drawn around + * empty cells (like normal cells). + *

+ *

+ * A value of hide means that no borders are drawn around empty cells. + * Furthermore, if all the cells in a row have a value of hide and have + * no visible content, the entire row behaves as if it had display: + * none. *

* *

@@ -911,7 +928,12 @@ public class CSS { */ public static HeightProperty HEIGHT; - public static final String INHERIT_VALUE = "inherit"; + /** + * CSS value specifying that the setting of the related property should be + * inherited from the parent element + */ + public static final String INHERIT= "inherit"; + /** *

@@ -1619,7 +1641,7 @@ public class CSS { /** *

- * The overflow property specifies whether the boxes generated by an + * The visibility property specifies whether the boxes generated by an * element are rendered. Invisible boxes still affect layout (set the * display property to none to suppress box generation * altogether). @@ -1699,7 +1721,7 @@ public class CSS { /** *

- * The white-space property specifies spacing behavior between words. + * The word-spacing property specifies spacing behavior between words. *

*

* Word spacing algorithms are user agent-dependent. Word spacing is also 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 index 7584587a..46c52c38 100644 --- 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 @@ -24,19 +24,26 @@ import com.google.gwt.dom.client.Style.HasCssName; public class CaptionSideProperty extends AbstractCssProperty { + /** + * Possible values for caption-side property. + * + */ public enum CaptionSide implements HasCssName { /** * Positions the caption box above the table box. */ TOP, + /** * Positions the caption box below the table box. */ BOTTOM, + /** * Positions the caption box to the left of the table box. */ LEFT, + /** * Positions the caption box to the right of the table box. */ 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 50efa050..6482da23 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 @@ -23,60 +23,35 @@ import com.google.gwt.dom.client.Style.HasCssName; */ public class ClearProperty extends AbstractCssProperty { + /** + * Possible values for clear property. + * + */ public static enum Clear implements HasCssName { - /** - * No floating elements allowed on either the left or the right side - */ - BOTH { - @Override - public String getCssName() { - return "both"; - } - }, /** - * Specifies that the value of the clear property should be inherited from - * the parent element + * No floating elements allowed on either the left or the right side */ - INHERIT { - @Override - public String getCssName() { - return CSS.INHERIT_VALUE; - } + BOTH, - }, /** * No floating elements allowed on the left side */ - LEFT { - @Override - public String getCssName() { - return "left"; - } + LEFT, - }, /** * Allows floating elements on both sides */ - NONE { - @Override - public String getCssName() { - return "none"; - } + NONE, - }, /** * No floating elements allowed on the right side */ - RIGHT { - @Override - public String getCssName() { - return "right"; - } - - }; + RIGHT; - public abstract String getCssName(); + public String getCssName() { + return name().toLowerCase(); + } } 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 8c820bc6..c46c91c1 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 @@ -18,16 +18,22 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * The clip property lets you specify the dimensions of an absolutely positioned - * element that should be visible, and the element is clipped into this shape, - * and displayed. - * - * The clip property does not work if the overflow property is set to visible. + * A clipping region defines what portion of an element's rendered content is + * visible. By default, the clipping region has the same size and shape as the + * element's box(es). The clip property allows you to modify this + * clipping region by defining a shape. */ public class ClipProperty extends AbstractCssProperty { + /** + * Object defining a clipping region used as value for clip property. + * + */ public static class Shape implements HasCssName { + /** + * Define a rectangular shape. + */ public static Shape rect(int top, int right, int bottom, int left) { return new Shape("rect(" + top + "px," + right + "px," + bottom + "px," + left + "px)"); 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 2a4b7566..f5b0c2b7 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 @@ -16,7 +16,8 @@ package com.google.gwt.query.client.css; /** - * This property describes the foreground color of an element's text content. + * The color property describes the foreground color of an element's text + * content. */ public class ColorProperty extends AbstractCssProperty { 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 index c91d889b..b01290b9 100644 --- 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 @@ -21,8 +21,11 @@ import com.google.gwt.dom.client.Style; * * An enumerated CSS property with values of type X,Y,Z. */ -public interface CssShorthandProperty3 extends CssProperty{ - +public interface CssShorthandProperty3 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/CssShorthandProperty5.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/CssShorthandProperty5.java index 2f60da62..615acdd4 100644 --- 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 @@ -23,6 +23,9 @@ import com.google.gwt.dom.client.Style; */ public interface CssShorthandProperty5 extends CssProperty { + /** + * Set the value of the property. + */ void set(Style s, V value1, W value2, X value3, Y value4, Z value5); } 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 0d3671d9..f19af341 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 @@ -18,7 +18,8 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.Cursor; /** - * This property specifies all possible value for cursor. + * The cursor property specifies the type of cursor to be displayed for + * the pointing device */ public class CursorProperty extends AbstractCssProperty { 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 index 901400e1..ccb3e428 100644 --- 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 @@ -18,18 +18,32 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * This property defines the text direction/writing direction + * The direction specifies the base writing direction of blocks and the + * direction of embeddings and overrides (see 'unicode-bidi') for the Unicode + * bidirectional algorithm. In addition, it specifies the direction of table + * column layout, the direction of horizontal overflow, and the position of an + * incomplete last line in a block in case of 'text-align: justify'. */ public class DirectionProperty extends AbstractCssProperty { + /** + * Possible values for direction property. + * + */ public static enum Direction implements HasCssName { - LTR , - RTL, - INHERIT; + /** + * Left-to-right direction. + */ + LTR, - public String getCssName(){ + /** + * Right-to-left direction. + */ + RTL; + + public String getCssName() { return name().toLowerCase(); } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java index f6f517ae..95cbfeee 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java @@ -27,6 +27,10 @@ import com.google.gwt.dom.client.Style.HasCssName; public class EmptyCellsProperty extends AbstractCssProperty { + /** + * Possible values for empty-cells property.) + * + */ public enum EmptyCells implements HasCssName { /** * No background or borders are shown on empty cells 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 537cb259..203989da 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 @@ -25,100 +25,57 @@ public class FontSizeProperty extends AbstractCssProperty implements TakesLength { /** - * Enum for the font-size property. + * Possible values for the font-size property. */ public static enum FontSize implements HasCssName { - /** - * Specifies that the font size should be inherited from the parent element - */ - INHERIT { - @Override - public String getCssName() { - return CSS.INHERIT_VALUE; - } - }, + /** * Sets the font-size to a large size */ - LARGE { - @Override - public String getCssName() { - return "large"; - } - }, + LARGE, + /** * Sets the font-size to a larger size than the parent element */ - LARGER { - @Override - public String getCssName() { - return "larger"; - } - }, + LARGER, + /** * Sets the font-size to a medium size */ - MEDIUM { - @Override - public String getCssName() { - return "medium"; - } - }, + MEDIUM, + /** * Sets the font-size to a small size */ - SMALL { - @Override - public String getCssName() { - return "small"; - } - }, + SMALL, + /** * Sets the font-size to a smaller size than the parent element */ - SMALLER { - @Override - public String getCssName() { - return "smaller"; - } - }, + SMALLER, + /** * Sets the font-size to an extra large size */ - X_LARGE { - @Override - public String getCssName() { - return "x-large"; - } - }, + X_LARGE, + /** * Sets the font-size to an extra small size */ - X_SMALL { - @Override - public String getCssName() { - return "x-small"; - } - }, + X_SMALL, + /** * Sets the font-size to an extra extra large size */ - XX_LARGE { - @Override - public String getCssName() { - return "xx-large"; - } - }, + XX_LARGE, + /** * Sets the font-size to an extra extra small size */ - XX_SMALL { - @Override - public String getCssName() { - return "xx-small"; - } - }; - public abstract String getCssName(); + XX_SMALL; + public String getCssName() { + return name().toLowerCase().replace('_', '-'); + } } private static final String CSS_PROPERTY = "fontSize"; 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 9276ebef..e60d08c4 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 @@ -18,7 +18,8 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.FontStyle; /** - * This property specifies the mechanism by which elements are rendered. + * The font-style property requests normal (sometimes referred to as + * "roman" or "upright"), italic, and oblique faces within a font family. */ public class FontStyleProperty extends AbstractCssProperty { 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 756a6519..72691bc5 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 @@ -18,44 +18,34 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * This property specifies the mechanism by which elements are rendered. + * In a small-caps font, the glyphs for lowercase letters look similar to the + * uppercase ones, but in a smaller size and with slightly different + * proportions. The font-variant property requests such a font for + * bicameral (having two cases, as with Latin script). This property has no + * visible effect for scripts that are unicameral (having only one case, as with + * most of the world's writing systems). */ public class FontVariantProperty extends AbstractCssProperty { /** - * Enum for the font-variant property. + * Possible values for the font-variant property. */ public static enum FontVariant implements HasCssName { - /** - * Specifies that the font variant should be inherited from the parent - * element - */ - INHERIT { - @Override - public String getCssName() { - return CSS.INHERIT_VALUE; - } - }, + /** * The browser displays a normal font */ - NORMAL { - @Override - public String getCssName() { - return "normal"; - } - }, + NORMAL, + /** * The browser displays a small-caps font */ - SMALL_CAPS { - @Override - public String getCssName() { - return "small-caps"; - } - }; - public abstract String getCssName(); + SMALL_CAPS; + + public String getCssName() { + return name().toLowerCase().replace('_', '-'); + } } private static final String CSS_PROPERTY = "fontVariant"; 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 6169a911..3407d4e5 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 @@ -18,7 +18,7 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.FontWeight; /** - * This property specifies the mechanism by which elements are rendered. + * The font-weight property specifies the weight of the font. */ public class FontWeightProperty extends AbstractCssProperty { 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 11541e0d..41c6cff6 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,7 +16,8 @@ package com.google.gwt.query.client.css; /** - * all height css properties : max-height, min-height, height + * All height css properties : max-height, min-height, + * height */ public class HeightProperty extends AbstractCssProperty { @@ -30,7 +31,6 @@ public class HeightProperty extends AbstractCssProperty { CSS.MIN_HEIGHT = new HeightProperty(MIN_HEIGHT_PROPERTY); } - private HeightProperty(String cssName) { super(cssName); } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ImageValue.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ImageValue.java index d7740007..780c7594 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ImageValue.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ImageValue.java @@ -22,14 +22,18 @@ import com.google.gwt.dom.client.Style.HasCssName; */ public class ImageValue implements HasCssName { - public static final ImageValue INHERIT; + /** + * Specify that no image is used + */ public static final ImageValue NONE; static { NONE = new ImageValue("none"); - INHERIT = new ImageValue(CSS.INHERIT_VALUE); } + /** + * Define an image by its url + */ public static ImageValue url(String url) { return new ImageValue("url('" + url + "')"); } 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 index 7cb62b9f..0dbd1c5e 100644 --- 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 @@ -16,7 +16,8 @@ package com.google.gwt.query.client.css; /** - * all height css properties : max-height, min-height, height + * The letter-spacing property specifies spacing behavior between text + * characters. */ public class LetterSpacingProperty extends AbstractCssProperty { 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 index f2396ab8..95000107 100644 --- 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 @@ -18,9 +18,21 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style; /** - * all height css properties : max-height, min-height, height + *

+ * If the property is set on a block-level element whose content is composed of + * inline-level elements, it specifies the minimal height of each generated + * inline box. + *

+ * + *

+ * If the property is set on an inline-level element, it specifies the exact + * height of each box generated by the element. (Except for inline replaced + * elements, where the height of the box is given by the height + * property.) + *

*/ -public class LineHeightProperty extends AbstractCssProperty implements TakesLength { +public class LineHeightProperty extends AbstractCssProperty + implements TakesLength { private static final String CSS_PROPERTY = "lineHeight"; @@ -34,7 +46,7 @@ public class LineHeightProperty extends AbstractCssProperty implement 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 b4e8f600..1d1695a8 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 @@ -16,7 +16,9 @@ package com.google.gwt.query.client.css; /** - * This property sets an image as the list-item marker. + * The list-style-image property sets the image that will be used as the + * list item marker. When the image is available, it will replace the marker set + * with the list-style-type marker. */ public class ListStyleImageProperty extends AbstractCssProperty { 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 765515d1..607b1f5a 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 @@ -18,46 +18,33 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * This property specifies if the list-item markers should appear inside or - * outside the content flow. + * The list-style-position property specifies the position of the marker + * box in the principal block box. */ public class ListStylePositionProperty extends AbstractCssProperty { + /** + * Possible values for list-style-position property. + * + */ public static enum ListStylePosition implements HasCssName { - /** - * Specifies that the value of the list-style-position property should be - * inherited from the parent element - */ - INHERIT { - @Override - public String getCssName() { - return "inherit"; - } - }, /** * Indents the marker and the text. The bullets appear inside the content * flow */ - INSIDE { - @Override - public String getCssName() { - return "inside"; - } - }, + INSIDE, + /** * Keeps the marker to the left of the text. The bullets appears outside the * content flow. This is default */ - OUTSIDE { - @Override - public String getCssName() { - return "outside"; - } - }; + OUTSIDE; - public abstract String getCssName(); + public String getCssName() { + return name().toLowerCase(); + } } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleProperty.java index 5b61e779..bf3a0c08 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/ListStyleProperty.java @@ -21,7 +21,9 @@ import com.google.gwt.dom.client.Style.ListStyleType; import com.google.gwt.query.client.css.ListStylePositionProperty.ListStylePosition; /** - * This property sets all list properties in one declaration. + * The list-style property is a shorthand notation for setting the three + * properties list-style-type, list-style-image, and + * list-style-position at the same place in the style sheet. */ public class ListStyleProperty implements CssShorthandProperty3 { 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 3dde5111..a9a2125d 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 @@ -18,7 +18,12 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.ListStyleType; /** - * This property sets the type of the list-item marker. + * The list-style-type property specifies appearance of the list item + * marker if list-style-image has the value 'none' or if the image + * pointed to by the URI cannot be displayed. The value 'none' specifies no + * marker, otherwise there are three types of marker: glyphs, numbering systems, + * and alphabetic systems. Note. Numbered lists improve document accessibility + * by making lists easier to navigate. */ public class ListStyleTypeProperty extends AbstractCssProperty { 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 67191595..abf3afcc 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 @@ -28,13 +28,6 @@ public class MarginProperty extends AbstractCssProperty { private ShorthandMarginProperty() { } - 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(MARGIN_PROPERTY, margin.trim()); - - } - public String get(Style s) { return s.getMargin(); } @@ -42,6 +35,13 @@ public class MarginProperty extends AbstractCssProperty { public String getCssName() { return MARGIN_PROPERTY; } + + 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(MARGIN_PROPERTY, margin.trim()); + + } private String notNull(HasCssName value) { return value != null ? value.getCssName() + " " : ""; 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 402cf398..7cc983da 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 @@ -30,7 +30,6 @@ public class OutlineStyleProperty extends AbstractCssProperty { CSS.OUTLINE_STYLE = new OutlineStyleProperty(); } - private OutlineStyleProperty() { super(CSS_PROPERTY); } 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 363ca541..82d04216 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 @@ -18,10 +18,11 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.Overflow; /** - * This property specifies what happens if content overflows an element's box.. + * The overflow property specifies whether the content of a block-level + * element is clipped when it overflows the element's box (which is acting as a + * containing block for the content). */ -public class OverflowProperty extends - AbstractCssProperty { +public class OverflowProperty extends AbstractCssProperty { private static final String CSS_PROPERTY = "overflow"; 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 a5c54a63..dd51eded 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 @@ -18,7 +18,8 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.Position; /** - * The position property is used to position an element. + * The position property determines which of the CSS2 positioning + * algorithms is used to calculate the position of a box. */ public class PositionProperty extends AbstractCssProperty { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/RGBColor.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/RGBColor.java index 478db618..0940f4fb 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/RGBColor.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/RGBColor.java @@ -27,7 +27,6 @@ public class RGBColor implements HasCssName { public static RGBColor FUSCHIA; public static RGBColor GRAY; public static RGBColor GREEN; - public static RGBColor INHERIT; public static RGBColor LIME; public static RGBColor MAROON; public static RGBColor NAVY; @@ -59,7 +58,6 @@ public class RGBColor implements HasCssName { WHITE = rgb("white"); YELLOW = rgb("yellow"); TRANSPARENT = rgb("transparent"); - INHERIT = rgb(CSS.INHERIT_VALUE); } /** 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 9e438466..72a3e12e 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 @@ -18,60 +18,51 @@ 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. + * The text-align property describes how inline-level content of a block + * container is aligned. */ public class TextAlignProperty extends AbstractCssProperty { + /** + * Possible value for text-align property. + */ public static enum TextAlign implements HasCssName { + /** * Align the line box with the left side of the containing box. */ - CENTER { - @Override - public String getCssName() { - return TEXT_ALIGN_CENTER; - } - }, + CENTER, + /** * this property specifies that the inline boxes are to be made flush with * both sides of the block. If the computed value of text-align is 'justify' * while the computed value of white-space is 'pre' or 'pre-line', the * actual value of text-align is set to the initial value. */ - JUSTIFY { - @Override - public String getCssName() { - return TEXT_ALIGN_JUSTIFY; - } - }, + JUSTIFY, + /** * Align the line box with the left side of the containing box. */ - LEFT { - @Override - public String getCssName() { - return TEXT_ALIGN_LEFT; - } - }, + LEFT, + /** * Align the line box with the right side of the containing box. */ - RIGHT { - @Override - public String getCssName() { - return TEXT_ALIGN_RIGHT; - } - }; + RIGHT; - public abstract String getCssName(); + public String getCssName() { + return name().toLowerCase(); + } } + private static final String CSS_PROPERTY = "textAlign"; - private static final String TEXT_ALIGN_CENTER = "center"; + /*private static final String TEXT_ALIGN_CENTER = "center"; private static final String TEXT_ALIGN_JUSTIFY = "justify"; private static final String TEXT_ALIGN_LEFT = "left"; - private static final String TEXT_ALIGN_RIGHT = "right"; + private static final String TEXT_ALIGN_RIGHT = "right";*/ public static void init() { CSS.TEXT_ALIGN = new TextAlignProperty(); 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 index 94662257..52c94554 100644 --- 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 @@ -18,17 +18,24 @@ 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. + * The text-decoration property describes decorations that are added to + * the text of an element using the element's color. When specified on or + * propagated to an inline element, it affects all the boxes generated by that + * element, and is further propagated to any in-flow block-level boxes that + * split the inline. For block containers that establish an inline formatting + * context, the decorations are propagated to an anonymous inline element that + * wraps all the in-flow inline-level children of the block container. For all + * other elements it is propagated to any in-flow children. Note that text + * decorations are not propagated to floating and absolutely positioned + * descendants, nor to the contents of atomic inline-level descendants such as + * inline blocks and inline tables. */ -public class TextDecorationProperty extends - AbstractCssProperty { +public class TextDecorationProperty extends AbstractCssProperty { - private static final String CSS_PROPERTY = "textDecoration"; - public static void init() { - CSS.TEXT_DECORATION= new TextDecorationProperty(); + CSS.TEXT_DECORATION = new TextDecorationProperty(); } private TextDecorationProperty() { 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 index 641a24b5..5f70907c 100644 --- 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 @@ -15,19 +15,19 @@ */ package com.google.gwt.query.client.css; - /** - * This property describes how inline content of a block is aligned. + * The text-ident property specifies the indentation of the first line of + * text in a block container. More precisely, it specifies the indentation of + * the first box that flows into the block's first line box. The box is indented + * with respect to the left (or right, for right-to-left layout) edge of the + * line box. User agents must render this indentation as blank space. */ -public class TextIdentProperty extends - AbstractCssProperty { +public class TextIdentProperty extends AbstractCssProperty { - private static final String CSS_PROPERTY = "textIdent"; - public static void init() { - CSS.TEXT_IDENT= new TextIdentProperty(); + CSS.TEXT_IDENT = new TextIdentProperty(); } private TextIdentProperty() { 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 index bf0c073d..510a08b0 100644 --- 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 @@ -18,12 +18,16 @@ 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. + * The text-transform property controls capitalization effects of an + * element's text. */ public class TextTransformProperty extends AbstractCssProperty { - public enum TextTransform implements HasCssName{ + /** + * Possible values for text-transform property. + */ + public enum TextTransform implements HasCssName { /** * Transforms the first character of each word to uppercase */ @@ -33,20 +37,19 @@ public class TextTransformProperty extends */ UPPERCASE, /** - * Transforms all characters to lowercase + * 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(); + CSS.TEXT_TRANSFORM = new TextTransformProperty(); } private TextTransformProperty() { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/UnicodeBidiProperty.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/UnicodeBidiProperty.java index 9f3a61a9..57707b81 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/css/UnicodeBidiProperty.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/UnicodeBidiProperty.java @@ -23,13 +23,44 @@ import com.google.gwt.dom.client.Style.HasCssName; public class UnicodeBidiProperty extends AbstractCssProperty { + /** + * Define possible values for unicode-bidi property + * + */ public static enum UnicodeBidi implements HasCssName { - NORMAL, - EMBED , - BIDI_OVERRIDE; + /** + * For inline-level elements this creates an override. For block container + * elements this creates an override for inline-level descendants not within + * another block-level, table-cell, table-caption, or inline-block element. + * This means that inside the element, reordering is strictly in sequence + * according to the direction property; the implicit part of the + * bidirectional algorithm is ignored. This corresponds to adding a LRO + * (U+202D; for direction: ltr) or RLO (U+202E; for direction: + * rtl) at the start of the element or at the start of each anonymous + * child block box, if any, and a PDF (U+202C) at the end of the element. + */ + BIDI_OVERRIDE, - public String getCssName(){ + /** + * If the element is inline, this value opens an additional level of + * embedding with respect to the bidirectional algorithm. The direction of + * this embedding level is given by the direction property. Inside + * the element, reordering is done implicitly. This corresponds to adding a + * LRE (U+202A; for direction: ltr) or RLE (U+202B; for direction: + * rtl) at the start of the element and a PDF (U+202C) at the end of the + * element. + */ + EMBED, + + /** + * The element does not open an additional level of embedding with respect + * to the bidirectional algorithm. For inline-level elements, implicit + * reordering works across element boundaries. + */ + NORMAL; + + public String getCssName() { return name().toLowerCase().replace('_', '-'); } 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 31781204..480faed1 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 @@ -19,8 +19,8 @@ import com.google.gwt.dom.client.Style; import com.google.gwt.dom.client.Style.VerticalAlign; /** - * This property affects the vertical positioning inside a line box of the boxes - * generated by an inline-level element. + * The vertical-align property affects the vertical positioning inside a + * line box of the boxes generated by an inline-level element. */ public class VerticalAlignProperty extends AbstractCssProperty implements TakesLength { 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 7b83b0ae..d9fec77c 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 @@ -18,11 +18,9 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.Visibility; /** - * The 'visibility' property specifies whether the boxes generated by an element - * are rendered. Invisible boxes still affect layout (set the 'display' property - * to 'none' to suppress box generation altogether). - - + * The visibility property specifies whether the boxes generated by an + * element are rendered. Invisible boxes still affect layout (set the + * display property to none to suppress box generation altogether). */ public class VisibilityProperty extends AbstractCssProperty { 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 index cb8bbc7f..b459b461 100644 --- 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 @@ -18,34 +18,40 @@ package com.google.gwt.query.client.css; import com.google.gwt.dom.client.Style.HasCssName; /** - * This property declares how white space inside the element is handled + * The white-space property declares how white space inside the element + * is handled */ public class WhiteSpaceProperty extends AbstractCssProperty { public enum WhiteSpace implements HasCssName { + /** * This value directs user agents to collapse sequences of white space, and * break lines as necessary to fill line boxes. */ NORMAL, + /** * This value collapses white space as for 'normal', but suppresses line * breaks within text. */ NOWRAP, + /** * This value prevents user agents from collapsing sequences of white space. * Lines are only broken at newlines in the source, or at occurrences of * "\A" in generated content. */ PRE, + /** * This value directs user agents to collapse sequences of white space. * Lines are broken at newlines in the source, at occurrences of "\A" in * generated content, and as necessary to fill line boxes. */ PRE_LINE, + /** * This value prevents user agents from collapsing sequences of white space. * Lines are broken at newlines in the source, at occurrences of "\A" in 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 6cb6cacf..7a1231c7 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 @@ -16,17 +16,7 @@ package com.google.gwt.query.client.css; /** - * This property specifies the content width of boxes generated by block-level - * and replaced elements. - * - * This property does not apply to non-replaced inline-level elements. The - * content width of a non-replaced inline element's boxes is that of the - * rendered content within them (before any relative offset of children). Recall - * that inline boxes flow into line boxes. The width of line boxes is given by - * the their containing block, but may be shorted by the presence of floats. - * - * The width of a replaced element's box is intrinsic and may be scaled by the - * user agent if the value of this property is different than 'auto'. + * All width css properties : max-width, min-width, width */ public class WidthProperty extends AbstractCssProperty { @@ -39,7 +29,7 @@ public class WidthProperty extends AbstractCssProperty { CSS.MAX_WIDTH = new WidthProperty(MAX_WIDTH_PROPERTY); CSS.MIN_WIDTH = new WidthProperty(MIN_WIDTH_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 index 20f4cbd6..dd108eb9 100644 --- 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 @@ -16,7 +16,7 @@ package com.google.gwt.query.client.css; /** - * all height css properties : max-height, min-height, height + * The word-spacing property specifies spacing behavior between words. */ public class WordSpacingProperty extends AbstractCssProperty { 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 12d34bb7..ebf1c7ab 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 @@ -51,6 +51,7 @@ 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.UnicodeBidiProperty.UnicodeBidi; 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; @@ -441,9 +442,6 @@ public class GQueryCssTest extends GWTTestCase { $("#test").css(CSS.COLOR, RGBColor.GREEN); assertEquals("green", $("#test").css(CSS.COLOR)); - $("#test").css(CSS.COLOR, RGBColor.INHERIT); - assertEquals("inherit", $("#test").css(CSS.COLOR)); - $("#test").css(CSS.COLOR, RGBColor.LIME); assertEquals("lime", $("#test").css(CSS.COLOR)); @@ -937,6 +935,21 @@ public class GQueryCssTest extends GWTTestCase { assertEquals("capitalize", $("#test").css("textTransform")); } + public void testUnicodeBidiProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.UNICODE_BIDI, 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); + assertEquals("embed", $("#test").css(CSS.UNICODE_BIDI)); + + $("#test").css(CSS.UNICODE_BIDI, UnicodeBidi.NORMAL); + assertEquals("normal", $("#test").css(CSS.UNICODE_BIDI)); + } + public void testVerticalAlignProperty() { $(e).html("
Content
"); -- 2.39.5