diff options
author | Henrik Paul <henrik@vaadin.com> | 2014-12-08 14:52:34 +0200 |
---|---|---|
committer | Henrik Paul <henrik@vaadin.com> | 2014-12-08 14:52:34 +0200 |
commit | a50e590b9d5c58fbfece464fee4f4152aa24bb02 (patch) | |
tree | e6998bb84791d3925d7139c90c68287519377374 | |
parent | e1d1673422cd31ac2fa9e7476ca7f695a0143868 (diff) | |
download | vaadin-framework-a50e590b9d5c58fbfece464fee4f4152aa24bb02.tar.gz vaadin-framework-a50e590b9d5c58fbfece464fee4f4152aa24bb02.zip |
Move Grid related renderer to com.vaadin.client.connectors (#13334)
Change-Id: Ia2b74c6d6b99ef9ec5aa0d41956c55ebd8a2615a
-rw-r--r-- | client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java | 2 | ||||
-rw-r--r-- | client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java | 2 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/AbstractRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/AbstractRendererConnector.java) | 15 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/ButtonRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/ButtonRendererConnector.java) | 3 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/ClickableRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/ClickableRendererConnector.java) | 2 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/DateRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/DateRendererConnector.java) | 2 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/GridConnector.java (renamed from client/src/com/vaadin/client/ui/grid/GridConnector.java) | 13 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/ImageRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/ImageRendererConnector.java) | 3 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/NumberRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/NumberRendererConnector.java) | 2 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/ProgressBarRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/ProgressBarRendererConnector.java) | 3 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/RpcDataSourceConnector.java (renamed from client/src/com/vaadin/client/data/RpcDataSourceConnector.java) | 80 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/TextRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/TextRendererConnector.java) | 3 | ||||
-rw-r--r-- | client/src/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java (renamed from client/src/com/vaadin/client/ui/grid/renderers/UnsafeHtmlRendererConnector.java) | 2 | ||||
-rw-r--r-- | client/src/com/vaadin/client/data/AbstractRemoteDataSource.java | 2 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/widgetset/client/grid/IntArrayRendererConnector.java | 2 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/widgetset/client/grid/RowAwareRendererConnector.java | 2 |
16 files changed, 73 insertions, 65 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java index 2c2d091d5e..89421dc3fb 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/ConnectorBundle.java @@ -43,8 +43,8 @@ import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ServerConnector; import com.vaadin.client.communication.JSONSerializer; +import com.vaadin.client.connectors.AbstractRendererConnector; import com.vaadin.client.ui.UnknownComponentConnector; -import com.vaadin.client.ui.grid.renderers.AbstractRendererConnector; import com.vaadin.shared.communication.ClientRpc; import com.vaadin.shared.communication.ServerRpc; import com.vaadin.shared.ui.Connect; diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java index 4c356cda7f..85236efccc 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/metadata/RendererVisitor.java @@ -22,7 +22,7 @@ import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; import com.google.gwt.core.ext.typeinfo.JParameterizedType; import com.google.gwt.core.ext.typeinfo.JType; -import com.vaadin.client.ui.grid.renderers.AbstractRendererConnector; +import com.vaadin.client.connectors.AbstractRendererConnector; /** * Generates type data for renderer connectors. diff --git a/client/src/com/vaadin/client/ui/grid/renderers/AbstractRendererConnector.java b/client/src/com/vaadin/client/connectors/AbstractRendererConnector.java index e528fcfa8b..3164ea01a2 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/AbstractRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/AbstractRendererConnector.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; import com.google.gwt.json.client.JSONValue; import com.vaadin.client.ServerConnector; @@ -24,7 +24,6 @@ import com.vaadin.client.metadata.NoDataException; import com.vaadin.client.metadata.Type; import com.vaadin.client.metadata.TypeData; import com.vaadin.client.metadata.TypeDataStore; -import com.vaadin.client.ui.grid.GridConnector; import com.vaadin.client.ui.grid.Renderer; /** @@ -88,12 +87,12 @@ public abstract class AbstractRendererConnector<T> extends * Creates a new Renderer instance associated with this renderer connector. * <p> * You should typically not override this method since the framework by - * default generates an implementation that uses {@link GWT#create(Class)} - * to create a renderer of the same type as returned by the most specific - * override of {@link #getRenderer()}. If you do override the method, you - * can't call <code>super.createRenderer()</code> since the metadata needed - * for that implementation is not generated if there's an override of the - * method. + * default generates an implementation that uses + * {@link com.google.gwt.core.client.GWT#create(Class)} to create a renderer + * of the same type as returned by the most specific override of + * {@link #getRenderer()}. If you do override the method, you can't call + * <code>super.createRenderer()</code> since the metadata needed for that + * implementation is not generated if there's an override of the method. * * @return a new renderer to be used with this connector */ diff --git a/client/src/com/vaadin/client/ui/grid/renderers/ButtonRendererConnector.java b/client/src/com/vaadin/client/connectors/ButtonRendererConnector.java index 405ec79a64..45556d6176 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/ButtonRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/ButtonRendererConnector.java @@ -13,10 +13,11 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; import com.google.gwt.json.client.JSONObject; import com.google.web.bindery.event.shared.HandlerRegistration; +import com.vaadin.client.ui.grid.renderers.ButtonRenderer; import com.vaadin.client.ui.grid.renderers.ClickableRenderer.RendererClickHandler; import com.vaadin.shared.ui.Connect; diff --git a/client/src/com/vaadin/client/ui/grid/renderers/ClickableRendererConnector.java b/client/src/com/vaadin/client/connectors/ClickableRendererConnector.java index f0d98c6ec0..07f762588f 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/ClickableRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/ClickableRendererConnector.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; import com.google.gwt.json.client.JSONObject; import com.google.web.bindery.event.shared.HandlerRegistration; diff --git a/client/src/com/vaadin/client/ui/grid/renderers/DateRendererConnector.java b/client/src/com/vaadin/client/connectors/DateRendererConnector.java index 52ae7d9b6b..b9fad95f0d 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/DateRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/DateRendererConnector.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; import com.vaadin.shared.ui.Connect; diff --git a/client/src/com/vaadin/client/ui/grid/GridConnector.java b/client/src/com/vaadin/client/connectors/GridConnector.java index ff55106175..9fc4b65349 100644 --- a/client/src/com/vaadin/client/ui/grid/GridConnector.java +++ b/client/src/com/vaadin/client/connectors/GridConnector.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.client.ui.grid; +package com.vaadin.client.connectors; import java.util.ArrayList; import java.util.Arrays; @@ -36,17 +36,20 @@ import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorHierarchyChangeEvent; import com.vaadin.client.annotations.OnStateChange; import com.vaadin.client.communication.StateChangeEvent; +import com.vaadin.client.connectors.RpcDataSourceConnector.RpcDataSource; import com.vaadin.client.data.DataSource.RowHandle; -import com.vaadin.client.data.RpcDataSourceConnector.RpcDataSource; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.AbstractHasComponentsConnector; import com.vaadin.client.ui.SimpleManagedLayout; +import com.vaadin.client.ui.grid.EditorRowHandler; +import com.vaadin.client.ui.grid.Grid; import com.vaadin.client.ui.grid.Grid.CellStyleGenerator; import com.vaadin.client.ui.grid.Grid.FooterCell; import com.vaadin.client.ui.grid.Grid.FooterRow; import com.vaadin.client.ui.grid.Grid.HeaderCell; import com.vaadin.client.ui.grid.Grid.HeaderRow; -import com.vaadin.client.ui.grid.renderers.AbstractRendererConnector; +import com.vaadin.client.ui.grid.GridColumn; +import com.vaadin.client.ui.grid.Renderer; import com.vaadin.client.ui.grid.selection.AbstractRowHandleSelectionModel; import com.vaadin.client.ui.grid.selection.SelectionChangeEvent; import com.vaadin.client.ui.grid.selection.SelectionChangeHandler; @@ -799,7 +802,7 @@ public class GridConnector extends AbstractHasComponentsConnector implements */ private native void selectByHandle(RowHandle<JSONObject> handle) /*-{ - var model = this.@com.vaadin.client.ui.grid.GridConnector::selectionModel; + var model = this.@com.vaadin.client.connectors.GridConnector::selectionModel; model.@com.vaadin.client.ui.grid.selection.AbstractRowHandleSelectionModel::selectByHandle(*)(handle); }-*/; @@ -809,7 +812,7 @@ public class GridConnector extends AbstractHasComponentsConnector implements */ private native void deselectByHandle(RowHandle<JSONObject> handle) /*-{ - var model = this.@com.vaadin.client.ui.grid.GridConnector::selectionModel; + var model = this.@com.vaadin.client.connectors.GridConnector::selectionModel; model.@com.vaadin.client.ui.grid.selection.AbstractRowHandleSelectionModel::deselectByHandle(*)(handle); }-*/; diff --git a/client/src/com/vaadin/client/ui/grid/renderers/ImageRendererConnector.java b/client/src/com/vaadin/client/connectors/ImageRendererConnector.java index c425b0a40d..33e108cd1e 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/ImageRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/ImageRendererConnector.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; import com.google.gwt.json.client.JSONObject; import com.google.gwt.json.client.JSONValue; @@ -21,6 +21,7 @@ import com.google.web.bindery.event.shared.HandlerRegistration; import com.vaadin.client.communication.JsonDecoder; import com.vaadin.client.metadata.TypeDataStore; import com.vaadin.client.ui.grid.renderers.ClickableRenderer.RendererClickHandler; +import com.vaadin.client.ui.grid.renderers.ImageRenderer; import com.vaadin.shared.communication.URLReference; import com.vaadin.shared.ui.Connect; diff --git a/client/src/com/vaadin/client/ui/grid/renderers/NumberRendererConnector.java b/client/src/com/vaadin/client/connectors/NumberRendererConnector.java index cba29d0690..cf8ef3e076 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/NumberRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/NumberRendererConnector.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; import com.vaadin.shared.ui.Connect; diff --git a/client/src/com/vaadin/client/ui/grid/renderers/ProgressBarRendererConnector.java b/client/src/com/vaadin/client/connectors/ProgressBarRendererConnector.java index e4c5e2bc00..ec7e8d0d08 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/ProgressBarRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/ProgressBarRendererConnector.java @@ -13,8 +13,9 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; +import com.vaadin.client.ui.grid.renderers.ProgressBarRenderer; import com.vaadin.shared.ui.Connect; /** diff --git a/client/src/com/vaadin/client/data/RpcDataSourceConnector.java b/client/src/com/vaadin/client/connectors/RpcDataSourceConnector.java index cc1e294fb8..c9a01c0c5e 100644 --- a/client/src/com/vaadin/client/data/RpcDataSourceConnector.java +++ b/client/src/com/vaadin/client/connectors/RpcDataSourceConnector.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.client.data; +package com.vaadin.client.connectors; import java.util.ArrayList; @@ -24,8 +24,8 @@ import com.google.gwt.json.client.JSONParser; import com.google.gwt.json.client.JSONString; import com.google.gwt.json.client.JSONValue; import com.vaadin.client.ServerConnector; +import com.vaadin.client.data.AbstractRemoteDataSource; import com.vaadin.client.extensions.AbstractExtensionConnector; -import com.vaadin.client.ui.grid.GridConnector; import com.vaadin.shared.data.DataProviderRpc; import com.vaadin.shared.data.DataProviderState; import com.vaadin.shared.data.DataRequestRpc; @@ -47,6 +47,45 @@ public class RpcDataSourceConnector extends AbstractExtensionConnector { public class RpcDataSource extends AbstractRemoteDataSource<JSONObject> { + protected RpcDataSource() { + registerRpc(DataProviderRpc.class, new DataProviderRpc() { + @Override + public void setRowData(int firstRow, String rowsJson) { + JSONValue parsedJson = JSONParser.parseStrict(rowsJson); + JSONArray rowArray = parsedJson.isArray(); + assert rowArray != null : "Was unable to parse JSON into an array: " + + parsedJson; + + ArrayList<JSONObject> rows = new ArrayList<JSONObject>( + rowArray.size()); + for (int i = 0; i < rowArray.size(); i++) { + JSONValue rowValue = rowArray.get(i); + JSONObject rowObject = rowValue.isObject(); + assert rowObject != null : "Was unable to parse JSON into an object: " + + rowValue; + rows.add(rowObject); + } + + dataSource.setRowData(firstRow, rows); + } + + @Override + public void removeRowData(int firstRow, int count) { + dataSource.removeRowData(firstRow, count); + } + + @Override + public void insertRowData(int firstRow, int count) { + dataSource.insertRowData(firstRow, count); + } + + @Override + public void resetDataAndSize(int size) { + dataSource.resetDataAndSize(size); + } + }); + } + private DataRequestRpc rpcProxy = getRpcProxy(DataRequestRpc.class); @Override @@ -106,43 +145,6 @@ public class RpcDataSourceConnector extends AbstractExtensionConnector { @Override protected void extend(ServerConnector target) { ((GridConnector) target).setDataSource(dataSource); - - registerRpc(DataProviderRpc.class, new DataProviderRpc() { - @Override - public void setRowData(int firstRow, String rowsJson) { - JSONValue parsedJson = JSONParser.parseStrict(rowsJson); - JSONArray rowArray = parsedJson.isArray(); - assert rowArray != null : "Was unable to parse JSON into an array: " - + parsedJson; - - ArrayList<JSONObject> rows = new ArrayList<JSONObject>(rowArray - .size()); - for (int i = 0; i < rowArray.size(); i++) { - JSONValue rowValue = rowArray.get(i); - JSONObject rowObject = rowValue.isObject(); - assert rowObject != null : "Was unable to parse JSON into an object: " - + rowValue; - rows.add(rowObject); - } - - dataSource.setRowData(firstRow, rows); - } - - @Override - public void removeRowData(int firstRow, int count) { - dataSource.removeRowData(firstRow, count); - } - - @Override - public void insertRowData(int firstRow, int count) { - dataSource.insertRowData(firstRow, count); - } - - @Override - public void resetDataAndSize(int size) { - dataSource.resetDataAndSize(size); - } - }); } @Override diff --git a/client/src/com/vaadin/client/ui/grid/renderers/TextRendererConnector.java b/client/src/com/vaadin/client/connectors/TextRendererConnector.java index 9ec609ae06..6af095c540 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/TextRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/TextRendererConnector.java @@ -13,8 +13,9 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; +import com.vaadin.client.ui.grid.renderers.TextRenderer; import com.vaadin.shared.ui.Connect; /** diff --git a/client/src/com/vaadin/client/ui/grid/renderers/UnsafeHtmlRendererConnector.java b/client/src/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java index 1d4a8c0384..d696b50214 100644 --- a/client/src/com/vaadin/client/ui/grid/renderers/UnsafeHtmlRendererConnector.java +++ b/client/src/com/vaadin/client/connectors/UnsafeHtmlRendererConnector.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.client.ui.grid.renderers; +package com.vaadin.client.connectors; import com.vaadin.client.ui.grid.FlyweightCell; import com.vaadin.client.ui.grid.Renderer; diff --git a/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java b/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java index 5052b9019b..531c40e2db 100644 --- a/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java +++ b/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java @@ -76,7 +76,7 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { } } - protected boolean isPinned() { + public boolean isPinned() { return pinnedRows.containsKey(key); } diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/IntArrayRendererConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/IntArrayRendererConnector.java index d6873ac0a5..fd3ea4de5e 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/IntArrayRendererConnector.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/IntArrayRendererConnector.java @@ -15,9 +15,9 @@ */ package com.vaadin.tests.widgetset.client.grid; +import com.vaadin.client.connectors.AbstractRendererConnector; import com.vaadin.client.ui.grid.FlyweightCell; import com.vaadin.client.ui.grid.Renderer; -import com.vaadin.client.ui.grid.renderers.AbstractRendererConnector; import com.vaadin.shared.ui.Connect; @Connect(com.vaadin.tests.components.grid.IntArrayRenderer.class) diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/RowAwareRendererConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/RowAwareRendererConnector.java index 3880bacae2..a49dd41d7f 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/RowAwareRendererConnector.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/RowAwareRendererConnector.java @@ -22,10 +22,10 @@ import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.user.client.DOM; +import com.vaadin.client.connectors.AbstractRendererConnector; import com.vaadin.client.ui.grid.Cell; import com.vaadin.client.ui.grid.FlyweightCell; import com.vaadin.client.ui.grid.Renderer; -import com.vaadin.client.ui.grid.renderers.AbstractRendererConnector; import com.vaadin.client.ui.grid.renderers.ComplexRenderer; import com.vaadin.shared.communication.ServerRpc; import com.vaadin.shared.ui.Connect; |