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/rendering_scheduler.dart'; | 7 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
8 import 'package:observatory/src/elements/helpers/tag.dart'; | 8 import 'package:observatory/src/elements/helpers/tag.dart'; |
9 import 'package:observatory/src/elements/helpers/uris.dart'; | 9 import 'package:observatory/src/elements/helpers/uris.dart'; |
10 import 'package:observatory/src/elements/nav/menu.dart'; | 10 import 'package:observatory/src/elements/nav/menu.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 [NavMenuElement.tag, | 15 dependencies: const [NavMenuElement.tag, |
16 NavMenuItemElement.tag]); | 16 NavMenuItemElement.tag]); |
17 | 17 |
18 RenderingScheduler _r; | 18 RenderingScheduler _r; |
19 | 19 |
20 Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered; | 20 Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered; |
21 | 21 |
22 bool _last; | 22 bool _last; |
| 23 |
23 bool get last => _last; | 24 bool get last => _last; |
| 25 |
24 set last(bool value) => _last = _r.checkAndReact(_last, value); | 26 set last(bool value) => _last = _r.checkAndReact(_last, value); |
25 | 27 |
26 factory NavTopMenuElement({bool last: false, RenderingQueue queue}) { | 28 factory NavTopMenuElement({bool last: false, RenderingQueue queue}) { |
27 assert(last != null); | 29 assert(last != null); |
28 NavTopMenuElement e = document.createElement(tag.name); | 30 NavTopMenuElement e = document.createElement(tag.name); |
29 e._r = new RenderingScheduler(e, queue: queue); | 31 e._r = new RenderingScheduler(e, queue: queue); |
30 e._last = last; | 32 e._last = last; |
31 return e; | 33 return e; |
32 } | 34 } |
33 | 35 |
(...skipping 17 matching lines...) Expand all Loading... |
51 new NavMenuElement('Observatory', link: Uris.vm(), last: last, | 53 new NavMenuElement('Observatory', link: Uris.vm(), last: last, |
52 queue: _r.queue) | 54 queue: _r.queue) |
53 ..children = [ | 55 ..children = [ |
54 new NavMenuItemElement('Connect to a VM', link: Uris.vmConnect(), | 56 new NavMenuItemElement('Connect to a VM', link: Uris.vmConnect(), |
55 queue: _r.queue), | 57 queue: _r.queue), |
56 new ContentElement() | 58 new ContentElement() |
57 ] | 59 ] |
58 ]; | 60 ]; |
59 } | 61 } |
60 } | 62 } |
OLD | NEW |