Best Practice for creae and add new views

Enrique's Avatar

Enrique

18 Jun, 2011 10:57 PM

Hi ! I need to create some views dynamically in my app, and I know that I can do it in many ways, but I want to know if you have some recommendations or "best practices" for this.

I've read this related post:
http://groups.google.com/group/robotlegs/browse_thread/thread/9279d...

My situation is a bit different because the views can be created at any time (not only on startup).

Basically, when a user click something, a new UIComponent is added to some Container.
I thought in 3 solutions:
1) The new view is created in a command, and added to the container in that command too. (Idon't like this option because the command needs to know about the container).

2) The new view is created and added in the ContextViewMediator. (I think this is OK, but I'm not sure if it's a good practice to dispatch a creation event from a mediator and create a view from another mediator).

3) The new view is created in a Command, sent inside an Event, and added in the ContainerViewMediator, or maybe ContextViewMediator. (This seems the most flexible option, but we need an extra event).

How are you dealing with these situations in your apps?

  1. Support Staff 1 Posted by Ondina D.F. on 22 Jul, 2011 12:53 PM

    Ondina D.F.'s Avatar

    Hi Enrique
    Just wanted to let you know, that, for some reason, there was a spam filter issue on the robotlegs forum.
    That’s why a few posts were visible on the list, but couldn’t be opened, therefore they got no answers.

    I think your post was one of them.

    Stray (from the Support Staff) has fixed the issue.

    Hopefully it’s not too late for you to get your question answered.

    Ondina

  2. 2 Posted by Enrique on 22 Jul, 2011 02:34 PM

    Enrique's Avatar

    Hi Ondina, never is too late to learn something from the experts :)

  3. 3 Posted by visnik on 28 Jul, 2011 06:04 PM

    visnik's Avatar

    I am looking at this very same thing, and was looking at the third solution Enrique was proposing. Is this the best approach and if so how would that work with the mapping and such in the context?

  4. Support Staff 4 Posted by Ondina D.F. on 02 Nov, 2011 05:42 PM

    Ondina D.F.'s Avatar

    Hi Enrique and Visnik
    Do you want to continue this discussion?
    May I close it?
    Thanks,
    Ondina

  5. Ondina D.F. closed this discussion on 16 Nov, 2011 09:10 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac