Multiselect table with checkboxes

Hello,

I would like to create a table with the leftmost column containing checkboxes that are synchronized with the table selection.
For example, in gmail or yahoo mail, the table showing a mailbox behaves this way.

I could put a listener on the table to change the checkboxes when the selection is changed, but the other way around doesn’t work because the checkboxes steal the click from the table and the multiselection doesn’t work.

Is there a easy solution for this?

Thanks!
nicolae