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 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 ..text = 'Call Tree Filter' | 154 ..text = 'Call Tree Filter' |
155 ..title = 'case-sensitive substring match', | 155 ..title = 'case-sensitive substring match', |
156 new SpanElement() | 156 new SpanElement() |
157 ..classes = ['memberValue'] | 157 ..classes = ['memberValue'] |
158 ..children = _createFilter() | 158 ..children = _createFilter() |
159 ]); | 159 ]); |
160 } | 160 } |
161 return members; | 161 return members; |
162 } | 162 } |
163 | 163 |
| 164 String get modeDescription { |
| 165 if (_mode == ProfileTreeMode.function) { |
| 166 return 'Inlined frames expanded.'; |
| 167 } else { |
| 168 return 'Inlined frames not expanded.'; |
| 169 } |
| 170 } |
| 171 |
164 List<Element> _createModeSelect() { | 172 List<Element> _createModeSelect() { |
165 var s; | 173 var s; |
166 return [ | 174 return [ |
167 s = new SelectElement() | 175 s = new SelectElement() |
168 ..classes = ['mode-select'] | 176 ..classes = ['mode-select'] |
169 ..value = modeToString(_mode) | 177 ..value = modeToString(_mode) |
170 ..children = ProfileTreeMode.values.map((mode) { | 178 ..children = ProfileTreeMode.values.map((mode) { |
171 return new OptionElement( | 179 return new OptionElement( |
172 value: modeToString(mode), | 180 value: modeToString(mode), |
173 selected: _mode == mode)..text = modeToString(mode); | 181 selected: _mode == mode)..text = modeToString(mode); |
174 }).toList(growable: false) | 182 }).toList(growable: false) |
175 ..onChange.listen((_) { | 183 ..onChange.listen((_) { |
176 _mode = ProfileTreeMode.values[s.selectedIndex]; | 184 _mode = ProfileTreeMode.values[s.selectedIndex]; |
| 185 _r.dirty(); |
177 }) | 186 }) |
178 ..onChange.map(_toEvent).listen(_triggerModeChange), | 187 ..onChange.map(_toEvent).listen(_triggerModeChange), |
| 188 new SpanElement() |
| 189 ..text = ' $modeDescription' |
179 ]; | 190 ]; |
180 } | 191 } |
181 | 192 |
| 193 String get directionDescription { |
| 194 if (_direction == M.ProfileTreeDirection.inclusive) { |
| 195 return 'Tree is rooted at "main". Child nodes are callees.'; |
| 196 } else { |
| 197 return 'Tree is rooted at top-of-stack. Child nodes are callers.'; |
| 198 } |
| 199 } |
| 200 |
182 List<Element> _createDirectionSelect() { | 201 List<Element> _createDirectionSelect() { |
183 var s; | 202 var s; |
184 return [ | 203 return [ |
185 s = new SelectElement() | 204 s = new SelectElement() |
186 ..classes = ['direction-select'] | 205 ..classes = ['direction-select'] |
187 ..value = directionToString(_direction) | 206 ..value = directionToString(_direction) |
188 ..children = M.ProfileTreeDirection.values.map((direction) { | 207 ..children = M.ProfileTreeDirection.values.map((direction) { |
189 return new OptionElement( | 208 return new OptionElement( |
190 value: directionToString(direction), | 209 value: directionToString(direction), |
191 selected: _direction == direction) | 210 selected: _direction == direction) |
192 ..text = directionToString(direction); | 211 ..text = directionToString(direction); |
193 }).toList(growable: false) | 212 }).toList(growable: false) |
194 ..onChange.listen((_) { | 213 ..onChange.listen((_) { |
195 _direction = M.ProfileTreeDirection.values[s.selectedIndex]; | 214 _direction = M.ProfileTreeDirection.values[s.selectedIndex]; |
| 215 _r.dirty(); |
196 }) | 216 }) |
197 ..onChange.map(_toEvent).listen(_triggerDirectionChange), | 217 ..onChange.map(_toEvent).listen(_triggerDirectionChange), |
198 new SpanElement() | 218 new SpanElement() |
199 ..text = 'Tree is rooted at ' + | 219 ..text = ' $directionDescription' |
200 (_direction == 'Down' ? '"main"' : 'function / code') + | |
201 '. Child nodes are callers.' | |
202 ]; | 220 ]; |
203 } | 221 } |
204 | 222 |
205 List<Element> _createFilter() { | 223 List<Element> _createFilter() { |
206 var t; | 224 var t; |
207 return [ | 225 return [ |
208 t = new TextInputElement() | 226 t = new TextInputElement() |
209 ..placeholder = 'Search filter' | 227 ..placeholder = 'Search filter' |
210 ..value = filter | 228 ..value = filter |
211 ..onChange.listen((_) { | 229 ..onChange.listen((_) { |
(...skipping 24 matching lines...) Expand all Loading... |
236 } | 254 } |
237 | 255 |
238 StackTraceTreeConfigChangedEvent _toEvent(_) { | 256 StackTraceTreeConfigChangedEvent _toEvent(_) { |
239 return new StackTraceTreeConfigChangedEvent(this); | 257 return new StackTraceTreeConfigChangedEvent(this); |
240 } | 258 } |
241 | 259 |
242 void _triggerModeChange(e) => _onModeChange.add(e); | 260 void _triggerModeChange(e) => _onModeChange.add(e); |
243 void _triggerDirectionChange(e) => _onDirectionChange.add(e); | 261 void _triggerDirectionChange(e) => _onDirectionChange.add(e); |
244 void _triggerFilterChange(e) => _onFilterChange.add(e); | 262 void _triggerFilterChange(e) => _onFilterChange.add(e); |
245 } | 263 } |
OLD | NEW |