]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix DefaultTextRenderer warning with String data (#15430)
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Tue, 30 Dec 2014 09:27:03 +0000 (11:27 +0200)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Fri, 2 Jan 2015 14:40:31 +0000 (14:40 +0000)
Change-Id: I04eae1e82da6bb0213be19599c7d8fc3085a92a5

client/src/com/vaadin/client/widgets/Grid.java
uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridDefaultTextRendererTest.java
uitest/src/com/vaadin/tests/widgetset/client/grid/GridDefaultTextRendererWidget.java

index 47569213258ff233e7a1a813a531148a4acb8b59..a32dccd391e028d4f3a28f588dbbfc5a4e7b1419 100644 (file)
@@ -2516,7 +2516,7 @@ public class Grid<T> extends ResizeComposite implements
 
             @Override
             public void render(RendererCellReference cell, Object data) {
-                if (!warned) {
+                if (!warned && !(data instanceof String)) {
                     getLogger().warning(
                             Column.this.toString() + ": "
                                     + DEFAULT_RENDERER_WARNING);
index cd31bfc86092e0aa6dfedb6bcd29fdafb28cc7cf..79eadd03d8cc9ea3eeebe805dba8c5572b3a396d 100644 (file)
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.Test;
 
+import com.vaadin.testbench.By;
 import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.testbench.elements.NotificationElement;
 import com.vaadin.testbench.elements.ServerClass;
@@ -40,6 +41,7 @@ public class GridDefaultTextRendererTest extends MultiBrowserTest {
 
     @Before
     public void init() {
+        setDebug(true);
         openTestURL();
         grid = $(MyGridElement.class).first();
         assertFalse("There was an unexpected notification during init",
@@ -57,4 +59,10 @@ public class GridDefaultTextRendererTest extends MultiBrowserTest {
         assertEquals("Second cell should've been populated ", "string", grid
                 .getCell(1, 0).getText());
     }
+
+    @Test
+    public void testWarningShouldNotBeInDebugLog() {
+        assertFalse("Warning visible with string content.",
+                isElementPresent(By.xpath("//span[contains(.,'attached:#1')]")));
+    }
 }
index 173ae097edc660e5499004612cc309b9be5f8cb3..4f1ea48be59b8452236587908e5c5392ed11b360 100644 (file)
@@ -47,10 +47,18 @@ public class GridDefaultTextRendererWidget extends
             }
         });
 
+        grid.addColumn(new Column<String, String>() {
+
+            @Override
+            public String getValue(String row) {
+                return "foo";
+            }
+
+        });
+
         grid.setHeightByRows(2);
         grid.setHeightMode(HeightMode.ROW);
         grid.setSelectionMode(SelectionMode.NONE);
         addNorth(grid, 500);
     }
-
 }