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

Side by Side Diff: runtime/observatory/lib/src/elements/curly_block.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) 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 curly_block_element; 5 library curly_block_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:observatory/src/elements/helpers/tag.dart'; 9 import 'package:observatory/src/elements/helpers/tag.dart';
10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
(...skipping 19 matching lines...) Expand all
30 Iterable<Element> _content = const []; 30 Iterable<Element> _content = const [];
31 31
32 bool get expanded => _expanded; 32 bool get expanded => _expanded;
33 bool get disabled => _disabled; 33 bool get disabled => _disabled;
34 Iterable<Element> get content => _content; 34 Iterable<Element> get content => _content;
35 35
36 set expanded(bool value) { 36 set expanded(bool value) {
37 if (_expanded != value) _onToggle.add(new CurlyBlockToggleEvent(this)); 37 if (_expanded != value) _onToggle.add(new CurlyBlockToggleEvent(this));
38 _expanded = _r.checkAndReact(_expanded, value); 38 _expanded = _r.checkAndReact(_expanded, value);
39 } 39 }
40
40 set disabled(bool value) => _disabled = _r.checkAndReact(_disabled, value); 41 set disabled(bool value) => _disabled = _r.checkAndReact(_disabled, value);
41 set content(Iterable<Element> value) { 42 set content(Iterable<Element> value) {
42 _content = value.toList(); 43 _content = value.toList();
43 _r.dirty(); 44 _r.dirty();
44 } 45 }
45 46
46 factory CurlyBlockElement({bool expanded: false, bool disabled: false, 47 factory CurlyBlockElement(
47 RenderingQueue queue}) { 48 {bool expanded: false, bool disabled: false, RenderingQueue queue}) {
48 assert(expanded != null); 49 assert(expanded != null);
49 assert(disabled != null); 50 assert(disabled != null);
50 CurlyBlockElement e = document.createElement(tag.name); 51 CurlyBlockElement e = document.createElement(tag.name);
51 e._r = new RenderingScheduler(e, queue: queue); 52 e._r = new RenderingScheduler(e, queue: queue);
52 e._expanded = expanded; 53 e._expanded = expanded;
53 e._disabled = disabled; 54 e._disabled = disabled;
54 e._r.enable(); 55 e._r.enable();
55 return e; 56 return e;
56 } 57 }
57 58
58 CurlyBlockElement.created() : super.created(); 59 CurlyBlockElement.created() : super.created();
59 60
60 @override 61 @override
61 void attached() { super.attached(); _r.enable(); } 62 void attached() {
63 super.attached();
64 _r.enable();
65 }
62 66
63 @override 67 @override
64 void detached() { 68 void detached() {
65 super.detached(); _r.disable(notify: true); 69 super.detached();
70 _r.disable(notify: true);
66 children = []; 71 children = [];
67 } 72 }
68 73
69 void toggle() { 74 void toggle() {
70 if (disabled) { 75 if (disabled) {
71 _r.scheduleNotification(); 76 _r.scheduleNotification();
72 return; 77 return;
73 } 78 }
74 expanded = !expanded; 79 expanded = !expanded;
75 } 80 }
76 81
77 void render() { 82 void render() {
78 List<Element> content = [ 83 List<Element> content = [new SpanElement()..text = '{'];
79 new SpanElement()..text = '{'
80 ];
81 SpanElement label = new SpanElement() 84 SpanElement label = new SpanElement()
82 ..classes = disabled ? ['curly-block', 'disabled'] : ['curly-block'] 85 ..classes = disabled ? ['curly-block', 'disabled'] : ['curly-block']
83 ..innerHtml = expanded ? 86 ..innerHtml = expanded
84 '&nbsp;&nbsp;&#8863;&nbsp;&nbsp;' : '&nbsp;&nbsp;&#8862;&nbsp;&nbsp;'; 87 ? '&nbsp;&nbsp;&#8863;&nbsp;&nbsp;'
88 : '&nbsp;&nbsp;&#8862;&nbsp;&nbsp;';
85 if (disabled) { 89 if (disabled) {
86 content.add(label); 90 content.add(label);
87 } else { 91 } else {
88 content.add(new AnchorElement() 92 content.add(new AnchorElement()
89 ..onClick.listen((_) { toggle(); }) 93 ..onClick.listen((_) {
94 toggle();
95 })
90 ..children = [label]); 96 ..children = [label]);
91 } 97 }
92 if (expanded) { 98 if (expanded) {
93 content.add(new BRElement()); 99 content.add(new BRElement());
94 content.addAll(_content); 100 content.addAll(_content);
95 } 101 }
96 content.add(new SpanElement()..text = '}'); 102 content.add(new SpanElement()..text = '}');
97 children = content; 103 children = content;
98 } 104 }
99 } 105 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/cpu_profile_table.dart ('k') | runtime/observatory/lib/src/elements/debugger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698