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 // This file contains View framework classes. | 5 // This file contains View framework classes. |
6 // As it grows, it may need to be split into multiple files. | 6 // As it grows, it may need to be split into multiple files. |
7 | 7 |
8 /** A factory that creates a view from a data model. */ | 8 /** A factory that creates a view from a data model. */ |
9 abstract class ViewFactory<D> { | 9 abstract class ViewFactory<D> { |
10 View newView(D item); | 10 View newView(D item); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 void onSelectedItemChange() { | 163 void onSelectedItemChange() { |
164 // TODO(rnystrom): use Observable to track the last value of _selectedItem | 164 // TODO(rnystrom): use Observable to track the last value of _selectedItem |
165 // rather than tracking it ourselves. | 165 // rather than tracking it ourselves. |
166 _select(findIndex(_lastSelectedItem), false); | 166 _select(findIndex(_lastSelectedItem), false); |
167 _select(findIndex(_selectedItem.value), true); | 167 _select(findIndex(_selectedItem.value), true); |
168 _lastSelectedItem = _selectedItem.value; | 168 _lastSelectedItem = _selectedItem.value; |
169 } | 169 } |
170 | 170 |
171 Collection<View> get childViews { | 171 Collection<View> get childViews { |
172 return _itemViews.getValues(); | 172 return _itemViews.values; |
173 } | 173 } |
174 | 174 |
175 void _onClick(MouseEvent e) { | 175 void _onClick(MouseEvent e) { |
176 int index = _findAssociatedIndex(e.target); | 176 int index = _findAssociatedIndex(e.target); |
177 if (index != null) { | 177 if (index != null) { |
178 _selectedItem.value = _data[index]; | 178 _selectedItem.value = _data[index]; |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 int _findAssociatedIndex(Node leafNode) { | 182 int _findAssociatedIndex(Node leafNode) { |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 976 |
977 container = node.query('.dialog-body'); | 977 container = node.query('.dialog-body'); |
978 container.nodes.add(_content.node); | 978 container.nodes.add(_content.node); |
979 | 979 |
980 return node; | 980 return node; |
981 } | 981 } |
982 | 982 |
983 /** Override to handle dialog done. */ | 983 /** Override to handle dialog done. */ |
984 void onDone() { } | 984 void onDone() { } |
985 } | 985 } |
OLD | NEW |