3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 * A custom drag proxy implementation specific to {@link Ext.panel.Panel}s. This class
17 * is primarily used internally for the Panel's drag drop implementation, and
18 * should never need to be created directly.
21 Ext.define('Ext.panel.Proxy', {
23 alternateClassName: 'Ext.dd.PanelProxy',
26 * Creates new panel proxy.
27 * @param {Ext.panel.Panel} panel The {@link Ext.panel.Panel} to proxy for
28 * @param {Object} [config] Config object
30 constructor: function(panel, config){
33 * @type Ext.panel.Panel
36 this.id = this.panel.id +'-ddproxy';
37 Ext.apply(this, config);
41 * @cfg {Boolean} insertProxy
42 * True to insert a placeholder proxy element while dragging the panel, false to drag with no proxy.
43 * Most Panels are not absolute positioned and therefore we need to reserve this space.
48 setStatus: Ext.emptyFn,
55 * Gets the proxy's element
56 * @return {Ext.Element} The proxy's element
63 * Gets the proxy's ghost Panel
64 * @return {Ext.panel.Panel} The proxy's ghost Panel
71 * Gets the proxy element. This is the element that represents where the
72 * Panel was before we started the drag operation.
73 * @return {Ext.Element} The proxy's element
89 // Unghost the Panel, do not move the Panel to where the ghost was
90 this.panel.unghost(null, false);
100 var panelSize = this.panel.getSize();
101 this.panel.el.setVisibilityMode(Ext.Element.DISPLAY);
102 this.ghost = this.panel.ghost();
103 if (this.insertProxy) {
104 // bc Panels aren't absolute positioned we need to take up the space
105 // of where the panel previously was
106 this.proxy = this.panel.el.insertSibling({cls: Ext.baseCSSPrefix + 'panel-dd-spacer'});
107 this.proxy.setSize(panelSize);
113 repair: function(xy, callback, scope) {
115 if (typeof callback == "function") {
116 callback.call(scope || this);
121 * Moves the proxy to a different position in the DOM. This is typically
122 * called while dragging the Panel to keep the proxy sync'd to the Panel's
124 * @param {HTMLElement} parentNode The proxy's parent DOM node
125 * @param {HTMLElement} [before] The sibling node before which the
126 * proxy should be inserted (defaults to the parent's last child if not
129 moveProxy : function(parentNode, before){
131 parentNode.insertBefore(this.proxy.dom, before);