| 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 | |
| 7 import 'package:observatory/app.dart'; | |
| 8 import 'package:observatory/service_html.dart' show Isolate; | |
| 9 import 'package:observatory/src/elements/isolate_ref.dart'; | |
| 10 import 'package:observatory/src/elements/helpers/tag.dart'; | |
| 11 import 'package:observatory/src/elements/shims/binding.dart'; | |
| 12 | |
| 13 @bindable | |
| 14 class IsolateRefElementWrapper extends HtmlElement { | |
| 15 | |
| 16 static const binder = const Binder<IsolateRefElementWrapper>(const { | |
| 17 'ref': #ref | |
| 18 }); | |
| 19 | |
| 20 static const tag = const Tag<IsolateRefElementWrapper>('isolate-ref'); | |
| 21 | |
| 22 Isolate _isolate; | |
| 23 | |
| 24 Isolate get ref => _isolate; | |
| 25 | |
| 26 void set ref(Isolate value) { | |
| 27 _isolate = value; | |
| 28 render(); | |
| 29 } | |
| 30 | |
| 31 IsolateRefElementWrapper.created() : super.created() { | |
| 32 binder.registerCallback(this); | |
| 33 createShadowRoot(); | |
| 34 render(); | |
| 35 } | |
| 36 | |
| 37 @override | |
| 38 void attached() { | |
| 39 super.attached(); | |
| 40 render(); | |
| 41 } | |
| 42 | |
| 43 void render() { | |
| 44 shadowRoot.children = []; | |
| 45 if (ref == null) { | |
| 46 return; | |
| 47 } | |
| 48 | |
| 49 shadowRoot.children = [ | |
| 50 new StyleElement() | |
| 51 ..text = ''' | |
| 52 isolate-ref-wrapped > a[href]:hover { | |
| 53 text-decoration: underline; | |
| 54 } | |
| 55 isolate-ref-wrapped > a[href] { | |
| 56 color: #0489c3; | |
| 57 text-decoration: none; | |
| 58 }''', | |
| 59 new IsolateRefElement(_isolate, app.events, queue: app.queue) | |
| 60 ]; | |
| 61 } | |
| 62 | |
| 63 ObservatoryApplication get app => ObservatoryApplication.app; | |
| 64 } | |
| OLD | NEW |