aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/v7
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-03-07 12:44:01 +0200
committerHenri Sara <henri.sara@gmail.com>2017-03-16 12:32:19 +0200
commit833e6e3bd98ff04a35b428c35afe16c874893780 (patch)
treed657866c79341476bcbcd13dac0944f6daf2fd5a /uitest/src/main/java/com/vaadin/v7
parentc299a6bb4803bb132409fa2b9c0d4b45636a7a4c (diff)
downloadvaadin-framework-833e6e3bd98ff04a35b428c35afe16c874893780.tar.gz
vaadin-framework-833e6e3bd98ff04a35b428c35afe16c874893780.zip
Always calculate Escalator max row count the same way (#8740)
* Rename getMaxEscalatorRowCapacity to describe what it does * Always calculate Escalator max row count the same way This changes Escalator to not take a horizontal scrollbar into account when trying to determine "maximum visible rows". This will add another row, compared to previous versions, when there is a horizontal scrollbar. In reality, it would likely make sense to always add 10 more rows to have some buffer above and below the visible area. Fixes #8661
Diffstat (limited to 'uitest/src/main/java/com/vaadin/v7')
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/HideGridColumnWhenHavingUnsuitableHeight.java92
1 files changed, 92 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/HideGridColumnWhenHavingUnsuitableHeight.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/HideGridColumnWhenHavingUnsuitableHeight.java
new file mode 100644
index 0000000000..d5e6c41063
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/HideGridColumnWhenHavingUnsuitableHeight.java
@@ -0,0 +1,92 @@
+package com.vaadin.v7.tests.components.grid;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.v7.data.Item;
+import com.vaadin.v7.data.util.BeanItemContainer;
+import com.vaadin.v7.data.util.GeneratedPropertyContainer;
+import com.vaadin.v7.data.util.PropertyValueGenerator;
+import com.vaadin.v7.ui.Grid;
+import com.vaadin.v7.ui.Grid.Column;
+import com.vaadin.v7.ui.renderers.ButtonRenderer;
+
+@Theme("valo")
+public class HideGridColumnWhenHavingUnsuitableHeight extends AbstractTestUI {
+
+ private Grid grid;
+
+ public static class SampleBean {
+
+ private String col1;
+ private String col2;
+
+ public SampleBean() {
+ }
+
+ public String getCol1() {
+ return col1;
+ }
+
+ public void setCol1(String col1) {
+ this.col1 = col1;
+ }
+
+ public String getCol2() {
+ return col2;
+ }
+
+ public void setCol2(String col2) {
+ this.col2 = col2;
+ }
+ }
+
+ @SuppressWarnings("serial")
+ @Override
+ protected void setup(VaadinRequest vaadinRequest) {
+ grid = new Grid();
+
+ BeanItemContainer<SampleBean> container = generateData(50);
+ GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(
+ container);
+ grid.setContainerDataSource(gpc);
+
+ gpc.addGeneratedProperty("Button1",
+ new PropertyValueGenerator<String>() {
+ @Override
+ public String getValue(Item item, Object itemId,
+ Object propertyId) {
+ return "Button 1";
+ }
+
+ @Override
+ public Class<String> getType() {
+ return String.class;
+ }
+ });
+ grid.getColumn("Button1").setRenderer(new ButtonRenderer());
+ grid.getColumn("col1").setWidth(1600);
+ for (Column gridCol : grid.getColumns()) {
+ gridCol.setHidable(true);
+ }
+ grid.setWidth("100%");
+ grid.setHeight("425px");
+
+ grid.setColumns("col1", "col2", "Button1");
+
+ addComponent(grid);
+ }
+
+ private BeanItemContainer<SampleBean> generateData(int rows) {
+ BeanItemContainer<SampleBean> container = new BeanItemContainer<SampleBean>(
+ SampleBean.class);
+ for (int y = 0; y < rows; ++y) {
+ SampleBean sampleBean = new SampleBean();
+ sampleBean.setCol1("Row " + y + " Column 1");
+ sampleBean.setCol2("Row " + y + " Column 2");
+ container.addBean(sampleBean);
+ }
+ return container;
+ }
+
+}