I apologize in advance for this question as I know there is a simple answer, I just can’t seem to find it.
I have a class that extends Form and binds the form to a BeanItem of lets say NewEntry where NewEntry contains a Submitter like follows:
public class NewEntry implements Serializable {
private Date dateOfEntry;
private String comments;
private Submitter submitter;
...
}
and Submitter:
public class Submitter implements Serializable {
private firstName;
private lastName;
....
}
From within my form I then have my attachField to layout the form with a GridLayout. When I inspect the propertyId and field in attachField I can see that Submitter is in fact a propertyId, I just don’t understand how to get it to be bound properly to show up in the form as part of the NewEntry.
NewEntry in the form class is bound to the form:
public class MyForm extends Form {
public MyForm() {
setItemDataSource(new BeanItem(new NewEntry()));
....
}
}
So simply put, how do I get the Submitter within NewEntry to process as part of the BeanItem? I know this is a simple thing I’m missing, thanks for any pointers to RTFM.
As a practical approach (if you are not having millions of NewEntry objects) I would suggest the following.
Wrap and “flatten” the objects - i.e. Create a simple (inner) class ‘NewEntryUI’ that extends the NewEntry, but adds two delegate functions to Submitter. Then loop through the collection before binding it to Form or Table.
Very easy to generate delegate functions in Eclipse IDE for example and this add extra flexibility to formatting too.
I have used this pattern whenever there is the UI needs a sightly modified version of data. Easy to understand what is happening and makes rest of your code a lot cleaner.
Is there any more infomation or a roadmap for these Form changes? We would like to jump the wagon at the right time - and form configurablity is high on our priority list.