| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library web_ui.observe.list; | 5 library web_ui.observe.list; |
| 6 | 6 |
| 7 import 'dart:collection'; |
| 8 |
| 7 import 'observable.dart'; | 9 import 'observable.dart'; |
| 8 import 'package:web_ui/src/utils_observe.dart' show Arrays, ListMixinWorkaround; | 10 import 'package:web_ui/src/utils_observe.dart' show Arrays; |
| 9 | 11 |
| 10 /** | 12 /** |
| 11 * Represents an observable list of model values. If any items are added, | 13 * Represents an observable list of model values. If any items are added, |
| 12 * removed, or replaced, then observers that are registered with | 14 * removed, or replaced, then observers that are registered with |
| 13 * [observe] will be notified. | 15 * [observe] will be notified. |
| 14 */ | 16 */ |
| 15 class ObservableList<E> extends ListMixinWorkaround with Observable | 17 class ObservableList<E> extends ListBase<E> with Observable { |
| 16 implements List<E> { | |
| 17 | 18 |
| 18 /** The inner [List<E>] with the actual storage. */ | 19 /** The inner [List<E>] with the actual storage. */ |
| 19 final List<E> _list; | 20 final List<E> _list; |
| 20 | 21 |
| 21 /** | 22 /** |
| 22 * Creates an observable list of the given [length]. | 23 * Creates an observable list of the given [length]. |
| 23 * | 24 * |
| 24 * If no [length] argument is supplied an extendable list of | 25 * If no [length] argument is supplied an extendable list of |
| 25 * length 0 is created. | 26 * length 0 is created. |
| 26 * | 27 * |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 157 |
| 157 String toString() { | 158 String toString() { |
| 158 if (observeReads) { | 159 if (observeReads) { |
| 159 for (int i = 0; i < length; i++) { | 160 for (int i = 0; i < length; i++) { |
| 160 notifyRead(this, ChangeRecord.INDEX, i); | 161 notifyRead(this, ChangeRecord.INDEX, i); |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 return _list.toString(); | 164 return _list.toString(); |
| 164 } | 165 } |
| 165 } | 166 } |
| OLD | NEW |