aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-06-13 17:00:53 +0300
committerGitHub <noreply@github.com>2017-06-13 17:00:53 +0300
commitaf5c46b6e064721b6639e6fab2e6e21988c713c1 (patch)
treef19a7f775486ac41cc127a5c02c5d60c2b81d217 /server/src/main/java/com/vaadin
parentcb1a2b99472faabba3596d673dbdbc377fb1628a (diff)
downloadvaadin-framework-af5c46b6e064721b6639e6fab2e6e21988c713c1.tar.gz
vaadin-framework-af5c46b6e064721b6639e6fab2e6e21988c713c1.zip
Allow changing the renderer of hierarchy column in TreeGrid (#9514)
Addresses #9465
Diffstat (limited to 'server/src/main/java/com/vaadin')
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java12
-rw-r--r--server/src/main/java/com/vaadin/ui/TreeGrid.java20
2 files changed, 11 insertions, 21 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 3ae03679cf..7e283a38ea 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -1906,6 +1906,16 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
}
/**
+ * Gets the Renderer for this Column.
+ *
+ * @return the renderer
+ * @since
+ */
+ public Renderer<? super V> getRenderer() {
+ return (Renderer<? super V>) getState().renderer;
+ }
+
+ /**
* Gets the grid that this column belongs to.
*
* @return the grid that this column belongs to, or <code>null</code> if
@@ -4006,7 +4016,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
column = addColumn(id);
} else {
DeclarativeValueProvider<T> provider = new DeclarativeValueProvider<>();
- column = new Column<>(provider, new HtmlRenderer());
+ column = createColumn(provider, new HtmlRenderer());
addColumn(getGeneratedIdentifier(), column);
if (id != null) {
column.setId(id);
diff --git a/server/src/main/java/com/vaadin/ui/TreeGrid.java b/server/src/main/java/com/vaadin/ui/TreeGrid.java
index 310a7c6cf5..fdda7226fe 100644
--- a/server/src/main/java/com/vaadin/ui/TreeGrid.java
+++ b/server/src/main/java/com/vaadin/ui/TreeGrid.java
@@ -486,26 +486,6 @@ public class TreeGrid<T> extends Grid<T>
childItem -> writeRow(container, childItem, item, context));
}
- @Override
- protected <V> Column<T, V> createColumn(ValueProvider<T, V> valueProvider,
- AbstractRenderer<? super T, ? super V> renderer) {
- return new Column<T, V>(valueProvider, renderer) {
-
- @Override
- public com.vaadin.ui.Grid.Column<T, V> setRenderer(
- Renderer<? super V> renderer) {
- // Disallow changing renderer for the hierarchy column
- if (getInternalIdForColumn(this).equals(
- TreeGrid.this.getState(false).hierarchyColumnId)) {
- throw new IllegalStateException(
- "Changing the renderer of the hierarchy column is not allowed.");
- }
-
- return super.setRenderer(renderer);
- }
- };
- }
-
/**
* Emit an expand event.
*