Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
JPAContainer FieldFactory properties caption
Hi,
how do you change caption of JPAContainer FieldFactory fields?
As I recall FieldFactory uses DefaultFieldFactory.createCaptionByPropertyId for that: FieldFactory - source code.
Thanks in advance,
Etam.
I think you should surround all generated fields with protected Field configureBasicFields(Field field) method for clients to extend it.
Hi,
That is an option, but maybe better would be a separate configureFieldCaption method that users could override.
Currently you could override the createField method (or actually both of them) and configure captions there.
cheers,
matti
I have overriden createField method:
setFormFieldFactory(new FieldFactory {
override def createField(item: Item,
propertyId: Object,
uiContext: Component) = {
val field = super.createField(item, propertyId, uiContext)
if (field != null && !captions.isEmpty) {
for(caption <- captions.get(propertyId.asInstanceOf[String])) {
field.setCaption(caption)
}
}
field
}
})
It works, thank you.