Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: runtime/observatory/lib/src/elements/nav/top_menu.dart

Issue 2159273003: Converted Observatory top-nav-menu element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Splitted instructions in multiple lines Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/nav/top_menu.dart
diff --git a/runtime/observatory/lib/src/elements/nav/top_menu.dart b/runtime/observatory/lib/src/elements/nav/top_menu.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cc8c01597bd34d4819c407e789e752e20dd2e772
--- /dev/null
+++ b/runtime/observatory/lib/src/elements/nav/top_menu.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html';
+import 'dart:async';
+import 'package:observatory/src/elements/helpers/tag.dart';
+import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
+import 'package:observatory/src/elements/nav/menu.dart';
+import 'package:observatory/src/elements/nav/menu_item.dart';
+
+class NavTopMenuElement extends HtmlElement implements Renderable {
+ static const tag = const Tag<NavTopMenuElement>('nav-top-menu',
+ dependencies: const [NavMenuElement.tag,
+ NavMenuItemElement.tag]);
+
+ RenderingScheduler _r;
+
+ Stream<RenderedEvent<NavTopMenuElement>> get onRendered => _r.onRendered;
+
+ bool _last;
+ bool get last => _last;
+ set last(bool value) => _last = _r.checkAndReact(_last, value);
+
+ factory NavTopMenuElement({bool last: false, RenderingQueue queue}) {
+ assert(last != null);
+ NavTopMenuElement e = document.createElement(tag.name);
+ e._r = new RenderingScheduler(e, queue: queue);
+ e._last = last;
+ return e;
+ }
+
+ NavTopMenuElement.created() : super.created() { createShadowRoot(); }
+
+ @override
+ void attached() {
+ super.attached();
+ _r.enable();
+ }
+
+ @override
+ void detached() {
+ super.detached();
+ _r.disable(notify: true);
+ shadowRoot.children = [];
+ }
+
+ void render() {
+ shadowRoot.children = [
+ new NavMenuElement('Observatory', link: '/vm', last: last,
+ queue: _r.queue)
+ ..children = [
+ new NavMenuItemElement('Connect to a VM', link: '/vm-connect',
+ queue: _r.queue),
+ new ContentElement()
+ ]
+ ];
+ }
+}
« no previous file with comments | « runtime/observatory/lib/elements.dart ('k') | runtime/observatory/lib/src/elements/nav/top_menu_wrapper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698