diff options
3 files changed, 26 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java b/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java index 1e47d3ad6b..c64908f24c 100644 --- a/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java +++ b/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java @@ -56,6 +56,8 @@ import com.vaadin.client.widgets.Grid; public class MultiSelectionRenderer<T> extends ClickableRenderer<Boolean, CheckBox> { + private static final String SELECTION_CHECKBOX_CLASSNAME = "-selection-checkbox"; + /** The size of the autoscroll area, both top and bottom. */ private static final int SCROLL_AREA_GRADIENT_PX = 100; @@ -591,6 +593,8 @@ public class MultiSelectionRenderer<T> extends @Override public CheckBox createWidget() { final CheckBox checkBox = GWT.create(CheckBox.class); + checkBox.setStylePrimaryName(grid.getStylePrimaryName() + + SELECTION_CHECKBOX_CLASSNAME); CheckBoxEventHandler handler = new CheckBoxEventHandler(checkBox); // Sink events diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index ce3db0970a..369e530b9d 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -209,6 +209,8 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, SubPartAware, DeferredWorker, HasWidgets, HasEnabled { + private static final String SELECT_ALL_CHECKBOX_CLASSNAME = "-select-all-checkbox"; + /** * Enum describing different sections of Grid. */ @@ -2405,6 +2407,8 @@ public class Grid<T> extends ResizeComposite implements if (selectAllCheckBox == null) { selectAllCheckBox = GWT.create(CheckBox.class); + selectAllCheckBox.setStylePrimaryName(getStylePrimaryName() + + SELECT_ALL_CHECKBOX_CLASSNAME); selectAllCheckBox .addValueChangeHandler(new ValueChangeHandler<Boolean>() { diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java index 1f3085d273..8bf8639d76 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java @@ -338,6 +338,24 @@ public class GridSelectionTest extends GridBasicFeaturesTest { } @Test + public void testSelectionCheckBoxesHaveStyleNames() { + openTestURL(); + + setSelectionModelMulti(); + + assertTrue( + "Selection column CheckBox should have the proper style name set", + getGridElement().getCell(0, 0).findElement(By.tagName("span")) + .getAttribute("class") + .contains("v-grid-selection-checkbox")); + + GridCellElement header = getGridElement().getHeaderCell(0, 0); + assertTrue("Select all CheckBox should have the proper style name set", + header.findElement(By.tagName("span")).getAttribute("class") + .contains("v-grid-select-all-checkbox")); + } + + @Test public void testServerSideSelectTogglesSelectAllCheckBox() { openTestURL(); |