diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-04-18 15:56:49 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-05-08 14:46:35 +0300 |
commit | 0d9e9caeff86cda9cccd71dfa719102816ad65ff (patch) | |
tree | 0a0e8a13b64cd714585758a280e26f255a64455b | |
parent | 12b54e9bd14bc009bedec6ac0443ca70fe2089be (diff) | |
download | vaadin-framework-0d9e9caeff86cda9cccd71dfa719102816ad65ff.tar.gz vaadin-framework-0d9e9caeff86cda9cccd71dfa719102816ad65ff.zip |
Add missing methods to compatibility AbstractRendererConnector
Fixes #9096
-rw-r--r-- | compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractRendererConnector.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractRendererConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractRendererConnector.java index fe0c561d5c..721dbd25a8 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractRendererConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/connectors/AbstractRendererConnector.java @@ -23,7 +23,9 @@ import com.vaadin.client.metadata.Type; import com.vaadin.client.metadata.TypeData; import com.vaadin.client.metadata.TypeDataStore; import com.vaadin.v7.client.renderers.Renderer; +import com.vaadin.v7.client.widgets.Grid.Column; +import elemental.json.JsonObject; import elemental.json.JsonValue; /** @@ -124,4 +126,47 @@ public abstract class AbstractRendererConnector<T> protected void extend(ServerConnector target) { // NOOP } + + /** + * Gets the row key for a row object. + * <p> + * In case this renderer wants be able to identify a row in such a way that + * the server also understands it, the row key is used for that. Rows are + * identified by unified keys between the client and the server. + * + * @param row + * the row object + * @return the row key for the given row + */ + protected String getRowKey(JsonObject row) { + final ServerConnector parent = getParent(); + if (parent instanceof GridConnector) { + return ((GridConnector) parent).getRowKey(row); + } else { + throw new IllegalStateException( + "Renderers can only be used " + "with a Grid."); + } + } + + /** + * Gets the column id for a column. + * <p> + * In case this renderer wants be able to identify a column in such a way + * that the server also understands it, the column id is used for that. + * Columns are identified by unified ids between the client and the server. + * + * @param column + * the column object + * @return the column id for the given column + */ + protected String getColumnId(Column<?, JsonObject> column) { + final ServerConnector parent = getParent(); + if (parent instanceof GridConnector) { + return ((GridConnector) parent).getColumnId(column); + } else { + throw new IllegalStateException( + "Renderers can only be used " + "with a Grid."); + } + } + } |