From: Teemu Suo-Anttila Date: Tue, 30 Aug 2016 09:30:37 +0000 (+0300) Subject: Duplicate shared classes of the Vaadin 7 Grid X-Git-Tag: 8.0.0.alpha1~51 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e65a1d80f11c4b98e0fb92aa25c1db9f4bd5ff0a;p=vaadin-framework.git Duplicate shared classes of the Vaadin 7 Grid Change-Id: I50cdcef0beb2f384636eb40c2f3f7493db52ac87 --- diff --git a/compatibility-client/pom.xml b/compatibility-client/pom.xml index 28ab3f0107..d427a0bdff 100644 --- a/compatibility-client/pom.xml +++ b/compatibility-client/pom.xml @@ -26,6 +26,11 @@ vaadin-compatibility-server ${project.version} + + ${project.groupId} + vaadin-compatibility-shared + ${project.version} + @@ -43,33 +48,33 @@ - - maven-resources-plugin - - - - copy-sources - - prepare-package - - copy-resources - - - ${project.build.outputDirectory} - - - src/main/resources - false - - - src/main/java - false - - - - - - + + maven-resources-plugin + + + + copy-sources + + prepare-package + + copy-resources + + + ${project.build.outputDirectory} + + + src/main/resources + false + + + src/main/java + false + + + + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractSelectionModelConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractSelectionModelConnector.java index 577f7d67b2..d30288e6b6 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractSelectionModelConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractSelectionModelConnector.java @@ -19,9 +19,9 @@ import java.util.Collection; import com.vaadin.client.data.DataSource.RowHandle; import com.vaadin.client.extensions.AbstractExtensionConnector; -import com.vaadin.shared.ui.grid.GridState; import com.vaadin.v7.client.widget.grid.selection.SelectionModel; import com.vaadin.v7.client.widgets.Grid; +import com.vaadin.v7.shared.ui.grid.GridState; import elemental.json.JsonObject; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/ClickableRendererConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/ClickableRendererConnector.java index 6a4bf0bb05..a7db9628c4 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/ClickableRendererConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/ClickableRendererConnector.java @@ -17,10 +17,10 @@ package com.vaadin.v7.client.connectors; import com.google.web.bindery.event.shared.HandlerRegistration; import com.vaadin.client.MouseEventDetailsBuilder; -import com.vaadin.shared.ui.grid.renderers.RendererClickRpc; import com.vaadin.v7.client.renderers.ClickableRenderer; import com.vaadin.v7.client.renderers.ClickableRenderer.RendererClickEvent; import com.vaadin.v7.client.renderers.ClickableRenderer.RendererClickHandler; +import com.vaadin.v7.shared.ui.grid.renderers.RendererClickRpc; import elemental.json.JsonObject; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/GridConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/GridConnector.java index fb634f0d90..6a89b6c938 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/GridConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/GridConnector.java @@ -53,18 +53,6 @@ import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.data.sort.SortDirection; import com.vaadin.shared.ui.Connect; -import com.vaadin.shared.ui.grid.EditorClientRpc; -import com.vaadin.shared.ui.grid.EditorServerRpc; -import com.vaadin.shared.ui.grid.GridClientRpc; -import com.vaadin.shared.ui.grid.GridColumnState; -import com.vaadin.shared.ui.grid.GridConstants; -import com.vaadin.shared.ui.grid.GridConstants.Section; -import com.vaadin.shared.ui.grid.GridServerRpc; -import com.vaadin.shared.ui.grid.GridState; -import com.vaadin.shared.ui.grid.GridStaticSectionState; -import com.vaadin.shared.ui.grid.GridStaticSectionState.CellState; -import com.vaadin.shared.ui.grid.GridStaticSectionState.RowState; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.v7.client.connectors.RpcDataSourceConnector.DetailsListener; import com.vaadin.v7.client.connectors.RpcDataSourceConnector.RpcDataSource; import com.vaadin.v7.client.widget.escalator.events.RowHeightChangedEvent; @@ -95,6 +83,18 @@ import com.vaadin.v7.client.widgets.Grid.FooterCell; import com.vaadin.v7.client.widgets.Grid.FooterRow; import com.vaadin.v7.client.widgets.Grid.HeaderCell; import com.vaadin.v7.client.widgets.Grid.HeaderRow; +import com.vaadin.v7.shared.ui.grid.EditorClientRpc; +import com.vaadin.v7.shared.ui.grid.EditorServerRpc; +import com.vaadin.v7.shared.ui.grid.GridClientRpc; +import com.vaadin.v7.shared.ui.grid.GridColumnState; +import com.vaadin.v7.shared.ui.grid.GridConstants; +import com.vaadin.v7.shared.ui.grid.GridServerRpc; +import com.vaadin.v7.shared.ui.grid.GridState; +import com.vaadin.v7.shared.ui.grid.GridStaticSectionState; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; +import com.vaadin.v7.shared.ui.grid.GridStaticSectionState.CellState; +import com.vaadin.v7.shared.ui.grid.GridStaticSectionState.RowState; import elemental.json.JsonObject; import elemental.json.JsonValue; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/MultiSelectionModelConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/MultiSelectionModelConnector.java index ffb100bd71..ff40816d93 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/MultiSelectionModelConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/MultiSelectionModelConnector.java @@ -30,10 +30,7 @@ import com.vaadin.client.annotations.OnStateChange; import com.vaadin.client.data.DataSource; import com.vaadin.client.data.DataSource.RowHandle; import com.vaadin.shared.ui.Connect; -import com.vaadin.shared.ui.grid.GridState; import com.vaadin.shared.ui.grid.Range; -import com.vaadin.shared.ui.grid.selection.MultiSelectionModelServerRpc; -import com.vaadin.shared.ui.grid.selection.MultiSelectionModelState; import com.vaadin.v7.client.renderers.ComplexRenderer; import com.vaadin.v7.client.renderers.Renderer; import com.vaadin.v7.client.widget.grid.DataAvailableEvent; @@ -46,6 +43,9 @@ import com.vaadin.v7.client.widget.grid.selection.SpaceSelectHandler; import com.vaadin.v7.client.widget.grid.selection.SelectionModel.Multi; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.HeaderCell; +import com.vaadin.v7.shared.ui.grid.GridState; +import com.vaadin.v7.shared.ui.grid.selection.MultiSelectionModelServerRpc; +import com.vaadin.v7.shared.ui.grid.selection.MultiSelectionModelState; import com.vaadin.v7.ui.Grid.MultiSelectionModel; import elemental.json.JsonObject; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java index 5eee892616..439305d718 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/RpcDataSourceConnector.java @@ -26,8 +26,8 @@ import com.vaadin.client.extensions.AbstractExtensionConnector; import com.vaadin.shared.data.DataProviderRpc; import com.vaadin.shared.data.DataRequestRpc; import com.vaadin.shared.ui.Connect; -import com.vaadin.shared.ui.grid.GridState; import com.vaadin.shared.ui.grid.Range; +import com.vaadin.v7.shared.ui.grid.GridState; import elemental.json.Json; import elemental.json.JsonArray; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/SingleSelectionModelConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/SingleSelectionModelConnector.java index 9d5233607d..8c206b8def 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/SingleSelectionModelConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/SingleSelectionModelConnector.java @@ -19,14 +19,14 @@ import com.vaadin.client.ServerConnector; import com.vaadin.client.annotations.OnStateChange; import com.vaadin.client.data.DataSource.RowHandle; import com.vaadin.shared.ui.Connect; -import com.vaadin.shared.ui.grid.GridState; -import com.vaadin.shared.ui.grid.selection.SingleSelectionModelServerRpc; -import com.vaadin.shared.ui.grid.selection.SingleSelectionModelState; import com.vaadin.v7.client.renderers.Renderer; import com.vaadin.v7.client.widget.grid.selection.ClickSelectHandler; import com.vaadin.v7.client.widget.grid.selection.SelectionModel; import com.vaadin.v7.client.widget.grid.selection.SpaceSelectHandler; import com.vaadin.v7.client.widget.grid.selection.SelectionModel.Single; +import com.vaadin.v7.shared.ui.grid.GridState; +import com.vaadin.v7.shared.ui.grid.selection.SingleSelectionModelServerRpc; +import com.vaadin.v7.shared.ui.grid.selection.SingleSelectionModelState; import com.vaadin.v7.ui.Grid.SingleSelectionModel; import elemental.json.JsonObject; diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/renderers/ClickableRenderer.java b/compatibility-client/src/main/java/com/vaadin/v7/client/renderers/ClickableRenderer.java index e99d03d3d1..940ac20982 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/renderers/ClickableRenderer.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/renderers/ClickableRenderer.java @@ -28,13 +28,13 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Widget; import com.google.web.bindery.event.shared.HandlerRegistration; import com.vaadin.client.WidgetUtil; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.client.widget.escalator.Cell; import com.vaadin.v7.client.widget.escalator.RowContainer; import com.vaadin.v7.client.widget.grid.CellReference; import com.vaadin.v7.client.widget.grid.EventCellReference; import com.vaadin.v7.client.widgets.Escalator; import com.vaadin.v7.client.widgets.Grid; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * An abstract superclass for renderers that render clickable widgets. Click diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/EventCellReference.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/EventCellReference.java index b4fc74c6e1..e12714d4e3 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/EventCellReference.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/EventCellReference.java @@ -16,10 +16,10 @@ package com.vaadin.v7.client.widget.grid; import com.google.gwt.dom.client.TableCellElement; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.client.widget.escalator.Cell; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.Column; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * A data class which contains information which identifies a cell being the diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridClickEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridClickEvent.java index 1dfd1dc42d..8f2350727f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridClickEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridClickEvent.java @@ -16,11 +16,11 @@ package com.vaadin.v7.client.widget.grid.events; import com.google.gwt.dom.client.BrowserEvents; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.client.widget.grid.CellReference; import com.vaadin.v7.client.widget.grid.events.AbstractGridMouseEventHandler.GridClickHandler; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.AbstractGridMouseEvent; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * Represents native mouse click event in Grid. diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridDoubleClickEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridDoubleClickEvent.java index f8383303aa..711e70f3b4 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridDoubleClickEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridDoubleClickEvent.java @@ -16,11 +16,11 @@ package com.vaadin.v7.client.widget.grid.events; import com.google.gwt.dom.client.BrowserEvents; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.client.widget.grid.CellReference; import com.vaadin.v7.client.widget.grid.events.AbstractGridMouseEventHandler.GridDoubleClickHandler; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.AbstractGridMouseEvent; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * Represents native mouse double click event in Grid. diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyDownEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyDownEvent.java index 3afd060307..e4405b69a5 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyDownEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyDownEvent.java @@ -17,11 +17,11 @@ package com.vaadin.v7.client.widget.grid.events; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.event.dom.client.KeyCodes; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.client.widget.grid.CellReference; import com.vaadin.v7.client.widget.grid.events.AbstractGridKeyEventHandler.GridKeyDownHandler; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.AbstractGridKeyEvent; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * Represents native key down event in Grid. diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyPressEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyPressEvent.java index 3fb3bb94e5..86a4664df0 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyPressEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyPressEvent.java @@ -16,11 +16,11 @@ package com.vaadin.v7.client.widget.grid.events; import com.google.gwt.dom.client.BrowserEvents; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.client.widget.grid.CellReference; import com.vaadin.v7.client.widget.grid.events.AbstractGridKeyEventHandler.GridKeyPressHandler; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.AbstractGridKeyEvent; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * Represents native key press event in Grid. diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyUpEvent.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyUpEvent.java index 485468b879..770f0214f9 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyUpEvent.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/events/GridKeyUpEvent.java @@ -17,11 +17,11 @@ package com.vaadin.v7.client.widget.grid.events; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.event.dom.client.KeyCodes; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.client.widget.grid.CellReference; import com.vaadin.v7.client.widget.grid.events.AbstractGridKeyEventHandler.GridKeyUpHandler; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.AbstractGridKeyEvent; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * Represents native key up event in Grid. diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SpaceSelectHandler.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SpaceSelectHandler.java index a3b05ff887..d4c0f2219f 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SpaceSelectHandler.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SpaceSelectHandler.java @@ -17,7 +17,6 @@ package com.vaadin.v7.client.widget.grid.selection; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.shared.HandlerRegistration; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.v7.client.widget.grid.DataAvailableEvent; import com.vaadin.v7.client.widget.grid.DataAvailableHandler; import com.vaadin.v7.client.widget.grid.events.BodyKeyDownHandler; @@ -25,6 +24,7 @@ import com.vaadin.v7.client.widget.grid.events.BodyKeyUpHandler; import com.vaadin.v7.client.widget.grid.events.GridKeyDownEvent; import com.vaadin.v7.client.widget.grid.events.GridKeyUpEvent; import com.vaadin.v7.client.widgets.Grid; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; /** * Generic class to perform selections when pressing space key. diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java index 322a2e54c4..745ffa24cf 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java @@ -65,9 +65,7 @@ import com.vaadin.client.DeferredWorker; import com.vaadin.client.Profiler; import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.SubPartAware; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.shared.ui.grid.Range; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.shared.util.SharedUtil; import com.vaadin.v7.client.widget.escalator.Cell; import com.vaadin.v7.client.widget.escalator.ColumnConfiguration; @@ -93,6 +91,8 @@ import com.vaadin.v7.client.widget.escalator.events.RowHeightChangedEvent; import com.vaadin.v7.client.widget.grid.events.ScrollEvent; import com.vaadin.v7.client.widget.grid.events.ScrollHandler; import com.vaadin.v7.client.widgets.Escalator.JsniUtil.TouchHandlerBundle; +import com.vaadin.v7.shared.ui.grid.HeightMode; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; /*- diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java index e6eb36f8c9..ca565e01c2 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java @@ -92,12 +92,7 @@ import com.vaadin.client.ui.dd.DragHandle.DragHandleCallback; import com.vaadin.client.widgets.Overlay; import com.vaadin.shared.Registration; import com.vaadin.shared.data.sort.SortDirection; -import com.vaadin.shared.ui.grid.GridConstants; -import com.vaadin.shared.ui.grid.GridConstants.Section; -import com.vaadin.shared.ui.grid.GridStaticCellType; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.shared.ui.grid.Range; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.shared.util.SharedUtil; import com.vaadin.v7.client.renderers.ComplexRenderer; import com.vaadin.v7.client.renderers.Renderer; @@ -184,6 +179,11 @@ import com.vaadin.v7.client.widgets.Escalator.SubPartArguments; import com.vaadin.v7.client.widgets.Grid.Editor.State; import com.vaadin.v7.client.widgets.Grid.StaticSection.StaticCell; import com.vaadin.v7.client.widgets.Grid.StaticSection.StaticRow; +import com.vaadin.v7.shared.ui.grid.GridConstants; +import com.vaadin.v7.shared.ui.grid.GridStaticCellType; +import com.vaadin.v7.shared.ui.grid.HeightMode; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; /** * A data grid view that supports columns and lazy loading of data rows from a diff --git a/compatibility-server/src/main/java/com/vaadin/v7/server/communication/data/RpcDataProviderExtension.java b/compatibility-server/src/main/java/com/vaadin/v7/server/communication/data/RpcDataProviderExtension.java index dce3eb1cfa..ce960fa5fd 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/server/communication/data/RpcDataProviderExtension.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/server/communication/data/RpcDataProviderExtension.java @@ -31,7 +31,6 @@ import com.vaadin.server.ClientConnector; import com.vaadin.server.KeyMapper; import com.vaadin.shared.data.DataProviderRpc; import com.vaadin.shared.data.DataRequestRpc; -import com.vaadin.shared.ui.grid.GridState; import com.vaadin.shared.ui.grid.Range; import com.vaadin.v7.data.Container; import com.vaadin.v7.data.Container.Indexed; @@ -45,6 +44,7 @@ import com.vaadin.v7.data.Property; import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.data.Property.ValueChangeNotifier; +import com.vaadin.v7.shared.ui.grid.GridState; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.Column; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java index 371520d5d5..6c7de83fc2 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java @@ -61,24 +61,6 @@ import com.vaadin.server.KeyMapper; import com.vaadin.server.VaadinSession; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.data.sort.SortDirection; -import com.vaadin.shared.ui.grid.EditorClientRpc; -import com.vaadin.shared.ui.grid.EditorServerRpc; -import com.vaadin.shared.ui.grid.GridClientRpc; -import com.vaadin.shared.ui.grid.GridColumnState; -import com.vaadin.shared.ui.grid.GridConstants; -import com.vaadin.shared.ui.grid.GridConstants.Section; -import com.vaadin.shared.ui.grid.GridServerRpc; -import com.vaadin.shared.ui.grid.GridState; -import com.vaadin.shared.ui.grid.GridStaticCellType; -import com.vaadin.shared.ui.grid.GridStaticSectionState; -import com.vaadin.shared.ui.grid.GridStaticSectionState.CellState; -import com.vaadin.shared.ui.grid.GridStaticSectionState.RowState; -import com.vaadin.shared.ui.grid.HeightMode; -import com.vaadin.shared.ui.grid.ScrollDestination; -import com.vaadin.shared.ui.grid.selection.MultiSelectionModelServerRpc; -import com.vaadin.shared.ui.grid.selection.MultiSelectionModelState; -import com.vaadin.shared.ui.grid.selection.SingleSelectionModelServerRpc; -import com.vaadin.shared.ui.grid.selection.SingleSelectionModelState; import com.vaadin.shared.util.SharedUtil; import com.vaadin.ui.AbstractFocusable; import com.vaadin.ui.Component; @@ -114,6 +96,24 @@ import com.vaadin.v7.event.ItemClickEvent.ItemClickListener; import com.vaadin.v7.event.ItemClickEvent.ItemClickNotifier; import com.vaadin.v7.server.communication.data.DataGenerator; import com.vaadin.v7.server.communication.data.RpcDataProviderExtension; +import com.vaadin.v7.shared.ui.grid.EditorClientRpc; +import com.vaadin.v7.shared.ui.grid.EditorServerRpc; +import com.vaadin.v7.shared.ui.grid.GridClientRpc; +import com.vaadin.v7.shared.ui.grid.GridColumnState; +import com.vaadin.v7.shared.ui.grid.GridConstants; +import com.vaadin.v7.shared.ui.grid.GridServerRpc; +import com.vaadin.v7.shared.ui.grid.GridState; +import com.vaadin.v7.shared.ui.grid.GridStaticCellType; +import com.vaadin.v7.shared.ui.grid.GridStaticSectionState; +import com.vaadin.v7.shared.ui.grid.HeightMode; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; +import com.vaadin.v7.shared.ui.grid.GridStaticSectionState.CellState; +import com.vaadin.v7.shared.ui.grid.GridStaticSectionState.RowState; +import com.vaadin.v7.shared.ui.grid.selection.MultiSelectionModelServerRpc; +import com.vaadin.v7.shared.ui.grid.selection.MultiSelectionModelState; +import com.vaadin.v7.shared.ui.grid.selection.SingleSelectionModelServerRpc; +import com.vaadin.v7.shared.ui.grid.selection.SingleSelectionModelState; import com.vaadin.v7.ui.renderers.HtmlRenderer; import com.vaadin.v7.ui.renderers.Renderer; import com.vaadin.v7.ui.renderers.TextRenderer; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/ClickableRenderer.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/ClickableRenderer.java index a1f48a99c4..bd63e08c93 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/ClickableRenderer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/ClickableRenderer.java @@ -20,8 +20,8 @@ import java.lang.reflect.Method; import com.vaadin.event.ConnectorEventListener; import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.shared.MouseEventDetails; -import com.vaadin.shared.ui.grid.renderers.RendererClickRpc; import com.vaadin.util.ReflectTools; +import com.vaadin.v7.shared.ui.grid.renderers.RendererClickRpc; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.AbstractRenderer; import com.vaadin.v7.ui.Grid.Column; diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java index a438bed25c..a0b2dc54bd 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridColumnsTest.java @@ -40,10 +40,10 @@ import org.junit.Before; import org.junit.Test; import com.vaadin.server.KeyMapper; -import com.vaadin.shared.ui.grid.GridColumnState; -import com.vaadin.shared.ui.grid.GridState; import com.vaadin.shared.util.SharedUtil; import com.vaadin.v7.data.util.IndexedContainer; +import com.vaadin.v7.shared.ui.grid.GridColumnState; +import com.vaadin.v7.shared.ui.grid.GridState; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.Column; import com.vaadin.v7.ui.Grid.ColumnResizeEvent; diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridStateTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridStateTest.java index 2170af060d..b9ae44301b 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridStateTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/GridStateTest.java @@ -18,7 +18,7 @@ package com.vaadin.v7.tests.server.component.grid; import org.junit.Assert; import org.junit.Test; -import com.vaadin.shared.ui.grid.GridState; +import com.vaadin.v7.shared.ui.grid.GridState; import com.vaadin.v7.ui.Grid; /** diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java index df46c6c70a..c026d5a51e 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeAttributeTest.java @@ -19,8 +19,8 @@ import static org.junit.Assert.assertSame; import org.junit.Test; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.tests.design.DeclarativeTestBase; +import com.vaadin.v7.shared.ui.grid.HeightMode; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.MultiSelectionModel; import com.vaadin.v7.ui.Grid.NoSelectionModel; diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/ColumnGroupState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/ColumnGroupState.java new file mode 100644 index 0000000000..f3751f449a --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/ColumnGroupState.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.v7.shared.ui.grid; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * The column group data shared between the server and the client + * + * @since 7.4 + * @author Vaadin Ltd + */ +public class ColumnGroupState implements Serializable { + + /** + * The columns that is included in the group + */ + public List columns = new ArrayList(); + + /** + * The header text of the group + */ + public String header; + + /** + * The footer text of the group + */ + public String footer; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/DetailsConnectorChange.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/DetailsConnectorChange.java new file mode 100644 index 0000000000..ff274ca432 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/DetailsConnectorChange.java @@ -0,0 +1,189 @@ +/* + * 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.shared.ui.grid; + +import java.io.Serializable; +import java.util.Comparator; + +import com.vaadin.shared.Connector; + +/** + * A description of an indexing modification for a connector. This is used by + * Grid for internal bookkeeping updates. + * + * @since 7.5.0 + * @author Vaadin Ltd + */ +public class DetailsConnectorChange implements Serializable { + + public static final Comparator REMOVED_FIRST_COMPARATOR = new Comparator() { + @Override + public int compare(DetailsConnectorChange a, DetailsConnectorChange b) { + boolean deleteA = a.getNewIndex() == null; + boolean deleteB = b.getNewIndex() == null; + if (deleteA && !deleteB) { + return -1; + } else if (!deleteA && deleteB) { + return 1; + } else { + return 0; + } + } + }; + + private Connector connector; + private Integer oldIndex; + private Integer newIndex; + private boolean shouldStillBeVisible; + + /** Create a new connector index change */ + public DetailsConnectorChange() { + } + + /** + * Convenience constructor for setting all the fields in one line. + *

+ * Calling this constructor will also assert that the state of the pojo is + * consistent by internal assumptions. + * + * @param connector + * the changed connector + * @param oldIndex + * the old index + * @param newIndex + * the new index + * @param shouldStillBeVisible + * details should be visible regardless of {@code connector} + */ + public DetailsConnectorChange(Connector connector, Integer oldIndex, + Integer newIndex, boolean shouldStillBeVisible) { + this.connector = connector; + this.oldIndex = oldIndex; + this.newIndex = newIndex; + this.shouldStillBeVisible = shouldStillBeVisible; + + assert assertStateIsOk(); + } + + private boolean assertStateIsOk() { + boolean connectorAndNewIndexIsNotNull = connector != null + && newIndex != null; + boolean connectorAndNewIndexIsNullThenOldIndexIsSet = connector == null + && newIndex == null && oldIndex != null; + + assert (connectorAndNewIndexIsNotNull + || connectorAndNewIndexIsNullThenOldIndexIsSet) : "connector: " + + nullityString(connector) + ", oldIndex: " + + nullityString(oldIndex) + ", newIndex: " + + nullityString(newIndex); + return true; + } + + private static String nullityString(Object object) { + return object == null ? "null" : "non-null"; + } + + /** + * Gets the old index for the connector. + *

+ * If null, the connector is recently added. This means that + * {@link #getConnector()} is expected not to return null. + * + * @return the old index for the connector + */ + public Integer getOldIndex() { + assert assertStateIsOk(); + return oldIndex; + } + + /** + * Gets the new index for the connector. + *

+ * If null, the connector should be removed. This means that + * {@link #getConnector()} is expected to return null as well. + * + * @return the new index for the connector + */ + public Integer getNewIndex() { + assert assertStateIsOk(); + return newIndex; + } + + /** + * Gets the changed connector. + * + * @return the changed connector. Might be null + */ + public Connector getConnector() { + assert assertStateIsOk(); + return connector; + } + + /** + * Sets the changed connector. + * + * @param connector + * the changed connector. May be null + */ + public void setConnector(Connector connector) { + this.connector = connector; + } + + /** + * Sets the old index + * + * @param oldIndex + * the old index. May be null if a new connector is + * being inserted + */ + public void setOldIndex(Integer oldIndex) { + this.oldIndex = oldIndex; + } + + /** + * Sets the new index + * + * @param newIndex + * the new index. May be null if a connector is + * being removed + */ + public void setNewIndex(Integer newIndex) { + this.newIndex = newIndex; + } + + /** + * Checks whether whether the details should remain open, even if connector + * might be null. + * + * @return true iff the details should remain open, even if + * connector might be null + */ + public boolean isShouldStillBeVisible() { + return shouldStillBeVisible; + } + + /** + * Sets whether the details should remain open, even if connector might be + * null. + * + * @param shouldStillBeVisible + * true iff the details should remain open, even if + * connector might be null + */ + public void setShouldStillBeVisible(boolean shouldStillBeVisible) { + this.shouldStillBeVisible = shouldStillBeVisible; + } +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/EditorClientRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/EditorClientRpc.java new file mode 100644 index 0000000000..72c7c83af6 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/EditorClientRpc.java @@ -0,0 +1,69 @@ +/* + * 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.shared.ui.grid; + +import java.util.List; + +import com.vaadin.shared.communication.ClientRpc; + +/** + * An RPC interface for the grid editor server-to-client communications. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public interface EditorClientRpc extends ClientRpc { + + /** + * Tells the client to open the editor and bind data to it. + * + * @param rowIndex + * the index of the edited row + */ + void bind(int rowIndex); + + /** + * Tells the client to cancel editing and hide the editor. + * + * @param rowIndex + * the index of the edited row + */ + void cancel(int rowIndex); + + /** + * Confirms a pending {@link EditorServerRpc#bind(int) bind request} sent by + * the client. + * + * @param bindSucceeded + * true iff the bind action was successful + */ + void confirmBind(boolean bindSucceeded); + + /** + * Confirms a pending {@link EditorServerRpc#save(int) save request} sent by + * the client. + * + * @param saveSucceeded + * true iff the save action was successful + * @param errorMessage + * the error message to show the user + * @param errorColumnsIds + * a list of column keys that should get error markers, or + * null if there should be no error markers + */ + void confirmSave(boolean saveSucceeded, String errorMessage, + List errorColumnsIds); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/EditorServerRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/EditorServerRpc.java new file mode 100644 index 0000000000..df7b090f91 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/EditorServerRpc.java @@ -0,0 +1,58 @@ +/* + * 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.shared.ui.grid; + +import com.vaadin.shared.communication.ServerRpc; + +/** + * An RPC interface for the grid editor client-to-server communications. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public interface EditorServerRpc extends ServerRpc { + + /** + * Asks the server to open the editor and bind data to it. When a bind + * request is sent, it must be acknowledged with a + * {@link EditorClientRpc#confirmBind() confirm call} before the client can + * open the editor. + * + * @param rowIndex + * the index of the edited row + */ + void bind(int rowIndex); + + /** + * Asks the server to save unsaved changes in the editor to the data source. + * When a save request is sent, it must be acknowledged with a + * {@link EditorClientRpc#confirmSave() confirm call}. + * + * @param rowIndex + * the index of the edited row + */ + void save(int rowIndex); + + /** + * Tells the server to cancel editing. When sending a cancel request, the + * client does not need to wait for confirmation by the server before hiding + * the editor. + * + * @param rowIndex + * the index of the edited row + */ + void cancel(int rowIndex); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridClientRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridClientRpc.java new file mode 100644 index 0000000000..64515d2205 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridClientRpc.java @@ -0,0 +1,58 @@ +/* + * 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.shared.ui.grid; + +import com.vaadin.shared.communication.ClientRpc; + +/** + * Server-to-client RPC interface for the Grid component. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public interface GridClientRpc extends ClientRpc { + + /** + * Command client Grid to scroll to a specific data row and its (optional) + * details. + * + * @param row + * zero-based row index. If the row index is below zero or above + * the row count of the client-side data source, a client-side + * exception will be triggered. Since this exception has no + * handling by default, an out-of-bounds value will cause a + * client-side crash. + * @param destination + * desired placement of scrolled-to row. See the documentation + * for {@link ScrollDestination} for more information. + */ + public void scrollToRow(int row, ScrollDestination destination); + + /** + * Command client Grid to scroll to the first row. + */ + public void scrollToStart(); + + /** + * Command client Grid to scroll to the last row. + */ + public void scrollToEnd(); + + /** + * Command client Grid to recalculate column widths. + */ + public void recalculateColumnWidths(); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridColumnState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridColumnState.java new file mode 100644 index 0000000000..b1bf1844e6 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridColumnState.java @@ -0,0 +1,94 @@ +/* + * 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.shared.ui.grid; + +import java.io.Serializable; + +import com.vaadin.shared.Connector; + +/** + * Column state DTO for transferring column properties from the server to the + * client + * + * @since 7.4 + * @author Vaadin Ltd + */ +public class GridColumnState implements Serializable { + + /** + * Id used by grid connector to map server side column with client side + * column + */ + public String id; + + /** + * Column width in pixels. Default column width is + * {@value GridConstants#DEFAULT_COLUMN_WIDTH_PX}. + */ + public double width = GridConstants.DEFAULT_COLUMN_WIDTH_PX; + + /** + * The connector for the renderer used to render the cells in this column. + */ + public Connector rendererConnector; + + /** + * Whether the values in this column are editable when the editor interface + * is active. + */ + public boolean editable = true; + + /** + * The connector for the field used to edit cells in this column when the + * editor interface is active. + */ + public Connector editorConnector; + + /** + * Whether this column is sortable by the user + */ + public boolean sortable = false; + + /** How much of the remaining space this column will reserve. */ + public int expandRatio = GridConstants.DEFAULT_EXPAND_RATIO; + + /** + * The maximum expansion width of this column. -1 for "no maximum". If + * maxWidth is less than the calculated width, maxWidth is ignored. + */ + public double maxWidth = GridConstants.DEFAULT_MAX_WIDTH; + + /** + * The minimum expansion width of this column. -1 for "no minimum". If + * minWidth is less than the calculated width, minWidth will win. + */ + public double minWidth = GridConstants.DEFAULT_MIN_WIDTH; + + /** Whether this column is currently hidden. */ + public boolean hidden = false; + + /** Whether the column can be hidden by the user. */ + public boolean hidable = false; + + /** The caption for the column hiding toggle. */ + public String hidingToggleCaption; + + /** Column header caption */ + public String headerCaption; + + /** Whether this column is resizable by the user. */ + public boolean resizable = true; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridConstants.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridConstants.java new file mode 100644 index 0000000000..dc9b2207e5 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridConstants.java @@ -0,0 +1,101 @@ +/* + * 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.shared.ui.grid; + +import java.io.Serializable; + +/** + * Container class for common constants and default values used by the Grid + * component. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public final class GridConstants implements Serializable { + + /** + * Enum describing different sections of Grid. + * + * @since 7.6 + */ + public enum Section { + HEADER, BODY, FOOTER + } + + /** + * Default padding in pixels when scrolling programmatically, without an + * explicitly defined padding value. + */ + public static final int DEFAULT_PADDING = 0; + + /** + * Delay before a long tap action is triggered. Number in milliseconds. + */ + public static final int LONG_TAP_DELAY = 500; + + /** + * The threshold in pixels a finger can move while long tapping. + */ + public static final int LONG_TAP_THRESHOLD = 3; + + /* Column constants */ + + /** + * Default maximum width for columns. + */ + public static final double DEFAULT_MAX_WIDTH = -1; + + /** + * Default minimum width for columns. + */ + public static final double DEFAULT_MIN_WIDTH = 10.0d; + + /** + * Default expand ratio for columns. + */ + public static final int DEFAULT_EXPAND_RATIO = -1; + + /** + * Default width for columns. + */ + public static final double DEFAULT_COLUMN_WIDTH_PX = -1; + + /** + * Event ID for item click events + */ + public static final String ITEM_CLICK_EVENT_ID = "itemClick"; + + /** The default save button caption in the editor */ + public static final String DEFAULT_SAVE_CAPTION = "Save"; + + /** The default cancel button caption in the editor */ + public static final String DEFAULT_CANCEL_CAPTION = "Cancel"; + + /** + * Event ID constant for editor open event + */ + public static final String EDITOR_OPEN_EVENT_ID = "editorOpen"; + + /** + * Event ID constant for editor move event + */ + public static final String EDITOR_MOVE_EVENT_ID = "editorMove"; + + /** + * Event ID constant for editor close event + */ + public static final String EDITOR_CLOSE_EVENT_ID = "editorClose"; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridServerRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridServerRpc.java new file mode 100644 index 0000000000..7fcf461244 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridServerRpc.java @@ -0,0 +1,103 @@ +/* + * 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.shared.ui.grid; + +import java.util.List; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.data.sort.SortDirection; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; + +/** + * Client-to-server RPC interface for the Grid component + * + * @since 7.4 + * @author Vaadin Ltd + */ +public interface GridServerRpc extends ServerRpc { + + void sort(String[] columnIds, SortDirection[] directions, + boolean userOriginated); + + /** + * Informs the server that an item has been clicked in Grid. + * + * @param rowKey + * a key identifying the clicked item + * @param columnId + * column id identifying the clicked property + * @param details + * mouse event details + */ + void itemClick(String rowKey, String columnId, MouseEventDetails details); + + /** + * Informs the server that a context click has happened inside of Grid. + * + * @since 7.6 + * @param rowIndex + * index of clicked row in Grid section + * @param rowKey + * a key identifying the clicked item + * @param columnId + * column id identifying the clicked property + * @param section + * grid section (header, footer, body) + * @param details + * mouse event details + */ + void contextClick(int rowIndex, String rowKey, String columnId, + Section section, MouseEventDetails details); + + /** + * Informs the server that the columns of the Grid have been reordered. + * + * @since 7.5.0 + * @param newColumnOrder + * a list of column ids in the new order + * @param oldColumnOrder + * a list of column ids in order before the change + */ + void columnsReordered(List newColumnOrder, + List oldColumnOrder); + + /** + * Informs the server that a column's visibility has been changed. + * + * @since 7.5.0 + * @param id + * the id of the column + * @param hidden + * true if hidden, false if unhidden + * @param userOriginated + * true if triggered by user, false if + * by code + */ + void columnVisibilityChanged(String id, boolean hidden, + boolean userOriginated); + + /** + * Informs the server that a column has been resized by the user. + * + * @since 7.6 + * @param id + * the id of the column + * @param pixels + * the new width of the column in pixels + */ + void columnResized(String id, double pixels); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridState.java new file mode 100644 index 0000000000..4befc1fe09 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridState.java @@ -0,0 +1,205 @@ +/* + * 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.shared.ui.grid; + +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.shared.annotations.DelegateToWidget; +import com.vaadin.shared.data.sort.SortDirection; +import com.vaadin.shared.ui.TabIndexState; + +/** + * The shared state for the {@link com.vaadin.ui.components.grid.Grid} component + * + * @since 7.4 + * @author Vaadin Ltd + */ +public class GridState extends TabIndexState { + + /** + * A description of which of the three bundled SelectionModels is currently + * in use. + *

+ * Used as a data transfer object instead of the client/server ones, because + * they don't know about each others classes. + * + * @see com.vaadin.ui.components.grid.Grid.SelectionMode + * @see com.vaadin.client.ui.grid.Grid.SelectionMode + */ + public enum SharedSelectionMode { + /** + * Representation of a single selection mode + * + * @see com.vaadin.ui.components.grid.Grid.SelectionMode#SINGLE + * @see com.vaadin.client.ui.grid.Grid.SelectionMode#SINGLE + */ + SINGLE, + + /** + * Representation of a multiselection mode + * + * @see com.vaadin.ui.components.grid.Grid.SelectionMode#MULTI + * @see com.vaadin.client.ui.grid.Grid.SelectionMode#MULTI + */ + MULTI, + + /** + * Representation of a no-selection mode + * + * @see com.vaadin.ui.components.grid.Grid.SelectionMode#NONE + * @see com.vaadin.client.ui.grid.Grid.SelectionMode#NONE + */ + NONE; + } + + /** + * The default value for height-by-rows for both GWT widgets + * {@link com.vaadin.ui.components.grid Grid} and + * {@link com.vaadin.client.ui.grid.Escalator Escalator} + */ + public static final double DEFAULT_HEIGHT_BY_ROWS = 10.0d; + + /** + * The key in which a row's data can be found + * + * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String) + */ + public static final String JSONKEY_DATA = "d"; + + /** + * The key in which a row's own key can be found + * + * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String) + */ + public static final String JSONKEY_ROWKEY = "k"; + + /** + * The key in which a row's generated style can be found + * + * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String) + */ + public static final String JSONKEY_ROWSTYLE = "rs"; + + /** + * The key in which a generated styles for a row's cells can be found + * + * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String) + */ + public static final String JSONKEY_CELLSTYLES = "cs"; + + /** + * The key in which a row's description can be found + * + * @since 7.6 + * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String) + */ + public static final String JSONKEY_ROWDESCRIPTION = "rd"; + + /** + * The key in which a cell's description can be found + * + * @since 7.6 + * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String) + */ + public static final String JSONKEY_CELLDESCRIPTION = "cd"; + + /** + * The key that tells whether details are visible for the row. + * + * @since 7.5.0 + * + * @see com.vaadin.ui.Grid#setDetailsGenerator(com.vaadin.ui.Grid.DetailsGenerator) + * @see com.vaadin.ui.Grid#setDetailsVisible(Object, boolean) + * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, + * elemental.json.JsonArray) + */ + public static final String JSONKEY_DETAILS_VISIBLE = "dv"; + + /** + * The key that tells whether row is selected. + * + * @since 7.6 + */ + public static final String JSONKEY_SELECTED = "s"; + + { + primaryStyleName = "v-grid"; + } + + /** + * Columns in grid. + */ + public List columns = new ArrayList(); + + /** + * Column order in grid. + */ + public List columnOrder = new ArrayList(); + + public GridStaticSectionState header = new GridStaticSectionState(); + + public GridStaticSectionState footer = new GridStaticSectionState(); + + /** The number of frozen columns */ + public int frozenColumnCount = 0; + + /** The height of the Grid in terms of body rows. */ + @DelegateToWidget + public double heightByRows = DEFAULT_HEIGHT_BY_ROWS; + + /** The mode by which Grid defines its height. */ + @DelegateToWidget + public HeightMode heightMode = HeightMode.CSS; + + /** Keys of the currently sorted columns */ + public String[] sortColumns = new String[0]; + + /** Directions for each sorted column */ + public SortDirection[] sortDirs = new SortDirection[0]; + + /** The enabled state of the editor interface */ + public boolean editorEnabled = false; + + /** + * Buffered editor mode + * + * @since 7.6 + */ + @DelegateToWidget + public boolean editorBuffered = true; + + /** + * Whether rows and/or cells have generated descriptions (tooltips) + * + * @since 7.6 + */ + public boolean hasDescriptions; + + /** The caption for the save button in the editor */ + @DelegateToWidget + public String editorSaveCaption = GridConstants.DEFAULT_SAVE_CAPTION; + + /** The caption for the cancel button in the editor */ + @DelegateToWidget + public String editorCancelCaption = GridConstants.DEFAULT_CANCEL_CAPTION; + + /** Whether the columns can be reordered */ + @DelegateToWidget + public boolean columnReorderingAllowed; + +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridStaticCellType.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridStaticCellType.java new file mode 100644 index 0000000000..70da93f573 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridStaticCellType.java @@ -0,0 +1,39 @@ +/* + * 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.shared.ui.grid; + +/** + * Enumeration, specifying the content type of a Cell in a GridStaticSection. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public enum GridStaticCellType { + /** + * Text content + */ + TEXT, + + /** + * HTML content + */ + HTML, + + /** + * Widget content + */ + WIDGET; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridStaticSectionState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridStaticSectionState.java new file mode 100644 index 0000000000..560f0f17d1 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/GridStaticSectionState.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.v7.shared.ui.grid; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.vaadin.shared.Connector; + +/** + * Shared state for Grid headers and footers. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public class GridStaticSectionState implements Serializable { + + public static class CellState implements Serializable { + public String text = ""; + + public String html = ""; + + public Connector connector = null; + + public GridStaticCellType type = GridStaticCellType.TEXT; + + public String columnId; + + public String styleName = null; + } + + public static class RowState implements Serializable { + public List cells = new ArrayList(); + + public boolean defaultRow = false; + + /** + * Map from column id set to cell state for merged state. + */ + public Map, CellState> cellGroups = new HashMap, CellState>(); + + /** + * The style name for the row. Null if none. + */ + public String styleName = null; + } + + public List rows = new ArrayList(); + + public boolean visible = true; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/HeightMode.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/HeightMode.java new file mode 100644 index 0000000000..2647a17abd --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/HeightMode.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.v7.shared.ui.grid; + +/** + * The modes for height calculation that are supported by Grid ( + * {@link com.vaadin.client.ui.grid.Grid client} and + * {@link com.vaadin.ui.components.grid.Grid server}) / + * {@link com.vaadin.client.ui.grid.Escalator Escalator}. + * + * @since 7.4 + * @author Vaadin Ltd + * @see com.vaadin.client.ui.grid.Grid#setHeightMode(HeightMode) + * @see com.vaadin.ui.components.grid.Grid#setHeightMode(HeightMode) + * @see com.vaadin.client.ui.grid.Escalator#setHeightMode(HeightMode) + */ +public enum HeightMode { + /** + * The height of the Component or Widget is defined by a CSS-like value. + * (e.g. "100px", "50em" or "25%") + */ + CSS, + + /** + * The height of the Component or Widget in question is defined by a number + * of rows. + */ + ROW, + + /** + * The height of the Component or Widget in question is defined by its + * contents. + */ + UNDEFINED; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/ScrollDestination.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/ScrollDestination.java new file mode 100644 index 0000000000..faa212c5ad --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/ScrollDestination.java @@ -0,0 +1,55 @@ +/* + * 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.shared.ui.grid; + +/** + * Enumeration, specifying the destinations that are supported when scrolling + * rows or columns into view. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public enum ScrollDestination { + + /** + * Scroll as little as possible to show the target element. If the element + * fits into view, this works as START or END depending on the current + * scroll position. If the element does not fit into view, this works as + * START. + */ + ANY, + + /** + * Scrolls so that the element is shown at the start of the viewport. The + * viewport will, however, not scroll beyond its contents. + */ + START, + + /** + * Scrolls so that the element is shown in the middle of the viewport. The + * viewport will, however, not scroll beyond its contents, given more + * elements than what the viewport is able to show at once. Under no + * circumstances will the viewport scroll before its first element. + */ + MIDDLE, + + /** + * Scrolls so that the element is shown at the end of the viewport. The + * viewport will, however, not scroll before its first element. + */ + END + +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/renderers/RendererClickRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/renderers/RendererClickRpc.java new file mode 100644 index 0000000000..cad4a1a76d --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/renderers/RendererClickRpc.java @@ -0,0 +1,31 @@ +/* + * 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.shared.ui.grid.renderers; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; + +public interface RendererClickRpc extends ServerRpc { + /** + * Called when a click event has occurred and there are server side + * listeners for the event. + * + * @param mouseDetails + * Details about the mouse when the event took place + */ + public void click(String rowKey, String columnId, + MouseEventDetails mouseDetails); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/MultiSelectionModelServerRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/MultiSelectionModelServerRpc.java new file mode 100644 index 0000000000..ba8ed0f3a5 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/MultiSelectionModelServerRpc.java @@ -0,0 +1,55 @@ +/* + * 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.shared.ui.grid.selection; + +import java.util.List; + +import com.vaadin.shared.communication.ServerRpc; + +/** + * ServerRpc for MultiSelectionModel. + * + * @since 7.6 + * @author Vaadin Ltd + */ +public interface MultiSelectionModelServerRpc extends ServerRpc { + + /** + * Select a list of rows based on their row keys on the server-side. + * + * @param rowKeys + * list of row keys to select + */ + public void select(List rowKeys); + + /** + * Deselect a list of rows based on their row keys on the server-side. + * + * @param rowKeys + * list of row keys to deselect + */ + public void deselect(List rowKeys); + + /** + * Selects all rows on the server-side. + */ + public void selectAll(); + + /** + * Deselects all rows on the server-side. + */ + public void deselectAll(); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/MultiSelectionModelState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/MultiSelectionModelState.java new file mode 100644 index 0000000000..c04d9aaff5 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/MultiSelectionModelState.java @@ -0,0 +1,31 @@ +/* + * 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.shared.ui.grid.selection; + +import com.vaadin.shared.communication.SharedState; + +/** + * SharedState object for MultiSelectionModel. + * + * @since 7.6 + * @author Vaadin Ltd + */ +public class MultiSelectionModelState extends SharedState { + + /* Select All -checkbox status */ + public boolean allSelected; + +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/SingleSelectionModelServerRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/SingleSelectionModelServerRpc.java new file mode 100644 index 0000000000..a5561f4665 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/SingleSelectionModelServerRpc.java @@ -0,0 +1,35 @@ +/* + * 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.shared.ui.grid.selection; + +import com.vaadin.shared.communication.ServerRpc; + +/** + * ServerRpc for SingleSelectionModel. + * + * @since 7.6 + * @author Vaadin Ltd + */ +public interface SingleSelectionModelServerRpc extends ServerRpc { + + /** + * Selects a row on server-side. + * + * @param rowKey + * row key of selected row; {@code null} if deselect + */ + public void select(String rowKey); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/SingleSelectionModelState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/SingleSelectionModelState.java new file mode 100644 index 0000000000..a9fb816449 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/grid/selection/SingleSelectionModelState.java @@ -0,0 +1,30 @@ +/* + * 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.shared.ui.grid.selection; + +import com.vaadin.shared.communication.SharedState; + +/** + * SharedState object for SingleSelectionModel. + * + * @since 7.6 + * @author Vaadin Ltd + */ +public class SingleSelectionModelState extends SharedState { + + /* Allow deselecting rows */ + public boolean deselectAllowed = true; +} diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeight.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeight.java index 14d179017f..f5caf9431e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeight.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeight.java @@ -20,7 +20,6 @@ import java.util.HashMap; import java.util.Map; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Alignment; import com.vaadin.ui.Component; @@ -31,6 +30,7 @@ import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.event.ItemClickEvent; import com.vaadin.v7.event.ItemClickEvent.ItemClickListener; +import com.vaadin.v7.shared.ui.grid.HeightMode; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.DetailsGenerator; import com.vaadin.v7.ui.Grid.RowReference; diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java index f47052bff8..091cc45ff3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java @@ -4,11 +4,11 @@ import java.util.Arrays; import java.util.List; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.data.Property; +import com.vaadin.v7.shared.ui.grid.HeightMode; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.NativeSelect; diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrolling.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrolling.java index f7dcf61cbe..8ed3f4e9f8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrolling.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrolling.java @@ -16,7 +16,6 @@ package com.vaadin.tests.components.grid; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -25,6 +24,7 @@ import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.data.Item; import com.vaadin.v7.data.util.IndexedContainer; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; import com.vaadin.v7.ui.Grid; @SuppressWarnings("serial") diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index b04f6a5a9c..f18b6408b8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -35,8 +35,6 @@ import com.vaadin.event.SelectionEvent.SelectionListener; import com.vaadin.event.SortEvent; import com.vaadin.event.SortEvent.SortListener; import com.vaadin.shared.data.sort.SortDirection; -import com.vaadin.shared.ui.grid.GridStaticCellType; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.tests.components.AbstractComponentTest; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -55,6 +53,8 @@ import com.vaadin.v7.data.fieldgroup.FieldGroup.CommitException; import com.vaadin.v7.data.util.IndexedContainer; import com.vaadin.v7.event.ItemClickEvent; import com.vaadin.v7.event.ItemClickEvent.ItemClickListener; +import com.vaadin.v7.shared.ui.grid.GridStaticCellType; +import com.vaadin.v7.shared.ui.grid.HeightMode; import com.vaadin.v7.ui.Field; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.CellDescriptionGenerator; diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridHeightByRowOnInit.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridHeightByRowOnInit.java index 8dd1b67856..bd43bc5065 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridHeightByRowOnInit.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basicfeatures/GridHeightByRowOnInit.java @@ -18,10 +18,10 @@ package com.vaadin.tests.components.grid.basicfeatures; import com.vaadin.annotations.Theme; import com.vaadin.annotations.Title; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.ui.UI; import com.vaadin.ui.themes.ValoTheme; import com.vaadin.v7.data.Container; +import com.vaadin.v7.shared.ui.grid.HeightMode; import com.vaadin.v7.ui.Grid; @Title("Server Grid height by row on init") diff --git a/uitest/src/main/java/com/vaadin/tests/contextclick/GridContextClick.java b/uitest/src/main/java/com/vaadin/tests/contextclick/GridContextClick.java index 487772a8d0..22c0331059 100644 --- a/uitest/src/main/java/com/vaadin/tests/contextclick/GridContextClick.java +++ b/uitest/src/main/java/com/vaadin/tests/contextclick/GridContextClick.java @@ -15,12 +15,12 @@ */ package com.vaadin.tests.contextclick; -import com.vaadin.shared.ui.grid.GridConstants.Section; import com.vaadin.tests.util.PersonContainer; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.HorizontalLayout; import com.vaadin.v7.data.Item; +import com.vaadin.v7.shared.ui.grid.GridConstants.Section; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.GridContextClickEvent; diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/ShowingInlineDataInGrid.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/ShowingInlineDataInGrid.java index ed9fe507f7..21261875b3 100644 --- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/ShowingInlineDataInGrid.java +++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7_4/ShowingInlineDataInGrid.java @@ -17,8 +17,8 @@ package com.vaadin.tests.minitutorials.v7_4; import com.vaadin.annotations.Theme; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.ui.UI; +import com.vaadin.v7.shared.ui.grid.HeightMode; import com.vaadin.v7.ui.Grid; @Theme("valo") diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java index fee6f93b73..c15c1c6070 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/EscalatorBasicClientFeaturesWidget.java @@ -9,7 +9,6 @@ import com.google.gwt.dom.client.TableCellElement; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTML; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.v7.client.widget.escalator.EscalatorUpdater; import com.vaadin.v7.client.widget.escalator.FlyweightCell; import com.vaadin.v7.client.widget.escalator.Row; @@ -18,6 +17,7 @@ import com.vaadin.v7.client.widget.escalator.Spacer; import com.vaadin.v7.client.widget.escalator.SpacerUpdater; import com.vaadin.v7.client.widget.escalator.RowContainer.BodyRowContainer; import com.vaadin.v7.client.widgets.Escalator; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; public class EscalatorBasicClientFeaturesWidget extends PureGWTTestApplication { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java index a168e78d54..7edba039e1 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridBasicClientFeaturesWidget.java @@ -47,7 +47,6 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.data.DataSource; import com.vaadin.client.data.DataSource.RowHandle; import com.vaadin.client.ui.VLabel; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.tests.widgetset.client.grid.GridBasicClientFeaturesWidget.Data; import com.vaadin.v7.client.renderers.DateRenderer; import com.vaadin.v7.client.renderers.HtmlRenderer; @@ -89,6 +88,7 @@ import com.vaadin.v7.client.widgets.Grid.Column; import com.vaadin.v7.client.widgets.Grid.FooterRow; import com.vaadin.v7.client.widgets.Grid.HeaderRow; import com.vaadin.v7.client.widgets.Grid.SelectionMode; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; /** * Grid basic client features test application. diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridDefaultTextRendererWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridDefaultTextRendererWidget.java index db33a92594..2ed5e17144 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridDefaultTextRendererWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridDefaultTextRendererWidget.java @@ -15,11 +15,11 @@ */ package com.vaadin.tests.widgetset.client.grid; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.v7.client.widget.grid.datasources.ListDataSource; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.Column; import com.vaadin.v7.client.widgets.Grid.SelectionMode; +import com.vaadin.v7.shared.ui.grid.HeightMode; public class GridDefaultTextRendererWidget extends PureGWTTestApplication> { diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridHeightByRowOnInitWidget.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridHeightByRowOnInitWidget.java index 6654f7b3d7..b740090c9e 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridHeightByRowOnInitWidget.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/grid/GridHeightByRowOnInitWidget.java @@ -4,10 +4,10 @@ import java.util.Arrays; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.SimplePanel; -import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.v7.client.widget.grid.datasources.ListDataSource; import com.vaadin.v7.client.widgets.Grid; import com.vaadin.v7.client.widgets.Grid.Column; +import com.vaadin.v7.shared.ui.grid.HeightMode; public class GridHeightByRowOnInitWidget extends Composite { private final SimplePanel panel = new SimplePanel(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java index 430a8ad5ce..ed15f13f34 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridDetailsClientTest.java @@ -31,12 +31,12 @@ import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import com.vaadin.shared.ui.grid.Range; -import com.vaadin.shared.ui.grid.ScrollDestination; import com.vaadin.testbench.By; import com.vaadin.testbench.ElementQuery; import com.vaadin.testbench.TestBenchElement; import com.vaadin.testbench.customelements.FixedNotificationElement; import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeaturesTest; +import com.vaadin.v7.shared.ui.grid.ScrollDestination; public class GridDetailsClientTest extends GridBasicClientFeaturesTest { diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java index fee503f6dc..abbd954b9b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java @@ -32,12 +32,12 @@ import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; -import com.vaadin.shared.ui.grid.GridConstants; import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.elements.GridElement.GridEditorElement; import com.vaadin.testbench.parallel.BrowserUtil; import com.vaadin.tests.components.grid.basicfeatures.GridBasicClientFeaturesTest; import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures; +import com.vaadin.v7.shared.ui.grid.GridConstants; public class GridEditorClientTest extends GridBasicClientFeaturesTest { diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java index 452dfb681d..923592fc31 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorBufferedTest.java @@ -28,10 +28,10 @@ import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; -import com.vaadin.shared.ui.grid.GridConstants; import com.vaadin.testbench.TestBenchElement; import com.vaadin.testbench.elements.GridElement.GridCellElement; import com.vaadin.testbench.elements.GridElement.GridEditorElement; +import com.vaadin.v7.shared.ui.grid.GridConstants; import com.vaadin.testbench.elements.NotificationElement; public class GridEditorBufferedTest extends GridEditorTest {