diff options
author | Mehdi Javan <mehdi@vaadin.com> | 2018-07-30 18:53:24 +0300 |
---|---|---|
committer | Mehdi Javan <32511762+mehdi-vaadin@users.noreply.github.com> | 2018-07-31 14:51:51 +0300 |
commit | a6625c1ac92fc84e42ffe5cf3bb69e4788bc91bb (patch) | |
tree | 189553cef809290e8152310ef9ce65c4d002a473 /uitest/src/main | |
parent | c37513ce99827d45da113e165b5dcc7d891ca4c8 (diff) | |
download | vaadin-framework-8.5.1.tar.gz vaadin-framework-8.5.1.zip |
Fix Escalator to properly reset height by rows (#11090)8.5.1
(cherry picked from commit 49f6f45cdf4895f179d9a630df6db096db3cdf66)
Diffstat (limited to 'uitest/src/main')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java new file mode 100644 index 0000000000..5254f9091f --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeightByRow.java @@ -0,0 +1,46 @@ +package com.vaadin.tests.components.grid; + +import com.vaadin.data.provider.DataProvider; +import com.vaadin.data.provider.ListDataProvider; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.grid.HeightMode; +import com.vaadin.tests.components.AbstractTestUIWithLog; +import com.vaadin.ui.Button; +import com.vaadin.ui.Grid; + +import java.util.ArrayList; +import java.util.List; + +public class GridHeightByRow extends AbstractTestUIWithLog { + @Override + protected void setup(VaadinRequest request) { + List<String> data = new ArrayList<>(); + for (int i = 0; i < 10; i++) + data.add("Data " + i); + + Grid<String> grid = new Grid<>(); + grid.addColumn(String::toString).setCaption("Test"); + ListDataProvider<String> provider = DataProvider.ofCollection(data); + grid.setDataProvider(provider); + + grid.setHeightMode(HeightMode.UNDEFINED); + grid.setRowHeight(50); + + Button addButton = new Button("Add Data"); + addButton.addClickListener(event -> { + data.add("Data"); + grid.getDataProvider().refreshAll(); + }); + + Button removeButton = new Button("Remove Data"); + removeButton.addClickListener(event -> { + if (data.isEmpty()) + return; + + data.remove(0); + grid.getDataProvider().refreshAll(); + }); + + addComponents(addButton, removeButton, grid); + } +} |