[ALOY-157] All top-level elements in a required view should be added its parent's view hierarchy
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-08-07T06:53:16.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2012 Sprint 16, Release 3.0.0 |
Components | XML |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-07-31T13:33:39.000+0000 |
Updated | 2018-03-07T22:25:44.000+0000 |
Description
For example:
myview.xml
<Alloy>
<View id="view1"/>
<View id="view2"/>
</Alloy>
Currently, if these view is required in the markup, or code, it will attach only the first top-level view to the parent hierarchy.
index.xml
<Alloy>
<Window>
<View require="myview"/>
</Window>
</Alloy>
Would roughly translate to
<Alloy>
<Window>
<View id="view1"/>
</Window>
</Alloy>
We instead want it to return all elements as part of the view hierarchy
<Alloy>
<Window>
<View id="view1"/>
<View id="view2"/>
</Window>
</Alloy>
This will require changes in the View/Widget require parsers, and will also change how the getRoot() function works.
All required views and widgets will return all top level elements to their parent, not just the first top level element now. This also helped flush out a bug where the view hierarchy wasn't established correctly if the only thing inside of a required view was other required views. A brief synopsis of the BaseController changes to facilitate this: * *getRoot()* remains the same and will return the first top level element. Useful as in most cases only one element is desired, even though the elements are now stored as an array. * *getRoots()* now returns the full array of top level elements belonging to a controler * *addRoot()* will add a new top level element to a controller's collection. This will likely never be used by developers and is currently only used by Alloy when establishing view hierarchy from markup. Eventually this may prove useful to developers if we further separate the controller lifecycle