Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: samples/ui_lib/observable/observable.dart

Issue 10928139: Changed interfaces to abstract classes where possible in {lib,samples,pkg} (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #library('observable'); 5 #library('observable');
6 6
7 #import('dart:coreimpl'); 7 #import('dart:coreimpl');
8 8
9 #source('ChangeEvent.dart'); 9 #source('ChangeEvent.dart');
10 #source('EventBatch.dart'); 10 #source('EventBatch.dart');
11 11
12 /** 12 /**
13 * An object whose changes are tracked and who can issue events notifying how it 13 * An object whose changes are tracked and who can issue events notifying how it
14 * has been changed. 14 * has been changed.
15 */ 15 */
16 interface Observable { 16 abstract class Observable {
17 /** Returns a globally unique identifier for the object. */ 17 /** Returns a globally unique identifier for the object. */
18 // TODO(sigmund): remove once dart supports maps with arbitrary keys. 18 // TODO(sigmund): remove once dart supports maps with arbitrary keys.
19 final int uid; 19 int get uid;
20 20
21 /** Listeners on this model. */ 21 /** Listeners on this model. */
22 final List<ChangeListener> listeners; 22 List<ChangeListener> get listeners;
23 23
24 /** The parent observable to notify when this child is changed. */ 24 /** The parent observable to notify when this child is changed. */
25 final Observable parent; 25 Observable get parent;
26 26
27 /** 27 /**
28 * Adds a listener for changes on this observable instance. Returns whether 28 * Adds a listener for changes on this observable instance. Returns whether
29 * the listener was added successfully. 29 * the listener was added successfully.
30 */ 30 */
31 bool addChangeListener(ChangeListener listener); 31 bool addChangeListener(ChangeListener listener);
32 32
33 /** 33 /**
34 * Removes a listener for changes on this observable instance. Returns whether 34 * Removes a listener for changes on this observable instance. Returns whether
35 * the listener was removed successfully. 35 * the listener was removed successfully.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // equality check should be done? 290 // equality check should be done?
291 if (newValue !== _value) { 291 if (newValue !== _value) {
292 final oldValue = _value; 292 final oldValue = _value;
293 _value = newValue; 293 _value = newValue;
294 recordPropertyUpdate("value", newValue, oldValue); 294 recordPropertyUpdate("value", newValue, oldValue);
295 } 295 }
296 } 296 }
297 297
298 T _value; 298 T _value;
299 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698