From 91e60a3866a18b11f144f6a42ce4a46772268ea7 Mon Sep 17 00:00:00 2001 From: Sun Zhe <31067185+ZheSun88@users.noreply.github.com> Date: Tue, 17 Jul 2018 16:12:18 +0300 Subject: [PATCH] Revert "Maintenance release picks (#259)" This reverts commit e49702ed322a5918dddd9392722963c896f227bd. --- .../com/vaadin/flow/component/grid/Grid.java | 19 +------------------ .../resources/frontend/gridConnector.js | 4 ++-- .../flow/component/grid/GridColumnTest.java | 14 -------------- .../component/grid/it/ButtonInGridIT.java | 10 ++++++++++ 4 files changed, 13 insertions(+), 34 deletions(-) mode change 100755 => 100644 src/main/java/com/vaadin/flow/component/grid/Grid.java mode change 100755 => 100644 src/test/java/com/vaadin/flow/component/grid/GridColumnTest.java diff --git a/src/main/java/com/vaadin/flow/component/grid/Grid.java b/src/main/java/com/vaadin/flow/component/grid/Grid.java old mode 100755 new mode 100644 index db551bbe..39e1f3cc --- a/src/main/java/com/vaadin/flow/component/grid/Grid.java +++ b/src/main/java/com/vaadin/flow/component/grid/Grid.java @@ -244,8 +244,6 @@ public static class Column extends AbstractColumn> { private Registration columnDataGeneratorRegistration; - private Renderer renderer; - /** * Constructs a new Column for use inside a Grid. * @@ -254,13 +252,11 @@ public static class Column extends AbstractColumn> { * @param columnId * unique identifier of this column * @param renderer - * the renderer to use in this column, must not be {@code null} + * the renderer to use in this column */ public Column(Grid grid, String columnId, Renderer renderer) { super(grid); - Objects.requireNonNull(renderer); this.columnInternalId = columnId; - this.renderer = renderer; comparator = (a, b) -> 0; @@ -289,19 +285,6 @@ protected String getInternalId() { return columnInternalId; } - /** - * Get the renderer used for this column. - * - * Note: Mutating the renderer after the Grid has been rendered - * on the client will not change the column, and can lead to - * undefined behavior. - * - * @return the renderer used for this column, should never be {@code null} - */ - public Renderer getRenderer() { - return renderer; - } - /** * Sets the width of this column as a CSS-string. * diff --git a/src/main/resources/META-INF/resources/frontend/gridConnector.js b/src/main/resources/META-INF/resources/frontend/gridConnector.js index 1f98ea68..53a8e5d4 100644 --- a/src/main/resources/META-INF/resources/frontend/gridConnector.js +++ b/src/main/resources/META-INF/resources/frontend/gridConnector.js @@ -133,7 +133,7 @@ window.Vaadin.Flow.gridConnector = { } } - const sorterChangeListener = function() { + const sorterChangeListener = function(event) { grid.$server.sortersChanged(grid._sorters.map(function(sorter) { return { path: sorter.path, @@ -141,7 +141,7 @@ window.Vaadin.Flow.gridConnector = { }; })); } - grid._createPropertyObserver("_previousSorters", sorterChangeListener); + grid.addEventListener('sorter-changed', sorterChangeListener); const itemsUpdated = function(items) { if (!items || !Array.isArray(items)) { diff --git a/src/test/java/com/vaadin/flow/component/grid/GridColumnTest.java b/src/test/java/com/vaadin/flow/component/grid/GridColumnTest.java old mode 100755 new mode 100644 index 14ae32a9..76798693 --- a/src/test/java/com/vaadin/flow/component/grid/GridColumnTest.java +++ b/src/test/java/com/vaadin/flow/component/grid/GridColumnTest.java @@ -21,13 +21,9 @@ import org.junit.Test; import org.junit.rules.ExpectedException; -import com.vaadin.flow.component.Component; import com.vaadin.flow.component.grid.Grid.Column; -import com.vaadin.flow.component.html.Label; import com.vaadin.flow.data.provider.SortDirection; -import com.vaadin.flow.data.renderer.IconRenderer; import com.vaadin.flow.function.SerializableComparator; -import com.vaadin.flow.function.SerializableFunction; public class GridColumnTest { @@ -35,9 +31,6 @@ public class GridColumnTest { Column firstColumn; Column secondColumn; Column thirdColumn; - Column fourthColumn; - - IconRenderer renderer; @Rule public ExpectedException thrown = ExpectedException.none(); @@ -48,8 +41,6 @@ public void init() { firstColumn = grid.addColumn(str -> str); secondColumn = grid.addColumn(str -> str); thirdColumn = grid.addColumn(str -> str); - renderer = new IconRenderer(generator -> new Label(":D")); - fourthColumn = grid.addColumn(renderer); } @Test @@ -173,11 +164,6 @@ public void addColumn_defaultComparator() { -1, result); } - @Test - public void testRenderer() { - assert renderer!= null; - Assert.assertEquals(renderer, fourthColumn.getRenderer()); - } private void expectNullPointerException(String message) { thrown.expect(NullPointerException.class); thrown.expectMessage(message); diff --git a/src/test/java/com/vaadin/flow/component/grid/it/ButtonInGridIT.java b/src/test/java/com/vaadin/flow/component/grid/it/ButtonInGridIT.java index e50bd63f..9b43c70a 100644 --- a/src/test/java/com/vaadin/flow/component/grid/it/ButtonInGridIT.java +++ b/src/test/java/com/vaadin/flow/component/grid/it/ButtonInGridIT.java @@ -16,6 +16,7 @@ package com.vaadin.flow.component.grid.it; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Keys; @@ -29,6 +30,15 @@ public class ButtonInGridIT extends AbstractComponentIT { @Test + @Ignore + /** + * The test is disabled due #4268. The test is for grid#122 (which is + * actually an issue in the flow-component-renderer inside flow-data + * module). + * + * At the moment the bug is not fixed. So the test fails. Should be enabled + * back once the gird#122 is fixed. + */ public void pressButtonUsingKeyboard() { open();