@Override public void updateGrid(Set<Subtitle> subs) { BeanItemContainer<Subtitle> subsContainer = new BeanItemContainer<>(Subtitle.class, subs); GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(subsContainer); gpc.addGeneratedProperty( "delete", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Delete"; } @Override public Class<String> getType() { return String.class; } }); grid.setContainerDataSource(gpc); downloadButton.setEnabled(subs != null && subs.size() > 0); }
@Override public Container createContainer() { EntityContainer<SysConfig> cont = (EntityContainer<SysConfig>) getHelper().createContainer(); GeneratedPropertyContainer gpContainer = new GeneratedPropertyContainer(cont); gpContainer.addGeneratedProperty( "id", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { String id = (String) item.getItemProperty("id").getValue(); return removePrefix(id); } @Override public Class<String> getType() { return String.class; } }); return gpContainer; }