Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: runtime/bin/vmservice/client/lib/src/app/view_model.dart

Issue 221263002: Miscellaneous Observatory UI improvements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 part of app; 5 part of app;
6 6
7 abstract class TableTreeRow extends Observable { 7 abstract class TableTreeRow extends Observable {
8 final TableTreeRow parent; 8 final TableTreeRow parent;
9 @observable final int depth; 9 @observable final int depth;
10 @observable final List<TableTreeRow> children = new List<TableTreeRow>(); 10 @observable final List<TableTreeRow> children = new List<TableTreeRow>();
11 @observable final List<String> columns = []; 11 @observable final List<String> columns = [];
12 static const arrowRight = '\u2192';
13 static const arrowDownRight = '\u21b3';
14 @observable String expander = arrowRight;
turnidge 2014/04/01 19:42:48 I recommend deleting expander here and instead usi
Cutch 2014/04/02 18:26:52 I agree with you in spirit. But putting this into
12 15
13 TableTreeRow(TableTreeRow parent) : 16 TableTreeRow(TableTreeRow parent) :
14 parent = parent, 17 parent = parent,
15 depth = parent != null ? parent.depth+1 : 0; 18 depth = parent != null ? parent.depth+1 : 0;
16 19
17 bool _expanded = false; 20 bool _expanded = false;
18 bool get expanded => _expanded; 21 bool get expanded => _expanded;
19 set expanded(bool expanded) { 22 set expanded(bool expanded) {
20 var changed = _expanded != expanded; 23 var changed = _expanded != expanded;
21 _expanded = expanded; 24 _expanded = expanded;
22 if (changed) { 25 if (changed) {
23 // If the state has changed, fire callbacks. 26 // If the state has changed, fire callbacks.
24 if (_expanded) { 27 if (_expanded) {
28 expander = arrowDownRight;
25 onShow(); 29 onShow();
26 } else { 30 } else {
31 expander = arrowRight;
27 onHide(); 32 onHide();
28 } 33 }
29 } 34 }
30 } 35 }
31 36
32 bool toggle() { 37 bool toggle() {
33 expanded = !expanded; 38 expanded = !expanded;
34 return expanded; 39 return expanded;
35 } 40 }
36 41
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 _collapse(row.children[i]); 90 _collapse(row.children[i]);
86 } 91 }
87 } 92 }
88 // Collapse this row. 93 // Collapse this row.
89 row.expanded = false; 94 row.expanded = false;
90 // Remove all children. 95 // Remove all children.
91 int index = _index(row); 96 int index = _index(row);
92 rows.removeRange(index + 1, index + 1 + childCount); 97 rows.removeRange(index + 1, index + 1 + childCount);
93 } 98 }
94 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698