Composite Item

Hi

I noticed I need to be able to join features of PropertysetItem and BeanItem. I did not find anything in Vaadin core so I added CompositeItem to Lazy Query Container which is used as follows:


        private Item toItem(Task task) {
            BeanItem<Task> beanItem= new BeanItem<Task>(task);
            
            CompositeItem compositeItem=new CompositeItem();
            
            compositeItem.addItem("task", beanItem);
            
            for(Object propertyId : definition.getPropertyIds()) {               
            	if(compositeItem.getItemProperty(propertyId)==null) {
            		compositeItem.addItemProperty(propertyId,new ObjectProperty(
            				definition.getPropertyDefaultValue(propertyId),
            				definition.getPropertyType(propertyId),
            				definition.isPropertyReadOnly(propertyId)));
            	}
            }
            
            return compositeItem;
        }

Do you think this is generally useful and a good feature to vaadin core? Does it even exist in some form already and I just missed it?

-Tommi

Yes, I think this could be a useful item type. It could be useful for adding item properties, such as for row header caption and icon properties in a Table or item icon properties in Tree and other selection components.

Taken that the current container implementations do not allow adding items that were created outside the container, also a new container type would be needed.

I think it has potential for the core. I added a feature request ticket (
#6305
). We’ll see if it gets accepted at some point.