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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
9 import 'package:observatory/src/elements/helpers/tag.dart'; | 9 import 'package:observatory/src/elements/helpers/tag.dart'; |
10 | 10 |
11 enum ProfileTreeMode { code, function, } | 11 enum ProfileTreeMode { |
| 12 code, |
| 13 function, |
| 14 } |
12 | 15 |
13 class StackTraceTreeConfigChangedEvent { | 16 class StackTraceTreeConfigChangedEvent { |
14 final StackTraceTreeConfigElement element; | 17 final StackTraceTreeConfigElement element; |
15 StackTraceTreeConfigChangedEvent(this.element); | 18 StackTraceTreeConfigChangedEvent(this.element); |
16 } | 19 } |
17 | 20 |
18 class StackTraceTreeConfigElement extends HtmlElement implements Renderable { | 21 class StackTraceTreeConfigElement extends HtmlElement implements Renderable { |
19 static const tag = | 22 static const tag = |
20 const Tag<StackTraceTreeConfigElement>('stack-trace-tree-config'); | 23 const Tag<StackTraceTreeConfigElement>('stack-trace-tree-config'); |
21 | 24 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 ..children = ProfileTreeMode.values.map((mode) { | 181 ..children = ProfileTreeMode.values.map((mode) { |
179 return new OptionElement( | 182 return new OptionElement( |
180 value: modeToString(mode), | 183 value: modeToString(mode), |
181 selected: _mode == mode)..text = modeToString(mode); | 184 selected: _mode == mode)..text = modeToString(mode); |
182 }).toList(growable: false) | 185 }).toList(growable: false) |
183 ..onChange.listen((_) { | 186 ..onChange.listen((_) { |
184 _mode = ProfileTreeMode.values[s.selectedIndex]; | 187 _mode = ProfileTreeMode.values[s.selectedIndex]; |
185 _r.dirty(); | 188 _r.dirty(); |
186 }) | 189 }) |
187 ..onChange.map(_toEvent).listen(_triggerModeChange), | 190 ..onChange.map(_toEvent).listen(_triggerModeChange), |
188 new SpanElement() | 191 new SpanElement()..text = ' $modeDescription' |
189 ..text = ' $modeDescription' | |
190 ]; | 192 ]; |
191 } | 193 } |
192 | 194 |
193 String get directionDescription { | 195 String get directionDescription { |
194 if (_direction == M.ProfileTreeDirection.inclusive) { | 196 if (_direction == M.ProfileTreeDirection.inclusive) { |
195 return 'Tree is rooted at "main". Child nodes are callees.'; | 197 return 'Tree is rooted at "main". Child nodes are callees.'; |
196 } else { | 198 } else { |
197 return 'Tree is rooted at top-of-stack. Child nodes are callers.'; | 199 return 'Tree is rooted at top-of-stack. Child nodes are callers.'; |
198 } | 200 } |
199 } | 201 } |
200 | 202 |
201 List<Element> _createDirectionSelect() { | 203 List<Element> _createDirectionSelect() { |
202 var s; | 204 var s; |
203 return [ | 205 return [ |
204 s = new SelectElement() | 206 s = new SelectElement() |
205 ..classes = ['direction-select'] | 207 ..classes = ['direction-select'] |
206 ..value = directionToString(_direction) | 208 ..value = directionToString(_direction) |
207 ..children = M.ProfileTreeDirection.values.map((direction) { | 209 ..children = M.ProfileTreeDirection.values.map((direction) { |
208 return new OptionElement( | 210 return new OptionElement( |
209 value: directionToString(direction), | 211 value: directionToString(direction), |
210 selected: _direction == direction) | 212 selected: _direction == direction) |
211 ..text = directionToString(direction); | 213 ..text = directionToString(direction); |
212 }).toList(growable: false) | 214 }).toList(growable: false) |
213 ..onChange.listen((_) { | 215 ..onChange.listen((_) { |
214 _direction = M.ProfileTreeDirection.values[s.selectedIndex]; | 216 _direction = M.ProfileTreeDirection.values[s.selectedIndex]; |
215 _r.dirty(); | 217 _r.dirty(); |
216 }) | 218 }) |
217 ..onChange.map(_toEvent).listen(_triggerDirectionChange), | 219 ..onChange.map(_toEvent).listen(_triggerDirectionChange), |
218 new SpanElement() | 220 new SpanElement()..text = ' $directionDescription' |
219 ..text = ' $directionDescription' | |
220 ]; | 221 ]; |
221 } | 222 } |
222 | 223 |
223 List<Element> _createFilter() { | 224 List<Element> _createFilter() { |
224 var t; | 225 var t; |
225 return [ | 226 return [ |
226 t = new TextInputElement() | 227 t = new TextInputElement() |
227 ..placeholder = 'Search filter' | 228 ..placeholder = 'Search filter' |
228 ..value = filter | 229 ..value = filter |
229 ..onChange.listen((_) { | 230 ..onChange.listen((_) { |
(...skipping 24 matching lines...) Expand all Loading... |
254 } | 255 } |
255 | 256 |
256 StackTraceTreeConfigChangedEvent _toEvent(_) { | 257 StackTraceTreeConfigChangedEvent _toEvent(_) { |
257 return new StackTraceTreeConfigChangedEvent(this); | 258 return new StackTraceTreeConfigChangedEvent(this); |
258 } | 259 } |
259 | 260 |
260 void _triggerModeChange(e) => _onModeChange.add(e); | 261 void _triggerModeChange(e) => _onModeChange.add(e); |
261 void _triggerDirectionChange(e) => _onDirectionChange.add(e); | 262 void _triggerDirectionChange(e) => _onDirectionChange.add(e); |
262 void _triggerFilterChange(e) => _onFilterChange.add(e); | 263 void _triggerFilterChange(e) => _onFilterChange.add(e); |
263 } | 264 } |
OLD | NEW |