| 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 import 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
| 9 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 10 import 'observatory_element.dart'; | 10 import 'observatory_element.dart'; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 @CustomTag('any-service-ref') | 61 @CustomTag('any-service-ref') |
| 62 class AnyServiceRefElement extends ObservatoryElement { | 62 class AnyServiceRefElement extends ObservatoryElement { |
| 63 @published ServiceObject ref; | 63 @published ServiceObject ref; |
| 64 AnyServiceRefElement.created() : super.created(); | 64 AnyServiceRefElement.created() : super.created(); |
| 65 | 65 |
| 66 Element _constructElementForRef() { | 66 Element _constructElementForRef() { |
| 67 var type = ref.serviceType; | 67 var type = ref.vmType; |
| 68 switch (type) { | 68 switch (type) { |
| 69 case 'Class': | 69 case 'Class': |
| 70 ServiceRefElement element = new Element.tag('class-ref'); | 70 ServiceRefElement element = new Element.tag('class-ref'); |
| 71 element.ref = ref; | 71 element.ref = ref; |
| 72 return element; | 72 return element; |
| 73 case 'Code': | 73 case 'Code': |
| 74 ServiceRefElement element = new Element.tag('code-ref'); | 74 ServiceRefElement element = new Element.tag('code-ref'); |
| 75 element.ref = ref; | 75 element.ref = ref; |
| 76 return element; | 76 return element; |
| 77 case 'Field': | 77 case 'Field': |
| (...skipping 30 matching lines...) Expand all Loading... |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 refChanged(oldValue) { | 111 refChanged(oldValue) { |
| 112 // Remove the current view. | 112 // Remove the current view. |
| 113 children.clear(); | 113 children.clear(); |
| 114 if (ref == null) { | 114 if (ref == null) { |
| 115 Logger.root.info('Viewing null object.'); | 115 Logger.root.info('Viewing null object.'); |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 var type = ref.serviceType; | 118 var type = ref.vmType; |
| 119 var element = _constructElementForRef(); | 119 var element = _constructElementForRef(); |
| 120 if (element == null) { | 120 if (element == null) { |
| 121 Logger.root.info('Unable to find a ref element for \'${type}\''); | 121 Logger.root.info('Unable to find a ref element for \'${type}\''); |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 children.add(element); | 124 children.add(element); |
| 125 Logger.root.info('Viewing object of \'${type}\''); | 125 Logger.root.info('Viewing object of \'${type}\''); |
| 126 } | 126 } |
| 127 } | 127 } |
| OLD | NEW |