Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 import 'dart:async'; | |
| 7 import 'package:observatory/models.dart' as M show IsolateRef, ClassRef; | |
| 8 import 'package:observatory/src/elements/helpers/tag.dart'; | |
| 9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | |
| 10 import 'package:observatory/src/elements/nav/menu.dart'; | |
| 11 | |
| 12 class NavClassMenuElement extends HtmlElement implements Renderable { | |
| 13 static const tag = const Tag<NavClassMenuElement>('nav-class-menu', | |
| 14 dependencies: const [NavMenuElement.tag]); | |
| 15 | |
| 16 RenderingScheduler _r; | |
| 17 | |
| 18 Stream<RenderedEvent<NavClassMenuElement>> get onRendered => _r.onRendered; | |
| 19 | |
| 20 bool _last; | |
| 21 M.IsolateRef _isolate; | |
| 22 M.ClassRef _cls; | |
| 23 bool get last => _last; | |
| 24 M.IsolateRef get isolate => _isolate; | |
| 25 M.ClassRef get cls => _cls; | |
| 26 set last(bool value) => _last = _r.checkAndReact(_last, value); | |
| 27 | |
| 28 factory NavClassMenuElement(M.IsolateRef isolate, M.ClassRef cls, | |
| 29 {bool last: false, RenderingQueue queue}) { | |
| 30 assert(isolate != null); | |
| 31 assert(cls != null); | |
| 32 assert(last != null); | |
| 33 NavClassMenuElement e = document.createElement(tag.name); | |
| 34 e._r = new RenderingScheduler(e, queue: queue); | |
| 35 e._isolate = isolate; | |
| 36 e._cls = cls; | |
| 37 e._last = last; | |
| 38 return e; | |
| 39 } | |
| 40 | |
| 41 NavClassMenuElement.created() : super.created() { createShadowRoot(); } | |
| 42 | |
| 43 @override | |
| 44 void attached() { | |
| 45 super.attached(); | |
| 46 _r.enable(); | |
| 47 } | |
| 48 | |
| 49 @override | |
| 50 void detached() { | |
| 51 super.detached(); | |
| 52 _r.disable(notify: true); | |
| 53 shadowRoot.children = []; | |
| 54 } | |
| 55 | |
| 56 void render() { | |
| 57 shadowRoot.children = [ | |
| 58 new NavMenuElement(cls.name, last: last, queue: _r.queue, | |
| 59 link: new Uri(path: '/inspect', | |
|
Cutch
2016/07/22 13:31:43
why isn't this using the Uri helper method?
cbernaschina
2016/07/22 16:57:54
Waiting the isolate menu to be accepted.
Once that
cbernaschina
2016/07/22 21:52:44
Done.
| |
| 60 queryParameters: {'isolateId': isolate.id, | |
| 61 'objectId': cls.id}).toString()) | |
| 62 ..children = [new ContentElement()] | |
| 63 ]; | |
| 64 } | |
| 65 } | |
| OLD | NEW |