From: Alan Date: Thu, 18 Jan 2024 06:43:41 +0000 (+0800) Subject: fix #7318 - rename upload cropbox and panel tree X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=7dfd0d3cd68424e103991ef6946d2368cbe08a81 fix #7318 - rename upload cropbox and panel tree --- diff --git a/Roo/BasicDialog.js b/Roo/BasicDialog.js index d8034fdab8..cb148bb545 100644 --- a/Roo/BasicDialog.js +++ b/Roo/BasicDialog.js @@ -335,7 +335,7 @@ Roo.extend(Roo.BasicDialog, Roo.util.Observable, { /** * Reinitializes the tabs component, clearing out old tabs and finding new ones. - * @return {Roo.TabPanel} The tabs component + * @return {Roo.panel.Tab} The tabs component */ initTabs : function(){ var tabs = this.getTabs(); @@ -456,16 +456,16 @@ Roo.extend(Roo.BasicDialog, Roo.util.Observable, { }, /** - * Returns the TabPanel component (creates it if it doesn't exist). + * Returns the panel.Tab component (creates it if it doesn't exist). * Note: If you wish to simply check for the existence of tabs without creating them, * check for a null 'tabs' property. - * @return {Roo.TabPanel} The tabs component + * @return {Roo.panel.Tab} The tabs component */ getTabs : function(){ if(!this.tabs){ this.el.addClass("x-dlg-auto-tabs"); this.body.addClass(this.tabPosition == "bottom" ? "x-tabs-bottom" : "x-tabs-top"); - this.tabs = new Roo.TabPanel(this.body.dom, this.tabPosition == "bottom"); + this.tabs = new Roo.panel.Tab(this.body.dom, this.tabPosition == "bottom"); } return this.tabs; }, diff --git a/Roo/BasicLayoutRegion.js b/Roo/BasicLayoutRegion.js index 2f2d910820..f6394ca8b2 100644 --- a/Roo/BasicLayoutRegion.js +++ b/Roo/BasicLayoutRegion.js @@ -28,7 +28,7 @@ Roo.BasicLayoutRegion = function(mgr, config, pos, skipConfig){ * @event beforeremove * Fires before a panel is removed (or closed). To cancel the removal set "e.cancel = true" on the event argument. * @param {Roo.LayoutRegion} this - * @param {Roo.ContentPanel} panel The panel + * @param {Roo.panel.Content} panel The panel * @param {Object} e The cancel event object */ "beforeremove" : true, @@ -49,14 +49,14 @@ Roo.BasicLayoutRegion = function(mgr, config, pos, skipConfig){ * @event paneladded * Fires when a panel is added. * @param {Roo.LayoutRegion} this - * @param {Roo.ContentPanel} panel The panel + * @param {Roo.panel.Content} panel The panel */ "paneladded" : true, /** * @event panelremoved * Fires when a panel is removed. * @param {Roo.LayoutRegion} this - * @param {Roo.ContentPanel} panel The panel + * @param {Roo.panel.Content} panel The panel */ "panelremoved" : true, /** @@ -93,7 +93,7 @@ Roo.BasicLayoutRegion = function(mgr, config, pos, skipConfig){ * @event panelactivated * Fires when a panel is activated. * @param {Roo.LayoutRegion} this - * @param {Roo.ContentPanel} panel The activated panel + * @param {Roo.panel.Content} panel The activated panel */ "panelactivated" : true, /** @@ -207,8 +207,8 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { /** * Show the specified panel. - * @param {Number/String/ContentPanel} panelId The panels index, id or the panel itself - * @return {Roo.ContentPanel} The shown panel or null + * @param {Number/String/panel.Content} panelId The panels index, id or the panel itself + * @return {Roo.panel.Content} The shown panel or null */ showPanel : function(panel){ if(panel = this.getPanel(panel)){ @@ -219,7 +219,7 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { /** * Get the active panel for this region. - * @return {Roo.ContentPanel} The active panel or null + * @return {Roo.panel.Content} The active panel or null */ getActivePanel : function(){ return this.activePanel; @@ -227,8 +227,8 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { /** * Add the passed ContentPanel(s) - * @param {ContentPanel...} panel The ContentPanel(s) to add (you can pass more than one) - * @return {Roo.ContentPanel} The panel added (if only one was added) + * @param {panel.Content...} panel The ContentPanel(s) to add (you can pass more than one) + * @return {Roo.panel.Content} The panel added (if only one was added) */ add : function(panel){ if(arguments.length > 1){ @@ -262,7 +262,7 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { /** * Returns true if the panel is in this region. - * @param {Number/String/ContentPanel} panel The panels index, id or the panel itself + * @param {Number/String/panel.Content} panel The panels index, id or the panel itself * @return {Boolean} */ hasPanel : function(panel){ @@ -274,9 +274,9 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { /** * Removes the specified panel. If preservePanel is not true (either here or in the config), the panel is destroyed. - * @param {Number/String/ContentPanel} panel The panels index, id or the panel itself + * @param {Number/String/panel.Content} panel The panels index, id or the panel itself * @param {Boolean} preservePanel Overrides the config preservePanel option - * @return {Roo.ContentPanel} The panel that was removed + * @return {Roo.panel.Content} The panel that was removed */ remove : function(panel, preservePanel){ panel = this.getPanel(panel); @@ -295,8 +295,8 @@ Roo.extend(Roo.BasicLayoutRegion, Roo.util.Observable, { /** * Returns the panel specified or null if it's not in this region. - * @param {Number/String/ContentPanel} panel The panels index, id or the panel itself - * @return {Roo.ContentPanel} + * @param {Number/String/panel.Content} panel The panels index, id or the panel itself + * @return {Roo.panel.Content} */ getPanel : function(id){ if(typeof id == "object"){ // must be panel obj diff --git a/Roo/BorderLayout.js b/Roo/BorderLayout.js index 8228cedb34..26e53be520 100644 --- a/Roo/BorderLayout.js +++ b/Roo/BorderLayout.js @@ -11,7 +11,7 @@ /** * @class Roo.BorderLayout * @extends Roo.LayoutManager - * @children Roo.ContentPanel + * @children Roo.panel.Content * This class represents a common layout manager used in desktop applications. For screenshots and more details, * please see:

