Adding ContainerViews to a Card Container manually

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding ContainerViews to a Card Container manually

Mikael Svane
In a project that I am working on, I use a card container with cards
(ContainerViews). The card container has two cards, one - the first - that
is always the same and one that, when the main view is shown, is chosen from
a collection of three cards. Instead of programmatically creating one of the
three cards when the view is shown, is it possible to create them in the
View Composer, save them and then load and add the correct one to the card
container when the view is opened? In that case, how do I create a view that
is neither a Shell view nor a Dialog view in the View Composer and how do I
load the saved view and add it to the card container?

Or perhaps it is better to add all four cards to the container in the View
Composer and then hide or remove the irrelevant ones when the view is
opened?

Best regards,

Mikael Svane


Reply | Threaded
Open this post in threaded view
|

Re: Adding ContainerViews to a Card Container manually

Christopher J. Demers
"Mikael Svane" <[hidden email]> wrote in message
news:bvmidu$tid9s$[hidden email]...
> In a project that I am working on, I use a card container with cards
> (ContainerViews). The card container has two cards, one - the first - that
> is always the same and one that, when the main view is shown, is chosen
from
> a collection of three cards. Instead of programmatically creating one of
the
> three cards when the view is shown, is it possible to create them in the
> View Composer, save them and then load and add the correct one to the card
> container when the view is opened? In that case, how do I create a view
that
> is neither a Shell view nor a Dialog view in the View Composer and how do
I
> load the saved view and add it to the card container?

Yes, you can do what you want to do.  You can create a Presenter
subclass(es) that contain(s) the view or views you want to use in the card
container.  Take a look at the method ClassBrowserAbstract<<createPlugins to
see how to add a view to a card container.  That code adds the Class Diagram
tab to the class browser and is called indirectly from the onViewOpened
method.

Chris


Reply | Threaded
Open this post in threaded view
|

Re: Adding ContainerViews to a Card Container manually

Chris Uppal-3
In reply to this post by Mikael Svane
Mikael Svane wrote:

> Or perhaps it is better to add all four cards to the container in the View
> Composer and then hide or remove the irrelevant ones when the view is
> opened?

Another option would be to split the tab widget off from the 'cards' (how the
tabbed view does it internally).

You create a ListPresenter.'Tab view' above (north of) a Presenter.'Wizard card
container'.  You add as many cards to the card container as you like.

At runtime, you can then add as many items as you like to the ListPresenter's
model -- Strings, say, or Symbols -- these are used as the labels.  You also
listen for selection changes in the list presenter, and respond by changing the
current card in the card presenter to whatever you consider appropriate.

    -- chris