What it the way to render html content in a table column

I have html formatted text into my database i would like to render and edit.

What is the best way the render it in table column ? do i need to define a rtearea as component for the column ?
How can i achieve this when the column is generated ?

Make the column property type a Label, and use new Label(htmlContent, Label.CONTENT_XHTML); to render the cells.

Thanks Jouni, I will test it.
My problem is that i don’t know how to set a component to a generated column from a BeanItemContainer. I read a lot of thread and some were saying that it was not possible to change it dynamically by getting the property after it is generated (and setting the component class).
Is that correct ?

Found the way by using generated column and overriding

	addGeneratedColumn("htmlSlrCommentText", new ColumnGenerator() {
		@Override
		public Component generateCell(Table source, final Object itemId,
				Object columnId) {
			// Get the text from bean item container
			String slrCommentText = (String) source.getContainerProperty(
					itemId, "slrCommentText").getValue();

			// Create the component for the generated column
			VerticalLayout cellLayout = new VerticalLayout();
			cellLayout.addComponent(new Label(slrCommentText,
					Label.CONTENT_XHTML));

			return cellLayout;
		}
	});

Yeah, generated columns can be used to achive this, but normal container properties allow component types as well. And using an extraneous layout inside the table is probably not needed (only slows down rendering).


but normal container properties allow component types as well

How to ?


http://vaadin.com/api/com/vaadin/ui/Table.html#addContainerProperty(java.lang.Object,%20java.lang.Class,%20java.lang.Object)

So basically
myTable.addContainerProperty(“Comment”, Label.class, null);

But this of course means that the actual pojos in the container will be Label components, and not Strings, and this is most likely not what you want if you persist the data in some way through the container. Using a generated column is the preferred way then I think.

Yes exactly, i’m using a Bean that is an hibernate java class with persistance method into … so generated column seem the best way. Thank you a lot. Very interesting.