* Cross Browser Layouts - Part 1
@@ -57,7 +57,7 @@ }); // shorthand -var CP = Roo.ContentPanel; +var CP = Roo.panel.Content; layout.beginUpdate(); layout.add("north", new CP("north", "North")); @@ -228,8 +228,8 @@ Roo.extend(Roo.BorderLayout, Roo.LayoutManager, { /** * Adds a ContentPanel (or subclass) to this layout. * @param {String} target The target region key (north, south, east, west or center). - * @param {Roo.ContentPanel} panel The panel to add - * @return {Roo.ContentPanel} The added panel + * @param {Roo.panel.Content} panel The panel to add + * @return {Roo.panel.Content} The added panel */ add : function(target, panel){ @@ -240,8 +240,8 @@ Roo.extend(Roo.BorderLayout, Roo.LayoutManager, { /** * Remove a ContentPanel (or subclass) to this layout. * @param {String} target The target region key (north, south, east, west or center). - * @param {Number/String/Roo.ContentPanel} panel The index, id or panel to remove - * @return {Roo.ContentPanel} The removed panel + * @param {Number/String/Roo.panel.Content} panel The index, id or panel to remove + * @return {Roo.panel.Content} The removed panel */ remove : function(target, panel){ target = target.toLowerCase(); @@ -251,7 +251,7 @@ Roo.extend(Roo.BorderLayout, Roo.LayoutManager, { /** * Searches all regions for a panel with the specified id * @param {String} panelId - * @return {Roo.ContentPanel} The panel or null if it wasn't found + * @return {Roo.panel.Content} The panel or null if it wasn't found */ findPanel : function(panelId){ var rs = this.regions; @@ -268,8 +268,8 @@ Roo.extend(Roo.BorderLayout, Roo.LayoutManager, { /** * Searches all regions for a panel with the specified id and activates (shows) it. - * @param {String/ContentPanel} panelId The panels id or the panel itself - * @return {Roo.ContentPanel} The shown panel or null + * @param {String/panel.Content} panelId The panels id or the panel itself + * @return {Roo.panel.Content} The shown panel or null */ showPanel : function(panelId) { var rs = this.regions; @@ -347,7 +347,7 @@ layout.batchAdd({ // private addTypedPanels : function(lr, ps){ if(typeof ps == 'string'){ - lr.add(new Roo.ContentPanel(ps)); + lr.add(new Roo.panel.Content(ps)); } else if(ps instanceof Array){ for(var i =0, len = ps.length; i < len; i++){ @@ -357,7 +357,7 @@ layout.batchAdd({ else if(!ps.events){ // raw config? var el = ps.el; delete ps.el; // prevent conflict - lr.add(new Roo.ContentPanel(el || Roo.id(), ps)); + lr.add(new Roo.panel.Content(el || Roo.id(), ps)); } else { // panel object assumed! lr.add(ps); @@ -393,11 +393,11 @@ layout.addxtype({ // can accept a layout region..!?!? //Roo.log('Roo.BorderLayout add ' + cfg.xtype) - if (!cfg.xtype.match(/Panel$/)) { - return false; - } + // if (!cfg.xtype.match(/Panel$/)) { + // return false; + // } var ret = false; - + if (typeof(cfg.region) == 'undefined') { Roo.log("Failed to add Panel, region was not set"); Roo.log(cfg); @@ -416,7 +416,72 @@ layout.addxtype({ switch(cfg.xtype) { - case 'ContentPanel': // ContentPanel (el, cfg) + case 'Content': + if(cfg.autoCreate) { + ret = new Roo.panel[cfg.xtype](cfg); // new panel!!!!! + } else { + var el = this.el.createChild(); + ret = new Roo.panel[cfg.xtype](el, cfg); // new panel!!!!! + } + + this.add(region, ret); + break; + case 'Grid': + // needs grid and region + + //var el = this.getRegion(region).el.createChild(); + var el = this.el.createChild(); + // create the grid first... + + var grid = new Roo.grid[cfg.grid.xtype](el, cfg.grid); + delete cfg.grid; + if (region == 'center' && this.active ) { + cfg.background = false; + } + ret = new Roo.panel[cfg.xtype](grid, cfg); // new panel!!!!! + + this.add(region, ret); + if (cfg.background) { + ret.on('activate', function(gp) { + if (!gp.grid.rendered) { + gp.grid.render(); + } + }); + } else { + grid.render(); + } + break; + case 'NestedLayout': + // create a new Layout (which is a Border Layout... + var el = this.el.createChild(); + var clayout = cfg.layout; + delete cfg.layout; + clayout.items = clayout.items || []; + // replace this exitems with the clayout ones.. + xitems = clayout.items; + + + if (region == 'center' && this.active && this.getRegion('center').panels.length < 1) { + cfg.background = false; + } + var layout = new Roo.BorderLayout(el, clayout); + + ret = new Roo.panel[cfg.xtype](layout, cfg); // new panel!!!!! + //console.log('adding nested layout panel ' + cfg.toSource()); + this.add(region, ret); + nb = {}; /// find first... + break; + + case 'Calendar': + ret = new Roo.panel[cfg.xtype](cfg); // new panel!!!!! + this.add(region, ret); + break; + case 'Tree': // our new panel! + cfg.el = this.el.createChild(); + ret = new Roo.panel[cfg.xtype](cfg); // new panel!!!!! + this.add(region, ret); + break; + case 'ContentPanel': case 'ScrollPanel': // ContentPanel (el, cfg) case 'ViewPanel': if(cfg.autoCreate) { diff --git a/Roo/ContentPanel.js b/Roo/Content.js similarity index 97% rename from Roo/ContentPanel.js rename to Roo/Content.js index cc1b9d0ce5..56b6abd47d 100644 --- a/Roo/ContentPanel.js +++ b/Roo/Content.js @@ -9,11 +9,11 @@ * - - + + -

