Chromium Code Reviews| 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 instance_ref_element; | 5 library instance_ref_element; |
| 6 | 6 |
| 7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
| 8 import 'service_ref.dart'; | 8 import 'service_ref.dart'; |
| 9 | 9 |
| 10 @CustomTag('instance-ref') | 10 @CustomTag('instance-ref') |
| 11 class InstanceRefElement extends ServiceRefElement { | 11 class InstanceRefElement extends ServiceRefElement { |
| 12 InstanceRefElement.created() : super.created(); | 12 InstanceRefElement.created() : super.created(); |
| 13 | 13 |
| 14 @published bool expanded = false; | |
| 15 | |
| 14 String get name { | 16 String get name { |
| 15 if (ref == null) { | 17 if (ref == null) { |
| 16 return super.name; | 18 return super.name; |
| 17 } | 19 } |
| 18 return ref['preview']; | 20 return ref['preview']; |
| 19 } | 21 } |
| 20 } | 22 |
| 23 void toggleExpand(var a, var b, var c) { | |
| 24 if (expanded) { | |
| 25 ref['fields'] = null; | |
| 26 ref['elements'] = null; | |
| 27 expanded = false; | |
| 28 } else { | |
| 29 app.requestManager.requestMap(url.substring(1)).then((map) { | |
|
Cutch
2014/02/13 22:31:29
Could you change requestMap to detect if the url s
turnidge
2014/02/14 17:36:47
Done. I find myself wondering if it would be bett
| |
| 30 print(map); | |
| 31 ref['fields'] = map['fields']; | |
| 32 ref['elements'] = map['elements']; | |
| 33 ref['length'] = map['length']; | |
| 34 expanded = true; | |
| 35 }).catchError((e, trace) { | |
| 36 Logger.root.severe('Error while expanding instance-ref: $e\n$trace'); | |
| 37 }); | |
| 38 } | |
| 39 } | |
| 40 } | |
| OLD | NEW |