Unanswered: Application with several Viewports?
I'm trying to find a best way to structure an application that has several main views: main application view, administration view, configuration view. Right now I have only main - actually a Viewport with border layout. I think that I can "throw away" previous view when switching to next one, as this is rarely done, and I don't need to come back to previously rendered view.
My first idea was to create separate Viewports, and create them when needed. Now I get an impression, that I should have only one "master" viewport for application and switch between panels?
I would like to avoid even deeper nesting of components like Viewport - CardLayout (panels) - content.
What is the best way of switching between viewports or is this not recommended at all?
Can someone suggest what would be the best way of handling that?
Do any of our online examples emulate the behavior you are looking for?
You should only have 1 viewport per application.
You can destroy a viewport and manually create a new one. I've done it on occasions where I didn't have full control over what I was being fed. Generally you'd be better off just removing all the children of the viewport and replacing them with new children.
Hi, thanks for your input! I have created a layout that is organized this way now:
MasterViewport (card layout) consists of:
-- collection of main views / panels like master app, administration, etc (each with border layout) consists of:
-- -- panels, grids, tree views etc
It works fine for now, I was only worried of adding another nesting level of viewport + extra panel.
In worst case I have Viewport -> panel -> panel -> tab panel -> grid panel nesting.
Whats more, in 90% of time users will only use main panel (main card).
Tags for this Thread