OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * A View that is composed of child views. | 6 * A View that is composed of child views. |
7 */ | 7 */ |
8 class CompositeView extends View { | 8 class CompositeView extends View { |
9 | 9 |
10 List<View> childViews; | 10 List<View> childViews; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 for (View childView in childViews) { | 57 for (View childView in childViews) { |
58 container.nodes.add(childView.node); | 58 container.nodes.add(childView.node); |
59 } | 59 } |
60 | 60 |
61 return node; | 61 return node; |
62 } | 62 } |
63 | 63 |
64 void afterRender(Element node) { | 64 void afterRender(Element node) { |
65 if (_scrollbar !== null) { | 65 if (_scrollbar != null) { |
66 _scrollbar.initialize(); | 66 _scrollbar.initialize(); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 View addChild(View view) { | 70 View addChild(View view) { |
71 childViews.add(view); | 71 childViews.add(view); |
72 // TODO(rnystrom): Container shouldn't be null. Remove this check. | 72 // TODO(rnystrom): Container shouldn't be null. Remove this check. |
73 if (container !== null) { | 73 if (container != null) { |
74 container.nodes.add(view.node); | 74 container.nodes.add(view.node); |
75 } | 75 } |
76 childViewAdded(view); | 76 childViewAdded(view); |
77 return view; | 77 return view; |
78 } | 78 } |
79 | 79 |
80 void removeChild(View view) { | 80 void removeChild(View view) { |
81 childViews = childViews.filter(bool _(e) { return view != e; }); | 81 childViews = childViews.filter(bool _(e) { return view != e; }); |
82 // TODO(rnystrom): Container shouldn't be null. Remove this check. | 82 // TODO(rnystrom): Container shouldn't be null. Remove this check. |
83 if (container !== null) { | 83 if (container != null) { |
84 view.node.remove(); | 84 view.node.remove(); |
85 } | 85 } |
86 } | 86 } |
87 } | 87 } |
OLD | NEW |