split panels into seperate files, and fix code doc
[roojs1] / Roo / ContentPanel.js
index bf70e60..0984532 100644 (file)
@@ -460,336 +460,6 @@ layout.addxtype({
     }
 });
 
-/**
- * @class Roo.GridPanel
- * @extends Roo.ContentPanel
- * @parent Roo.BorderLayout Roo.LayoutDialog builder
- * @constructor
- * Create a new GridPanel.
- * @cfg {Roo.grid.Grid} grid The grid for this panel
- */
-Roo.GridPanel = function(grid, config){
-    
-    // universal ctor...
-    if (typeof(grid.grid) != 'undefined') {
-        config = grid;
-        grid = config.grid;
-    }
-    this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
-        {tag: "div", cls: "x-layout-grid-wrapper x-layout-inactive-content"}, true);
-        
-    this.wrapper.dom.appendChild(grid.getGridEl().dom);
-    
-    Roo.GridPanel.superclass.constructor.call(this, this.wrapper, config);
-    
-    if(this.toolbar){
-        this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);
-    }
-    // xtype created footer. - not sure if will work as we normally have to render first..
-    if (this.footer && !this.footer.el && this.footer.xtype) {
-        
-        this.footer.container = this.grid.getView().getFooterPanel(true);
-        this.footer.dataSource = this.grid.dataSource;
-        this.footer = Roo.factory(this.footer, Roo);
-        
-    }
-    
-    grid.monitorWindowResize = false; // turn off autosizing
-    grid.autoHeight = false;
-    grid.autoWidth = false;
-    this.grid = grid;
-    this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
-};
-
-Roo.extend(Roo.GridPanel, Roo.ContentPanel, {
-    getId : function(){
-        return this.grid.id;
-    },
-    
-    /**
-     * Returns the grid for this panel
-     * @return {Roo.grid.Grid} 
-     */
-    getGrid : function(){
-        return this.grid;    
-    },
-    
-    setSize : function(width, height){
-        if(!this.ignoreResize(width, height)){
-            var grid = this.grid;
-            var size = this.adjustForComponents(width, height);
-            grid.getGridEl().setSize(size.width, size.height);
-            grid.autoSize();
-        }
-    },
-    
-    beforeSlide : function(){
-        this.grid.getView().scroller.clip();
-    },
-    
-    afterSlide : function(){
-        this.grid.getView().scroller.unclip();
-    },
-    
-    destroy : function(){
-        this.grid.destroy();
-        delete this.grid;
-        Roo.GridPanel.superclass.destroy.call(this); 
-    }
-});
-
-
-/**
- * @class Roo.NestedLayoutPanel
- * @extends Roo.ContentPanel
- * @parent Roo.BorderLayout Roo.LayoutDialog builder
- * @cfg Roo.BorderLayout} layout   [required] The layout for this panel
- *
- * 
- * @constructor
- * Create a new NestedLayoutPanel.
- * 
- * 
- * @param {Roo.BorderLayout} layout [required] The layout for this panel
- * @param {String/Object} config A string to set only the title or a config object
- */
-Roo.NestedLayoutPanel = function(layout, config)
-{
-    // construct with only one argument..
-    /* FIXME - implement nicer consturctors
-    if (layout.layout) {
-        config = layout;
-        layout = config.layout;
-        delete config.layout;
-    }
-    if (layout.xtype && !layout.getEl) {
-        // then layout needs constructing..
-        layout = Roo.factory(layout, Roo);
-    }
-    */
-    
-    
-    Roo.NestedLayoutPanel.superclass.constructor.call(this, layout.getEl(), config);
-    
-    layout.monitorWindowResize = false; // turn off autosizing
-    this.layout = layout;
-    this.layout.getEl().addClass("x-layout-nested-layout");
-    
-    
-    
-    
-};
-
-Roo.extend(Roo.NestedLayoutPanel, Roo.ContentPanel, {
-
-    setSize : function(width, height){
-        if(!this.ignoreResize(width, height)){
-            var size = this.adjustForComponents(width, height);
-            var el = this.layout.getEl();
-            el.setSize(size.width, size.height);
-            var touch = el.dom.offsetWidth;
-            this.layout.layout();
-            // ie requires a double layout on the first pass
-            if(Roo.isIE && !this.initialized){
-                this.initialized = true;
-                this.layout.layout();
-            }
-        }
-    },
-    
-    // activate all subpanels if not currently active..
-    
-    setActiveState : function(active){
-        this.active = active;
-        if(!active){
-            this.fireEvent("deactivate", this);
-            return;
-        }
-        
-        this.fireEvent("activate", this);
-        // not sure if this should happen before or after..
-        if (!this.layout) {
-            return; // should not happen..
-        }
-        var reg = false;
-        for (var r in this.layout.regions) {
-            reg = this.layout.getRegion(r);
-            if (reg.getActivePanel()) {
-                //reg.showPanel(reg.getActivePanel()); // force it to activate.. 
-                reg.setActivePanel(reg.getActivePanel());
-                continue;
-            }
-            if (!reg.panels.length) {
-                continue;
-            }
-            reg.showPanel(reg.getPanel(0));
-        }
-        
-        
-        
-        
-    },
-    
-    /**
-     * Returns the nested BorderLayout for this panel
-     * @return {Roo.BorderLayout} 
-     */
-    getLayout : function(){
-        return this.layout;
-    },
-    
-     /**
-     * Adds a xtype elements to the layout of the nested panel
-     * <pre><code>
-
-panel.addxtype({
-       xtype : 'ContentPanel',
-       region: 'west',
-       items: [ .... ]
-   }
-);
-
-panel.addxtype({
-        xtype : 'NestedLayoutPanel',
-        region: 'west',
-        layout: {
-           center: { },
-           west: { }   
-        },
-        items : [ ... list of content panels or nested layout panels.. ]
-   }
-);
-</code></pre>
-     * @param {Object} cfg Xtype definition of item to add.
-     */
-    addxtype : function(cfg) {
-        return this.layout.addxtype(cfg);
-    
-    }
-});
-
-Roo.ScrollPanel = function(el, config, content){
-    config = config || {};
-    config.fitToFrame = true;
-    Roo.ScrollPanel.superclass.constructor.call(this, el, config, content);
-    
-    this.el.dom.style.overflow = "hidden";
-    var wrap = this.el.wrap({cls: "x-scroller x-layout-inactive-content"});
-    this.el.removeClass("x-layout-inactive-content");
-    this.el.on("mousewheel", this.onWheel, this);
-
-    var up = wrap.createChild({cls: "x-scroller-up", html: "&#160;"}, this.el.dom);
-    var down = wrap.createChild({cls: "x-scroller-down", html: "&#160;"});
-    up.unselectable(); down.unselectable();
-    up.on("click", this.scrollUp, this);
-    down.on("click", this.scrollDown, this);
-    up.addClassOnOver("x-scroller-btn-over");
-    down.addClassOnOver("x-scroller-btn-over");
-    up.addClassOnClick("x-scroller-btn-click");
-    down.addClassOnClick("x-scroller-btn-click");
-    this.adjustments = [0, -(up.getHeight() + down.getHeight())];
-
-    this.resizeEl = this.el;
-    this.el = wrap; this.up = up; this.down = down;
-};
-
-Roo.extend(Roo.ScrollPanel, Roo.ContentPanel, {
-    increment : 100,
-    wheelIncrement : 5,
-    scrollUp : function(){
-        this.resizeEl.scroll("up", this.increment, {callback: this.afterScroll, scope: this});
-    },
-
-    scrollDown : function(){
-        this.resizeEl.scroll("down", this.increment, {callback: this.afterScroll, scope: this});
-    },
-
-    afterScroll : function(){
-        var el = this.resizeEl;
-        var t = el.dom.scrollTop, h = el.dom.scrollHeight, ch = el.dom.clientHeight;
-        this.up[t == 0 ? "addClass" : "removeClass"]("x-scroller-btn-disabled");
-        this.down[h - t <= ch ? "addClass" : "removeClass"]("x-scroller-btn-disabled");
-    },
-
-    setSize : function(){
-        Roo.ScrollPanel.superclass.setSize.apply(this, arguments);
-        this.afterScroll();
-    },
-
-    onWheel : function(e){
-        var d = e.getWheelDelta();
-        this.resizeEl.dom.scrollTop -= (d*this.wheelIncrement);
-        this.afterScroll();
-        e.stopEvent();
-    },
-
-    setContent : function(content, loadScripts){
-        this.resizeEl.update(content, loadScripts);
-    }
-
-});
-
-
-
-/**
- * @class Roo.TreePanel
- * @extends Roo.ContentPanel
- * @parent Roo.BorderLayout Roo.LayoutDialog builder
- * Treepanel component
- * 
- * @constructor
- * Create a new TreePanel. - defaults to fit/scoll contents.
- * @param {String/Object} config A string to set only the panel's title, or a config object
- */
-Roo.TreePanel = function(config){
-    var el = config.el;
-    var tree = config.tree;
-    delete config.tree; 
-    delete config.el; // hopefull!
-    
-    // wrapper for IE7 strict & safari scroll issue
-    
-    var treeEl = el.createChild();
-    config.resizeEl = treeEl;
-    
-    
-    
-    Roo.TreePanel.superclass.constructor.call(this, el, config);
-    this.tree = new Roo.tree.TreePanel(treeEl , tree);
-    //console.log(tree);
-    this.on('activate', function()
-    {
-        if (this.tree.rendered) {
-            return;
-        }
-        //console.log('render tree');
-        this.tree.render();
-    });
-    // this should not be needed.. - it's actually the 'el' that resizes?
-    // actuall it breaks the containerScroll - dragging nodes auto scroll at top
-    
-    //this.on('resize',  function (cp, w, h) {
-    //        this.tree.innerCt.setWidth(w);
-    //        this.tree.innerCt.setHeight(h);
-    //        //this.tree.innerCt.setStyle('overflow-y', 'auto');
-    //});
-
-        
-    
-};
-
-Roo.extend(Roo.TreePanel, Roo.ContentPanel, {   
-    fitToFrame : true,
-    autoScroll : true,
-    /*
-     * @cfg {Roo.tree.TreePanel} tree [required] The tree TreePanel, with config etc.
-     */
-    tree : false
-
-});
-