CheckBox in Table with DefaultFieldFactory

I use the same DefaultFieldFactory for a form and a table. My bean has a boolean property and in the createField, for this boolean property, I create the field in this way:

f = super.createField(item, propertyId, uiContext);

The form display the property correctly as a CheckBox, but the table (in non editable mode) display a text column whith value true/false. When I select a table row, I get:

Caused by: java.lang.IllegalArgumentException: CheckBox only accepts Boolean values
	at com.vaadin.ui.Button.setInternalValue(
	at com.vaadin.ui.AbstractField.discard(
	at com.vaadin.ui.AbstractField.setPropertyDataSource(
	at com.vaadin.incubator.spring.ui.LookupForm.rebind(
	at com.vaadin.incubator.spring.ui.LookupForm.update(
	at com.vaadin.incubator.spring.ui.funzioni.Lookup.itemClicked(
	at com.vaadin.incubator.spring.ui.LookupTable.itemClick(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at com.vaadin.event.ListenerMethod.receiveEvent(
	... 63 more

How can I display a CheckBox inside the table ?

Thank you, Francesco

Not sure what your problem is, you must have mixed some types somewhere.

The examples below show two cases. The editable mode is the normal case for having components in a table, but you can put them in a table in non-editable mode as well.



in non-editable mode


in editable mode

[/list]In these examples, the items are added to the table as object arrays, not from a BeanItem, but that should work just as well.

your links are not available…
Thank you, Francesco

We moved on monday and the tomcat apparently did not restart automatically. It seems to work again.


I just fixed the same Exception from our application. It was caused by a Boolean object which didn’t have a value yet. A null Boolean doesn’t default to false in Vaadin checkbox, which we would have hoped, but gave the Exception.

So make sure the object you pass to your field factory has a value. We forced default values to our database to facilitate this.

thank you for your suggestion. I fixed my problem initializing boolean properties to false on creation.
Thank you again, Francesco