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:

[font=Courier New]
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
}
})

[/font]
It works, thank you.