OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:observatory/models.dart' as M | 7 import 'package:observatory/models.dart' as M show IsolateRef, TokenStreamRef; |
8 show IsolateRef, TokenStreamRef; | |
9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
10 import 'package:observatory/src/elements/helpers/tag.dart'; | 9 import 'package:observatory/src/elements/helpers/tag.dart'; |
11 import 'package:observatory/src/elements/helpers/uris.dart'; | 10 import 'package:observatory/src/elements/helpers/uris.dart'; |
12 | 11 |
13 class TokenStreamRefElement extends HtmlElement implements Renderable { | 12 class TokenStreamRefElement extends HtmlElement implements Renderable { |
14 static const tag = const Tag<TokenStreamRefElement>('token-stream-ref'); | 13 static const tag = const Tag<TokenStreamRefElement>('token-stream-ref'); |
15 | 14 |
16 RenderingScheduler<TokenStreamRefElement> _r; | 15 RenderingScheduler<TokenStreamRefElement> _r; |
17 | 16 |
18 Stream<RenderedEvent<TokenStreamRefElement>> get onRendered => _r.onRendered; | 17 Stream<RenderedEvent<TokenStreamRefElement>> get onRendered => _r.onRendered; |
(...skipping 25 matching lines...) Expand all Loading... |
44 | 43 |
45 @override | 44 @override |
46 void detached() { | 45 void detached() { |
47 super.detached(); | 46 super.detached(); |
48 _r.disable(notify: true); | 47 _r.disable(notify: true); |
49 children = []; | 48 children = []; |
50 } | 49 } |
51 | 50 |
52 void render() { | 51 void render() { |
53 final text = (_token.name == null || _token.name == '') | 52 final text = (_token.name == null || _token.name == '') |
54 ? 'TokenStream' | 53 ? 'TokenStream' |
55 : _token.name; | 54 : _token.name; |
56 children = [ | 55 children = [ |
57 new AnchorElement(href: Uris.inspect(_isolate, object: _token)) | 56 new AnchorElement(href: Uris.inspect(_isolate, object: _token)) |
58 ..text = text | 57 ..text = text |
59 ]; | 58 ]; |
60 } | 59 } |
61 } | 60 } |
OLD | NEW |