OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * RequestsView is the class which glues together the different components to | 6 * RequestsView displays a filtered list of all the requests, and a details |
7 * form the primary UI: | 7 * pane for the selected requests. |
8 * | 8 * |
9 * - The search filter | 9 * +----------------------++----------------+ |
10 * - The requests table | 10 * | filter box || | |
11 * - The details panel | 11 * +----------------------+| | |
12 * - The action bar | 12 * | || | |
| 13 * | || | |
| 14 * | || | |
| 15 * | || | |
| 16 * | requests list || details | |
| 17 * | || view | |
| 18 * | || | |
| 19 * | || | |
| 20 * | || | |
| 21 * | || | |
| 22 * +----------------------++ | |
| 23 * | action bar || | |
| 24 * +----------------------++----------------+ |
13 * | 25 * |
14 * @constructor | 26 * @constructor |
15 */ | 27 */ |
16 function RequestsView(tableBodyId, filterInputId, filterCountId, | 28 function RequestsView(tableBodyId, filterInputId, filterCountId, |
17 deleteSelectedId, selectAllId, detailsView) { | 29 deleteSelectedId, selectAllId, |
| 30 tabHandlesContainerId, logTabId, timelineTabId, |
| 31 detailsLogBoxId, detailsTimelineBoxId, |
| 32 topbarId, middleboxId, bottombarId, sizerId) { |
| 33 View.call(this); |
| 34 |
| 35 // Initialize the sub-views. |
| 36 var leftPane = new TopMidBottomView(new DivView(topbarId), |
| 37 new DivView(middleboxId), |
| 38 new DivView(bottombarId)); |
| 39 |
| 40 this.detailsView_ = new DetailsView(tabHandlesContainerId, |
| 41 logTabId, |
| 42 timelineTabId, |
| 43 detailsLogBoxId, |
| 44 detailsTimelineBoxId); |
| 45 |
| 46 this.splitterView_ = new ResizableVerticalSplitView( |
| 47 leftPane, this.detailsView_, new DivView(sizerId)); |
| 48 |
18 this.sourceIdToEntryMap_ = {}; | 49 this.sourceIdToEntryMap_ = {}; |
19 this.currentSelectedSources_ = []; | 50 this.currentSelectedSources_ = []; |
20 | 51 |
21 LogDataProvider.addObserver(this); | 52 LogDataProvider.addObserver(this); |
22 | 53 |
23 this.tableBody_ = document.getElementById(tableBodyId); | 54 this.tableBody_ = document.getElementById(tableBodyId); |
24 this.detailsView_ = detailsView; | |
25 | 55 |
26 this.filterInput_ = document.getElementById(filterInputId); | 56 this.filterInput_ = document.getElementById(filterInputId); |
27 this.filterCount_ = document.getElementById(filterCountId); | 57 this.filterCount_ = document.getElementById(filterCountId); |
28 | 58 |
29 this.filterInput_.addEventListener("search", | 59 this.filterInput_.addEventListener("search", |
30 this.onFilterTextChanged_.bind(this), true); | 60 this.onFilterTextChanged_.bind(this), true); |
31 | 61 |
32 document.getElementById(deleteSelectedId).onclick = | 62 document.getElementById(deleteSelectedId).onclick = |
33 this.deleteSelected_.bind(this); | 63 this.deleteSelected_.bind(this); |
34 | 64 |
35 document.getElementById(selectAllId).addEventListener( | 65 document.getElementById(selectAllId).addEventListener( |
36 'click', this.selectAll_.bind(this), true); | 66 'click', this.selectAll_.bind(this), true); |
37 | 67 |
38 this.currentFilter_ = ''; | 68 this.currentFilter_ = ''; |
39 this.numPrefilter_ = 0; | 69 this.numPrefilter_ = 0; |
40 this.numPostfilter_ = 0; | 70 this.numPostfilter_ = 0; |
41 | 71 |
42 this.invalidateFilterCounter_(); | 72 this.invalidateFilterCounter_(); |
43 this.invalidateDetailsView_(); | 73 this.invalidateDetailsView_(); |
44 } | 74 } |
45 | 75 |
| 76 inherits(RequestsView, View); |
| 77 |
46 // How soon after updating the filter list the counter should be updated. | 78 // How soon after updating the filter list the counter should be updated. |
47 RequestsView.REPAINT_FILTER_COUNTER_TIMEOUT_MS = 0; | 79 RequestsView.REPAINT_FILTER_COUNTER_TIMEOUT_MS = 0; |
48 | 80 |
| 81 RequestsView.prototype.setGeometry = function(left, top, width, height) { |
| 82 RequestsView.superClass_.setGeometry.call(this, left, top, width, height); |
| 83 this.splitterView_.setGeometry(left, top, width, height); |
| 84 }; |
| 85 |
| 86 RequestsView.prototype.show = function(isVisible) { |
| 87 RequestsView.superClass_.show.call(this, isVisible); |
| 88 this.splitterView_.show(isVisible); |
| 89 }; |
| 90 |
49 RequestsView.prototype.onFilterTextChanged_ = function() { | 91 RequestsView.prototype.onFilterTextChanged_ = function() { |
50 this.setFilter_(this.filterInput_.value); | 92 this.setFilter_(this.filterInput_.value); |
51 }; | 93 }; |
52 | 94 |
53 RequestsView.prototype.setFilter_ = function(filterText) { | 95 RequestsView.prototype.setFilter_ = function(filterText) { |
54 this.currentFilter_ = filterText; | 96 this.currentFilter_ = filterText; |
55 | 97 |
56 // Iterate through all of the rows and see if they match the filter. | 98 // Iterate through all of the rows and see if they match the filter. |
57 for (var id in this.sourceIdToEntryMap_) { | 99 for (var id in this.sourceIdToEntryMap_) { |
58 var entry = this.sourceIdToEntryMap_[id]; | 100 var entry = this.sourceIdToEntryMap_[id]; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 RequestsView.REPAINT_FILTER_COUNTER_TIMEOUT_MS); | 198 RequestsView.REPAINT_FILTER_COUNTER_TIMEOUT_MS); |
157 } | 199 } |
158 }; | 200 }; |
159 | 201 |
160 RequestsView.prototype.repaintFilterCounter_ = function() { | 202 RequestsView.prototype.repaintFilterCounter_ = function() { |
161 this.outstandingRepaintFilterCounter_ = false; | 203 this.outstandingRepaintFilterCounter_ = false; |
162 this.filterCount_.innerHTML = ''; | 204 this.filterCount_.innerHTML = ''; |
163 addTextNode(this.filterCount_, | 205 addTextNode(this.filterCount_, |
164 this.numPostfilter_ + " of " + this.numPrefilter_); | 206 this.numPostfilter_ + " of " + this.numPrefilter_); |
165 }; | 207 }; |
OLD | NEW |