aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis <denis@vaadin.com>2017-02-02 12:50:09 +0200
committerGitHub <noreply@github.com>2017-02-02 12:50:09 +0200
commitbe2c4684cd43547c2785831a8b0aeda63ccbaebe (patch)
treefdab6dc4b02c9439f98fcbf4e3e9a78698fee8c8
parent59211beda0aaee3469336a671de5a7ccfb62f014 (diff)
downloadvaadin-framework-be2c4684cd43547c2785831a8b0aeda63ccbaebe.tar.gz
vaadin-framework-be2c4684cd43547c2785831a8b0aeda63ccbaebe.zip
Grid tests migration. Next round. (#8412)
* Grid tests migration. Next round. Fixes #8373
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridExtensionCommunication.java (renamed from uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridExtensionCommunication.java)59
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridGeneratedProperties.java (renamed from uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridGeneratedProperties.java)5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java125
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFormatChange.java128
-rw-r--r--uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridClickExtensionConnector.java (renamed from uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClickExtensionConnector.java)46
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridEditorUI.java53
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridFastAsyncUpdate.java5
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFooterComponents.java133
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java183
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorUITest.java (renamed from uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridEditorUITest.java)2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridExtensionCommunicationTest.java (renamed from uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridExtensionCommunicationTest.java)6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java (renamed from uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridGeneratedPropertiesTest.java)2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFooterComponentsTest.java (renamed from uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeaderFooterComponentsTest.java)4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java (renamed from uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChangeTest.java)4
14 files changed, 330 insertions, 425 deletions
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridExtensionCommunication.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridExtensionCommunication.java
index 8ee87b1dc1..27427f01fe 100644
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridExtensionCommunication.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridExtensionCommunication.java
@@ -13,57 +13,72 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.v7.tests.components.grid;
+package com.vaadin.tests.components.grid;
+
+import java.util.stream.IntStream;
import com.vaadin.annotations.Widgetset;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.data.bean.Person;
import com.vaadin.tests.widgetset.TestingWidgetSet;
-import com.vaadin.tests.widgetset.client.v7.grid.GridClickExtensionConnector.GridClickServerRpc;
-import com.vaadin.v7.data.Item;
-import com.vaadin.v7.ui.Grid;
-import com.vaadin.v7.ui.Grid.AbstractGridExtension;
-import com.vaadin.v7.ui.Grid.Column;
-import com.vaadin.v7.ui.Grid.SelectionMode;
+import com.vaadin.tests.widgetset.client.grid.GridClickExtensionConnector;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.AbstractGridExtension;
+import com.vaadin.ui.Grid.Column;
+import com.vaadin.ui.Grid.SelectionMode;
+
+import elemental.json.JsonObject;
@Widgetset(TestingWidgetSet.NAME)
public class GridExtensionCommunication extends AbstractTestUIWithLog {
- public class GridClickExtension extends AbstractGridExtension {
+ public class GridClickExtension extends AbstractGridExtension<Person> {
- public GridClickExtension(Grid grid) {
- super(grid);
- registerRpc(new GridClickServerRpc() {
+ public GridClickExtension(Grid<Person> grid) {
+ extend(grid);
+ registerRpc(new GridClickExtensionConnector.GridClickServerRpc() {
@Override
public void click(String row, String column,
MouseEventDetails click) {
- Object itemId = getItemId(row);
- Column col = getColumn(column);
+ Person person = getData(row);
+ Column<Person, ?> col = grid.getColumns()
+ .get(Integer.parseInt(column));
- Item person = getParentGrid().getContainerDataSource()
- .getItem(itemId);
-
- log("Click on Person "
- + person.getItemProperty("firstName").getValue()
- + " "
- + person.getItemProperty("lastName").getValue()
- + " on column " + col.toString());
+ log("Click on Person " + person.getFirstName() + " "
+ + person.getLastName() + " on column "
+ + col.getId());
log("MouseEventDetails: " + click.getButtonName() + " ("
+ click.getClientX() + ", " + click.getClientY()
+ ")");
}
});
}
+
+ @Override
+ public void generateData(Person item, JsonObject jsonObject) {
+ }
+
}
@Override
protected void setup(VaadinRequest request) {
- Grid grid = new PersonTestGrid(50);
+ Grid<Person> grid = new Grid<>();
+ grid.addColumn(Person::getFirstName).setId("first").setCaption("first");
+ grid.addColumn(Person::getLastName).setId("second")
+ .setCaption("second");
+ grid.setItems(IntStream.range(1, 51).mapToObj(this::createPerson));
grid.setSelectionMode(SelectionMode.NONE);
new GridClickExtension(grid);
addComponent(grid);
}
+ private Person createPerson(int index) {
+ Person person = new Person();
+ person.setFirstName("first name " + index);
+ person.setLastName("last name " + index);
+ return person;
+ }
}
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridGeneratedProperties.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridGeneratedProperties.java
index bf340fad4b..8c33692f2c 100644
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridGeneratedProperties.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridGeneratedProperties.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.v7.tests.components.grid;
+package com.vaadin.tests.components.grid;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.data.sort.SortDirection;
@@ -34,6 +34,9 @@ import com.vaadin.v7.data.util.filter.Compare;
import com.vaadin.v7.data.util.filter.UnsupportedFilterException;
import com.vaadin.v7.ui.Grid;
+/**
+ * Smoke tests for v7 generated properties in Grid
+ */
public class GridGeneratedProperties extends AbstractReindeerTestUI {
private GeneratedPropertyContainer container;
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java
new file mode 100644
index 0000000000..cdaf3fed81
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.grid;
+
+import java.util.stream.IntStream;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.data.bean.Person;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.Column;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.components.grid.FooterCell;
+import com.vaadin.ui.components.grid.FooterRow;
+import com.vaadin.ui.components.grid.HeaderCell;
+import com.vaadin.ui.components.grid.HeaderRow;
+import com.vaadin.ui.renderers.NumberRenderer;
+
+public class GridHeaderFooterComponents extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Grid<Person> grid = new Grid<>();
+ grid.setWidth("800px");
+ grid.addColumn(Person::getFirstName).setId("action");
+ grid.addColumn(Person::getLastName).setId("string");
+ grid.addColumn(Person::getAge, new NumberRenderer()).setId("int");
+ grid.addColumn(Person::getSalaryDouble, new NumberRenderer())
+ .setId("double");
+
+ grid.setItems(IntStream.range(0, 5).mapToObj(this::createPerson));
+
+ final HeaderRow defaultRow = grid.getDefaultHeaderRow();
+ final HeaderRow toggleVisibilityRow = grid.appendHeaderRow();
+ final HeaderRow filterRow = grid.appendHeaderRow();
+
+ final FooterRow footerRow = grid.appendFooterRow();
+ final FooterRow toggleVisibilityFooterRow = grid.addFooterRowAt(0);
+ final FooterRow filterFooterRow = grid.addFooterRowAt(0);
+
+ // Set up a filter for all columns
+
+ for (Column<Person, ?> column : grid.getColumns()) {
+ final HeaderCell headerCell = filterRow.getCell(column);
+ final FooterCell footerCell = filterFooterRow.getCell(column);
+
+ headerCell.setComponent(createTextField(column.getId()));
+ footerCell.setComponent(createTextField(column.getId()));
+
+ toggleVisibilityRow.getCell(column.getId())
+ .setComponent(new Button("Toggle field", event -> {
+ Component c = headerCell.getComponent();
+ c.setVisible(!c.isVisible());
+ }));
+ toggleVisibilityFooterRow.getCell(column.getId())
+ .setComponent(new Button("Toggle field", event -> {
+ Component c = footerCell.getComponent();
+ c.setVisible(!c.isVisible());
+ }));
+ }
+
+ addComponent(grid);
+
+ addRemoveHeaderRow(grid, defaultRow);
+ addRemoveHeaderRow(grid, filterRow);
+ addRemoveHeaderRow(grid, toggleVisibilityRow);
+
+ addRemoveFooterRow(grid, footerRow);
+ addRemoveFooterRow(grid, filterFooterRow);
+ addRemoveFooterRow(grid, toggleVisibilityFooterRow);
+
+ // Hide first field initially
+ filterRow.getCell("string").getComponent().setVisible(false);
+ filterFooterRow.getCell("string").getComponent().setVisible(false);
+ }
+
+ private void addRemoveHeaderRow(final Grid<Person> grid,
+ final HeaderRow row) {
+ row.getCell("action").setComponent(
+ new Button("Remove row", event -> grid.removeHeaderRow(row)));
+
+ }
+
+ private void addRemoveFooterRow(final Grid<Person> grid,
+ final FooterRow row) {
+ row.getCell("action").setComponent(
+ new Button("Remove row", event -> grid.removeFooterRow(row)));
+ }
+
+ private Person createPerson(int i) {
+ Person person = new Person();
+ person.setFirstName("");
+ person.setLastName("Hello world");
+ person.setAge(13);
+ person.setSalaryDouble(5.2d);
+ return person;
+ }
+
+ private TextField createTextField(final Object pid) {
+ TextField filterField = new TextField();
+ filterField.setWidth("8em");
+ filterField.setValue("Filter: " + pid);
+ filterField.addValueChangeListener(listener -> {
+ log("value change for field in " + pid + " to "
+ + listener.getValue());
+ });
+ return filterField;
+ }
+
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFormatChange.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFormatChange.java
new file mode 100644
index 0000000000..d5b9919f4f
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFormatChange.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.data.SelectionModel;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractReindeerTestUI;
+import com.vaadin.tests.data.bean.Address;
+import com.vaadin.tests.data.bean.Person;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.Column;
+import com.vaadin.ui.Grid.SelectionMode;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.components.grid.HeaderRow;
+
+public class GridHeaderFormatChange extends AbstractReindeerTestUI {
+
+ private static final long serialVersionUID = -2787771187365766027L;
+
+ private HeaderRow row;
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Grid<Person> grid = new Grid<>();
+ grid.setWidth("600px");
+
+ grid.addColumn(Person::getFirstName).setId("firstName");
+ grid.addColumn(Person::getLastName).setId("lastName");
+ grid.addColumn(person -> person.getAddress().getStreetAddress())
+ .setId("streetAddress");
+ grid.addColumn(person -> person.getAddress().getPostalCode())
+ .setId("zip");
+ grid.addColumn(person -> person.getAddress().getCity()).setId("city");
+ grid.setSelectionMode(SelectionMode.SINGLE);
+ addComponent(grid);
+
+ grid.setItems(createPerson());
+
+ Button showHide = new Button("Hide firstName", event -> {
+ Column<Person, ?> column = grid.getColumn("firstName");
+ if (grid.getColumn("firstName") != null) {
+ grid.removeColumn(column);
+ event.getButton().setCaption("Show firstName");
+ } else {
+ grid.addColumn(Person::getFirstName).setId("firstName");
+ grid.setColumnOrder(grid.getColumn("firstName"),
+ grid.getColumn("lastName"),
+ grid.getColumn("streetAddress"), grid.getColumn("zip"),
+ grid.getColumn("city"));
+
+ event.getButton().setCaption("Hide firstName");
+ }
+ });
+ showHide.setId("show_hide");
+
+ Button selectionMode = new Button("Set multiselect", event -> {
+ if (grid.getSelectionModel() instanceof SelectionModel.Single) {
+ grid.setSelectionMode(SelectionMode.MULTI);
+ } else {
+ grid.setSelectionMode(SelectionMode.SINGLE);
+ }
+ });
+ selectionMode.setId("selection_mode");
+
+ Button join = new Button("Add Join header column", event -> {
+ if (row == null) {
+ row = grid.prependHeaderRow();
+ if (grid.getColumn("firstName") != null) {
+ row.join(
+ grid.getDefaultHeaderRow()
+ .getCell(grid.getColumn("firstName")),
+ grid.getDefaultHeaderRow()
+ .getCell(grid.getColumn("lastName")))
+ .setText("Full Name");
+ }
+ row.join(
+ grid.getDefaultHeaderRow()
+ .getCell(grid.getColumn("streetAddress")),
+ grid.getDefaultHeaderRow()
+ .getCell(grid.getColumn("zip")),
+ grid.getDefaultHeaderRow()
+ .getCell(grid.getColumn("city")))
+ .setText("Address");
+ } else {
+ grid.removeHeaderRow(row);
+ row = null;
+ }
+ });
+ join.setId("join");
+ addComponent(new HorizontalLayout(showHide, selectionMode, join));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Grid for testing header re-rendering.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17131;
+ }
+
+ private Person createPerson() {
+ Person person = new Person();
+ person.setFirstName("Rudolph");
+ person.setLastName("Reindeer");
+ person.setAddress(new Address());
+
+ person.getAddress().setStreetAddress("Ruukinkatu 2-4");
+ person.getAddress().setPostalCode(20540);
+ person.getAddress().setCity("Turku");
+ return person;
+ }
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClickExtensionConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridClickExtensionConnector.java
index bc2fe71074..70f26ba0d9 100644
--- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/v7/grid/GridClickExtensionConnector.java
+++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridClickExtensionConnector.java
@@ -13,25 +13,26 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.tests.widgetset.client.v7.grid;
+package com.vaadin.tests.widgetset.client.grid;
import com.vaadin.client.MouseEventDetailsBuilder;
import com.vaadin.client.ServerConnector;
+import com.vaadin.client.connectors.grid.GridConnector;
import com.vaadin.client.extensions.AbstractExtensionConnector;
+import com.vaadin.client.widget.grid.CellReference;
+import com.vaadin.client.widget.grid.events.GridClickEvent;
+import com.vaadin.client.widgets.Grid;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.communication.ServerRpc;
+import com.vaadin.shared.data.DataCommunicatorConstants;
import com.vaadin.shared.ui.Connect;
-import com.vaadin.v7.client.connectors.GridConnector;
-import com.vaadin.v7.client.widget.grid.CellReference;
-import com.vaadin.v7.client.widget.grid.events.BodyClickHandler;
-import com.vaadin.v7.client.widget.grid.events.GridClickEvent;
-import com.vaadin.v7.client.widgets.Grid;
-import com.vaadin.v7.tests.components.grid.GridExtensionCommunication.GridClickExtension;
+import com.vaadin.tests.components.grid.GridExtensionCommunication.GridClickExtension;
import elemental.json.JsonObject;
@Connect(GridClickExtension.class)
public class GridClickExtensionConnector extends AbstractExtensionConnector {
+
public interface GridClickServerRpc extends ServerRpc {
public void click(String row, String column, MouseEventDetails click);
@@ -40,23 +41,7 @@ public class GridClickExtensionConnector extends AbstractExtensionConnector {
@Override
protected void extend(ServerConnector target) {
Grid<JsonObject> grid = getParent().getWidget();
- grid.addBodyClickHandler(new BodyClickHandler() {
-
- @Override
- public void onClick(GridClickEvent event) {
- CellReference<?> cellRef = event.getTargetCell();
-
- // Gather needed information.
- String rowKey = getParent()
- .getRowKey((JsonObject) cellRef.getRow());
- String columnId = getParent().getColumnId(cellRef.getColumn());
- MouseEventDetails clickDetails = MouseEventDetailsBuilder
- .buildMouseEventDetails(event.getNativeEvent());
-
- getRpcProxy(GridClickServerRpc.class).click(rowKey, columnId,
- clickDetails);
- }
- });
+ grid.addBodyClickHandler(this::handleClick);
}
@Override
@@ -64,4 +49,17 @@ public class GridClickExtensionConnector extends AbstractExtensionConnector {
return (GridConnector) super.getParent();
}
+ private void handleClick(GridClickEvent event) {
+ CellReference<?> cellRef = event.getTargetCell();
+
+ // Gather needed information.
+ JsonObject row = (JsonObject) cellRef.getRow();
+ String rowKey = row.getString(DataCommunicatorConstants.KEY);
+ String columnId = getParent().getColumnId(cellRef.getColumn());
+ MouseEventDetails clickDetails = MouseEventDetailsBuilder
+ .buildMouseEventDetails(event.getNativeEvent());
+
+ getRpcProxy(GridClickServerRpc.class).click(rowKey, columnId,
+ clickDetails);
+ }
}
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridEditorUI.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridEditorUI.java
deleted file mode 100644
index 614e5c3144..0000000000
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridEditorUI.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.v7.tests.components.grid;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractReindeerTestUI;
-import com.vaadin.tests.util.PersonContainer;
-import com.vaadin.v7.ui.Grid;
-import com.vaadin.v7.ui.PasswordField;
-import com.vaadin.v7.ui.TextField;
-
-public class GridEditorUI extends AbstractReindeerTestUI {
-
- @Override
- protected void setup(VaadinRequest request) {
- PersonContainer container = PersonContainer.createWithTestData();
-
- addComponent(createGrid(container));
- }
-
- protected Grid createGrid(PersonContainer container) {
- Grid grid = new Grid(container);
-
- // Don't use address since there's no converter
- grid.removeColumn("address");
-
- grid.setEditorEnabled(true);
-
- grid.getColumn("firstName").setEditorField(new PasswordField());
-
- TextField lastNameField = (TextField) grid.getColumn("lastName")
- .getEditorField();
- lastNameField.setMaxLength(50);
-
- grid.getColumn("phoneNumber").getEditorField().setReadOnly(true);
-
- return grid;
- }
-
-}
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridFastAsyncUpdate.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridFastAsyncUpdate.java
index 54ddbddf59..c7fc46bfd0 100644
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridFastAsyncUpdate.java
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridFastAsyncUpdate.java
@@ -22,6 +22,11 @@ import com.vaadin.v7.ui.Grid.SelectionMode;
@Push
@SuppressWarnings("serial")
+/**
+ *
+ * Uses scrollToEnd() method in Grid. Should be migrated once it's available.
+ *
+ */
public class GridFastAsyncUpdate extends AbstractTestUI {
private final Runnable addRowsTask = new Runnable() {
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFooterComponents.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFooterComponents.java
deleted file mode 100644
index 2bc596c3aa..0000000000
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFooterComponents.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.v7.tests.components.grid;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUIWithLog;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.TextField;
-import com.vaadin.v7.data.util.IndexedContainer;
-import com.vaadin.v7.ui.Grid;
-import com.vaadin.v7.ui.Grid.FooterRow;
-import com.vaadin.v7.ui.Grid.HeaderRow;
-
-public class GridHeaderFooterComponents extends AbstractTestUIWithLog {
-
- @Override
- protected void setup(VaadinRequest request) {
- final Grid grid = new Grid();
- grid.setWidth("800px");
- grid.setContainerDataSource(createContainer());
- grid.setFooterVisible(true);
- final HeaderRow defaultRow = grid.getDefaultHeaderRow();
- final HeaderRow toggleVisibilityRow = grid.appendHeaderRow();
- final Grid.HeaderRow filterRow = grid.appendHeaderRow();
-
- final FooterRow footerRow = grid.addFooterRowAt(0);
- final FooterRow toggleVisibilityFooterRow = grid.addFooterRowAt(0);
- final FooterRow filterFooterRow = grid.addFooterRowAt(0);
-
- // Set up a filter for all columns
- for (final Object pid : grid.getContainerDataSource()
- .getContainerPropertyIds()) {
- final Grid.HeaderCell headerCell = filterRow.getCell(pid);
- final Grid.FooterCell footerCell = filterFooterRow.getCell(pid);
-
- headerCell.setComponent(createTextField(pid));
- footerCell.setComponent(createTextField(pid));
-
- toggleVisibilityRow.getCell(pid).setComponent(
- new Button("Toggle field", new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- Component c = headerCell.getComponent();
- c.setVisible(!c.isVisible());
- }
- }));
- toggleVisibilityFooterRow.getCell(pid).setComponent(
- new Button("Toggle field", new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- Component c = footerCell.getComponent();
- c.setVisible(!c.isVisible());
- }
- }));
- }
- addComponent(grid);
-
- addRemoveHeaderRow(grid, defaultRow);
- addRemoveHeaderRow(grid, filterRow);
- addRemoveHeaderRow(grid, toggleVisibilityRow);
-
- addRemoveFooterRow(grid, footerRow);
- addRemoveFooterRow(grid, filterFooterRow);
- addRemoveFooterRow(grid, toggleVisibilityFooterRow);
-
- // Hide first field initially
- filterRow.getCell("string").getComponent().setVisible(false);
- filterFooterRow.getCell("string").getComponent().setVisible(false);
- }
-
- private void addRemoveHeaderRow(final Grid grid, final HeaderRow row) {
- row.getCell("action")
- .setComponent(new Button("Remove row", new ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- grid.removeHeaderRow(row);
- }
- }));
-
- }
-
- private void addRemoveFooterRow(final Grid grid, final FooterRow row) {
- row.getCell("action")
- .setComponent(new Button("Remove row", new ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- grid.removeFooterRow(row);
- }
- }));
-
- }
-
- private IndexedContainer createContainer() {
- IndexedContainer ic = new IndexedContainer();
- ic.addContainerProperty("action", String.class, "");
- ic.addContainerProperty("string", String.class, "Hello world");
- ic.addContainerProperty("int", int.class, 13);
- ic.addContainerProperty("double", double.class, 5.2f);
-
- for (int i = 0; i < 5; i++) {
- ic.addItem();
- }
- return ic;
- }
-
- private TextField createTextField(final Object pid) {
- TextField filterField = new TextField();
- filterField.setWidth("8em");
- filterField.setValue("Filter: " + pid);
- filterField.addValueChangeListener(listener -> {
- log("value change for field in " + pid + " to "
- + listener.getValue());
- });
- return filterField;
- }
-
-}
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java
deleted file mode 100644
index 8e6d326e24..0000000000
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChange.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.v7.tests.components.grid;
-
-import java.io.Serializable;
-
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractReindeerTestUI;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.v7.data.util.BeanItemContainer;
-import com.vaadin.v7.ui.Grid;
-import com.vaadin.v7.ui.Grid.HeaderRow;
-import com.vaadin.v7.ui.Grid.SelectionMode;
-import com.vaadin.v7.ui.Grid.SelectionModel;
-import com.vaadin.v7.ui.renderers.NumberRenderer;
-
-public class GridHeaderFormatChange extends AbstractReindeerTestUI {
-
- private static final long serialVersionUID = -2787771187365766027L;
-
- private HeaderRow row;
-
- public class Person implements Serializable {
- private static final long serialVersionUID = -7995927620756317000L;
-
- String firstName;
- String lastName;
- String streetAddress;
- Integer zipCode;
- String city;
-
- public Person(String firstName, String lastName, String streetAddress,
- Integer zipCode, String city) {
- this.firstName = firstName;
- this.lastName = lastName;
- this.streetAddress = streetAddress;
- this.zipCode = zipCode;
- this.city = city;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getStreetAddress() {
- return streetAddress;
- }
-
- public void setStreetAddress(String streetAddress) {
- this.streetAddress = streetAddress;
- }
-
- public Integer getZipCode() {
- return zipCode;
- }
-
- public void setZipCode(Integer zipCode) {
- this.zipCode = zipCode;
- }
-
- public String getCity() {
- return city;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-
- }
-
- @Override
- protected void setup(VaadinRequest request) {
- BeanItemContainer<Person> datasource = new BeanItemContainer<>(
- Person.class);
- final Grid grid;
-
- datasource.addItem(new Person("Rudolph", "Reindeer", "Ruukinkatu 2-4",
- 20540, "Turku"));
-
- grid = new Grid(datasource);
- grid.setWidth("600px");
- grid.getColumn("zipCode").setRenderer(new NumberRenderer());
- grid.setColumnOrder("firstName", "lastName", "streetAddress", "zipCode",
- "city");
- grid.setSelectionMode(SelectionMode.SINGLE);
- addComponent(grid);
-
- Button showHide = new Button("Hide firstName",
- new Button.ClickListener() {
- private static final long serialVersionUID = 8107530972693788705L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- if (grid.getColumn("firstName") != null) {
- grid.removeColumn("firstName");
- event.getButton().setCaption("Show firstName");
- } else {
- grid.addColumn("firstName");
- grid.setColumnOrder("firstName", "lastName",
- "streetAddress", "zipCode", "city");
-
- event.getButton().setCaption("Hide firstName");
- }
- }
- });
- showHide.setId("show_hide");
-
- Button selectionMode = new Button("Set multiselect",
- new Button.ClickListener() {
- private static final long serialVersionUID = 8107530972693788705L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- if (grid.getSelectionModel() instanceof SelectionModel.Single) {
- grid.setSelectionMode(SelectionMode.MULTI);
- } else {
- grid.setSelectionMode(SelectionMode.SINGLE);
- }
- }
- });
- selectionMode.setId("selection_mode");
-
- Button join = new Button("Add Join header column",
- new Button.ClickListener() {
- private static final long serialVersionUID = -5330801275551280623L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- if (row == null) {
- row = grid.prependHeaderRow();
- if (grid.getColumn("firstName") != null) {
- row.join("firstName", "lastName")
- .setText("Full Name");
- }
- row.join("streetAddress", "zipCode", "city")
- .setText("Address");
- } else {
- grid.removeHeaderRow(row);
- row = null;
- }
- }
- });
- join.setId("join");
- addComponent(new HorizontalLayout(showHide, selectionMode, join));
- }
-
- @Override
- protected String getTestDescription() {
- return "Grid for testing header re-rendering.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 17131;
- }
-}
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridEditorUITest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorUITest.java
index dfaf5222a6..0b213ec972 100644
--- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridEditorUITest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorUITest.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.v7.tests.components.grid;
+package com.vaadin.tests.components.grid;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridExtensionCommunicationTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridExtensionCommunicationTest.java
index deec323b22..f86d6b8ec5 100644
--- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridExtensionCommunicationTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridExtensionCommunicationTest.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.v7.tests.components.grid;
+package com.vaadin.tests.components.grid;
import static org.junit.Assert.assertEquals;
@@ -31,14 +31,14 @@ public class GridExtensionCommunicationTest extends SingleBrowserTest {
public void testMouseClickIsSentToExtension() {
openTestURL();
- GridCellElement cell = $(GridElement.class).first().getCell(0, 4);
+ GridCellElement cell = $(GridElement.class).first().getCell(0, 1);
cell.click(5, 5);
int expectedX = cell.getLocation().getX() + 5;
int expectedY = cell.getLocation().getY() + 5;
assertEquals(
- "1. Click on Person Nina Brown on column Column[propertyId:gender]",
+ "1. Click on Person first name 1 last name 1 on column second",
getLogRow(1));
assertEquals("2. MouseEventDetails: left (" + expectedX + ", "
+ expectedY + ")", getLogRow(0));
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridGeneratedPropertiesTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java
index 6238a04467..df89f217f3 100644
--- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridGeneratedPropertiesTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.v7.tests.components.grid;
+package com.vaadin.tests.components.grid;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeaderFooterComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFooterComponentsTest.java
index b8afd17c49..f6f1ff05d5 100644
--- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeaderFooterComponentsTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFooterComponentsTest.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.v7.tests.components.grid;
+package com.vaadin.tests.components.grid;
import java.util.List;
@@ -22,8 +22,8 @@ import org.junit.Before;
import org.junit.Test;
import com.vaadin.testbench.By;
-import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.GridElement.GridCellElement;
import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChangeTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java
index 5018a2433e..ef69679d98 100644
--- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/GridHeaderFormatChangeTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridHeaderFormatChangeTest.java
@@ -13,14 +13,14 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.v7.tests.components.grid;
+package com.vaadin.tests.components.grid;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
-import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.tb3.MultiBrowserTest;