Index: runtime/observatory/lib/src/elements/nav/vm_menu.dart |
diff --git a/runtime/observatory/lib/src/elements/nav/vm_menu.dart b/runtime/observatory/lib/src/elements/nav/vm_menu.dart |
index e4351affe33a2c174068b01fd92749a498122c8e..c652f361e6448319046008b85e73982ca9a5cddc 100644 |
--- a/runtime/observatory/lib/src/elements/nav/vm_menu.dart |
+++ b/runtime/observatory/lib/src/elements/nav/vm_menu.dart |
@@ -6,46 +6,45 @@ import 'dart:html'; |
import 'dart:async'; |
import 'package:observatory/models.dart' as M |
show VM, EventRepository; |
+import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
import 'package:observatory/src/elements/helpers/tag.dart'; |
import 'package:observatory/src/elements/helpers/uris.dart'; |
-import 'package:observatory/src/elements/nav/menu.dart'; |
import 'package:observatory/src/elements/nav/menu_item.dart'; |
class NavVMMenuElement extends HtmlElement implements Renderable { |
static const tag = const Tag<NavVMMenuElement>('nav-vm-menu', |
- dependencies: const [NavMenuElement.tag, |
- NavMenuItemElement.tag]); |
+ dependencies: const [NavMenuItemElement.tag]); |
RenderingScheduler _r; |
Stream<RenderedEvent<NavVMMenuElement>> get onRendered => _r.onRendered; |
- bool _last; |
M.VM _vm; |
M.EventRepository _events; |
StreamSubscription _updatesSubscription; |
+ Iterable<Element> _content = const []; |
- |
- bool get last => _last; |
M.VM get vm => _vm; |
+ Iterable<Element> get content => _content; |
- set last(bool value) => _last = _r.checkAndReact(_last, value); |
+ set content(Iterable<Element> value) { |
+ _content = value.toList(); |
+ _r.dirty(); |
+ } |
- factory NavVMMenuElement(M.VM vm, M.EventRepository events, {bool last: false, |
- RenderingQueue queue}) { |
+ factory NavVMMenuElement(M.VM vm, M.EventRepository events, |
+ {RenderingQueue queue}) { |
assert(vm != null); |
assert(events != null); |
- assert(last != null); |
NavVMMenuElement e = document.createElement(tag.name); |
e._r = new RenderingScheduler(e, queue: queue); |
e._vm = vm; |
e._events = events; |
- e._last = last; |
return e; |
} |
- NavVMMenuElement.created() : super.created() { createShadowRoot(); } |
+ NavVMMenuElement.created() : super.created(); |
@override |
void attached() { |
@@ -58,22 +57,21 @@ class NavVMMenuElement extends HtmlElement implements Renderable { |
@override |
void detached() { |
super.detached(); |
- shadowRoot.children = []; |
+ children = []; |
_r.disable(notify: true); |
_updatesSubscription.cancel(); |
} |
void render() { |
- shadowRoot.children = [ |
- new NavMenuElement(vm.displayName, link: Uris.vm(), last: last, |
- queue: _r.queue) |
- ..children = ( |
- _vm.isolates.map((isolate) { |
- return new NavMenuItemElement(isolate.name, queue: _r.queue, |
- link: Uris.inspect(isolate)); |
- }).toList() |
- ..add(new ContentElement()) |
- ) |
+ final content = ( |
+ _vm.isolates.map((isolate) { |
+ return new NavMenuItemElement(isolate.name, queue: _r.queue, |
+ link: Uris.inspect(isolate)); |
+ }).toList() |
+ ..addAll(_content) |
+ ); |
+ children = [ |
+ navMenu(vm.displayName, link: Uris.vm(), content: content) |
]; |
} |
} |