Application "refresh" after form submission

Hi all,

I’m pretty new to Vaadin.

I’m adding a registration window (modal) and I want to refresh the application once registration form has been committed.
The reason I need to refresh is because I want the user to be immediately logged-in once registration is completed successfully, and I have some logic in one of the apps components that builds the layout according to whether a user is logged in or not.
For example:


if (null == getUser()) {
//create the layout for users which are NOT logged-in
} else {
//create the layout for users which ARE logged-in


So, in short, given I have the Application object at hand, how do I trigger a “refresh” of the application so that the application will be recreated with the new layout?

As I mentioned, I’m new to Vaadin, so my approach/design might be fundamentally flawed - therefore, I would also love to hear any other suggested approach which will not require a “refresh” to rebuild the application layout.



Your thinking about Vaadin-Applications is flawed, because you are thinking in a webpage-way. A better approach would be to think in a Rich-Client-Way about it. So you need a method that rebuilds your layout and gets triggered by the Button.ClickListener of your Login-Form. It you are using Vaadin 7, using Views might be the best.

Thanks Tobias.

From within Button.ClickListener.buttonClick(ClickEvent event) of my form, I’m calling an Application method simply rebuilds the main application window (a new Window instance with new layout which is set using setMainWindow(…) ), yet I’m not seeing the changes on the client side. I’m probably doing something wrong.

Also, could you refer me to some docs describing Views in Vaadin 7. (I’m currently using 6.8)



Ok. Found some good leads on this issue:

And also:

I’ll keep this thread updated.