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

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

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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
« no previous file with comments | « samples/ui_lib/base/Size.dart ('k') | samples/ui_lib/observable/observable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** A change to an observable instance. */ 5 /** A change to an observable instance. */
6 class ChangeEvent { 6 class ChangeEvent {
7 // TODO(sigmund): capture language issues around enums & create a cannonical 7 // TODO(sigmund): capture language issues around enums & create a cannonical
8 // Dart enum design. 8 // Dart enum design.
9 /** Type denoting an in-place update event. */ 9 /** Type denoting an in-place update event. */
10 static const UPDATE = 0; 10 static const UPDATE = 0;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 List<ChangeEvent> events; 65 List<ChangeEvent> events;
66 66
67 EventSummary(this.target) : events = new List<ChangeEvent>(); 67 EventSummary(this.target) : events = new List<ChangeEvent>();
68 68
69 void addEvent(ChangeEvent e) { 69 void addEvent(ChangeEvent e) {
70 events.add(e); 70 events.add(e);
71 } 71 }
72 72
73 /** Notify listeners of [target] and parents of [target] about all changes. */ 73 /** Notify listeners of [target] and parents of [target] about all changes. */
74 void notify() { 74 void notify() {
75 if (!events.isEmpty()) { 75 if (!events.isEmpty) {
76 for (Observable obj = target; obj != null; obj = obj.parent) { 76 for (Observable obj = target; obj != null; obj = obj.parent) {
77 for (final listener in obj.listeners) { 77 for (final listener in obj.listeners) {
78 listener(this); 78 listener(this);
79 } 79 }
80 } 80 }
81 } 81 }
82 } 82 }
83 } 83 }
84 84
85 /** A listener of change events. */ 85 /** A listener of change events. */
86 typedef void ChangeListener(EventSummary events); 86 typedef void ChangeListener(EventSummary events);
OLDNEW
« no previous file with comments | « samples/ui_lib/base/Size.dart ('k') | samples/ui_lib/observable/observable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698