OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/src/elements/helpers/nav_menu.dart'; | 7 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
9 import 'package:observatory/src/elements/helpers/tag.dart'; | 9 import 'package:observatory/src/elements/helpers/tag.dart'; |
10 import 'package:observatory/src/elements/helpers/uris.dart'; | 10 import 'package:observatory/src/elements/helpers/uris.dart'; |
11 import 'package:observatory/src/elements/nav/menu_item.dart'; | 11 import 'package:observatory/src/elements/nav/menu_item.dart'; |
12 | 12 |
13 class NavTopMenuElement extends HtmlElement implements Renderable { | 13 class NavTopMenuElement extends HtmlElement implements Renderable { |
14 static const tag = const Tag<NavTopMenuElement>('nav-top-menu', | 14 static const tag = const Tag<NavTopMenuElement>('nav-top-menu', |
15 dependencies: const [NavMenuItemElement.tag]); | 15 dependencies: const [NavMenuItemElement.tag]); |
16 | 16 |
17 RenderingScheduler _r; | 17 RenderingScheduler _r; |
18 | 18 |
19 Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered; | 19 Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered; |
20 | 20 |
21 Iterable<Element> _content = const []; | 21 Iterable<Element> _content = const []; |
22 | 22 |
23 Iterable<Element> get content => _content; | 23 Iterable<Element> get content => _content; |
24 | 24 |
25 set content(Iterable<Element> value) { | 25 set content(Iterable<Element> value) { |
(...skipping 19 matching lines...) Expand all Loading... |
45 void detached() { | 45 void detached() { |
46 super.detached(); | 46 super.detached(); |
47 _r.disable(notify: true); | 47 _r.disable(notify: true); |
48 children = []; | 48 children = []; |
49 } | 49 } |
50 | 50 |
51 void render() { | 51 void render() { |
52 final content = ([ | 52 final content = ([ |
53 new NavMenuItemElement('Connect to a VM', link: Uris.vmConnect()), | 53 new NavMenuItemElement('Connect to a VM', link: Uris.vmConnect()), |
54 ]..addAll(_content)); | 54 ]..addAll(_content)); |
55 children = [ | 55 children = [navMenu('Observatory', link: Uris.vm(), content: content)]; |
56 navMenu('Observatory', link: Uris.vm(), content: content) | |
57 ]; | |
58 } | 56 } |
59 } | 57 } |
OLD | NEW |