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'; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ..children = [ |
69 new DivElement()..classes = const ['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 } |
79 }) | 79 }) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 case M.InstanceKind.typeParameter: | 128 case M.InstanceKind.typeParameter: |
129 case M.InstanceKind.boundedType: | 129 case M.InstanceKind.boundedType: |
130 return [ | 130 return [ |
131 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 131 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
132 ..text = _instance.name | 132 ..text = _instance.name |
133 ]; | 133 ]; |
134 case M.InstanceKind.closure: | 134 case M.InstanceKind.closure: |
135 return [ | 135 return [ |
136 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 136 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
137 ..children = [ | 137 ..children = [ |
138 new SpanElement()..classes = const ['emphasize'] | 138 new SpanElement()..classes = ['emphasize'] |
139 ..text = 'Closure', | 139 ..text = 'Closure', |
140 new SpanElement()..text = _instance.closureFunction.name | 140 new SpanElement()..text = _instance.closureFunction.name |
141 ] | 141 ] |
142 ]; | 142 ]; |
143 case M.InstanceKind.regExp: | 143 case M.InstanceKind.regExp: |
144 return [ | 144 return [ |
145 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 145 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
146 ..children = [ | 146 ..children = [ |
147 new SpanElement()..classes = const ['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 ..children = [ |
158 new DivElement()..classes = const ['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 ]; |
168 case M.InstanceKind.list: | 168 case M.InstanceKind.list: |
169 case M.InstanceKind.map: | 169 case M.InstanceKind.map: |
170 case M.InstanceKind.uint8ClampedList: | 170 case M.InstanceKind.uint8ClampedList: |
171 case M.InstanceKind.uint8List: | 171 case M.InstanceKind.uint8List: |
172 case M.InstanceKind.uint16List: | 172 case M.InstanceKind.uint16List: |
173 case M.InstanceKind.uint32List: | 173 case M.InstanceKind.uint32List: |
174 case M.InstanceKind.uint64List: | 174 case M.InstanceKind.uint64List: |
175 case M.InstanceKind.int8List: | 175 case M.InstanceKind.int8List: |
176 case M.InstanceKind.int16List: | 176 case M.InstanceKind.int16List: |
177 case M.InstanceKind.int32List: | 177 case M.InstanceKind.int32List: |
178 case M.InstanceKind.int64List: | 178 case M.InstanceKind.int64List: |
179 case M.InstanceKind.float32List: | 179 case M.InstanceKind.float32List: |
180 case M.InstanceKind.float64List: | 180 case M.InstanceKind.float64List: |
181 case M.InstanceKind.int32x4List: | 181 case M.InstanceKind.int32x4List: |
182 case M.InstanceKind.float32x4List: | 182 case M.InstanceKind.float32x4List: |
183 case M.InstanceKind.float64x2List: | 183 case M.InstanceKind.float64x2List: |
184 return [ | 184 return [ |
185 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 185 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
186 ..children = [ | 186 ..children = [ |
187 new SpanElement()..classes = const ['emphasize'] | 187 new SpanElement()..classes = ['emphasize'] |
188 ..text = _instance.clazz.name, | 188 ..text = _instance.clazz.name, |
189 new SpanElement()..text = ' (${_instance.length})' | 189 new SpanElement()..text = ' (${_instance.length})' |
190 ] | 190 ] |
191 ]; | 191 ]; |
192 case M.InstanceKind.mirrorReference: | 192 case M.InstanceKind.mirrorReference: |
193 return [ | 193 return [ |
194 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 194 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
195 ..classes = const ['emphasize'] | 195 ..classes = ['emphasize'] |
196 ..text = _instance.clazz.name | 196 ..text = _instance.clazz.name |
197 ]; | 197 ]; |
198 case M.InstanceKind.weakProperty: | 198 case M.InstanceKind.weakProperty: |
199 return [ | 199 return [ |
200 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) | 200 new AnchorElement(href: Uris.inspect(_isolate, object: _instance)) |
201 ..classes = const ['emphasize'] | 201 ..classes = ['emphasize'] |
202 ..text = _instance.clazz.name | 202 ..text = _instance.clazz.name |
203 ]; | 203 ]; |
204 } | 204 } |
205 throw new Exception('Unkown InstanceKind: ${_instance.kind}'); | 205 throw new Exception('Unkown InstanceKind: ${_instance.kind}'); |
206 } | 206 } |
207 | 207 |
208 bool _hasValue() { | 208 bool _hasValue() { |
209 switch (_instance.kind) { | 209 switch (_instance.kind) { |
210 case M.InstanceKind.plainInstance: | 210 case M.InstanceKind.plainInstance: |
211 case M.InstanceKind.mirrorReference: | 211 case M.InstanceKind.mirrorReference: |
(...skipping 98 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 |