}\r
return this;\r
}\r
+ \r
+ /**\r
+ * Set CSS a single style property on every matched element using type-safe\r
+ * enumerations. This method allows you to set manually the value or set\r
+ * <i>inherit</i> value\r
+ * \r
+ * ex :\r
+ * <pre class="code">\r
+ * $(#myId).css(CSS.TEXT_DECORATION, CSS.INHERIT);\r
+ * </pre>\r
+ */\r
+ public GQuery css(TakeCssValue<?> cssProperty, String value) {\r
+ return css(cssProperty.getCssName(), value);\r
+ }\r
\r
/**\r
* Set CSS a single style property on every matched element using type-safe\r
*/
<S, T extends TakeCssValue<S>> LazyGQuery<T> css(T cssProperty, S value);
+ /**
+ * Set CSS a single style property on every matched element using type-safe
+ * enumerations. This method allows you to set manually the value or set
+ * <i>inherit</i> value
+ *
+ * ex :
+ * <pre class="code">
+ * $(#myId).css(CSS.TEXT_DECORATION, CSS.INHERIT);
+ * </pre>
+ */
+ LazyGQuery<T> css(TakeCssValue<?> cssProperty, String value);
+
/**
* Set CSS a single style property on every matched element using type-safe
* enumerations.
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 (<i>'fixed'</i>) or scrolls along with the
+ * containing block (<i>'scroll'</i>).
*/
public class BackgroundAttachmentProperty extends
AbstractCssProperty<BackgroundAttachmentProperty.BackgroundAttachment> {
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() {
package com.google.gwt.query.client.css;
/**
- * This property sets the background color of an element, either a <color> value
- * or the keyword 'transparent', to make the underlying colors shine through.
+ * This property sets the background color of an element, either a <i>color</i>
+ * value or the keyword 'transparent', to make the underlying colors shine
+ * through.
*/
public class BackgroundColorProperty extends AbstractCssProperty<RGBColor> {
*/
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<BackgroundPositionProperty.BackgroundPosition> {
+ /**
+ * Value for <i>background-position</i> 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";
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;
import com.google.gwt.query.client.css.BackgroundPositionProperty.BackgroundPosition;
import com.google.gwt.query.client.css.BackgroundRepeatProperty.BackgroundRepeat;
+/**
+ * The <i>'background'</i> property is a shorthand property for setting the
+ * individual background properties (i.e., <i>'background-color'</i>,
+ * <i>'background-image'</i>, <i>'background-repeat'</i>,
+ * <i>'background-attachment'</i> and <i>'background-position'</i>) at the same
+ * place in the style sheet.
+ *
+ */
public class BackgroundProperty
implements
CssShorthandProperty5<RGBColor, ImageValue, BackgroundRepeat, BackgroundAttachment, BackgroundPosition> {
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<BackgroundRepeatProperty.BackgroundRepeat> {
+ /**
+ * Define possible values for <i>backgroung-repeat</i> 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();
import com.google.gwt.dom.client.Style.HasCssName;
/**
- * This property describes the color of a border.
+ *The <i>border-collapse</i> selects a table's border model.
*/
public class BorderCollapseProperty extends
AbstractCssProperty<BorderCollapseProperty.BorderCollapse> {
* 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();
}
package com.google.gwt.query.client.css;
/**
- * This property describes the color of a border.
+ * The <i>border-color</i> property specifies the color of a border of a
+ * box.
*/
public class BorderColorProperty extends AbstractCssProperty<RGBColor> {
BORDER_RIGHT_COLOR_PROPERTY);
CSS.BORDER_TOP_COLOR = new BorderColorProperty(BORDER_TOP_COLOR_PROPERTY);
}
-
+
private BorderColorProperty(String value) {
- super(value);
+ super(value);
}
}
import com.google.gwt.query.client.css.BorderWidthProperty.LineWidth;
/**
- * The border shorthand property sets all the border properties in one
- * declaration.
+ * The <i>border</i> property is a shorthand property for setting the same
+ * width, color, and style for all four borders of a box. Unlike the shorthand
+ * <i>margin</i> and <i>padding</i> properties, the <i>border</i> 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<LineWidth, LineStyle, RGBColor> {
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";
import com.google.gwt.dom.client.Style.HasCssName;
/**
- * This property describes the color of a border.
+ * The <i>border-spacing</i> 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<BorderSpacingProperty.BorderSpacing> {
+ /**
+ * value for <i>border-spacing</i> 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();
}
}
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 <i>border-style</i> property specifies the line style of a box's border
+ * (solid, double, dashed, etc.).
*/
public class BorderStyleProperty extends
AbstractCssProperty<BorderStyleProperty.LineStyle> {
/**
* 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 <i>border-width</i> 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";
import com.google.gwt.dom.client.Style.Unit;
/**
- * This property set the width of an element's border.
+ * The <i>border-width</i> property specifies the width of the border of a box.
*/
public class BorderWidthProperty extends
AbstractCssProperty<BorderWidthProperty.LineWidth> 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());
}
}
private BorderWidthProperty(String value) {
- super(value);
+ super(value);
}
public void set(Style s, Length p) {
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;
/**
/**
* <p>
* If a background image has been specified, this property specifies its
- * initial position. Values have the following meanings:
+ * initial position.
* </p>
*
* <p>
*/
public static DirectionProperty DIRECTION;
+ /**
+ * <p>
+ * This property takes a {@link UnicodeBidi} object as value.
+ * </p>
+ *
+ * <h3>Example:</h3>
+ *
+ * <pre class="code">
+ * // 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);
+ *
+ * </pre>
+ */
public static UnicodeBidiProperty UNICODE_BIDI;
/**
* 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'.
- *
- *
+ * </p>
+ * <p>
+ * When this property has the value <i>show</i>, borders are drawn around
+ * empty cells (like normal cells).
+ * </p>
+ * <p>
+ * A value of <i>hide</i> means that no borders are drawn around empty cells.
+ * Furthermore, if all the cells in a row have a value of <i>hide</i> and have
+ * no visible content, the entire row behaves as if it had <i>display:
+ * none</i>.
* </p>
*
* <p>
*/
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";
+
/**
* <p>
/**
* <p>
- * The <i>overflow</i> property specifies whether the boxes generated by an
+ * The <i>visibility</i> property specifies whether the boxes generated by an
* element are rendered. Invisible boxes still affect layout (set the
* <i>display<i> property to <i>none</i> to suppress box generation
* altogether).
/**
* <p>
- * The <i>white-space</i> property specifies spacing behavior between words.
+ * The <i>word-spacing</i> property specifies spacing behavior between words.
* </p>
* <p>
* Word spacing algorithms are user agent-dependent. Word spacing is also
public class CaptionSideProperty extends
AbstractCssProperty<CaptionSideProperty.CaptionSide> {
+ /**
+ * Possible values for <i>caption-side</i> 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.
*/
*/
public class ClearProperty extends AbstractCssProperty<ClearProperty.Clear> {
+ /**
+ * Possible values for <i>clear</i> 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();
+ }
}
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 <i>clip</i> property allows you to modify this
+ * clipping region by defining a shape.
*/
public class ClipProperty extends AbstractCssProperty<ClipProperty.Shape> {
+ /**
+ * Object defining a clipping region used as value for <i>clip</i> 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)");
package com.google.gwt.query.client.css;
/**
- * This property describes the foreground color of an element's text content.
+ * The <i>color</i> property describes the foreground color of an element's text
+ * content.
*/
public class ColorProperty extends AbstractCssProperty<RGBColor> {
*
* An enumerated CSS property with values of type X,Y,Z.
*/
-public interface CssShorthandProperty3<X, Y, Z> extends CssProperty{
-
+public interface CssShorthandProperty3<X, Y, Z> extends CssProperty {
+
+ /**
+ * Set the value of the css property
+ */
void set(Style s, X value1, Y value2, Z value3);
}
*/
public interface CssShorthandProperty5<V, W, X, Y, Z> extends CssProperty {
+ /**
+ * Set the value of the property.
+ */
void set(Style s, V value1, W value2, X value3, Y value4, Z value5);
}
import com.google.gwt.dom.client.Style.Cursor;
/**
- * This property specifies all possible value for cursor.
+ * The <i>cursor</i> property specifies the type of cursor to be displayed for
+ * the pointing device
*/
public class CursorProperty extends AbstractCssProperty<Cursor> {
import com.google.gwt.dom.client.Style.HasCssName;
/**
- * This property defines the text direction/writing direction
+ * The <i>direction</i> 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<DirectionProperty.Direction> {
+ /**
+ * Possible values for <i>direction</i> 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();
}
public class EmptyCellsProperty extends
AbstractCssProperty<EmptyCellsProperty.EmptyCells> {
+ /**
+ * Possible values for <i>empty-cells</i> property.)
+ *
+ */
public enum EmptyCells implements HasCssName {
/**
* No background or borders are shown on empty cells
AbstractCssProperty<FontSizeProperty.FontSize> implements TakesLength {
/**
- * Enum for the font-size property.
+ * Possible values for the <i>font-size</i> 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";
import com.google.gwt.dom.client.Style.FontStyle;
/**
- * This property specifies the mechanism by which elements are rendered.
+ * The <i>font-style</i> property requests normal (sometimes referred to as
+ * "roman" or "upright"), italic, and oblique faces within a font family.
*/
public class FontStyleProperty extends AbstractCssProperty<FontStyle> {
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 <i>font-variant</i> 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<FontVariantProperty.FontVariant> {
/**
- * Enum for the font-variant property.
+ * Possible values for the <i>font-variant</i> 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";
import com.google.gwt.dom.client.Style.FontWeight;
/**
- * This property specifies the mechanism by which elements are rendered.
+ * The <i>font-weight</i> property specifies the weight of the font.
*/
public class FontWeightProperty extends AbstractCssProperty<FontWeight> {
package com.google.gwt.query.client.css;
/**
- * all height css properties : max-height, min-height, height
+ * All height css properties : <i>max-height</i>, <i>min-height</i>,
+ * <i>height</i>
*/
public class HeightProperty extends AbstractCssProperty<Length> {
CSS.MIN_HEIGHT = new HeightProperty(MIN_HEIGHT_PROPERTY);
}
-
private HeightProperty(String cssName) {
super(cssName);
}
*/
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 + "')");
}
package com.google.gwt.query.client.css;
/**
- * all height css properties : max-height, min-height, height
+ * The <i>letter-spacing</i> property specifies spacing behavior between text
+ * characters.
*/
public class LetterSpacingProperty extends AbstractCssProperty<Length> {
import com.google.gwt.dom.client.Style;
/**
- * all height css properties : max-height, min-height, height
+ * <p>
+ * 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.
+ * </p>
+ *
+ * <p>
+ * 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 <i>height</i>
+ * property.)
+ * </p>
*/
-public class LineHeightProperty extends AbstractCssProperty<CssNumber> implements TakesLength {
+public class LineHeightProperty extends AbstractCssProperty<CssNumber>
+ implements TakesLength {
private static final String CSS_PROPERTY = "lineHeight";
public void set(Style s, Length p) {
s.setProperty(CSS_PROPERTY, p.getCssName());
-
+
}
}
package com.google.gwt.query.client.css;
/**
- * This property sets an image as the list-item marker.
+ * The <i>list-style-image</i> 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 <i>list-style-type</i> marker.
*/
public class ListStyleImageProperty extends AbstractCssProperty<ImageValue> {
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 <i>list-style-position</i> property specifies the position of the marker
+ * box in the principal block box.
*/
public class ListStylePositionProperty extends
AbstractCssProperty<ListStylePositionProperty.ListStylePosition> {
+ /**
+ * Possible values for <i>list-style-position</i> 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();
+ }
}
import com.google.gwt.query.client.css.ListStylePositionProperty.ListStylePosition;
/**
- * This property sets all list properties in one declaration.
+ * The <i>list-style</i> property is a shorthand notation for setting the three
+ * properties <i>list-style-type</i>, <i>list-style-image</i>, and
+ * <i>list-style-position</i> at the same place in the style sheet.
*/
public class ListStyleProperty implements
CssShorthandProperty3<ListStyleType, ListStylePosition, ImageValue> {
import com.google.gwt.dom.client.Style.ListStyleType;
/**
- * This property sets the type of the list-item marker.
+ * The <i>list-style-type</i> property specifies appearance of the list item
+ * marker if <i>list-style-image</i> 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<ListStyleType> {
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();
}
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() + " " : "";
CSS.OUTLINE_STYLE = new OutlineStyleProperty();
}
-
private OutlineStyleProperty() {
super(CSS_PROPERTY);
}
import com.google.gwt.dom.client.Style.Overflow;
/**
- * This property specifies what happens if content overflows an element's box..
+ * The <i>overflow</i> 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<Overflow> {
+public class OverflowProperty extends AbstractCssProperty<Overflow> {
private static final String CSS_PROPERTY = "overflow";
import com.google.gwt.dom.client.Style.Position;
/**
- * The position property is used to position an element.
+ * The <i>position</i> property determines which of the CSS2 positioning
+ * algorithms is used to calculate the position of a box.
*/
public class PositionProperty extends AbstractCssProperty<Position> {
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;
WHITE = rgb("white");
YELLOW = rgb("yellow");
TRANSPARENT = rgb("transparent");
- INHERIT = rgb(CSS.INHERIT_VALUE);
}
/**
import com.google.gwt.dom.client.Style.HasCssName;
/**
- * This property describes how inline content of a block is aligned.
+ * The <i>text-align</i> property describes how inline-level content of a block
+ * container is aligned.
*/
public class TextAlignProperty extends
AbstractCssProperty<TextAlignProperty.TextAlign> {
+ /**
+ * Possible value for <i>text-align</i> 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();
import com.google.gwt.dom.client.Style.TextDecoration;
/**
- * This property describes how inline content of a block is aligned.
+ * The <i>text-decoration</i> 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<TextDecoration> {
+public class TextDecorationProperty extends AbstractCssProperty<TextDecoration> {
-
private static final String CSS_PROPERTY = "textDecoration";
-
public static void init() {
- CSS.TEXT_DECORATION= new TextDecorationProperty();
+ CSS.TEXT_DECORATION = new TextDecorationProperty();
}
private TextDecorationProperty() {
*/
package com.google.gwt.query.client.css;
-
/**
- * This property describes how inline content of a block is aligned.
+ * The <i>text-ident</i> 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<Length> {
+public class TextIdentProperty extends AbstractCssProperty<Length> {
-
private static final String CSS_PROPERTY = "textIdent";
-
public static void init() {
- CSS.TEXT_IDENT= new TextIdentProperty();
+ CSS.TEXT_IDENT = new TextIdentProperty();
}
private TextIdentProperty() {
import com.google.gwt.dom.client.Style.HasCssName;
/**
- * This property describes how inline content of a block is aligned.
+ * The <i>text-transform</i> property controls capitalization effects of an
+ * element's text.
*/
public class TextTransformProperty extends
AbstractCssProperty<TextTransformProperty.TextTransform> {
- public enum TextTransform implements HasCssName{
+ /**
+ * Possible values for <i>text-transform</i> property.
+ */
+ public enum TextTransform implements HasCssName {
/**
* Transforms the first character of each word to uppercase
*/
*/
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() {
public class UnicodeBidiProperty extends
AbstractCssProperty<UnicodeBidiProperty.UnicodeBidi> {
+ /**
+ * Define possible values for <i>unicode-bidi</i> 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 <i>direction</i> property; the implicit part of the
+ * bidirectional algorithm is ignored. This corresponds to adding a LRO
+ * (U+202D; for <i>direction: ltr</i>) or RLO (U+202E; for <i>direction:
+ * rtl</i>) 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 <i>direction</i> property. Inside
+ * the element, reordering is done implicitly. This corresponds to adding a
+ * LRE (U+202A; for <i>direction: ltr</i>) or RLE (U+202B; for <i>direction:
+ * rtl</i>) 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('_', '-');
}
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 <i>vertical-align</i> property affects the vertical positioning inside a
+ * line box of the boxes generated by an inline-level element.
*/
public class VerticalAlignProperty extends AbstractCssProperty<VerticalAlign>
implements TakesLength {
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 <i>visibility</i> property specifies whether the boxes generated by an
+ * element are rendered. Invisible boxes still affect layout (set the
+ * <i>display<i> property to <i>none</i> to suppress box generation altogether).
*/
public class VisibilityProperty extends AbstractCssProperty<Visibility> {
import com.google.gwt.dom.client.Style.HasCssName;
/**
- * This property declares how white space inside the element is handled
+ * The <i>white-space</i> property declares how white space inside the element
+ * is handled
*/
public class WhiteSpaceProperty extends
AbstractCssProperty<WhiteSpaceProperty.WhiteSpace> {
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
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 : <i>max-width</i>, <i>min-width</i>, <i>width</i>
*/
public class WidthProperty extends AbstractCssProperty<Length> {
CSS.MAX_WIDTH = new WidthProperty(MAX_WIDTH_PROPERTY);
CSS.MIN_WIDTH = new WidthProperty(MIN_WIDTH_PROPERTY);
}
-
+
private WidthProperty(String cssName) {
super(cssName);
}
package com.google.gwt.query.client.css;
/**
- * all height css properties : max-height, min-height, height
+ * The <i>word-spacing</i> property specifies spacing behavior between words.
*/
public class WordSpacingProperty extends AbstractCssProperty<Length> {
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;
$("#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));
assertEquals("capitalize", $("#test").css("textTransform"));
}
+ public void testUnicodeBidiProperty() {
+
+ $(e).html("<div id='test'>Content</div>");
+
+ $("#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("<div id='test'>Content</div>");