| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, 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 'package:observatory/mocks.dart' show ErrorRefMock; |
| 7 import 'package:observatory/service_html.dart' show ServiceMap; |
| 8 import 'package:observatory/src/elements/error_ref.dart'; |
| 9 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 10 import 'package:observatory/src/elements/shims/binding.dart'; |
| 11 |
| 12 class ErrorRefElementWrapper extends HtmlElement { |
| 13 |
| 14 static final binder = new Binder<ErrorRefElementWrapper>( |
| 15 const [const Binding('ref')]); |
| 16 |
| 17 static const tag = const Tag<ErrorRefElementWrapper>('error-ref'); |
| 18 |
| 19 ServiceMap _error; |
| 20 ServiceMap get ref => _error; |
| 21 void set ref(ServiceMap ref) { _error = ref; render(); } |
| 22 |
| 23 ErrorRefElementWrapper.created() : super.created() { |
| 24 binder.registerCallback(this); |
| 25 createShadowRoot(); |
| 26 render(); |
| 27 } |
| 28 |
| 29 @override |
| 30 void attached() { |
| 31 super.attached(); |
| 32 render(); |
| 33 } |
| 34 |
| 35 void render() { |
| 36 shadowRoot.children = []; |
| 37 if (_error == null) return; |
| 38 |
| 39 shadowRoot.children = [ |
| 40 new StyleElement() |
| 41 ..text = '@import "packages/observatory/src/elements/css/shared.css";', |
| 42 new ErrorRefElement(new ErrorRefMock(message: ref['message'])) |
| 43 ]; |
| 44 } |
| 45 } |
| OLD | NEW |