| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, 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 |
| 8 show IsolateRef, InstructionsRef; |
| 9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
| 10 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 11 import 'package:observatory/src/elements/helpers/uris.dart'; |
| 12 |
| 13 class InstructionsRefElement extends HtmlElement implements Renderable { |
| 14 static const tag = const Tag<InstructionsRefElement>('instructions-ref'); |
| 15 |
| 16 RenderingScheduler<InstructionsRefElement> _r; |
| 17 |
| 18 Stream<RenderedEvent<InstructionsRefElement>> get onRendered => _r.onRendered; |
| 19 |
| 20 M.IsolateRef _isolate; |
| 21 M.InstructionsRef _instructions; |
| 22 |
| 23 M.IsolateRef get isolate => _isolate; |
| 24 M.InstructionsRef get instructions => _instructions; |
| 25 |
| 26 factory InstructionsRefElement(M.IsolateRef isolate, |
| 27 M.InstructionsRef instructions, {RenderingQueue queue}) { |
| 28 assert(isolate != null); |
| 29 assert(instructions != null); |
| 30 InstructionsRefElement e = document.createElement(tag.name); |
| 31 e._r = new RenderingScheduler(e, queue: queue); |
| 32 e._isolate = isolate; |
| 33 e._instructions = instructions; |
| 34 return e; |
| 35 } |
| 36 |
| 37 InstructionsRefElement.created() : super.created(); |
| 38 |
| 39 @override |
| 40 void attached() { |
| 41 super.attached(); |
| 42 _r.enable(); |
| 43 } |
| 44 |
| 45 @override |
| 46 void detached() { |
| 47 super.detached(); |
| 48 _r.disable(notify: true); |
| 49 children = []; |
| 50 } |
| 51 |
| 52 void render() { |
| 53 children = [ |
| 54 new AnchorElement(href: Uris.inspect(_isolate, object: _instructions)) |
| 55 ..children = [ |
| 56 new SpanElement()..classes = ['emphatize'] |
| 57 ..text = 'Instructions', |
| 58 new SpanElement()..text = ' (${_instructions.code.name})' |
| 59 ] |
| 60 ]; |
| 61 } |
| 62 } |
| OLD | NEW |