PDA

View Full Version : Application with several Viewports?



MaciejZabielski
16 Oct 2012, 2:14 AM
Hi,

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?
Thank you!

Best regards,
Mike

scottmartin
16 Oct 2012, 6:41 AM
Do any of our online examples emulate the behavior you are looking for?

You should only have 1 viewport per application.

Scott.

skirtle
16 Oct 2012, 9:50 AM
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.

MaciejZabielski
17 Oct 2012, 6:48 AM
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).