OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 WebInspector.FilterBar.FilterBarState = { | 51 WebInspector.FilterBar.FilterBarState = { |
52 Inactive : "inactive", | 52 Inactive : "inactive", |
53 Active : "active", | 53 Active : "active", |
54 Shown : "shown" | 54 Shown : "shown" |
55 }; | 55 }; |
56 | 56 |
57 WebInspector.FilterBar.prototype = { | 57 WebInspector.FilterBar.prototype = { |
58 /** | 58 /** |
| 59 * @param {string} name |
| 60 */ |
| 61 setName: function(name) |
| 62 { |
| 63 this._stateSetting = WebInspector.settings.createSetting("filterBar-" +
name + "-toggled", false); |
| 64 this._setState(this._stateSetting.get()); |
| 65 }, |
| 66 |
| 67 /** |
59 * @return {!WebInspector.StatusBarButton} | 68 * @return {!WebInspector.StatusBarButton} |
60 */ | 69 */ |
61 filterButton: function() | 70 filterButton: function() |
62 { | 71 { |
63 return this._filterButton; | 72 return this._filterButton; |
64 }, | 73 }, |
65 | 74 |
66 /** | 75 /** |
67 * @return {!Element} | 76 * @return {!Element} |
68 */ | 77 */ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 _updateFilterButton: function() | 125 _updateFilterButton: function() |
117 { | 126 { |
118 this._filterButton.state = this._filterBarState(); | 127 this._filterButton.state = this._filterBarState(); |
119 }, | 128 }, |
120 | 129 |
121 /** | 130 /** |
122 * @param {?Event} event | 131 * @param {?Event} event |
123 */ | 132 */ |
124 _handleFilterButtonClick: function(event) | 133 _handleFilterButtonClick: function(event) |
125 { | 134 { |
126 this._filtersShown = !this._filtersShown; | 135 this._setState(!this._filtersShown); |
| 136 }, |
| 137 |
| 138 /** |
| 139 * @param {boolean} filtersShown |
| 140 */ |
| 141 _setState: function(filtersShown) |
| 142 { |
| 143 if (this._filtersShown === filtersShown) |
| 144 return; |
| 145 |
| 146 this._filtersShown = filtersShown; |
| 147 if (this._stateSetting) |
| 148 this._stateSetting.set(filtersShown); |
| 149 |
127 this._updateFilterButton(); | 150 this._updateFilterButton(); |
128 this.dispatchEventToListeners(WebInspector.FilterBar.Events.FiltersToggl
ed, this._filtersShown); | 151 this.dispatchEventToListeners(WebInspector.FilterBar.Events.FiltersToggl
ed, this._filtersShown); |
129 if (this._filtersShown) { | 152 if (this._filtersShown) { |
130 for (var i = 0; i < this._filters.length; ++i) { | 153 for (var i = 0; i < this._filters.length; ++i) { |
131 if (this._filters[i] instanceof WebInspector.TextFilterUI) { | 154 if (this._filters[i] instanceof WebInspector.TextFilterUI) { |
132 var textFilterUI = /** @type {!WebInspector.TextFilterUI} */
(this._filters[i]); | 155 var textFilterUI = /** @type {!WebInspector.TextFilterUI} */
(this._filters[i]); |
133 textFilterUI.focus(); | 156 textFilterUI.focus(); |
134 } | 157 } |
135 } | 158 } |
136 } | 159 } |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 var label = this._filterElement.createChild("label"); | 757 var label = this._filterElement.createChild("label"); |
735 var checkBorder = label.createChild("div", "checkbox-filter-checkbox"); | 758 var checkBorder = label.createChild("div", "checkbox-filter-checkbox"); |
736 this._checkElement = checkBorder.createChild("div", "checkbox-filter-che
ckbox-check"); | 759 this._checkElement = checkBorder.createChild("div", "checkbox-filter-che
ckbox-check"); |
737 this._filterElement.addEventListener("click", this._onClick.bind(this),
false); | 760 this._filterElement.addEventListener("click", this._onClick.bind(this),
false); |
738 var typeElement = label.createChild("span", "type"); | 761 var typeElement = label.createChild("span", "type"); |
739 typeElement.textContent = title; | 762 typeElement.textContent = title; |
740 }, | 763 }, |
741 | 764 |
742 __proto__: WebInspector.Object.prototype | 765 __proto__: WebInspector.Object.prototype |
743 } | 766 } |
OLD | NEW |