| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| 11 * 2. Redistributions in binary form must reproduce the above | 11 * 2. Redistributions in binary form must reproduce the above |
| 12 * copyright notice, this list of conditions and the following disclaimer | 12 * copyright notice, this list of conditions and the following disclaimer |
| 13 * in the documentation and/or other materials provided with the | 13 * in the documentation and/or other materials provided with the |
| 14 * distribution. | 14 * distribution. |
| 15 * | 15 * |
| 16 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS | 16 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS |
| 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. | 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. |
| 20 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | |
| 29 /** | 28 /** |
| 30 * @constructor | 29 * @unrestricted |
| 31 * @extends {WebInspector.VBox} | |
| 32 * @param {boolean} isVertical | |
| 33 */ | 30 */ |
| 34 WebInspector.StackView = function(isVertical) | 31 WebInspector.StackView = class extends WebInspector.VBox { |
| 35 { | 32 /** |
| 36 WebInspector.VBox.call(this); | 33 * @param {boolean} isVertical |
| 34 */ |
| 35 constructor(isVertical) { |
| 36 super(); |
| 37 this._isVertical = isVertical; | 37 this._isVertical = isVertical; |
| 38 this._currentSplitWidget = null; | 38 this._currentSplitWidget = null; |
| 39 } |
| 40 |
| 41 /** |
| 42 * @param {!WebInspector.Widget} view |
| 43 * @param {string=} sidebarSizeSettingName |
| 44 * @param {number=} defaultSidebarWidth |
| 45 * @param {number=} defaultSidebarHeight |
| 46 * @return {?WebInspector.SplitWidget} |
| 47 */ |
| 48 appendView(view, sidebarSizeSettingName, defaultSidebarWidth, defaultSidebarHe
ight) { |
| 49 var splitWidget = new WebInspector.SplitWidget( |
| 50 this._isVertical, true, sidebarSizeSettingName, defaultSidebarWidth, def
aultSidebarHeight); |
| 51 splitWidget.setMainWidget(view); |
| 52 splitWidget.hideSidebar(); |
| 53 |
| 54 if (!this._currentSplitWidget) { |
| 55 splitWidget.show(this.element); |
| 56 } else { |
| 57 this._currentSplitWidget.setSidebarWidget(splitWidget); |
| 58 this._currentSplitWidget.showBoth(); |
| 59 } |
| 60 |
| 61 var lastSplitWidget = this._currentSplitWidget; |
| 62 this._currentSplitWidget = splitWidget; |
| 63 return lastSplitWidget; |
| 64 } |
| 65 |
| 66 /** |
| 67 * @override |
| 68 */ |
| 69 detachChildWidgets() { |
| 70 super.detachChildWidgets(); |
| 71 this._currentSplitWidget = null; |
| 72 } |
| 39 }; | 73 }; |
| 40 | |
| 41 WebInspector.StackView.prototype = { | |
| 42 /** | |
| 43 * @param {!WebInspector.Widget} view | |
| 44 * @param {string=} sidebarSizeSettingName | |
| 45 * @param {number=} defaultSidebarWidth | |
| 46 * @param {number=} defaultSidebarHeight | |
| 47 * @return {?WebInspector.SplitWidget} | |
| 48 */ | |
| 49 appendView: function(view, sidebarSizeSettingName, defaultSidebarWidth, defa
ultSidebarHeight) | |
| 50 { | |
| 51 var splitWidget = new WebInspector.SplitWidget(this._isVertical, true, s
idebarSizeSettingName, defaultSidebarWidth, defaultSidebarHeight); | |
| 52 splitWidget.setMainWidget(view); | |
| 53 splitWidget.hideSidebar(); | |
| 54 | |
| 55 if (!this._currentSplitWidget) { | |
| 56 splitWidget.show(this.element); | |
| 57 } else { | |
| 58 this._currentSplitWidget.setSidebarWidget(splitWidget); | |
| 59 this._currentSplitWidget.showBoth(); | |
| 60 } | |
| 61 | |
| 62 var lastSplitWidget = this._currentSplitWidget; | |
| 63 this._currentSplitWidget = splitWidget; | |
| 64 return lastSplitWidget; | |
| 65 }, | |
| 66 | |
| 67 detachChildWidgets: function() | |
| 68 { | |
| 69 WebInspector.Widget.prototype.detachChildWidgets.call(this); | |
| 70 this._currentSplitWidget = null; | |
| 71 }, | |
| 72 | |
| 73 __proto__: WebInspector.VBox.prototype | |
| 74 }; | |
| OLD | NEW |