tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/553-viewmanager-what-is-it-forRobotlegs: Discussion 2018-10-18T16:35:44Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/215153132012-11-26T19:41:43Z2012-11-26T19:41:43ZViewManager -> what is it for?<div><p>Hi Vjeko,</p>
<p>Good point! I need to add a readme for that one, but it's pretty
involved..</p>
<p>The ViewManager is the bridge between a context and the central
view container registry. The container registry keeps track of all
registered containers (usually Context Views) and sorts them
hierarchically. When view objects land on stage they are passed
through to the appropriate contexts to handle based on this
hierarchy.</p>
<p>In the MVCSBundle a configuration is installed that looks like
this:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/blob/master/src/robotlegs/bender/extensions/contextView/ContextViewListenerConfig.as">
https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...</a></p>
<p>As you can see it simply registers the Context View as a
container with the View Manager. Extensions like the Mediator Map
register themselves as view handlers with the View Map:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/blob/master/src/robotlegs/bender/extensions/mediatorMap/MediatorMapExtension.as#L61">
https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...</a></p>
<p>The only time you'd actually use the View Manager directly is
when dealing with Flex PopUps or Air Windows. Using the View
Manager you can register these containers (which live on a separate
Display List) as "view roots" so that your extensions can observe
views landing in them.</p>
<p>Also, worth noting is that the MVCSBundle installs the
StageObserver extension which is the final piece in the puzzle:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/blob/master/src/robotlegs/bender/extensions/viewManager/impl/StageObserver.as">
https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...</a></p>
<p>All of this is an approach to dealing with modular, hierarchical
contexts whilst trying to keep the overhead of the bubbling
<code>addedToStage</code> listener to a minimum. Without this, the
listeners might overlap, severely degrading performance.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/215153132012-11-27T07:49:13Z2012-11-27T07:49:13ZViewManager -> what is it for?<div><p>Hej Shaun, thanks for the answer! Much clearer now.<br>
Vjeko</p></div>Vj3k0