In a grid, I would like to render different components in rows based on a flag, but instead I get only the toStirng representation of the components in the UI. How can this be achieved in a grid?
Following is the snippet I tried
BeanItemContainer<Sample> beanContainer = new BeanItemContainer<Sample>(Sample.class, sampleList);
GeneratedPropertyContainer container = new GeneratedPropertyContainer(beanContainer);
container.addGeneratedProperty("columnDisplayed", new PropertyValueGenerator<Component>() {
@Override
public Component getValue(Item item, Object itemId, Object propertyId) {
if(((Sample)itemId).isFlag) {
return new Button("Foo");
}
return new Label("Bar");
}
@Override
public Class<Component> getType() {
return Component.class;
}
});
Grid grid = new Grid(container);
Could you explain how the rows can alternatively display button and text values?
And I also want to show a combobox in some particular rows based on the condition.
Is there a specific renderer available for Combobox?