summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Grid.java
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-18 13:22:11 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-18 15:26:08 +0200
commit41bf82e6dd57dc23c6cc298fde0a971305e9134b (patch)
tree905fcd6b8dfc5ed3f724b7d83b874ac477a6cfc9 /server/src/com/vaadin/ui/Grid.java
parentafa1aa38bd0a61c43d68be7f8120eb01991e7412 (diff)
downloadvaadin-framework-41bf82e6dd57dc23c6cc298fde0a971305e9134b.tar.gz
vaadin-framework-41bf82e6dd57dc23c6cc298fde0a971305e9134b.zip
Fix ClickableRenderers to use CellReferences (#13334)
This patch also uses row keys and column ids in communication rather than indices. Change-Id: Ie3bb554bd5c45700f1681160eef08bef8beeaaee
Diffstat (limited to 'server/src/com/vaadin/ui/Grid.java')
-rw-r--r--server/src/com/vaadin/ui/Grid.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index 60df269f10..8aee5ac19e 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -2382,9 +2382,35 @@ public class Grid extends AbstractComponent implements SelectionNotifier,
* @return the item id corresponding to {@code key}
*/
protected Object getItemId(String rowKey) {
+ return getParentGrid().getKeyMapper().getItemId(rowKey);
+ }
+
+ /**
+ * Gets the column for a column id.
+ * <p>
+ * An id is used to identify a particular column on both a server and a
+ * client. This method can be used to get the column for the column id
+ * that the client has sent.
+ *
+ * @param columnId
+ * the column id for which to retrieve a column
+ * @return the column corresponding to {@code columnId}
+ */
+ protected Column getColumn(String columnId) {
+ return getParentGrid().getColumnByColumnId(columnId);
+ }
+
+ /**
+ * Gets the parent Grid of the renderer.
+ *
+ * @return parent grid
+ * @throws IllegalStateException
+ * if parent is not Grid
+ */
+ protected Grid getParentGrid() {
if (getParent() instanceof Grid) {
Grid grid = (Grid) getParent();
- return grid.getKeyMapper().getItemId(rowKey);
+ return grid;
} else {
throw new IllegalStateException(
"Renderers can be used only with Grid");