Reset the MainWindow and its Components.

Hi, Wondering how do we reset all the components in a window to the initial state. I have a mainWindow and couple of Panels in it. In a flow I navigate through couple of Panels. I need to reset all the panels and components to the initial state if I click Cancel on any of the panels in the flow and return to the main screen. I was able to return to the main screen by replacing the Panel in the Window but not able to Reset the panels. All the fields in the panel that are selected before are still existing. would appreciate any kind of help. Thanks.

This sounds like a matter of application logic.

If you need to reinitialize the UI, just rebuild it from scratch. The UI is contained in the root layout of the main window, which you can set and re-set with getMainWindow().setContent().

You could also call close() for the application object, which then by default redirects to itself and restarts, but that’s a bit heavy operation and is rarely done except for user logout.

Thanks, I think reinitialize is the best option for me rather then closing the complete application. Not sure if “application.close()” is better option when you are in middle of the application. I instantiated the value of the same component to “null” and reconstructed the component again. That works fine for me.