X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2FLayoutRegion.js;h=55a88b2aa9146c426a8dc7f253419312b31e859a;hb=refs%2Fheads%2Fwip_leon_T7094_logo_image_upload_in_boilerplate;hp=9d8b8dbae28b14921ffc78e3e216d57fd24c82cb;hpb=db860973b81d3e820644f997a24e50d275df2cd4;p=roojs1 diff --git a/Roo/LayoutRegion.js b/Roo/LayoutRegion.js index 9d8b8dbae2..55a88b2aa9 100644 --- a/Roo/LayoutRegion.js +++ b/Roo/LayoutRegion.js @@ -18,7 +18,7 @@ * @cfg {Boolean} floatable False to disable floating (defaults to true) * @cfg {Object} margins Margins for the element (defaults to {top: 0, left: 0, right:0, bottom: 0}) * @cfg {Object} cmargins Margins for the element when collapsed (defaults to: north/south {top: 2, left: 0, right:0, bottom: 2} or east/west {top: 0, left: 2, right:2, bottom: 0}) - * @cfg {String} tabPosition "top" or "bottom" (defaults to "bottom") + * @cfg {String} tabPosition (top|bottom) "top" or "bottom" (defaults to "bottom") * @cfg {String} collapsedTitle Optional string message to display in the collapsed block of a north or south region * @cfg {Boolean} alwaysShowTabs True to always display tabs even when there is only 1 panel (defaults to false) * @cfg {Boolean} autoScroll True to enable overflow scrolling (defaults to false) @@ -195,7 +195,6 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { }, updateBox : function(box){ - Roo.log('run updatebox !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11'); this.box = box; if(!this.collapsed){ this.el.dom.style.left = box.x + "px"; @@ -303,22 +302,29 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { * Collapses this region. * @param {Boolean} skipAnim (optional) true to collapse the element without animation (if animate is true) */ - collapse : function(skipAnim){ - if(this.collapsed) return; - this.collapsed = true; - if(this.split){ - this.split.el.hide(); - } - if(this.config.animate && skipAnim !== true){ - this.fireEvent("invalidated", this); - this.animateCollapse(); - }else{ - this.el.setLocation(-20000,-20000); - this.el.hide(); - this.collapsedEl.show(); - this.fireEvent("collapsed", this); - this.fireEvent("invalidated", this); + collapse : function(skipAnim, skipCheck){ + if(this.collapsed) { + return; + } + + if(skipCheck || this.fireEvent("beforecollapse", this) != false){ + + this.collapsed = true; + if(this.split){ + this.split.el.hide(); + } + if(this.config.animate && skipAnim !== true){ + this.fireEvent("invalidated", this); + this.animateCollapse(); + }else{ + this.el.setLocation(-20000,-20000); + this.el.hide(); + this.collapsedEl.show(); + this.fireEvent("collapsed", this); + this.fireEvent("invalidated", this); + } } + }, animateCollapse : function(){ @@ -331,8 +337,12 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { * @param {Boolean} skipAnim (optional) true to expand the element without animation (if animate is true) */ expand : function(e, skipAnim){ - if(e) e.stopPropagation(); - if(!this.collapsed || this.el.hasActiveFx()) return; + if(e) { + e.stopPropagation(); + } + if(!this.collapsed || this.el.hasActiveFx()) { + return; + } if(this.isSlid){ this.afterSlideIn(); skipAnim = true; @@ -443,8 +453,10 @@ Roo.extend(Roo.LayoutRegion, Roo.BasicLayoutRegion, { * @param {Number/String/ContentPanel} panelId The panel's index, id or the panel itself * @return {Roo.ContentPanel} The shown panel, or null if a panel could not be found from panelId */ - showPanel : function(panel){ - if(panel = this.getPanel(panel)){ + showPanel : function(panel) + { + panel = this.getPanel(panel); + if(panel){ if(this.tabs){ var tab = this.tabs.getTab(panel.getEl().id); if(tab.isHidden()){