Upload Cropbox Dialog

-

This example shows how to create a very simple BasicDialog with "UploadCropbox".

+

Cropbox Panel

+

This example shows how to create a very simple BasicDialog with "Cropbox".



Note that the js is not minified so it is readable. See -for the full source code.

+for the full source code.

diff --git a/examples/dialog/uploadCropbox.js b/examples/panel/cropbox.js similarity index 91% rename from examples/dialog/uploadCropbox.js rename to examples/panel/cropbox.js index 9535a31123..5bae447d48 100644 --- a/examples/dialog/uploadCropbox.js +++ b/examples/panel/cropbox.js @@ -1,4 +1,4 @@ -var uploadCropbox = { +var cropboxDialog = { dialog : false, callback : false, @@ -32,13 +32,13 @@ var uploadCropbox = { }, items : [ { - xtype: 'ContentPanel', - xns: Roo, + xtype: 'Content', + xns: Roo.panel, region : "center", items : [ { - xtype : 'UploadCropbox', - xns : Roo.dialog, + xtype : 'Cropbox', + xns : Roo.panel, minWidth : 720, minHeight : 480, outputMaxWidth : 1200, @@ -148,11 +148,11 @@ var test = { }, items : [ { - xns : Roo, - xtype: 'GridPanel', + xns : Roo.panel, + xtype: 'Grid', region : "center", grid : { - xns : Roo.grid, + xns : Roo.panel, xtype : 'Grid', cm : [ { @@ -174,13 +174,13 @@ var test = { text : 'Add', listeners : { click : function () { - uploadCropbox.show(); + cropboxDialog.show(); document.body.onfocus = function(e) { - if(!uploadCropbox.cropbox.selectorEl.dom.files.length) { - uploadCropbox.dialog.hide(); + if(!cropboxDialog.cropbox.selectorEl.dom.files.length) { + cropboxDialog.dialog.hide(); } } - uploadCropbox.cropbox.selectorEl.dom.click(); + cropboxDialog.cropbox.selectorEl.dom.click(); } } } diff --git a/examples/tabs/tabs-adv.js b/examples/tabs/tabs-adv.js index 17e5da9f53..3f0c7d5f7b 100644 --- a/examples/tabs/tabs-adv.js +++ b/examples/tabs/tabs-adv.js @@ -7,9 +7,9 @@ * * Fork - LGPL *