OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 this._dropDownButton = this._createDropDownButton(); | 51 this._dropDownButton = this._createDropDownButton(); |
52 } | 52 } |
53 | 53 |
54 WebInspector.TabbedPane.EventTypes = { | 54 WebInspector.TabbedPane.EventTypes = { |
55 TabSelected: "TabSelected", | 55 TabSelected: "TabSelected", |
56 TabClosed: "TabClosed" | 56 TabClosed: "TabClosed" |
57 } | 57 } |
58 | 58 |
59 WebInspector.TabbedPane.prototype = { | 59 WebInspector.TabbedPane.prototype = { |
60 /** | 60 /** |
61 * @return {!WebInspector.View} | 61 * @return {?WebInspector.View} |
62 */ | 62 */ |
63 get visibleView() | 63 get visibleView() |
64 { | 64 { |
65 return this._currentTab ? this._currentTab.view : null; | 65 return this._currentTab ? this._currentTab.view : null; |
66 }, | 66 }, |
67 | 67 |
68 /** | 68 /** |
69 * @return {!Array.<!WebInspector.View>} | 69 * @return {!Array.<!WebInspector.View>} |
70 */ | 70 */ |
71 tabViews: function() | 71 tabViews: function() |
72 { | 72 { |
73 /** | 73 /** |
74 * @param {!WebInspector.TabbedPaneTab} tab | 74 * @param {!WebInspector.TabbedPaneTab} tab |
75 * @return {!WebInspector.View} | 75 * @return {!WebInspector.View} |
76 */ | 76 */ |
77 function tabToView(tab) | 77 function tabToView(tab) |
78 { | 78 { |
79 return tab.view; | 79 return tab.view; |
80 } | 80 } |
81 return this._tabs.map(tabToView); | 81 return this._tabs.map(tabToView); |
82 }, | 82 }, |
83 | 83 |
84 /** | 84 /** |
85 * @return {string} | 85 * @return {?string} |
86 */ | 86 */ |
87 get selectedTabId() | 87 get selectedTabId() |
88 { | 88 { |
89 return this._currentTab ? this._currentTab.id : null; | 89 return this._currentTab ? this._currentTab.id : null; |
90 }, | 90 }, |
91 | 91 |
92 /** | 92 /** |
93 * @type {boolean} shrinkableTabs | 93 * @type {boolean} shrinkableTabs |
94 */ | 94 */ |
95 set shrinkableTabs(shrinkableTabs) | 95 set shrinkableTabs(shrinkableTabs) |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 if (setting.get()) | 1137 if (setting.get()) |
1138 this._tabbedPane.appendTab(id, title, new WebInspector.View()); | 1138 this._tabbedPane.appendTab(id, title, new WebInspector.View()); |
1139 }, | 1139 }, |
1140 | 1140 |
1141 /** | 1141 /** |
1142 * @param {!WebInspector.Event} event | 1142 * @param {!WebInspector.Event} event |
1143 */ | 1143 */ |
1144 _tabSelected: function(event) | 1144 _tabSelected: function(event) |
1145 { | 1145 { |
1146 var tabId = this._tabbedPane.selectedTabId; | 1146 var tabId = this._tabbedPane.selectedTabId; |
| 1147 if (!tabId) |
| 1148 return; |
1147 var view = this._viewForId(tabId); | 1149 var view = this._viewForId(tabId); |
1148 if (view) | 1150 if (view) |
1149 this._tabbedPane.changeTabView(tabId, view); | 1151 this._tabbedPane.changeTabView(tabId, view); |
1150 }, | 1152 }, |
1151 | 1153 |
1152 /** | 1154 /** |
1153 * @return {?WebInspector.View} | 1155 * @return {?WebInspector.View} |
1154 */ | 1156 */ |
1155 _viewForId: function(id) | 1157 _viewForId: function(id) |
1156 { | 1158 { |
1157 if (this._views.contains(id)) | 1159 if (this._views.contains(id)) |
1158 return /** @type {!WebInspector.View} */ (this._views.get(id)); | 1160 return /** @type {!WebInspector.View} */ (this._views.get(id)); |
1159 var view = this._extensions[id] ? /** @type {!WebInspector.View} */ (thi
s._extensions[id].instance()) : null; | 1161 var view = this._extensions[id] ? /** @type {!WebInspector.View} */ (thi
s._extensions[id].instance()) : null; |
1160 this._views.put(id, view); | 1162 this._views.put(id, view); |
1161 if (this._viewCallback && view) | 1163 if (this._viewCallback && view) |
1162 this._viewCallback(id, view); | 1164 this._viewCallback(id, view); |
1163 return view; | 1165 return view; |
1164 } | 1166 } |
1165 } | 1167 } |
OLD | NEW |