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 field_view_element; | 5 library field_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/helpers/any_ref.dart'; | 12 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 13 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 14 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 15 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
14 import 'package:observatory/src/elements/helpers/tag.dart'; | 16 import 'package:observatory/src/elements/helpers/tag.dart'; |
15 import 'package:observatory/src/elements/nav/bar.dart'; | |
16 import 'package:observatory/src/elements/nav/class_menu.dart'; | 17 import 'package:observatory/src/elements/nav/class_menu.dart'; |
17 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 18 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
18 import 'package:observatory/src/elements/nav/library_menu.dart'; | 19 import 'package:observatory/src/elements/nav/library_menu.dart'; |
19 import 'package:observatory/src/elements/nav/menu.dart'; | |
20 import 'package:observatory/src/elements/nav/notify.dart'; | 20 import 'package:observatory/src/elements/nav/notify.dart'; |
21 import 'package:observatory/src/elements/nav/refresh.dart'; | 21 import 'package:observatory/src/elements/nav/refresh.dart'; |
22 import 'package:observatory/src/elements/nav/top_menu.dart'; | 22 import 'package:observatory/src/elements/nav/top_menu.dart'; |
23 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 23 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
24 import 'package:observatory/src/elements/object_common.dart'; | 24 import 'package:observatory/src/elements/object_common.dart'; |
25 import 'package:observatory/src/elements/script_inset.dart'; | 25 import 'package:observatory/src/elements/script_inset.dart'; |
26 import 'package:observatory/src/elements/source_link.dart'; | 26 import 'package:observatory/src/elements/source_link.dart'; |
27 import 'package:observatory/src/elements/view_footer.dart'; | 27 import 'package:observatory/src/elements/view_footer.dart'; |
28 | 28 |
29 class FieldViewElement extends HtmlElement implements Renderable { | 29 class FieldViewElement extends HtmlElement implements Renderable { |
30 static const tag = const Tag<FieldViewElement>('field-view', | 30 static const tag = const Tag<FieldViewElement>('field-view', |
31 dependencies: const [ | 31 dependencies: const [ |
32 ClassRefElement.tag, | 32 ClassRefElement.tag, |
33 CurlyBlockElement.tag, | 33 CurlyBlockElement.tag, |
34 NavBarElement.tag, | |
35 NavClassMenuElement.tag, | 34 NavClassMenuElement.tag, |
36 NavLibraryMenuElement.tag, | 35 NavLibraryMenuElement.tag, |
37 NavTopMenuElement.tag, | 36 NavTopMenuElement.tag, |
38 NavVMMenuElement.tag, | 37 NavVMMenuElement.tag, |
39 NavIsolateMenuElement.tag, | 38 NavIsolateMenuElement.tag, |
40 NavMenuElement.tag, | |
41 NavRefreshElement.tag, | 39 NavRefreshElement.tag, |
42 NavNotifyElement.tag, | 40 NavNotifyElement.tag, |
43 ObjectCommonElement.tag, | 41 ObjectCommonElement.tag, |
44 ScriptInsetElement.tag, | 42 ScriptInsetElement.tag, |
45 SourceLinkElement.tag, | 43 SourceLinkElement.tag, |
46 ViewFooterElement.tag | 44 ViewFooterElement.tag |
47 ]); | 45 ]); |
48 | 46 |
49 RenderingScheduler<FieldViewElement> _r; | 47 RenderingScheduler<FieldViewElement> _r; |
50 | 48 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 header += 'final '; | 144 header += 'final '; |
147 } else if (_field.isConst) { | 145 } else if (_field.isConst) { |
148 header += 'const '; | 146 header += 'const '; |
149 } | 147 } |
150 if (_field.declaredType.name == 'dynamic'){ | 148 if (_field.declaredType.name == 'dynamic'){ |
151 header += 'var'; | 149 header += 'var'; |
152 } else { | 150 } else { |
153 header += _field.declaredType.name; | 151 header += _field.declaredType.name; |
154 } | 152 } |
155 children = [ | 153 children = [ |
156 new NavBarElement(queue: _r.queue) | 154 navBar(_createMenu()), |
157 ..children = _createMenu(), | |
158 new DivElement()..classes = ['content-centered-big'] | 155 new DivElement()..classes = ['content-centered-big'] |
159 ..children = [ | 156 ..children = [ |
160 new HeadingElement.h2()..text = '$header ${field.name}', | 157 new HeadingElement.h2()..text = '$header ${field.name}', |
161 new HRElement(), | 158 new HRElement(), |
162 new ObjectCommonElement(_isolate, _field, _retainedSizes, | 159 new ObjectCommonElement(_isolate, _field, _retainedSizes, |
163 _reachableSizes, _references, _retainingPaths, | 160 _reachableSizes, _references, _retainingPaths, |
164 _instances, queue: _r.queue), | 161 _instances, queue: _r.queue), |
165 new BRElement(), | 162 new BRElement(), |
166 new DivElement()..classes = ['memberList'] | 163 new DivElement()..classes = ['memberList'] |
167 ..children = _createMembers(), | 164 ..children = _createMembers(), |
(...skipping 20 matching lines...) Expand all Loading... |
188 ]; | 185 ]; |
189 if (_library != null) { | 186 if (_library != null) { |
190 menu.add(new NavLibraryMenuElement(_isolate, _field.dartOwner, | 187 menu.add(new NavLibraryMenuElement(_isolate, _field.dartOwner, |
191 queue: _r.queue)); | 188 queue: _r.queue)); |
192 } else if (_field.dartOwner is M.ClassRef) { | 189 } else if (_field.dartOwner is M.ClassRef) { |
193 menu.add( | 190 menu.add( |
194 new NavClassMenuElement(_isolate, _field.dartOwner, queue: _r.queue) | 191 new NavClassMenuElement(_isolate, _field.dartOwner, queue: _r.queue) |
195 ); | 192 ); |
196 } | 193 } |
197 menu.addAll([ | 194 menu.addAll([ |
198 new NavMenuElement(_field.name, last: true, queue: _r.queue), | 195 navMenu(_field.name), |
199 new NavRefreshElement(queue: _r.queue) | 196 new NavRefreshElement(queue: _r.queue) |
200 ..onRefresh.listen((e) { | 197 ..onRefresh.listen((e) { |
201 e.element.disabled = true; | 198 e.element.disabled = true; |
202 _refresh(); | 199 _refresh(); |
203 }), | 200 }), |
204 new NavNotifyElement(_notifications, queue: _r.queue) | 201 new NavNotifyElement(_notifications, queue: _r.queue) |
205 ]); | 202 ]); |
206 return menu; | 203 return menu; |
207 } | 204 } |
208 | 205 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 Future _refresh() async { | 282 Future _refresh() async { |
286 _field = await _fields.get(_isolate, _field.id); | 283 _field = await _fields.get(_isolate, _field.id); |
287 if (_field.dartOwner is M.LibraryRef) { | 284 if (_field.dartOwner is M.LibraryRef) { |
288 _library = _field.dartOwner; | 285 _library = _field.dartOwner; |
289 } else if (_field.dartOwner is M.ClassRef) { | 286 } else if (_field.dartOwner is M.ClassRef) { |
290 _library = (await _classes.get(_isolate, _field.dartOwner.id)).library; | 287 _library = (await _classes.get(_isolate, _field.dartOwner.id)).library; |
291 } | 288 } |
292 _r.dirty(); | 289 _r.dirty(); |
293 } | 290 } |
294 } | 291 } |
OLD | NEW |