| 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; |
| 11 | 11 |
| 12 // TODO(rnystrom): Allowing this to be public is gross. CompositeView should | 12 // TODO(rnystrom): Allowing this to be public is gross. CompositeView should |
| 13 // encapsulate its markup and provide accessors to do the limited amount of | 13 // encapsulate its markup and provide accessors to do the limited amount of |
| 14 // things that external users need to access this for. | 14 // things that external users need to access this for. |
| 15 Element container; | 15 Element container; |
| 16 | 16 |
| 17 Scroller scroller; | 17 Scroller scroller; |
| 18 Scrollbar _scrollbar; | 18 Scrollbar _scrollbar; |
| 19 | 19 |
| 20 final String _cssName; | 20 final String _cssName; |
| 21 final bool _scrollable; | 21 final bool _scrollable; |
| 22 final bool _vertical; | 22 final bool _vertical; |
| 23 final bool _nestedContainer; | 23 final bool _nestedContainer; |
| 24 final bool _showScrollbar; | 24 final bool _showScrollbar; |
| 25 | 25 |
| 26 CompositeView(String this._cssName, [this._nestedContainer = false, | 26 CompositeView(String this._cssName, [nestedContainer = false, |
| 27 this._scrollable = false, this._vertical = false, | 27 scrollable = false, vertical = false, |
| 28 this._showScrollbar = false]) | 28 showScrollbar = false]) |
| 29 : super(), | 29 : super(), |
| 30 _nestedContainer = nestedContainer, |
| 31 _scrollable = scrollable, |
| 32 _vertical = vertical, |
| 33 _showScrollbar = showScrollbar, |
| 30 childViews = new List<View>() { | 34 childViews = new List<View>() { |
| 31 } | 35 } |
| 32 | 36 |
| 33 Element render() { | 37 Element render() { |
| 34 Element node = new Element.html('<div class="$_cssName"></div>'); | 38 Element node = new Element.html('<div class="$_cssName"></div>'); |
| 35 | 39 |
| 36 if (_nestedContainer) { | 40 if (_nestedContainer) { |
| 37 container = new Element.html('<div class="scroll-container"></div>'); | 41 container = new Element.html('<div class="scroll-container"></div>'); |
| 38 node.nodes.add(container); | 42 node.nodes.add(container); |
| 39 } else { | 43 } else { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 78 } |
| 75 | 79 |
| 76 void removeChild(View view) { | 80 void removeChild(View view) { |
| 77 childViews = childViews.filter(bool _(e) { return view != e; }); | 81 childViews = childViews.filter(bool _(e) { return view != e; }); |
| 78 // TODO(rnystrom): Container shouldn't be null. Remove this check. | 82 // TODO(rnystrom): Container shouldn't be null. Remove this check. |
| 79 if (container !== null) { | 83 if (container !== null) { |
| 80 view.node.remove(); | 84 view.node.remove(); |
| 81 } | 85 } |
| 82 } | 86 } |
| 83 } | 87 } |
| OLD | NEW |