I am using a derived FormFieldFactory to customize the appearance of fields on a form. I’ve overridden the createField and it is working well:
@Override
public Field createField(Item item, Object propertyId, Component uiContext) {
Field field = DefaultFieldFactory.get().createField(item, propertyId, uiContext);
if (propertyId.equals("exportProps"))
field = null;
else if (propertyId.equals("exportProps.jobName")) {
field.setCaption("Job Name");
} else if (propertyId.equals("exportProps.email")) {
field.setCaption("Email");
} else if (propertyId.equals("DL_URL")) {
String tt = (String) item.getItemProperty("DL_URL").getValue();
field.setDescription(tt);
field.setCaption("Download URL");
} else if (propertyId.equals("log_URL")) {
String tt = (String) item.getItemProperty("log_URL").getValue();
field.setDescription(tt);
field.setCaption("Log URL");
}
if (field != null) {
field.setReadOnly(true);
field.setWidth("100%");
}
return field;
}
For the URLs, I’d like to display them in Link … but Link does not derive from Field. I’m about to implement a CustomField to do this… but I’m having a hard time convincing myself that I’m not missing something fundamental: Is it really the case that everyone re-invents this everytime s/he needs a data-bound hyperlink? What should I do?
I’m Vaadin 6.