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

Side by Side Diff: runtime/observatory/lib/src/app/view_model.dart

Issue 2310003004: Removed polymer & mirror from Observatory (Closed)
Patch Set: Fixed tests Created 4 years, 3 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
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 {
8 static const arrowRight = '\u2192'; 8 static const arrowRight = '\u2192';
9 static const arrowDownRight = '\u21b3'; 9 static const arrowDownRight = '\u21b3';
10 // Number of ems each subtree is indented. 10 // Number of ems each subtree is indented.
11 static const subtreeIndent = 2; 11 static const subtreeIndent = 2;
12 12
13 TableTreeRow(this.tree, TableTreeRow parent) : 13 TableTreeRow(this.tree, TableTreeRow parent) :
14 parent = parent, 14 parent = parent,
15 depth = parent != null ? parent.depth + 1 : 0 { 15 depth = parent != null ? parent.depth + 1 : 0 {
16 } 16 }
17 17
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (_tableColumns != null) { 160 if (_tableColumns != null) {
161 _tableColumns.clear(); 161 _tableColumns.clear();
162 } 162 }
163 if (flexColumns != null) { 163 if (flexColumns != null) {
164 flexColumns.clear(); 164 flexColumns.clear();
165 } 165 }
166 _cleanUpListeners(); 166 _cleanUpListeners();
167 } 167 }
168 } 168 }
169 169
170 class TableTree extends Observable { 170 class TableTree {
Cutch 2016/09/07 17:09:17 is this being used anymore?
cbernaschina 2016/09/07 17:27:53 No. Removed TableTree and TableTreeRow Done
171 final TableSectionElement tableBody; 171 final TableSectionElement tableBody;
172 final List<TableTreeRow> rows = []; 172 final List<TableTreeRow> rows = [];
173 final int columnCount; 173 final int columnCount;
174 Future _pendingOperation; 174 Future _pendingOperation;
175 /// Create a table tree with column [headers]. 175 /// Create a table tree with column [headers].
176 TableTree(this.tableBody, this.columnCount); 176 TableTree(this.tableBody, this.columnCount);
177 177
178 void clear() { 178 void clear() {
179 tableBody.children.clear(); 179 tableBody.children.clear();
180 for (var i = 0; i < rows.length; i++) { 180 for (var i = 0; i < rows.length; i++) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 SortedTableColumn.withFormatter(this.label, this.formatter); 281 SortedTableColumn.withFormatter(this.label, this.formatter);
282 SortedTableColumn(this.label) 282 SortedTableColumn(this.label)
283 : formatter = toStringFormatter; 283 : formatter = toStringFormatter;
284 } 284 }
285 285
286 class SortedTableRow { 286 class SortedTableRow {
287 final List values; 287 final List values;
288 SortedTableRow(this.values); 288 SortedTableRow(this.values);
289 } 289 }
290 290
291 class SortedTable extends Observable { 291 class SortedTable {
Cutch 2016/09/07 17:09:17 can this code just be deleted now?
cbernaschina 2016/09/07 17:27:53 It is still used by code-view
292 final List<SortedTableColumn> columns; 292 final List<SortedTableColumn> columns;
293 final List<SortedTableRow> rows = new List<SortedTableRow>(); 293 final List<SortedTableRow> rows = new List<SortedTableRow>();
294 final List<int> sortedRows = []; 294 final List<int> sortedRows = [];
295 295
296 SortedTable(this.columns); 296 SortedTable(this.columns);
297 297
298 int _sortColumnIndex = 0; 298 int _sortColumnIndex = 0;
299 set sortColumnIndex(var index) { 299 set sortColumnIndex(var index) {
300 assert(index >= 0); 300 assert(index >= 0);
301 assert(index < columns.length); 301 assert(index < columns.length);
302 _sortColumnIndex = index; 302 _sortColumnIndex = index;
303 notifyPropertyChange(#getColumnLabel, 0, 1);
304 } 303 }
305 int get sortColumnIndex => _sortColumnIndex; 304 int get sortColumnIndex => _sortColumnIndex;
306 bool _sortDescending = true; 305 bool _sortDescending = true;
307 bool get sortDescending => _sortDescending; 306 bool get sortDescending => _sortDescending;
308 set sortDescending(var descending) { 307 set sortDescending(var descending) {
309 _sortDescending = descending; 308 _sortDescending = descending;
310 notifyPropertyChange(#getColumnLabel, 0, 1);
311 } 309 }
312 310
313 311
314 dynamic getSortKeyFor(int row, int col) { 312 dynamic getSortKeyFor(int row, int col) {
315 return rows[row].values[col]; 313 return rows[row].values[col];
316 } 314 }
317 315
318 int _sortFuncDescending(int i, int j) { 316 int _sortFuncDescending(int i, int j) {
319 var a = getSortKeyFor(i, _sortColumnIndex); 317 var a = getSortKeyFor(i, _sortColumnIndex);
320 var b = getSortKeyFor(j, _sortColumnIndex); 318 var b = getSortKeyFor(j, _sortColumnIndex);
(...skipping 25 matching lines...) Expand all
346 sortedRows.add(rows.length); 344 sortedRows.add(rows.length);
347 rows.add(row); 345 rows.add(row);
348 } 346 }
349 347
350 String getFormattedValue(int row, int column) { 348 String getFormattedValue(int row, int column) {
351 var value = getValue(row, column); 349 var value = getValue(row, column);
352 var formatter = columns[column].formatter; 350 var formatter = columns[column].formatter;
353 return formatter(value); 351 return formatter(value);
354 } 352 }
355 353
356 @observable String getColumnLabel(int column) { 354 String getColumnLabel(int column) {
357 assert(column >= 0); 355 assert(column >= 0);
358 assert(column < columns.length); 356 assert(column < columns.length);
359 // TODO(johnmccutchan): Move expander display decisions into html once 357 // TODO(johnmccutchan): Move expander display decisions into html once
360 // tables and templates are better supported. 358 // tables and templates are better supported.
361 const arrowUp = '\u25BC'; 359 const arrowUp = '\u25BC';
362 const arrowDown = '\u25B2'; 360 const arrowDown = '\u25B2';
363 if (column != _sortColumnIndex) { 361 if (column != _sortColumnIndex) {
364 return columns[column].label + '\u2003'; 362 return columns[column].label + '\u2003';
365 } 363 }
366 return columns[column].label + (_sortDescending ? arrowUp : arrowDown); 364 return columns[column].label + (_sortDescending ? arrowUp : arrowDown);
367 } 365 }
368 366
369 dynamic getValue(int row, int column) { 367 dynamic getValue(int row, int column) {
370 return rows[row].values[column]; 368 return rows[row].values[column];
371 } 369 }
372 } 370 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698