jeudi 3 novembre 2016

Setting Vaadin item caption property for generated classes

I have multiple classes generated from a schema (.xsd) using jaxb. I need to use instances of those classes as tree items in Vaadin. For this, I needed to have a property that all the classes contain, to use as their caption.

What I initially did was modifying the schema, and making all classes subclass TreeItemBaseContainer, a simple class that only has an attribute namein it, and which in turn subclasses Vaadin's HierarchicalContainer.

This worked perfectly, since now all objects have a nameattribute, and I could simply use

tree.setItemCaptionPropertyId("name");

The problem now is that the project manager did not approve changing the schema, and I need a different way (or workaround) of including some property into all the classes.





Aucun commentaire:

Enregistrer un commentaire