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

Side by Side Diff: runtime/observatory/lib/src/elements/nav/menu_wrapper.dart

Issue 2162733002: Converted Observatory nav-menu element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted from single to triple quotes 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:html';
6
7 import 'package:observatory/app.dart';
8 import 'package:observatory/src/elements/helpers/tag.dart';
9 import 'package:observatory/src/elements/shims/binding.dart';
10 import 'package:observatory/src/elements/nav/menu.dart';
11
12 class NavMenuElementWrapper extends HtmlElement {
13 static final binder = new Binder<NavMenuElementWrapper>(
14 const [const Binding('anchor'), const Binding('link'),
15 const Binding('last')]);
16
17 static const tag =
18 const Tag<NavMenuElementWrapper>('nav-menu');
19
20 String _anchor = '---';
21 String _link;
22 bool _last = false;
23 String get anchor => _anchor;
24 String get link => _link;
25 bool get last => _last;
26 set anchor(String value) {
27 _anchor = value; render();
28 }
29 set link(String value) {
30 _link = value; render();
31 }
32 set last(bool value) {
33 _last = value; render();
34 }
35
36 NavMenuElementWrapper.created() : super.created() {
37 binder.registerCallback(this);
38 _anchor = getAttribute('anchor');
39 _link = getAttribute('link');
40 _last = getAttribute('') != null;
41 createShadowRoot();
42 render();
43 }
44
45 @override
46 void attached() {
47 super.attached();
48 render();
49 }
50
51 void render() {
52 shadowRoot.children = [];
53 if (_anchor == null || _last == null) return;
54
55 shadowRoot.children = [
56 new NavMenuElement(_anchor, link: _link, last: last,
57 queue: ObservatoryApplication.app.queue)
58 ..children = [new ContentElement()]
59 ];
60 }
61 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/menu.dart ('k') | runtime/observatory/lib/src/elements/nav_bar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698