From 703f6c937387bf1011905ed0acaa930d42e1afc7 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 11 Aug 2011 12:48:51 +0000 Subject: #5916 Table.ColumnGenerator should allow generation of plain text svn changeset:20302/svn branch:6.7 --- src/com/vaadin/ui/Table.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/com/vaadin/ui') diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index 572dececc3..1098b47e1c 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -1559,7 +1559,12 @@ public class Table extends AbstractSelect implements Action.Container, ColumnGenerator cg = columnGenerators .get(colids[j]); value = cg.generateCell(this, id, colids[j]); - + if (!(value instanceof Component) + && !(value instanceof String)) { + // Avoid errors if a generator returns something + // other than a Component or a String + value = value.toString(); + } } else if (iscomponent[j]) { value = p.getValue(); listenProperty(p, oldListenedProperties); @@ -3845,9 +3850,11 @@ public class Table extends AbstractSelect implements Action.Container, * @param columnId * the id for the generated column (as specified in * addGeneratedColumn) - * @return + * @return A {@link Component} that should be rendered in the cell or a + * {@link String} that should be displayed in the cell. Other + * return values are not supported. */ - public abstract Component generateCell(Table source, Object itemId, + public abstract Object generateCell(Table source, Object itemId, Object columnId); } -- cgit v1.2.3