Hello all,
I am new to Vaadin; I’ve been learning by writing simple apps for the last couple of months after switching over from Wicket. I have tried using the GridLayout (and GridForm add-on??) to handle complex form layouts. I am now looking at the Custom Layout and after reading as many threads as I can find I think I understand how to submit complex forms but would like to get feedback before starting down that path. Here goes:
- Create a Form class instance and assign it a BeanItem datasource containing the POJO that the form fields will map to and from
- Create an HTML file containing the complex form layout required by the business entities (do not add the <form ,> tag to the html file)
- Use as the placeholders for the html file’s html component tags (<input …>, <select …>, etc.)
- Use the customLayout.addComponent(<vaadin_component>, ) method to bind the Vaadin components to the html template file fields
5.Bind a Vaadin Button to the HTML file’s submit button and create an anon listener that contains the method to call for data persistence or updates - Use a FormFIeldFactory class to assign Ajaxable behaviour to html field components (remember to set fieldFactory on Form instance)
I believe this is the correct way to bind an HTML form for create/update to a Vaadin Form when using the Custom Layout - is this a correct assumption?
Also, the normal rules still apply to the Vaadin form creation:
- You still have to set the fields that you want to be visable using a collection or object array.
- You still need to add a submit button with an "addListener(…) " listener attached.
- Basically you have just replaced the normal FormLayout class with an CustomLayout class and provided an external template file.
Thanks,
Darryl