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 library script_ref_element; | 5 library script_ref_element; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'package:observatory/models.dart' as M show IsolateRef, ScriptRef; | 9 import 'package:observatory/models.dart' as M show IsolateRef, ScriptRef; |
10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 10 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | 11 import 'package:observatory/src/elements/helpers/tag.dart'; |
12 import 'package:observatory/src/elements/helpers/uris.dart'; | 12 import 'package:observatory/src/elements/helpers/uris.dart'; |
13 | 13 |
14 class ScriptRefElement extends HtmlElement implements Renderable { | 14 class ScriptRefElement extends HtmlElement implements Renderable { |
15 static const tag = const Tag<ScriptRefElement>('script-ref'); | 15 static const tag = const Tag<ScriptRefElement>('script-ref'); |
16 | 16 |
17 RenderingScheduler _r; | 17 RenderingScheduler _r; |
18 | 18 |
19 Stream<RenderedEvent<ScriptRefElement>> get onRendered => _r.onRendered; | 19 Stream<RenderedEvent<ScriptRefElement>> get onRendered => _r.onRendered; |
20 | 20 |
21 | |
22 M.IsolateRef _isolate; | 21 M.IsolateRef _isolate; |
23 M.ScriptRef _script; | 22 M.ScriptRef _script; |
24 | 23 |
25 M.IsolateRef get isolate => _isolate; | 24 M.IsolateRef get isolate => _isolate; |
26 M.ScriptRef get script => _script; | 25 M.ScriptRef get script => _script; |
27 | 26 |
28 factory ScriptRefElement(M.IsolateRef isolate, M.ScriptRef script, | 27 factory ScriptRefElement(M.IsolateRef isolate, M.ScriptRef script, |
29 {RenderingQueue queue}) { | 28 {RenderingQueue queue}) { |
30 assert(isolate != null); | 29 assert(isolate != null); |
31 assert(script != null); | 30 assert(script != null); |
32 ScriptRefElement e = document.createElement(tag.name); | 31 ScriptRefElement e = document.createElement(tag.name); |
33 e._r = new RenderingScheduler(e, queue: queue); | 32 e._r = new RenderingScheduler(e, queue: queue); |
34 e._isolate = isolate; | 33 e._isolate = isolate; |
35 e._script = script; | 34 e._script = script; |
36 return e; | 35 return e; |
37 } | 36 } |
38 | 37 |
39 ScriptRefElement.created() : super.created(); | 38 ScriptRefElement.created() : super.created(); |
(...skipping 12 matching lines...) Expand all Loading... |
52 } | 51 } |
53 | 52 |
54 void render() { | 53 void render() { |
55 children = [ | 54 children = [ |
56 new AnchorElement(href: Uris.inspect(isolate, object: script)) | 55 new AnchorElement(href: Uris.inspect(isolate, object: script)) |
57 ..title = script.uri | 56 ..title = script.uri |
58 ..text = script.uri.split('/').last | 57 ..text = script.uri.split('/').last |
59 ]; | 58 ]; |
60 } | 59 } |
61 } | 60 } |
OLD | NEW |