]> source.dussan.org Git - vaadin-framework.git/commitdiff
Ignore selection col for server-side cell style generator (#15486)
authorLeif Åstrand <leif@vaadin.com>
Wed, 31 Dec 2014 09:42:18 +0000 (11:42 +0200)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Wed, 31 Dec 2014 10:41:34 +0000 (10:41 +0000)
Change-Id: Ia66ee24da787ca99d16705e699e46729d9aaaca6

client/src/com/vaadin/client/connectors/GridConnector.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java

index d3954f23665b41ab3913275bc010c803d08cf611..44aa2763822ff7ab241b7a2bf87d508d105fb0a1 100644 (file)
@@ -57,6 +57,7 @@ import com.vaadin.client.widget.grid.sort.SortEvent;
 import com.vaadin.client.widget.grid.sort.SortHandler;
 import com.vaadin.client.widget.grid.sort.SortOrder;
 import com.vaadin.client.widgets.Grid;
+import com.vaadin.client.widgets.Grid.Column;
 import com.vaadin.client.widgets.Grid.FooterCell;
 import com.vaadin.client.widgets.Grid.FooterRow;
 import com.vaadin.client.widgets.Grid.HeaderCell;
@@ -102,7 +103,12 @@ public class GridConnector extends AbstractHasComponentsConnector implements
                 return null;
             }
 
-            CustomGridColumn c = (CustomGridColumn) cellReference.getColumn();
+            Column<?, JsonObject> column = cellReference.getColumn();
+            if (!(column instanceof CustomGridColumn)) {
+                // Selection checkbox column
+                return null;
+            }
+            CustomGridColumn c = (CustomGridColumn) column;
 
             JsonObject cellStylesObject = row
                     .getObject(GridState.JSONKEY_CELLSTYLES);
index fc44d5aaf53d8a644d016e4f6714c326b2778cd3..643c61d90af1f0a12c702cbcb0a5e7c385b93e03 100644 (file)
  */
 package com.vaadin.tests.components.grid.basicfeatures.server;
 
+import static org.junit.Assert.assertFalse;
+
 import org.junit.Assert;
 import org.junit.Test;
 
 import com.vaadin.testbench.elements.GridElement.GridCellElement;
 import com.vaadin.testbench.elements.GridElement.GridRowElement;
+import com.vaadin.testbench.elements.NotificationElement;
 import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures;
 import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
 
@@ -96,6 +99,18 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest {
         Assert.assertTrue(hasCssClass(cell3_2, "Column-2"));
     }
 
+    @Test
+    public void testCellStyleGeneratorWithSelectionColumn() {
+        setDebug(true);
+        openTestURL();
+        selectMenuPath("Component", "State", "Selection mode", "multi");
+
+        selectCellStyleNameGenerator(GridBasicFeatures.CELL_STYLE_GENERATOR_SPECIAL);
+
+        assertFalse("Error notification was present",
+                isElementPresent(NotificationElement.class));
+    }
+
     private void selectRowStyleNameGenerator(String name) {
         selectMenuPath("Component", "State", "Row style generator", name);
     }