OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/value/ui/histogram_set_table_cell.html"> | 8 <link rel="import" href="/tracing/value/ui/histogram_set_table_cell.html"> |
9 <link rel="import" href="/tracing/value/ui/histogram_set_table_name_cell.html"> | 9 <link rel="import" href="/tracing/value/ui/histogram_set_table_name_cell.html"> |
10 | 10 |
11 <script> | 11 <script> |
12 'use strict'; | 12 'use strict'; |
13 tr.exportTo('tr.v.ui', function() { | 13 tr.exportTo('tr.v.ui', function() { |
14 class HistogramSetTableRow { | 14 class HistogramSetTableRow { |
15 /** | 15 /** |
16 * @param {!tr.v.HistogramSetHierarchy} hierarchy | 16 * @param {!tr.v.HistogramSetHierarchy} hierarchy |
17 * @param {!Element} baseTable tr-ui-b-table | 17 * @param {!Element} baseTable tr-ui-b-table |
18 * @param {!tr.v.ui.HistogramSetViewState} rootViewState | 18 * @param {!tr.v.ui.HistogramSetViewState} rootViewState |
19 */ | 19 */ |
20 constructor(hierarchy, baseTable, rootViewState) { | 20 constructor(hierarchy, baseTable, histograms, rootViewState) { |
21 this.hierarchy_ = hierarchy; | 21 this.hierarchy_ = hierarchy; |
22 this.baseTable_ = baseTable; | 22 this.baseTable_ = baseTable; |
| 23 this.histograms_ = histograms; |
23 this.rootViewState_ = rootViewState; | 24 this.rootViewState_ = rootViewState; |
24 this.viewState_ = new tr.v.ui.HistogramSetTableRowState(); | 25 this.viewState_ = new tr.v.ui.HistogramSetTableRowState(); |
25 this.viewState_.addUpdateListener(this.onViewStateUpdate_.bind(this)); | 26 this.viewState_.addUpdateListener(this.onViewStateUpdate_.bind(this)); |
26 this.overviewDataRange_ = undefined; | 27 this.overviewDataRange_ = undefined; |
27 this.nameCell_ = undefined; | 28 this.nameCell_ = undefined; |
28 this.cells_ = new Map(); | 29 this.cells_ = new Map(); |
29 this.subRows_ = []; | 30 this.subRows_ = []; |
30 | 31 |
31 // Don't assign viewState.subRows or cells. There can't be anything | 32 // Don't assign viewState.subRows or cells. There can't be anything |
32 // listening to viewState, so avoid the overhead of dispatching an event. | 33 // listening to viewState, so avoid the overhead of dispatching an event. |
33 for (const subHierarchy of hierarchy.subRows) { | 34 for (const subHierarchy of hierarchy.subRows) { |
34 const subRow = new HistogramSetTableRow( | 35 const subRow = new HistogramSetTableRow( |
35 subHierarchy, baseTable, rootViewState); | 36 subHierarchy, baseTable, histograms, rootViewState); |
36 this.subRows_.push(subRow); | 37 this.subRows_.push(subRow); |
37 this.viewState.subRows.set(subRow.name, subRow.viewState); | 38 this.viewState.subRows.set(subRow.name, subRow.viewState); |
38 } | 39 } |
39 for (const columnName of this.columns.keys()) { | 40 for (const columnName of this.columns.keys()) { |
40 this.viewState.cells.set( | 41 this.viewState.cells.set( |
41 columnName, new tr.v.ui.HistogramSetTableCellState()); | 42 columnName, new tr.v.ui.HistogramSetTableCellState()); |
42 } | 43 } |
43 } | 44 } |
44 | 45 |
45 /** | 46 /** |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 this.nameCell_ = document.createElement( | 177 this.nameCell_ = document.createElement( |
177 'tr-v-ui-histogram-set-table-name-cell'); | 178 'tr-v-ui-histogram-set-table-name-cell'); |
178 this.nameCell_.build(this); | 179 this.nameCell_.build(this); |
179 } | 180 } |
180 return this.nameCell_; | 181 return this.nameCell_; |
181 } | 182 } |
182 | 183 |
183 getCell(columnName) { | 184 getCell(columnName) { |
184 if (this.cells.has(columnName)) return this.cells.get(columnName); | 185 if (this.cells.has(columnName)) return this.cells.get(columnName); |
185 const cell = document.createElement('tr-v-ui-histogram-set-table-cell'); | 186 const cell = document.createElement('tr-v-ui-histogram-set-table-cell'); |
186 cell.build(this, columnName, this.viewState.cells.get(columnName)); | 187 cell.build(this, columnName, this.histograms_, |
| 188 this.viewState.cells.get(columnName)); |
187 this.cells.set(columnName, cell); | 189 this.cells.set(columnName, cell); |
188 return cell; | 190 return cell; |
189 } | 191 } |
190 | 192 |
191 compareNames(other) { | 193 compareNames(other) { |
192 return this.name.localeCompare(other.name); | 194 return this.name.localeCompare(other.name); |
193 } | 195 } |
194 | 196 |
195 compareCells(other, displayLabel) { | 197 compareCells(other, displayLabel) { |
196 const cellA = this.columns.get(displayLabel); | 198 const cellA = this.columns.get(displayLabel); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 this.subRows_.reverse(); | 278 this.subRows_.reverse(); |
277 } | 279 } |
278 } | 280 } |
279 } | 281 } |
280 | 282 |
281 return { | 283 return { |
282 HistogramSetTableRow, | 284 HistogramSetTableRow, |
283 }; | 285 }; |
284 }); | 286 }); |
285 </script> | 287 </script> |
OLD | NEW |