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

Side by Side Diff: runtime/observatory/lib/src/elements/nav/refresh.dart

Issue 2345023003: Use dartfmt on Observatory code (Closed)
Patch Set: merge Created 4 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:observatory/src/elements/helpers/tag.dart'; 7 import 'package:observatory/src/elements/helpers/tag.dart';
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 9
10 class RefreshEvent { 10 class RefreshEvent {
11 final NavRefreshElement element; 11 final NavRefreshElement element;
12 RefreshEvent(this.element); 12 RefreshEvent(this.element);
13 } 13 }
14 14
15 class NavRefreshElement extends HtmlElement implements Renderable { 15 class NavRefreshElement extends HtmlElement implements Renderable {
16 static const tag = const Tag<NavRefreshElement>('nav-refresh'); 16 static const tag = const Tag<NavRefreshElement>('nav-refresh');
17 17
18 RenderingScheduler _r; 18 RenderingScheduler _r;
19 19
20 Stream<RenderedEvent<NavRefreshElement>> get onRendered => _r.onRendered; 20 Stream<RenderedEvent<NavRefreshElement>> get onRendered => _r.onRendered;
21 21
22 final StreamController<RefreshEvent> _onRefresh = 22 final StreamController<RefreshEvent> _onRefresh =
23 new StreamController<RefreshEvent>.broadcast(); 23 new StreamController<RefreshEvent>.broadcast();
24 Stream<RefreshEvent> get onRefresh => _onRefresh.stream; 24 Stream<RefreshEvent> get onRefresh => _onRefresh.stream;
25 25
26 bool _disabled; 26 bool _disabled;
27 String _label; 27 String _label;
28 28
29 bool get disabled => _disabled; 29 bool get disabled => _disabled;
30 String get label => _label; 30 String get label => _label;
31 31
32 set disabled(bool value) => _disabled = _r.checkAndReact(_disabled, value); 32 set disabled(bool value) => _disabled = _r.checkAndReact(_disabled, value);
33 set label(String value) => _label = _r.checkAndReact(_label, value); 33 set label(String value) => _label = _r.checkAndReact(_label, value);
34 34
35 factory NavRefreshElement({String label: 'Refresh', bool disabled: false, 35 factory NavRefreshElement(
36 RenderingQueue queue}) { 36 {String label: 'Refresh', bool disabled: false, RenderingQueue queue}) {
37 assert(label != null); 37 assert(label != null);
38 assert(disabled != null); 38 assert(disabled != null);
39 NavRefreshElement e = document.createElement(tag.name); 39 NavRefreshElement e = document.createElement(tag.name);
40 e._r = new RenderingScheduler(e, queue: queue); 40 e._r = new RenderingScheduler(e, queue: queue);
41 e._label = label; 41 e._label = label;
42 e._disabled = disabled; 42 e._disabled = disabled;
43 return e; 43 return e;
44 } 44 }
45 45
46 NavRefreshElement.created() : super.created(); 46 NavRefreshElement.created() : super.created();
(...skipping 30 matching lines...) Expand all
77 void _refresh(RefreshEvent e) { 77 void _refresh(RefreshEvent e) {
78 if (_disabled) return; 78 if (_disabled) return;
79 _onRefresh.add(e); 79 _onRefresh.add(e);
80 } 80 }
81 81
82 void refresh() { 82 void refresh() {
83 if (_disabled) return; 83 if (_disabled) return;
84 _refresh(new RefreshEvent(this)); 84 _refresh(new RefreshEvent(this));
85 } 85 }
86 } 86 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/notify_exception.dart ('k') | runtime/observatory/lib/src/elements/nav/top_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698