tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/741-update-browsermanager-instanceRobotlegs: Discussion 2012-01-05T12:59:51Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/119338952011-12-06T22:29:23Z2011-12-08T18:20:15ZImplement MVP in robotlegs<div><p>I have a Flex web app that I am converting to a Robotlegs web
app<br>
It uses a BrowserManager .<br>
What is the best practice for integrating the BrowserManager into
Robotlegs?</p>
<p>ie. I have a number of mvcs.Command's that need to update a
BrowserManager instance</p>
<p>Should I create a class that extends Actor and Inject that into
the Commands to handle the browser updates ?<br>
Any suggestions would be greatly appreciated.</p>
<pre>
<code>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");
}
}</code>
</pre></div>davektag:robotlegs.tenderapp.com,2009-10-18:Comment/119338952011-12-08T12:13:39Z2011-12-08T12:27:28ZImplement MVP in robotlegs<div><p>Hi Davek,</p>
<p>Sorry for the late answer, but your post has been deleted for
some reasons. The Tender spam filter is sometimes too strict, I
guess.</p>
<p>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)</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/119338952011-12-08T17:07:00Z2011-12-08T17:17:15ZImplement MVP in robotlegs<div><p>Hi Ondina,<br>
The web app I am converting is the AdobeShoppingCart<br>
<a href=
"http://www.adobe.com/devnet/flex/articles/web-mobile-reference-apps.html">
http://www.adobe.com/devnet/flex/articles/web-mobile-reference-apps...</a></p>
<p>It is based on the MVP (Model View Presenter) design pattern</p>
<p>The documentation says:<br>
If you are using a framework like Swiz or Robotlegs wiring of the
Presenters<br>
and Controllers will most likely happen with framework code</p>
<p>The Presenters are instantiated with an EventDispatcher
argument.</p>
<p>I want to "wire" the Presenters and Controller in robotlegs.<br>
Should the Presenters and Controller extend Actor instead of
EventDispatcher?<br>
Inject the Presenter and Controller into the
ItemListViewMediator?<br>
How do I resolve the EventDispatcher argument to the Presenter?</p>
<pre>
<code>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;
}
}
ItemListView.mxml
....
{
presenter = AppModel.getInstance().itemListBlendedPresenter;
}</code>
</pre></div>davektag:robotlegs.tenderapp.com,2009-10-18:Comment/119338952011-12-08T18:00:34Z2011-12-08T18:00:34ZImplement MVP in robotlegs<div><p>Hi:)</p>
<p>Disclaimer: I’m not using the MVP pattern, so I
can’t help you very much. Sorry about that.</p>
<p>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)</p>
<p>Anyway, I hope somebody else, with MVP experience, will chime in
and help you with it.<br>
You can also search the forum for ViewMap, Presenter, MVP...there
are many discussion about this topic.</p>
<p>One of them:<br>
<a href=
"http://knowledge.robotlegs.org/discussions/suggestions/6-presentation-model-vs-mediator-design-pattern">
http://knowledge.robotlegs.org/discussions/suggestions/6-presentati...</a></p></div>Ondina D.F.