Tooltip for a Label in TreeTable

Hi!
(Vaadin 6)
I am trying to set tooltip (description) for a cell in TreeTable, the cell is filled with a Label.
Below is my code:

    TreeTable table = new TreeTable();
    table.addContainerProperty("test", Component.class, null);
    AbstractComponent component = new Label("xxxx");
    component.setDescription("blah blah");
    component.setSizeUndefined();
    table.addItem(new Object[] {component}, 1);

And this does not work, but if I chage Label to another component (e.g. Button) then tooltips works as expected.
Any idea why?

I’ve been facing with the same issue some time ago.
There is dev ticket
http://dev.vaadin.com/ticket/3173

as a workaround you can create a VerticalLayout and add Label to it and after that add Layout to the Table.


TreeTable table = new TreeTable();
table.addContainerProperty("test", Component.class, null);
VerticalLayout lo = new VerticalLayout();
Label l = new Label("xxxx");
l.setDescription("blah blah");
lo.addComponent(l);
table.addItem(new Object[] {lo}, 1);

Second workaround and maybe the cleaner solution is that you use ItemDescriptionGenerator.


table.setItemDescriptionGenerator(new ItemDescriptionGenerator() {                            
    public String generateDescription(Component source, Object itemId, Object propertyId) {
        if(propertyId == null){
            return "Row description "+ itemId;
        } else if(propertyId.equals("test")) {
            return "Cell description " + itemId +","+propertyId;
        }                                                                      
        return null;
    }
}