| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 if (ref == null) { | 49 if (ref == null) { |
| 50 return 'NULL REF'; | 50 return 'NULL REF'; |
| 51 } | 51 } |
| 52 return ref.name; | 52 return ref.name; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Workaround isEmpty not being useable due to missing @MirrorsUsed. | 55 // Workaround isEmpty not being useable due to missing @MirrorsUsed. |
| 56 bool get nameIsEmpty { | 56 bool get nameIsEmpty { |
| 57 return (name == null) || name.isEmpty; | 57 return (name == null) || name.isEmpty; |
| 58 } | 58 } |
| 59 |
| 60 |
| 61 @published bool expanded = false; |
| 62 dynamic expander() { |
| 63 return expandEvent; |
| 64 } |
| 65 void expandEvent(bool expand, Function onDone) { |
| 66 if (expand) { |
| 67 ref.reload().then((result) { |
| 68 ref = result; |
| 69 notifyPropertyChange(#ref, 0, 1); |
| 70 expanded = true; |
| 71 }).whenComplete(onDone); |
| 72 } else { |
| 73 expanded = false; |
| 74 onDone(); |
| 75 } |
| 76 } |
| 59 } | 77 } |
| 60 | 78 |
| 61 | 79 |
| 62 @CustomTag('any-service-ref') | 80 @CustomTag('any-service-ref') |
| 63 class AnyServiceRefElement extends ObservatoryElement { | 81 class AnyServiceRefElement extends ObservatoryElement { |
| 64 @published ServiceObject ref; | 82 @published ServiceObject ref; |
| 65 @published String expandKey; | 83 @published String expandKey; |
| 66 AnyServiceRefElement.created() : super.created(); | 84 AnyServiceRefElement.created() : super.created(); |
| 67 | 85 |
| 68 Element _constructElementForRef() { | 86 Element _constructElementForRef() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 return; | 151 return; |
| 134 } | 152 } |
| 135 children.add(element); | 153 children.add(element); |
| 136 } | 154 } |
| 137 } | 155 } |
| 138 | 156 |
| 139 @CustomTag('object-ref') | 157 @CustomTag('object-ref') |
| 140 class ObjectRefElement extends ServiceRefElement { | 158 class ObjectRefElement extends ServiceRefElement { |
| 141 ObjectRefElement.created() : super.created(); | 159 ObjectRefElement.created() : super.created(); |
| 142 } | 160 } |
| OLD | NEW |