Implement MVP in robotlegs

davek's Avatar


06 Dec, 2011 10:29 PM

I have a Flex web app that I am converting to a Robotlegs web app
It uses a BrowserManager .
What is the best practice for integrating the BrowserManager into Robotlegs?

ie. I have a number of mvcs.Command's that need to update a BrowserManager instance

Should I create a class that extends Actor and Inject that into the Commands to handle the browser updates ?
Any suggestions would be greatly appreciated.

public class MyBrowserManager extends Actor
        private var browserManager:IBrowserManager;

        public function MyBrowserManager ()
              browserManager = BrowserManager.getInstance();
              browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, changeHandler, false, 0, true);
              browserManager.init("state=" + StateEnum.HOME_STATE, "Cart");
              browserManager.setTitle("Cart - Home");
  1. Support Staff 1 Posted by Ondina D.F. on 08 Dec, 2011 12:13 PM

    Ondina D.F.'s Avatar

    Hi Davek,

    Sorry for the late answer, but your post has been deleted for some reasons. The Tender spam filter is sometimes too strict, I guess.

    Of course, you can use an Actor for your BrowserManager and a Command to facilitate communication with the Mediator of a NavigatorView(or however you’d call it)

  2. 2 Posted by davek on 08 Dec, 2011 05:07 PM

    davek's Avatar

    Hi Ondina,
    The web app I am converting is the AdobeShoppingCart

    It is based on the MVP (Model View Presenter) design pattern

    The documentation says:
    If you are using a framework like Swiz or Robotlegs wiring of the Presenters
    and Controllers will most likely happen with framework code

    The Presenters are instantiated with an EventDispatcher argument.

    I want to "wire" the Presenters and Controller in robotlegs.
    Should the Presenters and Controller extend Actor instead of EventDispatcher?
    Inject the Presenter and Controller into the ItemListViewMediator?
    How do I resolve the EventDispatcher argument to the Presenter?

    public class AppController extends EventDispatcher
        appModel.itemListBlendedPresenter = new ItemListPresenter(this);
    public class ItemListPresenter extends EventDispatcher
        public function ItemListPresenter(dispatcher:EventDispatcher)
            // Set (Inject) the object to dispatch events on
            this.dispatcher = dispatcher;
        presenter = AppModel.getInstance().itemListBlendedPresenter;
  3. Support Staff 3 Posted by Ondina D.F. on 08 Dec, 2011 06:00 PM

    Ondina D.F.'s Avatar


    Disclaimer: I’m not using the MVP pattern, so I can’t help you very much. Sorry about that.

    Instead of the MediatorMap you’ll have to use the ViewMap to perform injections into your Views. If you use both, there are performance issues as far as I know. (I think rl2 will provide a better solution for the MVP)

    Anyway, I hope somebody else, with MVP experience, will chime in and help you with it.
    You can also search the forum for ViewMap, Presenter, MVP...there are many discussion about this topic.

    One of them:

  4. Ondina D.F. closed this discussion on 05 Jan, 2012 09:05 AM.

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

Keyboard shortcuts


? 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