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 library library_view_element; | 5 library library_view_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
10 import 'package:observatory/src/elements/class_ref.dart'; | 10 import 'package:observatory/src/elements/class_ref.dart'; |
11 import 'package:observatory/src/elements/curly_block.dart'; | 11 import 'package:observatory/src/elements/curly_block.dart'; |
12 import 'package:observatory/src/elements/eval_box.dart'; | 12 import 'package:observatory/src/elements/eval_box.dart'; |
13 import 'package:observatory/src/elements/field_ref.dart'; | 13 import 'package:observatory/src/elements/field_ref.dart'; |
14 import 'package:observatory/src/elements/function_ref.dart'; | 14 import 'package:observatory/src/elements/function_ref.dart'; |
15 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 15 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
16 import 'package:observatory/src/elements/helpers/nav_bar.dart'; | |
17 import 'package:observatory/src/elements/helpers/nav_menu.dart'; | |
16 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 18 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
17 import 'package:observatory/src/elements/helpers/tag.dart'; | 19 import 'package:observatory/src/elements/helpers/tag.dart'; |
18 import 'package:observatory/src/elements/library_ref.dart'; | 20 import 'package:observatory/src/elements/library_ref.dart'; |
19 import 'package:observatory/src/elements/nav/bar.dart'; | |
20 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 21 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
21 import 'package:observatory/src/elements/nav/menu.dart'; | |
22 import 'package:observatory/src/elements/nav/notify.dart'; | 22 import 'package:observatory/src/elements/nav/notify.dart'; |
23 import 'package:observatory/src/elements/nav/refresh.dart'; | 23 import 'package:observatory/src/elements/nav/refresh.dart'; |
24 import 'package:observatory/src/elements/nav/top_menu.dart'; | 24 import 'package:observatory/src/elements/nav/top_menu.dart'; |
25 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 25 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
26 import 'package:observatory/src/elements/object_common.dart'; | 26 import 'package:observatory/src/elements/object_common.dart'; |
27 import 'package:observatory/src/elements/script_ref.dart'; | 27 import 'package:observatory/src/elements/script_ref.dart'; |
28 import 'package:observatory/src/elements/script_inset.dart'; | 28 import 'package:observatory/src/elements/script_inset.dart'; |
29 import 'package:observatory/src/elements/view_footer.dart'; | 29 import 'package:observatory/src/elements/view_footer.dart'; |
30 | 30 |
31 class LibraryViewElement extends HtmlElement implements Renderable { | 31 class LibraryViewElement extends HtmlElement implements Renderable { |
32 static const tag = const Tag<LibraryViewElement>('library-view', | 32 static const tag = const Tag<LibraryViewElement>('library-view', |
33 dependencies: const [ | 33 dependencies: const [ |
34 ClassRefElement.tag, | 34 ClassRefElement.tag, |
35 CurlyBlockElement.tag, | 35 CurlyBlockElement.tag, |
36 EvalBoxElement.tag, | 36 EvalBoxElement.tag, |
37 FieldRefElement.tag, | 37 FieldRefElement.tag, |
38 FunctionRefElement.tag, | 38 FunctionRefElement.tag, |
39 LibraryRefElement.tag, | 39 LibraryRefElement.tag, |
40 NavBarElement.tag, | |
41 NavTopMenuElement.tag, | 40 NavTopMenuElement.tag, |
42 NavVMMenuElement.tag, | 41 NavVMMenuElement.tag, |
43 NavIsolateMenuElement.tag, | 42 NavIsolateMenuElement.tag, |
44 NavMenuElement.tag, | |
45 NavRefreshElement.tag, | 43 NavRefreshElement.tag, |
46 NavNotifyElement.tag, | 44 NavNotifyElement.tag, |
47 ObjectCommonElement.tag, | 45 ObjectCommonElement.tag, |
48 ScriptRefElement.tag, | 46 ScriptRefElement.tag, |
49 ScriptInsetElement.tag, | 47 ScriptInsetElement.tag, |
50 ViewFooterElement.tag | 48 ViewFooterElement.tag |
51 ]); | 49 ]); |
52 | 50 |
53 RenderingScheduler<LibraryViewElement> _r; | 51 RenderingScheduler<LibraryViewElement> _r; |
54 | 52 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 | 131 |
134 @override | 132 @override |
135 detached() { | 133 detached() { |
136 super.detached(); | 134 super.detached(); |
137 _r.disable(notify: true); | 135 _r.disable(notify: true); |
138 children = []; | 136 children = []; |
139 } | 137 } |
140 | 138 |
141 void render() { | 139 void render() { |
142 children = [ | 140 children = [ |
143 new NavBarElement(queue: _r.queue) | 141 navBar([ |
144 ..children = [ | 142 new NavTopMenuElement(queue: _r.queue), |
145 new NavTopMenuElement(queue: _r.queue), | 143 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
146 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 144 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
147 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 145 navMenu('instance'), |
Cutch
2016/09/07 19:12:52
library?
cbernaschina
2016/09/07 19:45:41
Done.
| |
148 new NavMenuElement('instance', last: true, queue: _r.queue), | 146 new NavRefreshElement(queue: _r.queue) |
149 new NavRefreshElement(queue: _r.queue) | 147 ..onRefresh.listen((e) async { |
150 ..onRefresh.listen((e) async { | 148 e.element.disabled = true; |
151 e.element.disabled = true; | 149 _refresh(); |
152 _refresh(); | 150 }), |
153 }), | 151 new NavNotifyElement(_notifications, queue: _r.queue) |
154 new NavNotifyElement(_notifications, queue: _r.queue) | 152 ]), |
155 ], | |
156 | |
157 new DivElement()..classes = ['content-centered-big'] | 153 new DivElement()..classes = ['content-centered-big'] |
158 ..children = [ | 154 ..children = [ |
159 new HeadingElement.h2()..text = 'ICData', | 155 new HeadingElement.h2()..text = 'ICData', |
160 new HRElement(), | 156 new HRElement(), |
161 new ObjectCommonElement(_isolate, _library, _retainedSizes, | 157 new ObjectCommonElement(_isolate, _library, _retainedSizes, |
162 _reachableSizes, _references, _retainingPaths, | 158 _reachableSizes, _references, _retainingPaths, |
163 _instances, queue: _r.queue), | 159 _instances, queue: _r.queue), |
164 new DivElement()..classes = ['memberList'] | 160 new DivElement()..classes = ['memberList'] |
165 ..children = [ | 161 ..children = [ |
166 new DivElement()..classes = ['memberItem'] | 162 new DivElement()..classes = ['memberItem'] |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 | 207 |
212 Element _createDependencies() { | 208 Element _createDependencies() { |
213 if (_library.dependencies.isEmpty) { | 209 if (_library.dependencies.isEmpty) { |
214 return new SpanElement(); | 210 return new SpanElement(); |
215 } | 211 } |
216 final dependencies = _library.dependencies.toList(); | 212 final dependencies = _library.dependencies.toList(); |
217 return new DivElement() | 213 return new DivElement() |
218 ..children = [ | 214 ..children = [ |
219 new SpanElement()..text = 'dependencies (${dependencies.length}) ', | 215 new SpanElement()..text = 'dependencies (${dependencies.length}) ', |
220 new CurlyBlockElement(queue: _r.queue) | 216 new CurlyBlockElement(queue: _r.queue) |
221 ..children = dependencies.map((d) => | 217 ..content = dependencies.map((d) => |
222 new DivElement()..classes = ['indent'] | 218 new DivElement()..classes = ['indent'] |
223 ..children = [ | 219 ..children = [ |
224 new SpanElement()..text = d.isImport ? 'import ' : 'export ', | 220 new SpanElement()..text = d.isImport ? 'import ' : 'export ', |
225 new LibraryRefElement(_isolate, d.target, queue: _r.queue), | 221 new LibraryRefElement(_isolate, d.target, queue: _r.queue), |
226 new SpanElement()..text = d.prefix == null ? '' | 222 new SpanElement()..text = d.prefix == null ? '' |
227 : ' as ${d.prefix}', | 223 : ' as ${d.prefix}', |
228 new SpanElement()..text = d.isDeferred ? ' deferred' : '', | 224 new SpanElement()..text = d.isDeferred ? ' deferred' : '', |
229 ]).toList() | 225 ]).toList() |
230 ]; | 226 ]; |
231 } | 227 } |
232 | 228 |
233 Element _createScripts() { | 229 Element _createScripts() { |
234 if (_library.scripts.isEmpty) { | 230 if (_library.scripts.isEmpty) { |
235 return new SpanElement(); | 231 return new SpanElement(); |
236 } | 232 } |
237 final scripts = _library.scripts.toList(); | 233 final scripts = _library.scripts.toList(); |
238 return new DivElement() | 234 return new DivElement() |
239 ..children = [ | 235 ..children = [ |
240 new SpanElement()..text = 'scripts (${scripts.length}) ', | 236 new SpanElement()..text = 'scripts (${scripts.length}) ', |
241 new CurlyBlockElement(queue: _r.queue) | 237 new CurlyBlockElement(queue: _r.queue) |
242 ..children = scripts.map((s) => | 238 ..content = scripts.map((s) => |
243 new DivElement()..classes = ['indent'] | 239 new DivElement()..classes = ['indent'] |
244 ..children = [ | 240 ..children = [ |
245 new ScriptRefElement(_isolate, s, queue: _r.queue) | 241 new ScriptRefElement(_isolate, s, queue: _r.queue) |
246 ]).toList() | 242 ]).toList() |
247 ]; | 243 ]; |
248 } | 244 } |
249 | 245 |
250 Element _createClasses() { | 246 Element _createClasses() { |
251 if (_library.classes.isEmpty) { | 247 if (_library.classes.isEmpty) { |
252 return new SpanElement(); | 248 return new SpanElement(); |
253 } | 249 } |
254 final classes = _library.classes.toList(); | 250 final classes = _library.classes.toList(); |
255 return new DivElement() | 251 return new DivElement() |
256 ..children = [ | 252 ..children = [ |
257 new SpanElement()..text = 'classes (${classes.length}) ', | 253 new SpanElement()..text = 'classes (${classes.length}) ', |
258 new CurlyBlockElement(queue: _r.queue) | 254 new CurlyBlockElement(queue: _r.queue) |
259 ..children = classes.map((c) => | 255 ..content = classes.map((c) => |
260 new DivElement()..classes = ['indent'] | 256 new DivElement()..classes = ['indent'] |
261 ..children = [ | 257 ..children = [ |
262 new ClassRefElement(_isolate, c, queue: _r.queue) | 258 new ClassRefElement(_isolate, c, queue: _r.queue) |
263 ]).toList() | 259 ]).toList() |
264 ]; | 260 ]; |
265 } | 261 } |
266 | 262 |
267 Element _createVariables() { | 263 Element _createVariables() { |
268 if (_library.variables.isEmpty) { | 264 if (_library.variables.isEmpty) { |
269 return new SpanElement(); | 265 return new SpanElement(); |
270 } | 266 } |
271 final variables = _library.variables.toList(); | 267 final variables = _library.variables.toList(); |
272 return new DivElement() | 268 return new DivElement() |
273 ..children = [ | 269 ..children = [ |
274 new SpanElement()..text = 'variables (${variables.length}) ', | 270 new SpanElement()..text = 'variables (${variables.length}) ', |
275 new CurlyBlockElement(queue: _r.queue) | 271 new CurlyBlockElement(queue: _r.queue) |
276 ..children = [ | 272 ..content = [ |
277 _variables == null | 273 _variables == null |
278 ? (new SpanElement()..text = 'loading...') | 274 ? (new SpanElement()..text = 'loading...') |
279 : (new DivElement()..classes = ['indent', 'memberList'] | 275 : (new DivElement()..classes = ['indent', 'memberList'] |
280 ..children = _variables.map((f) => | 276 ..children = _variables.map((f) => |
281 new DivElement()..classes = ['memberItem'] | 277 new DivElement()..classes = ['memberItem'] |
282 ..children = [ | 278 ..children = [ |
283 new DivElement()..classes = ['memberName'] | 279 new DivElement()..classes = ['memberName'] |
284 ..children = [ | 280 ..children = [ |
285 new FieldRefElement(_isolate, f, _instances, | 281 new FieldRefElement(_isolate, f, _instances, |
286 queue: _r.queue) | 282 queue: _r.queue) |
(...skipping 11 matching lines...) Expand all Loading... | |
298 | 294 |
299 Element _createFunctions() { | 295 Element _createFunctions() { |
300 if (_library.functions.isEmpty) { | 296 if (_library.functions.isEmpty) { |
301 return new SpanElement(); | 297 return new SpanElement(); |
302 } | 298 } |
303 final functions = _library.functions.toList(); | 299 final functions = _library.functions.toList(); |
304 return new DivElement() | 300 return new DivElement() |
305 ..children = [ | 301 ..children = [ |
306 new SpanElement()..text = 'functions (${functions.length}) ', | 302 new SpanElement()..text = 'functions (${functions.length}) ', |
307 new CurlyBlockElement(queue: _r.queue) | 303 new CurlyBlockElement(queue: _r.queue) |
308 ..children = functions.map((f) => | 304 ..content = functions.map((f) => |
309 new DivElement()..classes = ['indent'] | 305 new DivElement()..classes = ['indent'] |
310 ..children = [ | 306 ..children = [ |
311 new FunctionRefElement(_isolate, f, queue: _r.queue) | 307 new FunctionRefElement(_isolate, f, queue: _r.queue) |
312 ]).toList() | 308 ]).toList() |
313 ]; | 309 ]; |
314 } | 310 } |
315 } | 311 } |
OLD | NEW |