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