webgui/www/extras/yui-ext/build/layout/ContentPanels-min.js
JT Smith cfd09a5cb6 upgraded to yui 0.12.0
upgraded to yui-ext 0.33 rc2
2006-11-28 02:23:34 +00:00

14 lines
No EOL
4.4 KiB
JavaScript

/*
* YUI Extensions 0.33 RC2
* Copyright(c) 2006, Jack Slocum.
*/
YAHOO.ext.ContentPanel=function(el,config,content){YAHOO.ext.ContentPanel.superclass.constructor.call(this);this.el=getEl(el,true);if(!this.el&&config&&config.autoCreate){if(typeof config.autoCreate=='object'){if(!config.autoCreate.id){config.autoCreate.id=el;}
this.el=YAHOO.ext.DomHelper.append(document.body,config.autoCreate,true);}else{this.el=YAHOO.ext.DomHelper.append(document.body,{tag:'div',cls:'ylayout-inactive-content',id:el},true);}}
this.closable=false;this.loaded=false;this.active=false;if(typeof config=='string'){this.title=config;}else{YAHOO.ext.util.Config.apply(this,config);}
if(this.resizeEl){this.resizeEl=getEl(this.resizeEl,true);}else{this.resizeEl=this.el;}
this.events={'activate':new YAHOO.util.CustomEvent('activate'),'deactivate':new YAHOO.util.CustomEvent('deactivate')};if(content){this.setContent(content);}};YAHOO.extendX(YAHOO.ext.ContentPanel,YAHOO.ext.util.Observable,{setRegion:function(region){this.region=region;if(region){this.el.replaceClass('ylayout-inactive-content','ylayout-active-content');}else{this.el.replaceClass('ylayout-active-content','ylayout-inactive-content');}},getToolbar:function(){return this.toolbar;},setActiveState:function(active){this.active=active;if(!active){this.fireEvent('deactivate',this);}else{this.fireEvent('activate',this);}},setContent:function(content,loadScripts){this.el.update(content,loadScripts);},getUpdateManager:function(){return this.el.getUpdateManager();},setUrl:function(url,params,loadOnce){if(this.refreshDelegate){this.removeListener('activate',this.refreshDelegate);}
this.refreshDelegate=this._handleRefresh.createDelegate(this,[url,params,loadOnce]);this.on('activate',this._handleRefresh.createDelegate(this,[url,params,loadOnce]));return this.el.getUpdateManager();},_handleRefresh:function(url,params,loadOnce){if(!loadOnce||!this.loaded){var updater=this.el.getUpdateManager();updater.update(url,params,this._setLoaded.createDelegate(this));}},_setLoaded:function(){this.loaded=true;},getId:function(){return this.el.id;},getEl:function(){return this.el;},adjustForComponents:function(width,height){if(this.toolbar){height-=this.toolbar.getEl().getHeight();}
return{'width':width,'height':height};},setSize:function(width,height){if(this.fitToFrame){var size=this.adjustForComponents(width,height);this.resizeEl.setSize(size.width,size.height);}},getTitle:function(){return this.title;},setTitle:function(title){this.title=title;if(this.region){this.region.updatePanelTitle(this,title);}},isClosable:function(){return this.closable;},beforeSlide:function(){this.el.clip();this.resizeEl.clip();},afterSlide:function(){this.el.unclip();this.resizeEl.unclip();},destroy:function(){this.el.removeAllListeners();var tempEl=document.createElement('span');tempEl.appendChild(this.el.dom);tempEl.innerHTML='';this.el=null;}});YAHOO.ext.GridPanel=function(grid,config){this.wrapper=YAHOO.ext.DomHelper.append(document.body,{tag:'div',cls:'ylayout-grid-wrapper ylayout-inactive-content'},true);this.wrapper.dom.appendChild(grid.container.dom);YAHOO.ext.GridPanel.superclass.constructor.call(this,this.wrapper,config);if(this.toolbar){this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);}
grid.monitorWindowResize=false;grid.autoHeight=false;grid.autoWidth=false;this.grid=grid;this.grid.container.replaceClass('ylayout-inactive-content','ylayout-component-panel');};YAHOO.extendX(YAHOO.ext.GridPanel,YAHOO.ext.ContentPanel,{getId:function(){return this.grid.id;},getGrid:function(){return this.grid;},setSize:function(width,height){var grid=this.grid;var size=this.adjustForComponents(width,height);grid.container.setSize(size.width,size.height);grid.autoSize();},beforeSlide:function(){this.grid.getView().wrapEl.clip();},afterSlide:function(){this.grid.getView().wrapEl.unclip();},destroy:function(){this.grid.getView().unplugDataModel(this.grid.getDataModel());this.grid.container.removeAllListeners();YAHOO.ext.GridPanel.superclass.destroy.call(this);}});YAHOO.ext.NestedLayoutPanel=function(layout,config){YAHOO.ext.NestedLayoutPanel.superclass.constructor.call(this,layout.getEl(),config);layout.monitorWindowResize=false;this.layout=layout;this.layout.getEl().addClass('ylayout-nested-layout');};YAHOO.extendX(YAHOO.ext.NestedLayoutPanel,YAHOO.ext.ContentPanel,{setSize:function(width,height){var size=this.adjustForComponents(width,height);this.layout.getEl().setSize(size.width,size.height);this.layout.layout();},getLayout:function(){return this.layout;}});