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 json_view_element; | 5 library json_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/helpers/nav_bar.dart'; |
10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | 12 import 'package:observatory/src/elements/helpers/tag.dart'; |
12 import 'package:observatory/src/elements/nav/bar.dart'; | |
13 import 'package:observatory/src/elements/nav/notify.dart'; | 13 import 'package:observatory/src/elements/nav/notify.dart'; |
14 import 'package:observatory/src/elements/nav/top_menu.dart'; | 14 import 'package:observatory/src/elements/nav/top_menu.dart'; |
15 import 'package:observatory/src/elements/view_footer.dart'; | 15 import 'package:observatory/src/elements/view_footer.dart'; |
16 | 16 |
17 class JSONViewElement extends HtmlElement implements Renderable { | 17 class JSONViewElement extends HtmlElement implements Renderable { |
18 static const tag = const Tag<JSONViewElement>('json-view', | 18 static const tag = const Tag<JSONViewElement>('json-view', |
19 dependencies: const [ | 19 dependencies: const [ |
20 NavBarElement.tag, | |
21 NavTopMenuElement.tag, | 20 NavTopMenuElement.tag, |
22 NavNotifyElement.tag, | 21 NavNotifyElement.tag, |
23 ViewFooterElement.tag | 22 ViewFooterElement.tag |
24 ]); | 23 ]); |
25 | 24 |
26 RenderingScheduler<JSONViewElement> _r; | 25 RenderingScheduler<JSONViewElement> _r; |
27 | 26 |
28 Stream<RenderedEvent<JSONViewElement>> get onRendered => _r.onRendered; | 27 Stream<RenderedEvent<JSONViewElement>> get onRendered => _r.onRendered; |
29 | 28 |
30 M.NotificationRepository _notifications; | 29 M.NotificationRepository _notifications; |
(...skipping 25 matching lines...) Expand all Loading... |
56 | 55 |
57 @override | 56 @override |
58 detached() { | 57 detached() { |
59 super.detached(); | 58 super.detached(); |
60 _r.disable(notify: true); | 59 _r.disable(notify: true); |
61 children = []; | 60 children = []; |
62 } | 61 } |
63 | 62 |
64 void render() { | 63 void render() { |
65 children = [ | 64 children = [ |
66 new NavBarElement(queue: _r.queue) | 65 navBar([ |
67 ..children = [ | 66 new NavTopMenuElement(queue: _r.queue), |
68 new NavTopMenuElement(queue: _r.queue), | 67 new NavNotifyElement(_notifications, queue: _r.queue) |
69 new NavNotifyElement(_notifications, queue: _r.queue) | 68 ]), |
70 ], | |
71 new DivElement()..classes = ['content-centered-big'] | 69 new DivElement()..classes = ['content-centered-big'] |
72 ..children = [ | 70 ..children = [ |
73 new HeadingElement.h2()..text = 'Object', | 71 new HeadingElement.h2()..text = 'Object', |
74 new HRElement(), | 72 new HRElement(), |
75 new PreElement() | 73 new PreElement() |
76 ..text = JSONPretty.stringify(_map), | 74 ..text = JSONPretty.stringify(_map), |
77 new HRElement(), | 75 new HRElement(), |
78 new ViewFooterElement(queue: _r.queue) | 76 new ViewFooterElement(queue: _r.queue) |
79 ] | 77 ] |
80 ]; | 78 ]; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 149 } |
152 | 150 |
153 void _writeIndent(int depth) { | 151 void _writeIndent(int depth) { |
154 const tab = ' '; // 2 spaces. | 152 const tab = ' '; // 2 spaces. |
155 _buffer.write(tab * depth); | 153 _buffer.write(tab * depth); |
156 } | 154 } |
157 | 155 |
158 final _buffer = new StringBuffer(); | 156 final _buffer = new StringBuffer(); |
159 final _seen = new Set(); | 157 final _seen = new Set(); |
160 } | 158 } |
OLD | NEW |