OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 12 matching lines...) Expand all Loading... |
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 /** | 30 /** |
31 * @constructor | 31 * @constructor |
32 * @extends {WebInspector.VBox} | 32 * @extends {WebInspector.VBox} |
33 * @param {!WebInspector.SplitView} splitView | 33 * @param {!WebInspector.SplitWidget} splitWidget |
34 */ | 34 */ |
35 WebInspector.Drawer = function(splitView) | 35 WebInspector.Drawer = function(splitWidget) |
36 { | 36 { |
37 WebInspector.VBox.call(this); | 37 WebInspector.VBox.call(this); |
38 this.element.id = "drawer-contents"; | 38 this.element.id = "drawer-contents"; |
39 | 39 |
40 this._splitView = splitView; | 40 this._splitWidget = splitWidget; |
41 splitView.hideDefaultResizer(); | 41 splitWidget.hideDefaultResizer(); |
42 splitView.setSidebarView(this); | 42 splitWidget.setSidebarWidget(this); |
43 | 43 |
44 this._toggleDrawerButton = new WebInspector.ToolbarButton(WebInspector.UIStr
ing("Show drawer"), "console-toolbar-item"); | 44 this._toggleDrawerButton = new WebInspector.ToolbarButton(WebInspector.UIStr
ing("Show drawer"), "console-toolbar-item"); |
45 this._toggleDrawerButton.addEventListener("click", this.toggle, this); | 45 this._toggleDrawerButton.addEventListener("click", this.toggle, this); |
46 | 46 |
47 this._tabbedPane = new WebInspector.TabbedPane(); | 47 this._tabbedPane = new WebInspector.TabbedPane(); |
48 this._tabbedPane.element.id = "drawer-tabbed-pane"; | 48 this._tabbedPane.element.id = "drawer-tabbed-pane"; |
49 this._tabbedPane.setCloseableTabs(false); | 49 this._tabbedPane.setCloseableTabs(false); |
50 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele
cted, this._tabSelected, this); | 50 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele
cted, this._tabSelected, this); |
51 new WebInspector.ExtensibleTabbedPaneController(this._tabbedPane, "drawer-vi
ew"); | 51 new WebInspector.ExtensibleTabbedPaneController(this._tabbedPane, "drawer-vi
ew"); |
52 | 52 |
53 splitView.installResizer(this._tabbedPane.headerElement()); | 53 splitWidget.installResizer(this._tabbedPane.headerElement()); |
54 this._lastSelectedViewSetting = WebInspector.settings.createSetting("WebInsp
ector.Drawer.lastSelectedView", "console"); | 54 this._lastSelectedViewSetting = WebInspector.settings.createSetting("WebInsp
ector.Drawer.lastSelectedView", "console"); |
55 this._tabbedPane.show(this.element); | 55 this._tabbedPane.show(this.element); |
56 } | 56 } |
57 | 57 |
58 WebInspector.Drawer.prototype = { | 58 WebInspector.Drawer.prototype = { |
59 /** | 59 /** |
60 * @return {!WebInspector.ToolbarButton} | 60 * @return {!WebInspector.ToolbarButton} |
61 */ | 61 */ |
62 toggleButton: function() | 62 toggleButton: function() |
63 { | 63 { |
(...skipping 21 matching lines...) Expand all Loading... |
85 } | 85 } |
86 this._innerShow(immediate); | 86 this._innerShow(immediate); |
87 this._tabbedPane.selectTab(id, true); | 87 this._tabbedPane.selectTab(id, true); |
88 // In case this id is already selected, anyways persist it as the last s
aved value. | 88 // In case this id is already selected, anyways persist it as the last s
aved value. |
89 this._lastSelectedViewSetting.set(id); | 89 this._lastSelectedViewSetting.set(id); |
90 }, | 90 }, |
91 | 91 |
92 /** | 92 /** |
93 * @param {string} id | 93 * @param {string} id |
94 * @param {string} title | 94 * @param {string} title |
95 * @param {!WebInspector.View} view | 95 * @param {!WebInspector.Widget} view |
96 */ | 96 */ |
97 showCloseableView: function(id, title, view) | 97 showCloseableView: function(id, title, view) |
98 { | 98 { |
99 if (!this._tabbedPane.hasTab(id)) { | 99 if (!this._tabbedPane.hasTab(id)) { |
100 this._tabbedPane.appendTab(id, title, view, undefined, false, true); | 100 this._tabbedPane.appendTab(id, title, view, undefined, false, true); |
101 } else { | 101 } else { |
102 this._tabbedPane.changeTabView(id, view); | 102 this._tabbedPane.changeTabView(id, view); |
103 this._tabbedPane.changeTabTitle(id, title); | 103 this._tabbedPane.changeTabTitle(id, title); |
104 } | 104 } |
105 this._innerShow(); | 105 this._innerShow(); |
(...skipping 19 matching lines...) Expand all Loading... |
125 }, | 125 }, |
126 | 126 |
127 /** | 127 /** |
128 * @param {boolean=} immediate | 128 * @param {boolean=} immediate |
129 */ | 129 */ |
130 _innerShow: function(immediate) | 130 _innerShow: function(immediate) |
131 { | 131 { |
132 if (this.isShowing()) | 132 if (this.isShowing()) |
133 return; | 133 return; |
134 | 134 |
135 this._splitView.showBoth(!immediate); | 135 this._splitWidget.showBoth(!immediate); |
136 | 136 |
137 if (this._visibleView()) | 137 if (this._visibleView()) |
138 this._visibleView().focus(); | 138 this._visibleView().focus(); |
139 }, | 139 }, |
140 | 140 |
141 closeDrawer: function() | 141 closeDrawer: function() |
142 { | 142 { |
143 if (!this.isShowing()) | 143 if (!this.isShowing()) |
144 return; | 144 return; |
145 | 145 |
146 WebInspector.restoreFocusFromElement(this.element); | 146 WebInspector.restoreFocusFromElement(this.element); |
147 this._splitView.hideSidebar(true); | 147 this._splitWidget.hideSidebar(true); |
148 }, | 148 }, |
149 | 149 |
150 /** | 150 /** |
151 * @return {?WebInspector.View} view | 151 * @return {?WebInspector.Widget} view |
152 */ | 152 */ |
153 _visibleView: function() | 153 _visibleView: function() |
154 { | 154 { |
155 return this._tabbedPane.visibleView; | 155 return this._tabbedPane.visibleView; |
156 }, | 156 }, |
157 | 157 |
158 /** | 158 /** |
159 * @param {!WebInspector.Event} event | 159 * @param {!WebInspector.Event} event |
160 */ | 160 */ |
161 _tabSelected: function(event) | 161 _tabSelected: function(event) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 /** | 200 /** |
201 * @interface | 201 * @interface |
202 */ | 202 */ |
203 WebInspector.Drawer.ViewFactory = function() | 203 WebInspector.Drawer.ViewFactory = function() |
204 { | 204 { |
205 } | 205 } |
206 | 206 |
207 WebInspector.Drawer.ViewFactory.prototype = { | 207 WebInspector.Drawer.ViewFactory.prototype = { |
208 /** | 208 /** |
209 * @return {!WebInspector.View} | 209 * @return {!WebInspector.Widget} |
210 */ | 210 */ |
211 createView: function() {} | 211 createView: function() {} |
212 } | 212 } |
213 | 213 |
214 /** | 214 /** |
215 * @constructor | 215 * @constructor |
216 * @implements {WebInspector.Drawer.ViewFactory} | 216 * @implements {WebInspector.Drawer.ViewFactory} |
217 * @param {function(new:T)} constructor | 217 * @param {function(new:T)} constructor |
218 * @template T | 218 * @template T |
219 */ | 219 */ |
220 WebInspector.Drawer.SingletonViewFactory = function(constructor) | 220 WebInspector.Drawer.SingletonViewFactory = function(constructor) |
221 { | 221 { |
222 this._constructor = constructor; | 222 this._constructor = constructor; |
223 } | 223 } |
224 | 224 |
225 WebInspector.Drawer.SingletonViewFactory.prototype = { | 225 WebInspector.Drawer.SingletonViewFactory.prototype = { |
226 /** | 226 /** |
227 * @override | 227 * @override |
228 * @return {!WebInspector.View} | 228 * @return {!WebInspector.Widget} |
229 */ | 229 */ |
230 createView: function() | 230 createView: function() |
231 { | 231 { |
232 if (!this._instance) | 232 if (!this._instance) |
233 this._instance = /** @type {!WebInspector.View} */(new this._constru
ctor()); | 233 this._instance = /** @type {!WebInspector.Widget} */(new this._const
ructor()); |
234 return this._instance; | 234 return this._instance; |
235 } | 235 } |
236 } | 236 } |
OLD | NEW |