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:html'; | 5 import 'dart:html'; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/src/elements/curly_block.dart'; | 8 import 'package:observatory/src/elements/curly_block.dart'; |
9 import 'package:observatory/src/elements/field_ref.dart'; | 9 import 'package:observatory/src/elements/field_ref.dart'; |
10 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 10 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
12 import 'package:observatory/src/elements/helpers/tag.dart'; | 12 import 'package:observatory/src/elements/helpers/tag.dart'; |
13 import 'package:observatory/src/elements/helpers/uris.dart'; | 13 import 'package:observatory/src/elements/helpers/uris.dart'; |
14 import 'package:observatory/src/elements/sentinel_value.dart'; | 14 import 'package:observatory/src/elements/sentinel_value.dart'; |
15 import 'package:observatory/utils.dart'; | 15 import 'package:observatory/utils.dart'; |
16 | 16 |
17 class InstanceRefElement extends HtmlElement implements Renderable { | 17 class InstanceRefElement extends HtmlElement implements Renderable { |
18 static const tag = const Tag<InstanceRefElement>('instance-ref-wrapped'); | 18 static const tag = const Tag<InstanceRefElement>('instance-ref'); |
19 | 19 |
20 RenderingScheduler<InstanceRefElement> _r; | 20 RenderingScheduler<InstanceRefElement> _r; |
21 | 21 |
22 Stream<RenderedEvent<InstanceRefElement>> get onRendered => _r.onRendered; | 22 Stream<RenderedEvent<InstanceRefElement>> get onRendered => _r.onRendered; |
23 | 23 |
24 M.IsolateRef _isolate; | 24 M.IsolateRef _isolate; |
25 M.InstanceRef _instance; | 25 M.InstanceRef _instance; |
26 M.InstanceRepository _instances; | 26 M.InstanceRepository _instances; |
27 M.Instance _loadedInstance; | 27 M.Instance _loadedInstance; |
28 bool _expanded = false; | 28 bool _expanded = false; |
(...skipping 29 matching lines...) Expand all Loading... |
58 _r.disable(notify: true); | 58 _r.disable(notify: true); |
59 } | 59 } |
60 | 60 |
61 void render() { | 61 void render() { |
62 final content = _createLink(); | 62 final content = _createLink(); |
63 | 63 |
64 if (_hasValue()) { | 64 if (_hasValue()) { |
65 content.addAll([ | 65 content.addAll([ |
66 new SpanElement()..text = ' ', | 66 new SpanElement()..text = ' ', |
67 new CurlyBlockElement(expanded: _expanded, queue: _r.queue) | 67 new CurlyBlockElement(expanded: _expanded, queue: _r.queue) |
68 ..children = [ | 68 ..content = [ |
69 new DivElement()..classes = ['indent'] | 69 new DivElement()..classes = ['indent'] |
70 ..children = _createValue() | 70 ..children = _createValue() |
71 ] | 71 ] |
72 ..onToggle.listen((e) async { | 72 ..onToggle.listen((e) async { |
73 _expanded = e.control.expanded; | 73 _expanded = e.control.expanded; |
74 if (_expanded) { | 74 if (_expanded) { |
75 e.control.disabled = true; | 75 e.control.disabled = true; |
76 await _refresh(); | 76 await _refresh(); |
77 e.control.disabled = false; | 77 e.control.disabled = false; |
78 } | 78 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 new SpanElement()..classes = ['emphasize'] | 147 new SpanElement()..classes = ['emphasize'] |
148 ..text = _instance.clazz.name, | 148 ..text = _instance.clazz.name, |
149 new SpanElement()..text = _instance.pattern.name | 149 new SpanElement()..text = _instance.pattern.name |
150 ] | 150 ] |
151 ]; | 151 ]; |
152 case M.InstanceKind.stackTrace: | 152 case M.InstanceKind.stackTrace: |
153 return [ | 153 return [ |
154 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 154 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
155 ..text = _instance.clazz.name, | 155 ..text = _instance.clazz.name, |
156 new CurlyBlockElement(queue: _r.queue) | 156 new CurlyBlockElement(queue: _r.queue) |
157 ..children = [ | 157 ..content = [ |
158 new DivElement()..classes = ['stackTraceBox'] | 158 new DivElement()..classes = ['stackTraceBox'] |
159 ..text = _instance.valueAsString | 159 ..text = _instance.valueAsString |
160 ] | 160 ] |
161 ]; | 161 ]; |
162 case M.InstanceKind.plainInstance: | 162 case M.InstanceKind.plainInstance: |
163 return [ | 163 return [ |
164 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 164 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
165 ..classes = ['emphasize'] | 165 ..classes = ['emphasize'] |
166 ..text = _instance.clazz.name | 166 ..text = _instance.clazz.name |
167 ]; | 167 ]; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 new BRElement(), | 310 new BRElement(), |
311 new SpanElement()..text = '<value> : ', | 311 new SpanElement()..text = '<value> : ', |
312 new InstanceRefElement(_isolate, _loadedInstance.value, _instances, | 312 new InstanceRefElement(_isolate, _loadedInstance.value, _instances, |
313 queue: _r.queue), | 313 queue: _r.queue), |
314 ]; | 314 ]; |
315 default: | 315 default: |
316 return []; | 316 return []; |
317 } | 317 } |
318 } | 318 } |
319 } | 319 } |
OLD | NEW |