private CheckBox tableCellItemDescription;
private CheckBox tableRowItemDescription;
@Override
protected void setup(VaadinRequest request) {
final Table table = createTable();
table.setId("table");
componentDescription = new CheckBox("Tooltip on components");
componentDescription.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
table.setContainerDataSource(createContainer(componentDescription
.getValue()));
}
});
componentDescription.setImmediate(true);
componentDescription.setValue(true);
tableCellItemDescription = new CheckBox("Tooltip on table cells");
tableCellItemDescription
.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
table.refreshRowCache();
}
});
tableCellItemDescription.setImmediate(true);
tableCellItemDescription.setValue(true);
tableRowItemDescription = new CheckBox("Tooltip on table Rows");
tableRowItemDescription
.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
table.refreshRowCache();
}
});
tableRowItemDescription.setImmediate(true);
tableRowItemDescription.setValue(true);
addComponent(componentDescription);
addComponent(tableCellItemDescription);
addComponent(tableRowItemDescription);
addComponent(table);
table.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
@Override
public String generateDescription(Component source, Object itemId,
Object propertyId) {
if (propertyId == null && tableRowItemDescription.getValue()) {
return "Row description " + itemId;
} else if (tableCellItemDescription.getValue()) {
return "Cell description " + itemId + ", " + propertyId;
}
return null;
}
});
table.addGeneratedColumn(GEN_WIDGET_PROPERTY_ID,
new Table.ColumnGenerator() {
@Override
public Component generateCell(Table source, Object itemId,
Object columnId) {