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 * @class Ext.panel.Proxy
18 * A custom drag proxy implementation specific to {@link Ext.panel.Panel}s. This class
19 * is primarily used internally for the Panel's drag drop implementation, and
20 * should never need to be created directly.
22 Ext.define('Ext.panel.Proxy', {
24 alternateClassName: 'Ext.dd.PanelProxy',
27 * Creates new panel proxy.
28 * @param {Ext.panel.Panel} panel The {@link Ext.panel.Panel} to proxy for
29 * @param {Object} config (optional) Config object
31 constructor: function(panel, config){
34 * @type Ext.panel.Panel
37 this.id = this.panel.id +'-ddproxy';
38 Ext.apply(this, config);
42 * @cfg {Boolean} insertProxy True to insert a placeholder proxy element
43 * while dragging the panel, false to drag with no proxy (defaults to true).
44 * Most Panels are not absolute positioned and therefore we need to reserve
50 setStatus: Ext.emptyFn,
57 * Gets the proxy's element
58 * @return {Element} The proxy's element
65 * Gets the proxy's ghost Panel
66 * @return {Panel} The proxy's ghost Panel
73 * Gets the proxy element. This is the element that represents where the
74 * Panel was before we started the drag operation.
75 * @return {Element} The proxy's element
91 // Unghost the Panel, do not move the Panel to where the ghost was
92 this.panel.unghost(null, false);
102 var panelSize = this.panel.getSize();
103 this.panel.el.setVisibilityMode(Ext.core.Element.DISPLAY);
104 this.ghost = this.panel.ghost();
105 if (this.insertProxy) {
106 // bc Panels aren't absolute positioned we need to take up the space
107 // of where the panel previously was
108 this.proxy = this.panel.el.insertSibling({cls: Ext.baseCSSPrefix + 'panel-dd-spacer'});
109 this.proxy.setSize(panelSize);
115 repair: function(xy, callback, scope) {
117 if (typeof callback == "function") {
118 callback.call(scope || this);
123 * Moves the proxy to a different position in the DOM. This is typically
124 * called while dragging the Panel to keep the proxy sync'd to the Panel's
126 * @param {HTMLElement} parentNode The proxy's parent DOM node
127 * @param {HTMLElement} before (optional) The sibling node before which the
128 * proxy should be inserted (defaults to the parent's last child if not
131 moveProxy : function(parentNode, before){
133 parentNode.insertBefore(this.proxy.dom, before);