| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 class_tree_element; | 5 library class_tree_element; |
| 6 | 6 |
| 7 import 'observatory_element.dart'; | 7 import 'observatory_element.dart'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:logging/logging.dart'; | 9 import 'package:logging/logging.dart'; |
| 10 import 'package:observatory/app.dart'; | 10 import 'package:observatory/app.dart'; |
| 11 import 'package:observatory/service.dart'; | 11 import 'package:observatory/service.dart'; |
| 12 import 'package:polymer/polymer.dart'; | 12 import 'package:polymer/polymer.dart'; |
| 13 | 13 |
| 14 class ClassTreeRow extends TableTreeRow { | 14 class ClassTreeRow extends TableTreeRow { |
| 15 @reflectable final Isolate isolate; | 15 @reflectable final Isolate isolate; |
| 16 @reflectable final Class cls; | 16 @reflectable final Class cls; |
| 17 ClassTreeRow(this.isolate, this.cls, ClassTreeRow parent) : super(parent) { | 17 ClassTreeRow(this.isolate, this.cls, ClassTreeRow parent) : super(parent) { |
| 18 assert(isolate != null); | 18 assert(isolate != null); |
| 19 assert(cls != null); | 19 assert(cls != null); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void onShow() { | 22 void onShow() { |
| 23 if (children.length > 0) { | 23 if (children.length > 0) { |
| 24 // Child rows already created. | 24 // Child rows already created. |
| 25 return; | 25 return; |
| 26 } | 26 } |
| 27 for (var subClass in cls.children) { | 27 for (var subclass in cls.subclasses) { |
| 28 if (subClass.isPatch) { | 28 if (subclass.isPatch) { |
| 29 continue; | 29 continue; |
| 30 } | 30 } |
| 31 var row = new ClassTreeRow(isolate, subClass, this); | 31 var row = new ClassTreeRow(isolate, subclass, this); |
| 32 children.add(row); | 32 children.add(row); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 void onHide() { | 36 void onHide() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool hasChildren() { | 39 bool hasChildren() { |
| 40 return cls.children.length > 0; | 40 return cls.subclasses.length > 0; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 @CustomTag('class-tree') | 45 @CustomTag('class-tree') |
| 46 class ClassTreeElement extends ObservatoryElement { | 46 class ClassTreeElement extends ObservatoryElement { |
| 47 @observable Isolate isolate; | 47 @observable Isolate isolate; |
| 48 | 48 |
| 49 TableTree tree; | 49 TableTree tree; |
| 50 | 50 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 try { | 106 try { |
| 107 // Subtract 1 to get 0 based indexing. | 107 // Subtract 1 to get 0 based indexing. |
| 108 tree.toggle(row.rowIndex - 1); | 108 tree.toggle(row.rowIndex - 1); |
| 109 } catch (e, stackTrace) { | 109 } catch (e, stackTrace) { |
| 110 Logger.root.warning('toggleExpanded', e, stackTrace); | 110 Logger.root.warning('toggleExpanded', e, stackTrace); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 } | 115 } |
| OLD | NEW |