Hello All,
I’m trying to create a simple application with login view and couple of other views. The login view has single layout and only the login component. Other views (view1 and view2) have a header, left navigation and content region. I’m using a single UI class to load the login page first and redirect to view1 on successful navigation. What are the different ways to achieve a common seperate layouts for multiple views, one for login and other for view1 and view2(header,left nav and content region)?
Should two UI classes be used? If so, how navigation between each UI and views is done? how to persist session data between two UI’s?
Should I create a common layout class and add that in each views?
Not sure if I understand your question. Why should you need several UIs? Just decompose your views to several fragments (Java classes for different panels, abstract classes to inherit common behaviour) and construct your views with them.
In this case, shouldn’t I add the common components for each view every time? I want to create the common layout separately and include view as part of common layout.
Consider using an MVC pattern. The UI class should be quite empty exept for some boot-up code. Make a Java class per view. If they have things in common, refactor them into seperate classes for reuse. Make a Java class per controller. Let the controllers open and close their views by adding and removing them from the UI.