Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / ux / Portal.js
diff --git a/examples/ux/Portal.js b/examples/ux/Portal.js
deleted file mode 100644 (file)
index 0cc4b36..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-Ext.ux.Portal = Ext.extend(Ext.Panel, {\r
-    layout : 'column',\r
-    autoScroll : true,\r
-    cls : 'x-portal',\r
-    defaultType : 'portalcolumn',\r
-    \r
-    initComponent : function(){\r
-        Ext.ux.Portal.superclass.initComponent.call(this);\r
-        this.addEvents({\r
-            validatedrop:true,\r
-            beforedragover:true,\r
-            dragover:true,\r
-            beforedrop:true,\r
-            drop:true\r
-        });\r
-    },\r
-\r
-    initEvents : function(){\r
-        Ext.ux.Portal.superclass.initEvents.call(this);\r
-        this.dd = new Ext.ux.Portal.DropZone(this, this.dropConfig);\r
-    },\r
-    \r
-    beforeDestroy : function() {\r
-        if(this.dd){\r
-            this.dd.unreg();\r
-        }\r
-        Ext.ux.Portal.superclass.beforeDestroy.call(this);\r
-    }\r
-});\r
-\r
-Ext.reg('portal', Ext.ux.Portal);\r
-\r
-\r
-Ext.ux.Portal.DropZone = function(portal, cfg){\r
-    this.portal = portal;\r
-    Ext.dd.ScrollManager.register(portal.body);\r
-    Ext.ux.Portal.DropZone.superclass.constructor.call(this, portal.bwrap.dom, cfg);\r
-    portal.body.ddScrollConfig = this.ddScrollConfig;\r
-};\r
-\r
-Ext.extend(Ext.ux.Portal.DropZone, Ext.dd.DropTarget, {\r
-    ddScrollConfig : {\r
-        vthresh: 50,\r
-        hthresh: -1,\r
-        animate: true,\r
-        increment: 200\r
-    },\r
-\r
-    createEvent : function(dd, e, data, col, c, pos){\r
-        return {\r
-            portal: this.portal,\r
-            panel: data.panel,\r
-            columnIndex: col,\r
-            column: c,\r
-            position: pos,\r
-            data: data,\r
-            source: dd,\r
-            rawEvent: e,\r
-            status: this.dropAllowed\r
-        };\r
-    },\r
-\r
-    notifyOver : function(dd, e, data){\r
-        var xy = e.getXY(), portal = this.portal, px = dd.proxy;\r
-\r
-        // case column widths\r
-        if(!this.grid){\r
-            this.grid = this.getGrid();\r
-        }\r
-\r
-        // handle case scroll where scrollbars appear during drag\r
-        var cw = portal.body.dom.clientWidth;\r
-        if(!this.lastCW){\r
-            this.lastCW = cw;\r
-        }else if(this.lastCW != cw){\r
-            this.lastCW = cw;\r
-            portal.doLayout();\r
-            this.grid = this.getGrid();\r
-        }\r
-\r
-        // determine column\r
-        var col = 0, xs = this.grid.columnX, cmatch = false;\r
-        for(var len = xs.length; col < len; col++){\r
-            if(xy[0] < (xs[col].x + xs[col].w)){\r
-                cmatch = true;\r
-                break;\r
-            }\r
-        }\r
-        // no match, fix last index\r
-        if(!cmatch){\r
-            col--;\r
-        }\r
-\r
-        // find insert position\r
-        var p, match = false, pos = 0,\r
-            c = portal.items.itemAt(col),\r
-            items = c.items.items, overSelf = false;\r
-\r
-        for(var len = items.length; pos < len; pos++){\r
-            p = items[pos];\r
-            var h = p.el.getHeight();\r
-            if(h === 0){\r
-                overSelf = true;\r
-            }\r
-            else if((p.el.getY()+(h/2)) > xy[1]){\r
-                match = true;\r
-                break;\r
-            }\r
-        }\r
-\r
-        pos = (match && p ? pos : c.items.getCount()) + (overSelf ? -1 : 0);\r
-        var overEvent = this.createEvent(dd, e, data, col, c, pos);\r
-\r
-        if(portal.fireEvent('validatedrop', overEvent) !== false &&\r
-           portal.fireEvent('beforedragover', overEvent) !== false){\r
-\r
-            // make sure proxy width is fluid\r
-            px.getProxy().setWidth('auto');\r
-\r
-            if(p){\r
-                px.moveProxy(p.el.dom.parentNode, match ? p.el.dom : null);\r
-            }else{\r
-                px.moveProxy(c.el.dom, null);\r
-            }\r
-\r
-            this.lastPos = {c: c, col: col, p: overSelf || (match && p) ? pos : false};\r
-            this.scrollPos = portal.body.getScroll();\r
-\r
-            portal.fireEvent('dragover', overEvent);\r
-\r
-            return overEvent.status;\r
-        }else{\r
-            return overEvent.status;\r
-        }\r
-\r
-    },\r
-\r
-    notifyOut : function(){\r
-        delete this.grid;\r
-    },\r
-\r
-    notifyDrop : function(dd, e, data){\r
-        delete this.grid;\r
-        if(!this.lastPos){\r
-            return;\r
-        }\r
-        var c = this.lastPos.c, col = this.lastPos.col, pos = this.lastPos.p;\r
-\r
-        var dropEvent = this.createEvent(dd, e, data, col, c,\r
-            pos !== false ? pos : c.items.getCount());\r
-\r
-        if(this.portal.fireEvent('validatedrop', dropEvent) !== false &&\r
-           this.portal.fireEvent('beforedrop', dropEvent) !== false){\r
-\r
-            dd.proxy.getProxy().remove();\r
-            dd.panel.el.dom.parentNode.removeChild(dd.panel.el.dom);\r
-            \r
-            if(pos !== false){\r
-                if(c == dd.panel.ownerCt && (c.items.items.indexOf(dd.panel) <= pos)){\r
-                    pos++;\r
-                }\r
-                c.insert(pos, dd.panel);\r
-            }else{\r
-                c.add(dd.panel);\r
-            }\r
-            \r
-            c.doLayout();\r
-\r
-            this.portal.fireEvent('drop', dropEvent);\r
-\r
-            // scroll position is lost on drop, fix it\r
-            var st = this.scrollPos.top;\r
-            if(st){\r
-                var d = this.portal.body.dom;\r
-                setTimeout(function(){\r
-                    d.scrollTop = st;\r
-                }, 10);\r
-            }\r
-\r
-        }\r
-        delete this.lastPos;\r
-    },\r
-\r
-    // internal cache of body and column coords\r
-    getGrid : function(){\r
-        var box = this.portal.bwrap.getBox();\r
-        box.columnX = [];\r
-        this.portal.items.each(function(c){\r
-             box.columnX.push({x: c.el.getX(), w: c.el.getWidth()});\r
-        });\r
-        return box;\r
-    },\r
-\r
-    // unregister the dropzone from ScrollManager\r
-    unreg: function() {\r
-        //Ext.dd.ScrollManager.unregister(this.portal.body);\r
-        Ext.ux.Portal.DropZone.superclass.unreg.call(this);\r
-    }\r
-});\r