From 4b3e9b4f4168d6b059f720f393c74be34e04634a Mon Sep 17 00:00:00 2001 From: Julien Dramaix Date: Wed, 9 Feb 2011 15:53:01 +0000 Subject: [PATCH] add EmptyCells property --- .../com/google/gwt/query/client/css/CSS.java | 3 ++ .../query/client/css/EmptyCellsProperty.java | 51 +++++++++++++++++++ .../gwt/query/client/GQueryCssTest.java | 13 +++++ 3 files changed, 67 insertions(+) create mode 100644 gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java 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 fddd291d..a6995742 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 @@ -127,6 +127,8 @@ public class CSS { */ public static DisplayProperty DISPLAY; + public static EmptyCellsProperty EMPTY_CELLS; + /** * This property specifies whether a box should float to the left, right, or * not at all. It may be set for any element, but only applies to elements @@ -328,6 +330,7 @@ public class CSS { ClipProperty.init(); DisplayProperty.init(); EdgePositionProperty.init(); + EmptyCellsProperty.init(); FloatProperty.init(); FontStyleProperty.init(); FontVariantProperty.init(); 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 new file mode 100644 index 00000000..36808070 --- /dev/null +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/css/EmptyCellsProperty.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011, The gwtquery team. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.google.gwt.query.client.css; + +import com.google.gwt.dom.client.Style.HasCssName; + +/** + * This property describes how inline content of a block is aligned. + */ +public class EmptyCellsProperty extends + AbstractCssProperty { + + public enum EmptyCells implements HasCssName { + /** + * No background or borders are shown on empty cells + */ + HIDE, + /** + * Background and borders are shown on empty cells. + */ + SHOW; + + public String getCssName() { + return name().toLowerCase(); + }; + } + + private static final String CSS_PROPERTY = "emptyCells"; + + public static void init() { + CSS.EMPTY_CELLS = new EmptyCellsProperty(); + } + + private EmptyCellsProperty() { + super(CSS_PROPERTY); + } + +} 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 8cb98138..710d1c5c 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 @@ -32,6 +32,7 @@ import com.google.gwt.dom.client.Style.Visibility; import com.google.gwt.junit.client.GWTTestCase; import com.google.gwt.query.client.css.CSS; import com.google.gwt.query.client.css.CssNumber; +import com.google.gwt.query.client.css.EmptyCellsProperty; import com.google.gwt.query.client.css.ImageValue; import com.google.gwt.query.client.css.Length; import com.google.gwt.query.client.css.RGBColor; @@ -224,6 +225,18 @@ public class GQueryCssTest extends GWTTestCase { } + + public void testEmptyCellsProperty() { + + $(e).html("
Content
"); + + $("#test").css(CSS.EMPTY_CELLS, EmptyCellsProperty.EmptyCells.HIDE); + assertEquals("hide", $("#test").css("emptyCells")); + assertEquals("hide", $("#test").css(CSS.EMPTY_CELLS)); + + } + + public void testBorderSpacingProperty() { $(e).html("
Content
"); -- 2.39.5