summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2016-12-15 15:57:07 +0200
committerPekka Hyvönen <pekka@vaadin.com>2016-12-15 15:57:07 +0200
commit536139870943d684907e0d9b93bbda60582b340d (patch)
tree9eb3d93ab16dd8b9fc39466680c2fa854ec08081
parent4b3b5a232589128151324221eb6fbf51eb5387ab (diff)
downloadvaadin-framework-536139870943d684907e0d9b93bbda60582b340d.tar.gz
vaadin-framework-536139870943d684907e0d9b93bbda60582b340d.zip
Extract interfaces from Grid (#8005)
* Extract interfaces from Grid Closes vaadin/framework8-issues#566
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java661
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/AbstractSelectionModel.java1
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/ColumnReorderListener.java38
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/ColumnResizeListener.java38
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/ColumnVisibilityChangeListener.java38
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/DescriptionGenerator.java32
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/DetailsGenerator.java33
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/Editor.java158
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/EditorErrorGenerator.java52
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/Footer.java18
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java90
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java82
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/GridSelectionModel.java46
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/Header.java17
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java90
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java83
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/ItemClickListener.java45
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java68
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java3
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/NoSelectionModel.java1
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModel.java68
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModelImpl.java1
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/SortOrderProvider.java48
-rw-r--r--server/src/test/java/com/vaadin/data/GridAsSingleSelectInBinderTest.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java17
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridDefaultHeaderTest.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridHeaderFooterTest.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java14
32 files changed, 1069 insertions, 693 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 9f4f00a114..bb48ac56a4 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -33,7 +33,6 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
-import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -44,9 +43,7 @@ import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.vaadin.data.Binder;
-import com.vaadin.data.BinderValidationStatus;
import com.vaadin.data.Listing;
-import com.vaadin.data.SelectionModel;
import com.vaadin.data.ValueProvider;
import com.vaadin.data.provider.DataCommunicator;
import com.vaadin.data.provider.DataProvider;
@@ -54,7 +51,6 @@ import com.vaadin.data.provider.Query;
import com.vaadin.data.provider.SortOrder;
import com.vaadin.event.ConnectorEvent;
import com.vaadin.event.ContextClickEvent;
-import com.vaadin.event.SerializableEventListener;
import com.vaadin.event.selection.MultiSelectionListener;
import com.vaadin.event.selection.SelectionListener;
import com.vaadin.event.selection.SingleSelectionListener;
@@ -78,17 +74,30 @@ import com.vaadin.shared.ui.grid.GridState;
import com.vaadin.shared.ui.grid.GridStaticCellType;
import com.vaadin.shared.ui.grid.HeightMode;
import com.vaadin.shared.ui.grid.SectionState;
-import com.vaadin.ui.Grid.FooterRow;
import com.vaadin.ui.Grid.SelectionMode;
-import com.vaadin.ui.components.grid.AbstractSelectionModel;
+import com.vaadin.ui.components.grid.ColumnReorderListener;
+import com.vaadin.ui.components.grid.ColumnResizeListener;
+import com.vaadin.ui.components.grid.ColumnVisibilityChangeListener;
+import com.vaadin.ui.components.grid.DescriptionGenerator;
+import com.vaadin.ui.components.grid.DetailsGenerator;
+import com.vaadin.ui.components.grid.Editor;
import com.vaadin.ui.components.grid.EditorComponentGenerator;
import com.vaadin.ui.components.grid.EditorImpl;
import com.vaadin.ui.components.grid.Footer;
+import com.vaadin.ui.components.grid.FooterCell;
+import com.vaadin.ui.components.grid.FooterRow;
+import com.vaadin.ui.components.grid.GridSelectionModel;
import com.vaadin.ui.components.grid.Header;
import com.vaadin.ui.components.grid.Header.Row;
+import com.vaadin.ui.components.grid.HeaderCell;
+import com.vaadin.ui.components.grid.HeaderRow;
+import com.vaadin.ui.components.grid.ItemClickListener;
+import com.vaadin.ui.components.grid.MultiSelectionModel;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl;
import com.vaadin.ui.components.grid.NoSelectionModel;
+import com.vaadin.ui.components.grid.SingleSelectionModel;
import com.vaadin.ui.components.grid.SingleSelectionModelImpl;
+import com.vaadin.ui.components.grid.SortOrderProvider;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.DesignException;
@@ -136,21 +145,6 @@ public class Grid<T> extends AbstractListing<T>
ColumnVisibilityChangeEvent.class);
/**
- * An event listener for column reorder events in the Grid.
- */
- @FunctionalInterface
- public interface ColumnReorderListener extends Serializable {
-
- /**
- * Called when the columns of the grid have been reordered.
- *
- * @param event
- * An event providing more information
- */
- void columnReorder(ColumnReorderEvent event);
- }
-
- /**
* Selection mode representing the built-in selection models in grid.
* <p>
* These enums can be used in {@link Grid#setSelectionMode(SelectionMode)}
@@ -210,157 +204,6 @@ public class Grid<T> extends AbstractListing<T>
}
/**
- * The server-side interface that controls Grid's selection state.
- * SelectionModel should extend {@link AbstractGridExtension}.
- * <p>
- *
- * @param <T>
- * the grid bean type
- * @see AbstractSelectionModel
- * @see SingleSelectionModel
- * @see MultiSelectionModel
- */
- public interface GridSelectionModel<T>
- extends SelectionModel<T>, Extension {
-
- /**
- * Removes this selection model from the grid.
- * <p>
- * Must call super {@link Extension#remove()} to detach the extension,
- * and fire an selection change event for the selection model (with an
- * empty selection).
- */
- @Override
- public void remove();
- }
-
- /**
- * Single selection model interface for Grid.
- *
- * @param <T>
- * the type of items in grid
- */
- public interface SingleSelectionModel<T> extends GridSelectionModel<T>,
- com.vaadin.data.SelectionModel.Single<T> {
-
- /**
- * Gets a wrapper to use this single selection model as a single select
- * in {@link Binder}.
- *
- * @return the single select wrapper
- */
- SingleSelect<T> asSingleSelect();
-
- /**
- * {@inheritDoc}
- * <p>
- * Use {@link #addSingleSelectionListener(SingleSelectionListener)} for
- * more specific single selection event.
- *
- * @see #addSingleSelectionListener(SingleSelectionListener)
- */
- @Override
- public default Registration addSelectionListener(
- SelectionListener<T> listener) {
- return addSingleSelectionListener(e -> listener.selectionChange(e));
- }
-
- /**
- * Adds a single selection listener that is called when the value of
- * this select is changed either by the user or programmatically.
- *
- * @param listener
- * the value change listener, not {@code null}
- * @return a registration for the listener
- */
- public Registration addSingleSelectionListener(
- SingleSelectionListener<T> listener);
- }
-
- /**
- * Multiselection model interface for Grid.
- *
- * @param <T>
- * the type of items in grid
- */
- public interface MultiSelectionModel<T> extends GridSelectionModel<T>,
- com.vaadin.data.SelectionModel.Multi<T> {
-
- /**
- * Gets a wrapper to use this multiselection model as a multiselect in
- * {@link Binder}.
- *
- * @return the multiselect wrapper
- */
- MultiSelect<T> asMultiSelect();
-
- /**
- * {@inheritDoc}
- * <p>
- * Use {@link #addMultiSelectionListener(MultiSelectionListener)} for
- * more specific event on multiselection.
- *
- * @see #addMultiSelectionListener(MultiSelectionListener)
- */
- @Override
- public default Registration addSelectionListener(
- SelectionListener<T> listener) {
- return addMultiSelectionListener(e -> listener.selectionChange(e));
- }
-
- /**
- * Adds a selection listener that will be called when the selection is
- * changed either by the user or programmatically.
- *
- * @param listener
- * the value change listener, not {@code null}
- * @return a registration for the listener
- */
- public Registration addMultiSelectionListener(
- MultiSelectionListener<T> listener);
- }
-
- /**
- * An event listener for column resize events in the Grid.
- */
- @FunctionalInterface
- public interface ColumnResizeListener extends Serializable {
-
- /**
- * Called when the columns of the grid have been resized.
- *
- * @param event
- * An event providing more information
- */
- void columnResize(ColumnResizeEvent event);
- }
-
- /**
- * Generates the sort orders when rows are sorted by a column.
- *
- * @see Column#setSortOrderProvider
- *
- * @since 8.0
- * @author Vaadin Ltd
- */
- @FunctionalInterface
- public interface SortOrderProvider extends
- SerializableFunction<SortDirection, Stream<SortOrder<String>>> {
-
- /**
- * Generates the sort orders when rows are sorted by a column.
- *
- * @param sortDirection
- * desired sort direction
- *
- * @return sort information
- */
- @Override
- public Stream<SortOrder<String>> apply(SortDirection sortDirection);
-
- }
-
- /**
* An event that is fired when the columns are reordered.
*/
public static class ColumnReorderEvent extends Component.Event {
@@ -500,27 +343,6 @@ public class Grid<T> extends AbstractListing<T>
}
/**
- * A listener for item click events.
- *
- * @param <T>
- * the grid bean type
- *
- * @see ItemClick
- * @see Registration
- */
- @FunctionalInterface
- public interface ItemClickListener<T> extends SerializableEventListener {
- /**
- * Invoked when this listener receives a item click event from a Grid to
- * which it has been added.
- *
- * @param event
- * the received event, not null
- */
- public void itemClick(ItemClick<T> event);
- }
-
- /**
* ContextClickEvent for the Grid Component.
*
* @param <T>
@@ -605,22 +427,6 @@ public class Grid<T> extends AbstractListing<T>
}
/**
- * An event listener for column visibility change events in the Grid.
- *
- * @since 7.5.0
- */
- @FunctionalInterface
- public interface ColumnVisibilityChangeListener extends Serializable {
-
- /**
- * Called when a column has become hidden or unhidden.
- *
- * @param event
- */
- void columnVisibilityChanged(ColumnVisibilityChangeEvent event);
- }
-
- /**
* An event that is fired when a column's visibility changes.
*
* @since 7.5.0
@@ -685,28 +491,6 @@ public class Grid<T> extends AbstractListing<T>
}
/**
- * A callback interface for generating description texts for an item.
- *
- * @param <T>
- * the grid bean type
- */
- @FunctionalInterface
- public interface DescriptionGenerator<T>
- extends SerializableFunction<T, String> {
- }
-
- /**
- * A callback interface for generating details for a particular row in Grid.
- *
- * @param <T>
- * the grid bean type
- */
- @FunctionalInterface
- public interface DetailsGenerator<T>
- extends SerializableFunction<T, Component> {
- }
-
- /**
* A helper base class for creating extensions for the Grid component.
*
* @param <T>
@@ -1952,421 +1736,6 @@ public class Grid<T> extends AbstractListing<T>
}
}
- /**
- * A header row in a Grid.
- */
- public interface HeaderRow extends Serializable {
-
- /**
- * Returns the cell on this row corresponding to the given column id.
- *
- * @param columnId
- * the id of the column whose header cell to get, not null
- * @return the header cell
- * @throws IllegalArgumentException
- * if there is no such column in the grid
- */
- public HeaderCell getCell(String columnId);
-
- /**
- * Returns the cell on this row corresponding to the given column.
- *
- * @param column
- * the column whose header cell to get, not null
- * @return the header cell
- * @throws IllegalArgumentException
- * if there is no such column in the grid
- */
- public HeaderCell getCell(Column<?, ?> column);
-
- /**
- * Merges column cells in the row. Original cells are hidden, and new
- * merged cell is shown instead. The cell has a width of all merged
- * cells together, inherits styles of the first merged cell but has
- * empty caption.
- *
- * @param cellsToMerge
- * the cells which should be merged. The cells should not be
- * merged to any other cell set.
- * @return the remaining visible cell after the merge
- *
- * @see #join(Grid.HeaderCell...)
- * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
- */
- HeaderCell join(Set<HeaderCell> cellsToMerge);
-
- /**
- * Merges column cells in the row. Original cells are hidden, and new
- * merged cell is shown instead. The cell has a width of all merged
- * cells together, inherits styles of the first merged cell but has
- * empty caption.
- *
- * @param cellsToMerge
- * the cells which should be merged. The cells should not be
- * merged to any other cell set.
- * @return the remaining visible cell after the merge
- *
- * @see #join(Set)
- * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
- */
- HeaderCell join(HeaderCell... cellsToMerge);
-
- }
-
- /**
- * An individual cell on a Grid header row.
- */
- public interface HeaderCell extends Serializable {
-
- /**
- * Returns the textual caption of this cell.
- *
- * @return the header caption
- */
- public String getText();
-
- /**
- * Sets the textual caption of this cell.
- *
- * @param text
- * the header caption to set, not null
- */
- public void setText(String text);
-
- /**
- * Returns the HTML content displayed in this cell.
- *
- * @return the html
- *
- */
- public String getHtml();
-
- /**
- * Sets the HTML content displayed in this cell.
- *
- * @param html
- * the html to set
- */
- public void setHtml(String html);
-
- /**
- * Returns the component displayed in this cell.
- *
- * @return the component
- */
- public Component getComponent();
-
- /**
- * Sets the component displayed in this cell.
- *
- * @param component
- * the component to set
- */
- public void setComponent(Component component);
-
- /**
- * Returns the type of content stored in this cell.
- *
- * @return cell content type
- */
- public GridStaticCellType getCellType();
-
- /**
- * Gets the column id where this cell is.
- *
- * @return column id for this cell
- */
- public String getColumnId();
- }
-
- /**
- * A footer row in a Grid.
- */
- public interface FooterRow extends Serializable {
-
- /**
- * Returns the cell on this row corresponding to the given column id.
- *
- * @param columnId
- * the id of the column whose footer cell to get, not null
- * @return the footer cell
- * @throws IllegalArgumentException
- * if there is no such column in the grid
- */
- public FooterCell getCell(String columnId);
-
- /**
- * Returns the cell on this row corresponding to the given column.
- *
- * @param column
- * the column whose footer cell to get, not null
- * @return the footer cell
- * @throws IllegalArgumentException
- * if there is no such column in the grid
- */
- public FooterCell getCell(Column<?, ?> column);
-
- /**
- * Merges column cells in the row. Original cells are hidden, and new
- * merged cell is shown instead. The cell has a width of all merged
- * cells together, inherits styles of the first merged cell but has
- * empty caption.
- *
- * @param cellsToMerge
- * the cells which should be merged. The cells should not be
- * merged to any other cell set.
- * @return the remaining visible cell after the merge
- *
- * @see #join(Grid.FooterCell...)
- * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
- */
- FooterCell join(Set<FooterCell> cellsToMerge);
-
- /**
- * Merges column cells in the row. Original cells are hidden, and new
- * merged cell is shown instead. The cell has a width of all merged
- * cells together, inherits styles of the first merged cell but has
- * empty caption.
- *
- * @param cellsToMerge
- * the cells which should be merged. The cells should not be
- * merged to any other cell set.
- * @return the remaining visible cell after the merge
- *
- * @see #join(Set)
- * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
- */
- FooterCell join(FooterCell... cellsToMerge);
- }
-
- /**
- * An individual cell on a Grid footer row.
- */
- public interface FooterCell extends Serializable {
-
- /**
- * Returns the textual caption of this cell.
- *
- * @return the footer caption
- */
- public String getText();
-
- /**
- * Sets the textual caption of this cell.
- *
- * @param text
- * the footer caption to set, not null
- */
- public void setText(String text);
-
- /**
- * Returns the HTML content displayed in this cell.
- *
- * @return the html
- *
- */
- public String getHtml();
-
- /**
- * Sets the HTML content displayed in this cell.
- *
- * @param html
- * the html to set
- */
- public void setHtml(String html);
-
- /**
- * Returns the component displayed in this cell.
- *
- * @return the component
- */
- public Component getComponent();
-
- /**
- * Sets the component displayed in this cell.
- *
- * @param component
- * the component to set
- */
- public void setComponent(Component component);
-
- /**
- * Returns the type of content stored in this cell.
- *
- * @return cell content type
- */
- public GridStaticCellType getCellType();
-
- /**
- * Gets the column id where this cell is.
- *
- * @return column id for this cell
- */
- public String getColumnId();
- }
-
- /**
- * Generator for creating editor validation and conversion error messages.
- *
- * @param <T>
- * the bean type
- */
- @FunctionalInterface
- public interface EditorErrorGenerator<T> extends Serializable,
- BiFunction<Map<Component, Column<T, ?>>, BinderValidationStatus<T>, String> {
-
- /**
- * Generates an error message from given validation status object.
- *
- * @param fieldToColumn
- * the map of failed fields and corresponding columns
- * @param status
- * the binder status object with all failures
- *
- * @return error message string
- */
- @Override
- public String apply(Map<Component, Column<T, ?>> fieldToColumn,
- BinderValidationStatus<T> status);
- }
-
- /**
- * An editor in a Grid.
- *
- * @param <T>
- */
- public interface Editor<T> extends Serializable {
-
- /**
- * Sets the underlying Binder to this Editor.
- *
- * @param binder
- * the binder for updating editor fields; not {@code null}
- * @return this editor
- */
- public Editor<T> setBinder(Binder<T> binder);
-
- /**
- * Returns the underlying Binder from Editor.
- *
- * @return the binder; not {@code null}
- */
- public Binder<T> getBinder();
-
- /**
- * Sets the Editor buffered mode. When the editor is in buffered mode,
- * edits are only committed when the user clicks the save button. In
- * unbuffered mode valid changes are automatically committed.
- *
- * @param buffered
- * {@code true} if editor should be buffered; {@code false}
- * if not
- * @return this editor
- */
- public Editor<T> setBuffered(boolean buffered);
-
- /**
- * Enables or disabled the Editor. A disabled editor cannot be opened.
- *
- * @param enabled
- * {@code true} if editor should be enabled; {@code false} if
- * not
- * @return this editor
- */
- public Editor<T> setEnabled(boolean enabled);
-
- /**
- * Returns whether Editor is buffered or not.
- *
- * @see #setBuffered(boolean)
- *
- * @return {@code true} if editor is buffered; {@code false} if not
- */
- public boolean isBuffered();
-
- /**
- * Returns whether Editor is enabled or not.
- *
- * @return {@code true} if editor is enabled; {@code false} if not
- */
- public boolean isEnabled();
-
- /**
- * Returns whether Editor is open or not.
- *
- * @return {@code true} if editor is open; {@code false} if not
- */
- public boolean isOpen();
-
- /**
- * Saves any changes from the Editor fields to the edited bean.
- *
- * @return {@code true} if save succeeded; {@code false} if not
- */
- public boolean save();
-
- /**
- * Close the editor discarding any unsaved changes.
- */
- public void cancel();
-
- /**
- * Sets the caption of the save button in buffered mode.
- *
- * @param saveCaption
- * the save button caption
- * @return this editor
- */
- public Editor<T> setSaveCaption(String saveCaption);
-
- /**
- * Sets the caption of the cancel button in buffered mode.
- *
- * @param cancelCaption
- * the cancel button caption
- * @return this editor
- */
- public Editor<T> setCancelCaption(String cancelCaption);
-
- /**
- * Gets the caption of the save button in buffered mode.
- *
- * @return the save button caption
- */
- public String getSaveCaption();
-
- /**
- * Gets the caption of the cancel button in buffered mode.
- *
- * @return the cancel button caption
- */
- public String getCancelCaption();
-
- /**
- * Sets the error message generator for this editor.
- * <p>
- * The default message is a concatenation of column field validation
- * failures and bean validation failures.
- *
- * @param errorGenerator
- * the function to generate error messages; not {@code null}
- * @return this editor
- *
- * @see EditorErrorGenerator
- */
- public Editor<T> setErrorGenerator(
- EditorErrorGenerator<T> errorGenerator);
-
- /**
- * Gets the error message generator of this editor.
- *
- * @return the function that generates error messages; not {@code null}
- *
- * @see EditorErrorGenerator
- */
- public EditorErrorGenerator<T> getErrorGenerator();
- }
-
private class HeaderImpl extends Header {
@Override
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/AbstractSelectionModel.java b/server/src/main/java/com/vaadin/ui/components/grid/AbstractSelectionModel.java
index 58fb6bd12a..0371d2be3a 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/AbstractSelectionModel.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/AbstractSelectionModel.java
@@ -20,7 +20,6 @@ import com.vaadin.shared.ui.grid.AbstractSelectionModelState;
import com.vaadin.ui.AbstractListing;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.AbstractGridExtension;
-import com.vaadin.ui.Grid.GridSelectionModel;
import elemental.json.JsonObject;
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/ColumnReorderListener.java b/server/src/main/java/com/vaadin/ui/components/grid/ColumnReorderListener.java
new file mode 100644
index 0000000000..e946e590a2
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/ColumnReorderListener.java
@@ -0,0 +1,38 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+
+import com.vaadin.ui.Grid;
+
+/**
+ * An event listener for column reorder events in the Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ */
+@FunctionalInterface
+public interface ColumnReorderListener extends Serializable {
+
+ /**
+ * Called when the columns of the grid have been reordered.
+ *
+ * @param event
+ * An event providing more information
+ */
+ void columnReorder(Grid.ColumnReorderEvent event);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/ColumnResizeListener.java b/server/src/main/java/com/vaadin/ui/components/grid/ColumnResizeListener.java
new file mode 100644
index 0000000000..04efc67f27
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/ColumnResizeListener.java
@@ -0,0 +1,38 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+
+import com.vaadin.ui.Grid;
+
+/**
+ * An event listener for column resize events in the Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ */
+@FunctionalInterface
+public interface ColumnResizeListener extends Serializable {
+
+ /**
+ * Called when the columns of the grid have been resized.
+ *
+ * @param event
+ * An event providing more information
+ */
+ void columnResize(Grid.ColumnResizeEvent event);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/ColumnVisibilityChangeListener.java b/server/src/main/java/com/vaadin/ui/components/grid/ColumnVisibilityChangeListener.java
new file mode 100644
index 0000000000..db951e58e4
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/ColumnVisibilityChangeListener.java
@@ -0,0 +1,38 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+
+import com.vaadin.ui.Grid;
+
+/**
+ * An event listener for column visibility change events in the Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ */
+@FunctionalInterface
+public interface ColumnVisibilityChangeListener extends Serializable {
+
+ /**
+ * Called when a column has become hidden or unhidden.
+ *
+ * @param event
+ * the event
+ */
+ void columnVisibilityChanged(Grid.ColumnVisibilityChangeEvent event);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/DescriptionGenerator.java b/server/src/main/java/com/vaadin/ui/components/grid/DescriptionGenerator.java
new file mode 100644
index 0000000000..4ec3d72482
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/DescriptionGenerator.java
@@ -0,0 +1,32 @@
+/*
+ * 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.ui.components.grid;
+
+import com.vaadin.server.SerializableFunction;
+
+/**
+ * A callback interface for generating description texts for an item.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ * the grid bean type
+ */
+@FunctionalInterface
+public interface DescriptionGenerator<T>
+ extends SerializableFunction<T, String> {
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/DetailsGenerator.java b/server/src/main/java/com/vaadin/ui/components/grid/DetailsGenerator.java
new file mode 100644
index 0000000000..c1da727d1d
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/DetailsGenerator.java
@@ -0,0 +1,33 @@
+/*
+ * 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.ui.components.grid;
+
+import com.vaadin.server.SerializableFunction;
+import com.vaadin.ui.Component;
+
+/**
+ * A callback interface for generating details for a particular row in Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ * the grid bean type
+ */
+@FunctionalInterface
+public interface DetailsGenerator<T>
+ extends SerializableFunction<T, Component> {
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/Editor.java b/server/src/main/java/com/vaadin/ui/components/grid/Editor.java
new file mode 100644
index 0000000000..823c5cd849
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/Editor.java
@@ -0,0 +1,158 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+
+import com.vaadin.data.Binder;
+
+/**
+ * An editor in a Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ */
+public interface Editor<T> extends Serializable {
+
+ /**
+ * Sets the underlying Binder to this Editor.
+ *
+ * @param binder
+ * the binder for updating editor fields; not {@code null}
+ * @return this editor
+ */
+ public Editor<T> setBinder(Binder<T> binder);
+
+ /**
+ * Returns the underlying Binder from Editor.
+ *
+ * @return the binder; not {@code null}
+ */
+ public Binder<T> getBinder();
+
+ /**
+ * Sets the Editor buffered mode. When the editor is in buffered mode, edits
+ * are only committed when the user clicks the save button. In unbuffered
+ * mode valid changes are automatically committed.
+ *
+ * @param buffered
+ * {@code true} if editor should be buffered; {@code false} if
+ * not
+ * @return this editor
+ */
+ public Editor<T> setBuffered(boolean buffered);
+
+ /**
+ * Enables or disabled the Editor. A disabled editor cannot be opened.
+ *
+ * @param enabled
+ * {@code true} if editor should be enabled; {@code false} if not
+ * @return this editor
+ */
+ public Editor<T> setEnabled(boolean enabled);
+
+ /**
+ * Returns whether Editor is buffered or not.
+ *
+ * @see #setBuffered(boolean)
+ *
+ * @return {@code true} if editor is buffered; {@code false} if not
+ */
+ public boolean isBuffered();
+
+ /**
+ * Returns whether Editor is enabled or not.
+ *
+ * @return {@code true} if editor is enabled; {@code false} if not
+ */
+ public boolean isEnabled();
+
+ /**
+ * Returns whether Editor is open or not.
+ *
+ * @return {@code true} if editor is open; {@code false} if not
+ */
+ public boolean isOpen();
+
+ /**
+ * Saves any changes from the Editor fields to the edited bean.
+ *
+ * @return {@code true} if save succeeded; {@code false} if not
+ */
+ public boolean save();
+
+ /**
+ * Close the editor discarding any unsaved changes.
+ */
+ public void cancel();
+
+ /**
+ * Sets the caption of the save button in buffered mode.
+ *
+ * @param saveCaption
+ * the save button caption
+ * @return this editor
+ */
+ public Editor<T> setSaveCaption(String saveCaption);
+
+ /**
+ * Sets the caption of the cancel button in buffered mode.
+ *
+ * @param cancelCaption
+ * the cancel button caption
+ * @return this editor
+ */
+ public Editor<T> setCancelCaption(String cancelCaption);
+
+ /**
+ * Gets the caption of the save button in buffered mode.
+ *
+ * @return the save button caption
+ */
+ public String getSaveCaption();
+
+ /**
+ * Gets the caption of the cancel button in buffered mode.
+ *
+ * @return the cancel button caption
+ */
+ public String getCancelCaption();
+
+ /**
+ * Sets the error message generator for this editor.
+ * <p>
+ * The default message is a concatenation of column field validation
+ * failures and bean validation failures.
+ *
+ * @param errorGenerator
+ * the function to generate error messages; not {@code null}
+ * @return this editor
+ *
+ * @see EditorErrorGenerator
+ */
+ public Editor<T> setErrorGenerator(EditorErrorGenerator<T> errorGenerator);
+
+ /**
+ * Gets the error message generator of this editor.
+ *
+ * @return the function that generates error messages; not {@code null}
+ *
+ * @see EditorErrorGenerator
+ */
+ public EditorErrorGenerator<T> getErrorGenerator();
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/EditorErrorGenerator.java b/server/src/main/java/com/vaadin/ui/components/grid/EditorErrorGenerator.java
new file mode 100644
index 0000000000..df649f1ea9
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/EditorErrorGenerator.java
@@ -0,0 +1,52 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+import com.vaadin.data.BinderValidationStatus;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Grid;
+
+/**
+ * Generator for creating editor validation and conversion error messages.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ * the bean type
+ */
+@FunctionalInterface
+public interface EditorErrorGenerator<T> extends Serializable,
+ BiFunction<Map<Component, Grid.Column<T, ?>>, BinderValidationStatus<T>, String> {
+
+ /**
+ * Generates an error message from given validation status object.
+ *
+ * @param fieldToColumn
+ * the map of failed fields and corresponding columns
+ * @param status
+ * the binder status object with all failures
+ *
+ * @return error message string
+ */
+ @Override
+ public String apply(Map<Component, Grid.Column<T, ?>> fieldToColumn,
+ BinderValidationStatus<T> status);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
index 7aa3920c3c..56bf4d6414 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
@@ -32,8 +32,6 @@ import com.vaadin.shared.ui.grid.editor.EditorState;
import com.vaadin.ui.Component;
import com.vaadin.ui.Grid.AbstractGridExtension;
import com.vaadin.ui.Grid.Column;
-import com.vaadin.ui.Grid.Editor;
-import com.vaadin.ui.Grid.EditorErrorGenerator;
import elemental.json.JsonObject;
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/Footer.java b/server/src/main/java/com/vaadin/ui/components/grid/Footer.java
index 7d4f45cd1e..ddc36c1efa 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/Footer.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/Footer.java
@@ -19,8 +19,6 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import com.vaadin.ui.Grid;
-
/**
* Represents the footer section of a Grid.
*
@@ -34,13 +32,13 @@ public abstract class Footer extends StaticSection<Footer.Row> {
* A row in a Grid Footer.
*/
public class Row extends StaticSection.StaticRow<Row.Cell>
- implements Grid.FooterRow {
+ implements FooterRow {
/**
* A cell in a Grid footer row.
*/
public class Cell extends StaticSection.StaticCell
- implements Grid.FooterCell {
+ implements FooterCell {
/**
* Creates a new footer cell.
*/
@@ -77,12 +75,12 @@ public abstract class Footer extends StaticSection<Footer.Row> {
* merged to any other cell set.
* @return the remaining visible cell after the merge
*
- * @see #join(Grid.FooterCell...)
+ * @see #join(FooterCell...)
* @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
*/
@Override
- public Grid.FooterCell join(Set<Grid.FooterCell> cellsToMerge) {
- for (Grid.FooterCell cell : cellsToMerge) {
+ public FooterCell join(Set<FooterCell> cellsToMerge) {
+ for (FooterCell cell : cellsToMerge) {
checkIfAlreadyMerged(cell.getColumnId());
}
@@ -90,7 +88,7 @@ public abstract class Footer extends StaticSection<Footer.Row> {
Cell newCell = createCell();
Set<String> columnGroup = new HashSet<>();
- for (Grid.FooterCell cell : cellsToMerge) {
+ for (FooterCell cell : cellsToMerge) {
columnGroup.add(cell.getColumnId());
}
addMergedCell(newCell, columnGroup);
@@ -113,8 +111,8 @@ public abstract class Footer extends StaticSection<Footer.Row> {
* @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
*/
@Override
- public Grid.FooterCell join(Grid.FooterCell... cellsToMerge) {
- Set<Grid.FooterCell> footerCells = new HashSet<>(
+ public FooterCell join(FooterCell... cellsToMerge) {
+ Set<FooterCell> footerCells = new HashSet<>(
Arrays.asList(cellsToMerge));
return join(footerCells);
}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java b/server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java
new file mode 100644
index 0000000000..092637c891
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/FooterCell.java
@@ -0,0 +1,90 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+
+import com.vaadin.shared.ui.grid.GridStaticCellType;
+import com.vaadin.ui.Component;
+
+/**
+ * An individual cell on a Grid footer row.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ */
+public interface FooterCell extends Serializable {
+
+ /**
+ * Returns the textual caption of this cell.
+ *
+ * @return the footer caption
+ */
+ public String getText();
+
+ /**
+ * Sets the textual caption of this cell.
+ *
+ * @param text
+ * the footer caption to set, not null
+ */
+ public void setText(String text);
+
+ /**
+ * Returns the HTML content displayed in this cell.
+ *
+ * @return the html
+ *
+ */
+ public String getHtml();
+
+ /**
+ * Sets the HTML content displayed in this cell.
+ *
+ * @param html
+ * the html to set
+ */
+ public void setHtml(String html);
+
+ /**
+ * Returns the component displayed in this cell.
+ *
+ * @return the component
+ */
+ public Component getComponent();
+
+ /**
+ * Sets the component displayed in this cell.
+ *
+ * @param component
+ * the component to set
+ */
+ public void setComponent(Component component);
+
+ /**
+ * Returns the type of content stored in this cell.
+ *
+ * @return cell content type
+ */
+ public GridStaticCellType getCellType();
+
+ /**
+ * Gets the column id where this cell is.
+ *
+ * @return column id for this cell
+ */
+ public String getColumnId();
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java b/server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java
new file mode 100644
index 0000000000..8d6bd70bf1
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/FooterRow.java
@@ -0,0 +1,82 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import com.vaadin.ui.Grid;
+
+/**
+ * A footer row in a Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ */
+public interface FooterRow extends Serializable {
+
+ /**
+ * Returns the cell on this row corresponding to the given column id.
+ *
+ * @param columnId
+ * the id of the column whose footer cell to get, not null
+ * @return the footer cell
+ * @throws IllegalArgumentException
+ * if there is no such column in the grid
+ */
+ public FooterCell getCell(String columnId);
+
+ /**
+ * Returns the cell on this row corresponding to the given column.
+ *
+ * @param column
+ * the column whose footer cell to get, not null
+ * @return the footer cell
+ * @throws IllegalArgumentException
+ * if there is no such column in the grid
+ */
+ public FooterCell getCell(Grid.Column<?, ?> column);
+
+ /**
+ * Merges column cells in the row. Original cells are hidden, and new merged
+ * cell is shown instead. The cell has a width of all merged cells together,
+ * inherits styles of the first merged cell but has empty caption.
+ *
+ * @param cellsToMerge
+ * the cells which should be merged. The cells should not be
+ * merged to any other cell set.
+ * @return the remaining visible cell after the merge
+ *
+ * @see #join(FooterCell...)
+ * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
+ */
+ FooterCell join(Set<FooterCell> cellsToMerge);
+
+ /**
+ * Merges column cells in the row. Original cells are hidden, and new merged
+ * cell is shown instead. The cell has a width of all merged cells together,
+ * inherits styles of the first merged cell but has empty caption.
+ *
+ * @param cellsToMerge
+ * the cells which should be merged. The cells should not be
+ * merged to any other cell set.
+ * @return the remaining visible cell after the merge
+ *
+ * @see #join(Set)
+ * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
+ */
+ FooterCell join(FooterCell... cellsToMerge);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/GridSelectionModel.java b/server/src/main/java/com/vaadin/ui/components/grid/GridSelectionModel.java
new file mode 100644
index 0000000000..2913318bf8
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/GridSelectionModel.java
@@ -0,0 +1,46 @@
+/*
+ * 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.ui.components.grid;
+
+import com.vaadin.data.SelectionModel;
+import com.vaadin.server.Extension;
+import com.vaadin.ui.Grid.AbstractGridExtension;
+
+/**
+ * The server-side interface that controls Grid's selection state.
+ * SelectionModel should extend {@link AbstractGridExtension}.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ * the grid bean type
+ * @see AbstractSelectionModel
+ * @see SingleSelectionModel
+ * @see MultiSelectionModel
+ */
+public interface GridSelectionModel<T> extends SelectionModel<T>, Extension {
+
+ /**
+ * Removes this selection model from the grid.
+ * <p>
+ * Must call super {@link Extension#remove()} to detach the extension, and
+ * fire an selection change event for the selection model (with an empty
+ * selection).
+ */
+ @Override
+ public void remove();
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/Header.java b/server/src/main/java/com/vaadin/ui/components/grid/Header.java
index 0991069487..69c23c6818 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/Header.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/Header.java
@@ -21,7 +21,6 @@ import java.util.Set;
import org.jsoup.nodes.Element;
-import com.vaadin.ui.Grid;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
@@ -38,13 +37,13 @@ public abstract class Header extends StaticSection<Header.Row> {
* A row in a Grid header.
*/
public class Row extends StaticSection.StaticRow<Row.Cell>
- implements Grid.HeaderRow {
+ implements HeaderRow {
/**
* A cell in a Grid header row.
*/
public class Cell extends StaticSection.StaticCell
- implements Grid.HeaderCell {
+ implements HeaderCell {
/**
* Creates a new header cell.
*/
@@ -101,12 +100,12 @@ public abstract class Header extends StaticSection<Header.Row> {
* merged to any other cell set.
* @return the remaining visible cell after the merge
*
- * @see #join(Grid.HeaderCell...)
+ * @see #join(HeaderCell...)
* @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
*/
@Override
- public Grid.HeaderCell join(Set<Grid.HeaderCell> cellsToMerge) {
- for (Grid.HeaderCell cell : cellsToMerge) {
+ public HeaderCell join(Set<HeaderCell> cellsToMerge) {
+ for (HeaderCell cell : cellsToMerge) {
checkIfAlreadyMerged(cell.getColumnId());
}
@@ -114,7 +113,7 @@ public abstract class Header extends StaticSection<Header.Row> {
Cell newCell = createCell();
Set<String> columnGroup = new HashSet<>();
- for (Grid.HeaderCell cell : cellsToMerge) {
+ for (HeaderCell cell : cellsToMerge) {
columnGroup.add(cell.getColumnId());
}
addMergedCell(newCell, columnGroup);
@@ -137,8 +136,8 @@ public abstract class Header extends StaticSection<Header.Row> {
* @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
*/
@Override
- public Grid.HeaderCell join(Grid.HeaderCell... cellsToMerge) {
- Set<Grid.HeaderCell> headerCells = new HashSet<>(
+ public HeaderCell join(HeaderCell... cellsToMerge) {
+ Set<HeaderCell> headerCells = new HashSet<>(
Arrays.asList(cellsToMerge));
return join(headerCells);
}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java b/server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java
new file mode 100644
index 0000000000..741ea96617
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/HeaderCell.java
@@ -0,0 +1,90 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+
+import com.vaadin.shared.ui.grid.GridStaticCellType;
+import com.vaadin.ui.Component;
+
+/**
+ * An individual cell on a Grid header row.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ */
+public interface HeaderCell extends Serializable {
+
+ /**
+ * Returns the textual caption of this cell.
+ *
+ * @return the header caption
+ */
+ public String getText();
+
+ /**
+ * Sets the textual caption of this cell.
+ *
+ * @param text
+ * the header caption to set, not null
+ */
+ public void setText(String text);
+
+ /**
+ * Returns the HTML content displayed in this cell.
+ *
+ * @return the html
+ *
+ */
+ public String getHtml();
+
+ /**
+ * Sets the HTML content displayed in this cell.
+ *
+ * @param html
+ * the html to set
+ */
+ public void setHtml(String html);
+
+ /**
+ * Returns the component displayed in this cell.
+ *
+ * @return the component
+ */
+ public Component getComponent();
+
+ /**
+ * Sets the component displayed in this cell.
+ *
+ * @param component
+ * the component to set
+ */
+ public void setComponent(Component component);
+
+ /**
+ * Returns the type of content stored in this cell.
+ *
+ * @return cell content type
+ */
+ public GridStaticCellType getCellType();
+
+ /**
+ * Gets the column id where this cell is.
+ *
+ * @return column id for this cell
+ */
+ public String getColumnId();
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java b/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java
new file mode 100644
index 0000000000..19bcb4d111
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/HeaderRow.java
@@ -0,0 +1,83 @@
+/*
+ * 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.ui.components.grid;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import com.vaadin.ui.Grid;
+
+/**
+ * A header row in a Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ */
+public interface HeaderRow extends Serializable {
+
+ /**
+ * Returns the cell on this row corresponding to the given column id.
+ *
+ * @param columnId
+ * the id of the column whose header cell to get, not null
+ * @return the header cell
+ * @throws IllegalArgumentException
+ * if there is no such column in the grid
+ */
+ public HeaderCell getCell(String columnId);
+
+ /**
+ * Returns the cell on this row corresponding to the given column.
+ *
+ * @param column
+ * the column whose header cell to get, not null
+ * @return the header cell
+ * @throws IllegalArgumentException
+ * if there is no such column in the grid
+ */
+ public HeaderCell getCell(Grid.Column<?, ?> column);
+
+ /**
+ * Merges column cells in the row. Original cells are hidden, and new merged
+ * cell is shown instead. The cell has a width of all merged cells together,
+ * inherits styles of the first merged cell but has empty caption.
+ *
+ * @param cellsToMerge
+ * the cells which should be merged. The cells should not be
+ * merged to any other cell set.
+ * @return the remaining visible cell after the merge
+ *
+ * @see #join(HeaderCell...)
+ * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
+ */
+ HeaderCell join(Set<HeaderCell> cellsToMerge);
+
+ /**
+ * Merges column cells in the row. Original cells are hidden, and new merged
+ * cell is shown instead. The cell has a width of all merged cells together,
+ * inherits styles of the first merged cell but has empty caption.
+ *
+ * @param cellsToMerge
+ * the cells which should be merged. The cells should not be
+ * merged to any other cell set.
+ * @return the remaining visible cell after the merge
+ *
+ * @see #join(Set)
+ * @see com.vaadin.ui.AbstractComponent#setCaption(String) setCaption
+ */
+ HeaderCell join(HeaderCell... cellsToMerge);
+
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/ItemClickListener.java b/server/src/main/java/com/vaadin/ui/components/grid/ItemClickListener.java
new file mode 100644
index 0000000000..2ac3428423
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/ItemClickListener.java
@@ -0,0 +1,45 @@
+/*
+ * 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.ui.components.grid;
+
+import com.vaadin.event.SerializableEventListener;
+import com.vaadin.shared.Registration;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.ItemClick;
+
+/**
+ * A listener for item click events.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ * the grid bean type
+ *
+ * @see ItemClick
+ * @see Registration
+ */
+@FunctionalInterface
+public interface ItemClickListener<T> extends SerializableEventListener {
+ /**
+ * Invoked when this listener receives a item click event from a Grid to
+ * which it has been added.
+ *
+ * @param event
+ * the received event, not null
+ */
+ public void itemClick(Grid.ItemClick<T> event);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java
new file mode 100644
index 0000000000..4c5da97a5d
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java
@@ -0,0 +1,68 @@
+/*
+ * 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.ui.components.grid;
+
+import com.vaadin.data.Binder;
+import com.vaadin.event.selection.MultiSelectionListener;
+import com.vaadin.event.selection.SelectionListener;
+import com.vaadin.shared.Registration;
+import com.vaadin.ui.MultiSelect;
+
+/**
+ * Multiselection model interface for Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ * the type of items in grid
+ */
+public interface MultiSelectionModel<T>
+ extends GridSelectionModel<T>, com.vaadin.data.SelectionModel.Multi<T> {
+
+ /**
+ * Gets a wrapper to use this multiselection model as a multiselect in
+ * {@link Binder}.
+ *
+ * @return the multiselect wrapper
+ */
+ MultiSelect<T> asMultiSelect();
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Use {@link #addMultiSelectionListener(MultiSelectionListener)} for more
+ * specific event on multiselection.
+ *
+ * @see #addMultiSelectionListener(MultiSelectionListener)
+ */
+ @Override
+ public default Registration addSelectionListener(
+ SelectionListener<T> listener) {
+ return addMultiSelectionListener(e -> listener.selectionChange(e));
+ }
+
+ /**
+ * Adds a selection listener that will be called when the selection is
+ * changed either by the user or programmatically.
+ *
+ * @param listener
+ * the value change listener, not {@code null}
+ * @return a registration for the listener
+ */
+ public Registration addMultiSelectionListener(
+ MultiSelectionListener<T> listener);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java
index 764d958dac..41158b6f03 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java
@@ -32,7 +32,6 @@ import com.vaadin.event.selection.MultiSelectionListener;
import com.vaadin.shared.Registration;
import com.vaadin.shared.data.selection.GridMultiSelectServerRpc;
import com.vaadin.shared.ui.grid.MultiSelectionModelState;
-import com.vaadin.ui.Grid.MultiSelectionModel;
import com.vaadin.ui.MultiSelect;
/**
@@ -200,7 +199,7 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T>
@Override
public boolean isSelected(T item) {
return isAllSelected()
- || com.vaadin.ui.Grid.MultiSelectionModel.super.isSelected(
+ || com.vaadin.ui.components.grid.MultiSelectionModel.super.isSelected(
item);
}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/NoSelectionModel.java b/server/src/main/java/com/vaadin/ui/components/grid/NoSelectionModel.java
index e3f40db2c3..ff51b74cfc 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/NoSelectionModel.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/NoSelectionModel.java
@@ -22,7 +22,6 @@ import java.util.Set;
import com.vaadin.event.selection.SelectionListener;
import com.vaadin.server.AbstractExtension;
import com.vaadin.shared.Registration;
-import com.vaadin.ui.Grid.GridSelectionModel;
/**
* Selection model that doesn't allow selecting anything from the grid.
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModel.java b/server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModel.java
new file mode 100644
index 0000000000..21b95c102c
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModel.java
@@ -0,0 +1,68 @@
+/*
+ * 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.ui.components.grid;
+
+import com.vaadin.data.Binder;
+import com.vaadin.event.selection.SelectionListener;
+import com.vaadin.event.selection.SingleSelectionListener;
+import com.vaadin.shared.Registration;
+import com.vaadin.ui.SingleSelect;
+
+/**
+ * Single selection model interface for Grid.
+ *
+ * @author Vaadin Ltd
+ * @since 8.0
+ *
+ * @param <T>
+ * the type of items in grid
+ */
+public interface SingleSelectionModel<T> extends GridSelectionModel<T>,
+ com.vaadin.data.SelectionModel.Single<T> {
+
+ /**
+ * Gets a wrapper to use this single selection model as a single select in
+ * {@link Binder}.
+ *
+ * @return the single select wrapper
+ */
+ SingleSelect<T> asSingleSelect();
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Use {@link #addSingleSelectionListener(SingleSelectionListener)} for more
+ * specific single selection event.
+ *
+ * @see #addSingleSelectionListener(SingleSelectionListener)
+ */
+ @Override
+ public default Registration addSelectionListener(
+ SelectionListener<T> listener) {
+ return addSingleSelectionListener(e -> listener.selectionChange(e));
+ }
+
+ /**
+ * Adds a single selection listener that is called when the value of this
+ * select is changed either by the user or programmatically.
+ *
+ * @param listener
+ * the value change listener, not {@code null}
+ * @return a registration for the listener
+ */
+ public Registration addSingleSelectionListener(
+ SingleSelectionListener<T> listener);
+}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModelImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModelImpl.java
index 7ca7b583a8..eeb57bab26 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModelImpl.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModelImpl.java
@@ -28,7 +28,6 @@ import com.vaadin.shared.Registration;
import com.vaadin.shared.data.selection.SelectionServerRpc;
import com.vaadin.shared.ui.grid.SingleSelectionModelState;
import com.vaadin.ui.Component;
-import com.vaadin.ui.Grid.SingleSelectionModel;
import com.vaadin.ui.SingleSelect;
/**
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/SortOrderProvider.java b/server/src/main/java/com/vaadin/ui/components/grid/SortOrderProvider.java
new file mode 100644
index 0000000000..c05b37f88a
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/components/grid/SortOrderProvider.java
@@ -0,0 +1,48 @@
+/*
+ * 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.ui.components.grid;
+
+import java.util.stream.Stream;
+
+import com.vaadin.server.SerializableFunction;
+import com.vaadin.server.data.SortOrder;
+import com.vaadin.shared.data.sort.SortDirection;
+import com.vaadin.ui.Grid.Column;
+
+/**
+ * Generates the sort orders when rows are sorted by a column.
+ *
+ * @see Column#setSortOrderProvider
+ *
+ * @since 8.0
+ * @author Vaadin Ltd
+ */
+@FunctionalInterface
+public interface SortOrderProvider
+ extends SerializableFunction<SortDirection, Stream<SortOrder<String>>> {
+
+ /**
+ * Generates the sort orders when rows are sorted by a column.
+ *
+ * @param sortDirection
+ * desired sort direction
+ *
+ * @return sort information
+ */
+ @Override
+ public Stream<SortOrder<String>> apply(SortDirection sortDirection);
+
+}
diff --git a/server/src/test/java/com/vaadin/data/GridAsSingleSelectInBinderTest.java b/server/src/test/java/com/vaadin/data/GridAsSingleSelectInBinderTest.java
index 964cf0bc98..9886df43fc 100644
--- a/server/src/test/java/com/vaadin/data/GridAsSingleSelectInBinderTest.java
+++ b/server/src/test/java/com/vaadin/data/GridAsSingleSelectInBinderTest.java
@@ -25,7 +25,7 @@ public class GridAsSingleSelectInBinderTest
private class GridWithCustomSingleSelectionModel extends Grid<Sex> {
@Override
public void setSelectionModel(
- com.vaadin.ui.Grid.GridSelectionModel<Sex> model) {
+ com.vaadin.ui.components.grid.GridSelectionModel<Sex> model) {
super.setSelectionModel(model);
}
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
index 21e157c925..8124927ed7 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
@@ -31,9 +31,9 @@ import com.vaadin.event.selection.MultiSelectionListener;
import com.vaadin.shared.Registration;
import com.vaadin.tests.util.MockUI;
import com.vaadin.ui.Grid;
-import com.vaadin.ui.Grid.GridSelectionModel;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.UI;
+import com.vaadin.ui.components.grid.GridSelectionModel;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisibility;
@@ -633,14 +633,16 @@ public class GridMultiSelectionModelTest {
model.getSelectAllCheckBoxVisibility());
// change to explicit NO
- model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.HIDDEN);
+ model.setSelectAllCheckBoxVisibility(
+ SelectAllCheckBoxVisibility.HIDDEN);
Assert.assertEquals(SelectAllCheckBoxVisibility.HIDDEN,
model.getSelectAllCheckBoxVisibility());
Assert.assertFalse(model.isSelectAllCheckBoxVisible());
// change to explicit YES
- model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.VISIBLE);
+ model.setSelectAllCheckBoxVisibility(
+ SelectAllCheckBoxVisibility.VISIBLE);
Assert.assertEquals(SelectAllCheckBoxVisibility.VISIBLE,
model.getSelectAllCheckBoxVisibility());
@@ -676,21 +678,24 @@ public class GridMultiSelectionModelTest {
model.getSelectAllCheckBoxVisibility());
// change to explicit YES
- model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.VISIBLE);
+ model.setSelectAllCheckBoxVisibility(
+ SelectAllCheckBoxVisibility.VISIBLE);
Assert.assertEquals(SelectAllCheckBoxVisibility.VISIBLE,
model.getSelectAllCheckBoxVisibility());
Assert.assertTrue(model.isSelectAllCheckBoxVisible());
// change to explicit NO
- model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.HIDDEN);
+ model.setSelectAllCheckBoxVisibility(
+ SelectAllCheckBoxVisibility.HIDDEN);
Assert.assertEquals(SelectAllCheckBoxVisibility.HIDDEN,
model.getSelectAllCheckBoxVisibility());
Assert.assertFalse(model.isSelectAllCheckBoxVisible());
// change back to depends on data provider
- model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.DEFAULT);
+ model.setSelectAllCheckBoxVisibility(
+ SelectAllCheckBoxVisibility.DEFAULT);
Assert.assertFalse(model.isSelectAllCheckBoxVisible());
Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java
index 442b5009ac..4222b20d15 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java
@@ -10,8 +10,8 @@ import org.junit.Test;
import com.vaadin.data.provider.bov.Person;
import com.vaadin.ui.Grid;
-import com.vaadin.ui.Grid.GridSelectionModel;
import com.vaadin.ui.Grid.SelectionMode;
+import com.vaadin.ui.components.grid.GridSelectionModel;
public class GridNoSelectionModelTest {
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java
index 9132ecaa22..cded4f878c 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java
@@ -23,8 +23,8 @@ import com.vaadin.event.selection.SingleSelectionEvent;
import com.vaadin.event.selection.SingleSelectionListener;
import com.vaadin.shared.Registration;
import com.vaadin.ui.Grid;
-import com.vaadin.ui.Grid.GridSelectionModel;
import com.vaadin.ui.Grid.SelectionMode;
+import com.vaadin.ui.components.grid.GridSelectionModel;
import com.vaadin.ui.components.grid.SingleSelectionModelImpl;
import elemental.json.JsonObject;
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java
index b4d9dc5f29..70e6539a48 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java
@@ -34,12 +34,12 @@ import com.vaadin.tests.data.bean.Person;
import com.vaadin.tests.server.component.abstractlisting.AbstractListingDeclarativeTest;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
-import com.vaadin.ui.Grid.FooterCell;
-import com.vaadin.ui.Grid.FooterRow;
-import com.vaadin.ui.Grid.HeaderCell;
-import com.vaadin.ui.Grid.HeaderRow;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.Label;
+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.declarative.DesignContext;
import com.vaadin.ui.declarative.DesignException;
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDefaultHeaderTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDefaultHeaderTest.java
index 41cdbc8310..bdecc15c35 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDefaultHeaderTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDefaultHeaderTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
import com.vaadin.data.ValueProvider;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
-import com.vaadin.ui.Grid.HeaderRow;
+import com.vaadin.ui.components.grid.HeaderRow;
public class GridDefaultHeaderTest {
private Grid<String> grid;
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridHeaderFooterTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridHeaderFooterTest.java
index ca6e7dd9f6..5a30325378 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridHeaderFooterTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridHeaderFooterTest.java
@@ -26,7 +26,7 @@ import org.junit.Test;
import com.vaadin.data.ValueProvider;
import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.Column;
-import com.vaadin.ui.Grid.HeaderRow;
+import com.vaadin.ui.components.grid.HeaderRow;
public class GridHeaderFooterTest {
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
index e7ab23961b..63ef591246 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java
@@ -29,10 +29,6 @@ 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.Grid.DetailsGenerator;
-import com.vaadin.ui.Grid.FooterRow;
-import com.vaadin.ui.Grid.HeaderRow;
-import com.vaadin.ui.Grid.MultiSelectionModel;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.Label;
import com.vaadin.ui.MenuBar;
@@ -45,6 +41,12 @@ import com.vaadin.ui.SingleSelect;
import com.vaadin.ui.StyleGenerator;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.components.grid.DetailsGenerator;
+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.components.grid.MultiSelectionModel;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl;
import com.vaadin.ui.components.grid.MultiSelectionModelImpl.SelectAllCheckBoxVisibility;
import com.vaadin.ui.components.grid.SingleSelectionModelImpl;
@@ -628,7 +630,7 @@ public class GridBasics extends AbstractTestUIWithLog {
int... columnIndexes) {
HeaderRow headerRow = grid.getHeaderRow(rowIndex);
List<Column<DataObject, ?>> columns = grid.getColumns();
- Set<Grid.HeaderCell> toMerge = new HashSet<>();
+ Set<HeaderCell> toMerge = new HashSet<>();
for (int columnIndex : columnIndexes) {
toMerge.add(headerRow.getCell(columns.get(columnIndex)));
}
@@ -639,7 +641,7 @@ public class GridBasics extends AbstractTestUIWithLog {
int... columnIndexes) {
FooterRow footerRow = grid.getFooterRow(rowIndex);
List<Column<DataObject, ?>> columns = grid.getColumns();
- Set<Grid.FooterCell> toMerge = new HashSet<>();
+ Set<FooterCell> toMerge = new HashSet<>();
for (int columnIndex : columnIndexes) {
toMerge.add(footerRow.getCell(columns.get(columnIndex)));
}