| 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 service_ref_element; | 5 library service_ref_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'package:logging/logging.dart'; | 9 import 'package:logging/logging.dart'; |
| 10 import 'package:observatory/models.dart' as M; |
| 10 import 'package:observatory/service.dart'; | 11 import 'package:observatory/service.dart'; |
| 11 import 'package:polymer/polymer.dart'; | 12 import 'package:polymer/polymer.dart'; |
| 12 | 13 |
| 13 import 'class_ref.dart'; | 14 import 'class_ref.dart'; |
| 15 import 'class_ref_as_value.dart'; |
| 16 import 'code_ref.dart'; |
| 17 import 'error_ref.dart'; |
| 18 import 'function_ref.dart'; |
| 14 import 'library_ref.dart'; | 19 import 'library_ref.dart'; |
| 20 import 'library_ref_as_value.dart'; |
| 21 import 'script_ref.dart'; |
| 15 import 'observatory_element.dart'; | 22 import 'observatory_element.dart'; |
| 16 | 23 |
| 17 class ServiceRefElement extends ObservatoryElement { | 24 class ServiceRefElement extends ObservatoryElement { |
| 18 @published ServiceObject ref; | 25 @published ServiceObject ref; |
| 19 @published bool internal = false; | 26 @published bool internal = false; |
| 20 @published String expandKey; | 27 @published String expandKey; |
| 21 ServiceRefElement.created() : super.created(); | 28 ServiceRefElement.created() : super.created(); |
| 22 | 29 |
| 23 void refChanged(oldValue) { | 30 void refChanged(oldValue) { |
| 24 notifyPropertyChange(#url, "", url); | 31 notifyPropertyChange(#url, "", url); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 class AnyServiceRefElement extends ObservatoryElement { | 91 class AnyServiceRefElement extends ObservatoryElement { |
| 85 @published ServiceObject ref; | 92 @published ServiceObject ref; |
| 86 @published String expandKey; | 93 @published String expandKey; |
| 87 @published bool asValue = false; | 94 @published bool asValue = false; |
| 88 AnyServiceRefElement.created() : super.created(); | 95 AnyServiceRefElement.created() : super.created(); |
| 89 | 96 |
| 90 Element _constructElementForRef() { | 97 Element _constructElementForRef() { |
| 91 var type = ref.type; | 98 var type = ref.type; |
| 92 switch (type) { | 99 switch (type) { |
| 93 case 'Class': | 100 case 'Class': |
| 94 ClassRefElement element = new Element.tag('class-ref'); | 101 if (asValue) { |
| 95 element.ref = ref; | 102 ClassRefAsValueElement element = |
| 96 element.asValue = asValue; | 103 new Element.tag('class-ref-as-element'); |
| 97 return element; | 104 element.ref = ref; |
| 105 return element; |
| 106 } |
| 107 return new ClassRefElement(ref.isolate, |
| 108 ref as M.ClassRef, |
| 109 queue: app.queue); |
| 98 case 'Code': | 110 case 'Code': |
| 99 ServiceRefElement element = new Element.tag('code-ref'); | 111 return new CodeRefElement(ref.isolate, ref as M.Code, queue: app.queue); |
| 100 element.ref = ref; | |
| 101 return element; | |
| 102 case 'Context': | 112 case 'Context': |
| 103 ServiceRefElement element = new Element.tag('context-ref'); | 113 ServiceRefElement element = new Element.tag('context-ref'); |
| 104 element.ref = ref; | 114 element.ref = ref; |
| 105 return element; | 115 return element; |
| 106 case 'Error': | 116 case 'Error': |
| 107 ServiceRefElement element = new Element.tag('error-ref'); | 117 return new ErrorRefElement(ref as M.ErrorRef, queue: app.queue); |
| 108 element.ref = ref; | |
| 109 return element; | |
| 110 case 'Field': | 118 case 'Field': |
| 111 ServiceRefElement element = new Element.tag('field-ref'); | 119 ServiceRefElement element = new Element.tag('field-ref'); |
| 112 element.ref = ref; | 120 element.ref = ref; |
| 113 return element; | 121 return element; |
| 114 case 'Function': | 122 case 'Function': |
| 115 ServiceRefElement element = new Element.tag('function-ref'); | 123 return new FunctionRefElement(ref.isolate, |
| 116 element.ref = ref; | 124 ref as M.FunctionRef, |
| 117 return element; | 125 queue: app.queue); |
| 118 case 'Library': | 126 case 'Library': |
| 119 LibraryRefElement element = new Element.tag('library-ref'); | 127 if (asValue) { |
| 120 element.ref = ref; | 128 LibraryRefAsValueElement element = |
| 121 element.asValue = asValue; | 129 new Element.tag('library-ref-as-value'); |
| 122 return element; | 130 element.ref = ref; |
| 131 return element; |
| 132 } |
| 133 return new LibraryRefElement(ref.isolate, |
| 134 ref as M.LibraryRef, |
| 135 queue: app.queue); |
| 123 case 'Object': | 136 case 'Object': |
| 124 ServiceRefElement element = new Element.tag('object-ref'); | 137 ServiceRefElement element = new Element.tag('object-ref'); |
| 125 element.ref = ref; | 138 element.ref = ref; |
| 126 return element; | 139 return element; |
| 127 case 'Script': | 140 case 'Script': |
| 128 ServiceRefElement element = new Element.tag('script-ref'); | 141 return new ScriptRefElement(ref.isolate, |
| 129 element.ref = ref; | 142 ref as M.ScriptRef, |
| 130 return element; | 143 queue: app.queue); |
| 131 case 'Instance': | 144 case 'Instance': |
| 132 case 'Sentinel': | 145 case 'Sentinel': |
| 133 ServiceRefElement element = new Element.tag('instance-ref'); | 146 ServiceRefElement element = new Element.tag('instance-ref'); |
| 134 element.ref = ref; | 147 element.ref = ref; |
| 135 if (expandKey != null) { | 148 if (expandKey != null) { |
| 136 element.expandKey = expandKey; | 149 element.expandKey = expandKey; |
| 137 } | 150 } |
| 138 return element; | 151 return element; |
| 139 default: | 152 default: |
| 140 SpanElement element = new Element.tag('span'); | 153 SpanElement element = new Element.tag('span'); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 157 return; | 170 return; |
| 158 } | 171 } |
| 159 children.add(element); | 172 children.add(element); |
| 160 } | 173 } |
| 161 } | 174 } |
| 162 | 175 |
| 163 @CustomTag('object-ref') | 176 @CustomTag('object-ref') |
| 164 class ObjectRefElement extends ServiceRefElement { | 177 class ObjectRefElement extends ServiceRefElement { |
| 165 ObjectRefElement.created() : super.created(); | 178 ObjectRefElement.created() : super.created(); |
| 166 } | 179 } |
| OLD | NEW |