| 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 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'observatory_element.dart'; | 8 import 'observatory_element.dart'; |
| 9 import 'package:observatory/service.dart'; | 9 import 'package:observatory/service.dart'; |
| 10 | 10 |
| 11 @CustomTag('service-ref') | 11 @CustomTag('service-ref') |
| 12 class ServiceRefElement extends ObservatoryElement { | 12 class ServiceRefElement extends ObservatoryElement { |
| 13 @published ServiceObject ref; | 13 @published ServiceObject ref; |
| 14 @published bool internal = false; | 14 @published bool internal = false; |
| 15 ServiceRefElement.created() : super.created(); | 15 ServiceRefElement.created() : super.created(); |
| 16 | 16 |
| 17 void refChanged(oldValue) { | 17 void refChanged(oldValue) { |
| 18 notifyPropertyChange(#url, "", url); | 18 notifyPropertyChange(#url, "", url); |
| 19 notifyPropertyChange(#name, [], name); | 19 notifyPropertyChange(#name, [], name); |
| 20 notifyPropertyChange(#nameIsEmpty, 0, 1); | 20 notifyPropertyChange(#nameIsEmpty, 0, 1); |
| 21 notifyPropertyChange(#hoverText, "", hoverText); | 21 notifyPropertyChange(#hoverText, "", hoverText); |
| 22 } | 22 } |
| 23 | 23 |
| 24 String get url { | 24 String get url { |
| 25 if (ref == null) { | 25 if (ref == null) { |
| 26 return 'NULL REF'; | 26 return 'NULL REF'; |
| 27 } | 27 } |
| 28 return ref.hashLink; | 28 return gotoLink(ref.link); |
| 29 } | 29 } |
| 30 | 30 |
| 31 String get serviceId { | 31 String get serviceId { |
| 32 if (ref == null) { | 32 if (ref == null) { |
| 33 return 'NULL REF'; | 33 return 'NULL REF'; |
| 34 } | 34 } |
| 35 return ref.id; | 35 return ref.id; |
| 36 } | 36 } |
| 37 | 37 |
| 38 String get hoverText { | 38 String get hoverText { |
| 39 if (ref == null) { | 39 if (ref == null) { |
| 40 return 'NULL REF'; | 40 return 'NULL REF'; |
| 41 } | 41 } |
| 42 return ref.vmName; | 42 return ref.vmName; |
| 43 } | 43 } |
| 44 | 44 |
| 45 String get name { | 45 String get name { |
| 46 if (ref == null) { | 46 if (ref == null) { |
| 47 return 'NULL REF'; | 47 return 'NULL REF'; |
| 48 } | 48 } |
| 49 return ref.name; | 49 return ref.name; |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Workaround isEmpty not being useable due to missing @MirrorsUsed. | 52 // Workaround isEmpty not being useable due to missing @MirrorsUsed. |
| 53 bool get nameIsEmpty { | 53 bool get nameIsEmpty { |
| 54 return name.isEmpty; | 54 return name.isEmpty; |
| 55 } | 55 } |
| 56 } | 56 } |
| OLD | NEW |