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;
@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
HasSelectionHandlers<T>, SubPartAware, DeferredWorker, HasWidgets,
HasEnabled {
+ private static final String SELECT_ALL_CHECKBOX_CLASSNAME = "-select-all-checkbox";
+
/**
* Enum describing different sections of Grid.
*/
if (selectAllCheckBox == null) {
selectAllCheckBox = GWT.create(CheckBox.class);
+ selectAllCheckBox.setStylePrimaryName(getStylePrimaryName()
+ + SELECT_ALL_CHECKBOX_CLASSNAME);
selectAllCheckBox
.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
getRow(5).isSelected());
}
+ @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();