diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-04-18 15:56:49 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2017-04-18 14:56:49 +0200 |
commit | 300f691b19e6ebb43578768f795125c0aa6a365e (patch) | |
tree | 2bc7b29daa651038cbed866d80e05a7326473304 | |
parent | 28f4e6478351eda45bf40a7cc241f124f49cbf63 (diff) | |
download | vaadin-framework-300f691b19e6ebb43578768f795125c0aa6a365e.tar.gz vaadin-framework-300f691b19e6ebb43578768f795125c0aa6a365e.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."); + } + } + } |