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

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

Issue 2211603002: Centralized event streams (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with master Created 4 years, 4 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
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 6
7 import 'package:observatory/app.dart'; 7 import 'package:observatory/app.dart';
8 import 'package:observatory/service.dart'; 8 import 'package:observatory/service.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/shims/binding.dart'; 10 import 'package:observatory/src/elements/shims/binding.dart';
11 import 'package:observatory/src/elements/nav/class_menu.dart'; 11 import 'package:observatory/src/elements/nav/class_menu.dart';
12 12
13 @bindable 13 @bindable
14 class NavClassMenuElementWrapper extends HtmlElement { 14 class NavClassMenuElementWrapper extends HtmlElement {
15 static const binder = const Binder<NavClassMenuElementWrapper>(const { 15 static const binder = const Binder<NavClassMenuElementWrapper>(const {
16 'last': #last, 'cls': #cls 16 'last': #last, 'cls': #cls
17 }); 17 });
18 18
19 static const tag = 19 static const tag =
20 const Tag<NavClassMenuElementWrapper>('class-nav-menu'); 20 const Tag<NavClassMenuElementWrapper>('class-nav-menu');
21 21
22 bool _last = false; 22 bool _last = false;
23 Class _cls; 23 Class _cls;
24
24 bool get last => _last; 25 bool get last => _last;
25 Class get cls => _cls; 26 Class get cls => _cls;
27
26 set last(bool value) { 28 set last(bool value) {
27 _last = value; render(); 29 _last = value;
30 render();
28 } 31 }
29 set cls(Class value) { 32 set cls(Class value) {
30 _cls = value; render(); 33 _cls = value;
34 render();
31 } 35 }
32 36
33 NavClassMenuElementWrapper.created() : super.created() { 37 NavClassMenuElementWrapper.created() : super.created() {
34 binder.registerCallback(this); 38 binder.registerCallback(this);
35 _last = _getBoolAttribute('last'); 39 _last = _getBoolAttribute('last');
36 createShadowRoot(); 40 createShadowRoot();
37 render(); 41 render();
38 } 42 }
39 43
40 @override 44 @override
41 void attached() { 45 void attached() {
42 super.attached(); 46 super.attached();
43 render(); 47 render();
44 } 48 }
45 49
46 void render() { 50 void render() {
47 shadowRoot.children = []; 51 shadowRoot.children = [];
48 if (_cls == null || _last == null) return; 52 if (_cls == null || _last == null) {
53 return;
54 }
49 55
50 shadowRoot.children = [ 56 shadowRoot.children = [
51 new NavClassMenuElement(cls.isolate, cls, last: last, 57 new NavClassMenuElement(cls.isolate, cls, last: last,
52 queue: ObservatoryApplication.app.queue) 58 queue: ObservatoryApplication.app.queue)
53 ..children = [new ContentElement()] 59 ..children = [new ContentElement()]
54 ]; 60 ];
55 } 61 }
56 62
57 bool _getBoolAttribute(String name) { 63 bool _getBoolAttribute(String name) {
58 final String value = getAttribute(name); 64 final String value = getAttribute(name);
59 return !(value == null || value == 'false'); 65 return !(value == null || value == 'false');
60 } 66 }
61 } 67 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/bar.dart ('k') | runtime/observatory/lib/src/elements/nav/isolate_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698