Proxy.html
4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js"><span id='Ext-panel-Proxy'>/**
</span> * A custom drag proxy implementation specific to {@link Ext.panel.Panel}s. This class
* is primarily used internally for the Panel's drag drop implementation, and
* should never need to be created directly.
* @private
*/
Ext.define('Ext.panel.Proxy', {
alternateClassName: 'Ext.dd.PanelProxy',
<span id='Ext-panel-Proxy-cfg-moveOnDrag'> /**
</span> * @cfg {Boolean} [moveOnDrag=true]
* True to move the panel to the dragged position when dropped
*/
moveOnDrag: true,
<span id='Ext-panel-Proxy-method-constructor'> /**
</span> * Creates new panel proxy.
* @param {Ext.panel.Panel} panel The {@link Ext.panel.Panel} to proxy for
* @param {Object} [config] Config object
*/
constructor: function(panel, config){
var me = this;
<span id='Ext-panel-Proxy-property-panel'> /**
</span> * @property panel
* @type Ext.panel.Panel
*/
me.panel = panel;
me.id = me.panel.id +'-ddproxy';
Ext.apply(me, config);
},
<span id='Ext-panel-Proxy-cfg-insertProxy'> /**
</span> * @cfg {Boolean} insertProxy
* True to insert a placeholder proxy element while dragging the panel, false to drag with no proxy.
* Most Panels are not absolute positioned and therefore we need to reserve this space.
*/
insertProxy: true,
// private overrides
setStatus: Ext.emptyFn,
reset: Ext.emptyFn,
update: Ext.emptyFn,
stop: Ext.emptyFn,
sync: Ext.emptyFn,
<span id='Ext-panel-Proxy-method-getEl'> /**
</span> * Gets the proxy's element
* @return {Ext.Element} The proxy's element
*/
getEl: function(){
return this.ghost.el;
},
<span id='Ext-panel-Proxy-method-getGhost'> /**
</span> * Gets the proxy's ghost Panel
* @return {Ext.panel.Panel} The proxy's ghost Panel
*/
getGhost: function(){
return this.ghost;
},
<span id='Ext-panel-Proxy-method-getProxy'> /**
</span> * Gets the proxy element. This is the element that represents where the
* Panel was before we started the drag operation.
* @return {Ext.Element} The proxy's element
*/
getProxy: function(){
return this.proxy;
},
<span id='Ext-panel-Proxy-method-hide'> /**
</span> * Hides the proxy
*/
hide : function(){
var me = this;
if (me.ghost) {
if (me.proxy) {
me.proxy.remove();
delete me.proxy;
}
// Unghost the Panel, do not move the Panel to where the ghost was
me.panel.unghost(null, me.moveOnDrag);
delete me.ghost;
}
},
<span id='Ext-panel-Proxy-method-show'> /**
</span> * Shows the proxy
*/
show: function(){
var me = this,
panelSize;
if (!me.ghost) {
panelSize = me.panel.getSize();
me.panel.el.setVisibilityMode(Ext.Element.DISPLAY);
me.ghost = me.panel.ghost();
if (me.insertProxy) {
// bc Panels aren't absolute positioned we need to take up the space
// of where the panel previously was
me.proxy = me.panel.el.insertSibling({cls: Ext.baseCSSPrefix + 'panel-dd-spacer'});
me.proxy.setSize(panelSize);
}
}
},
// private
repair: function(xy, callback, scope) {
this.hide();
Ext.callback(callback, scope || this);
},
<span id='Ext-panel-Proxy-method-moveProxy'> /**
</span> * Moves the proxy to a different position in the DOM. This is typically
* called while dragging the Panel to keep the proxy sync'd to the Panel's
* location.
* @param {HTMLElement} parentNode The proxy's parent DOM node
* @param {HTMLElement} [before] The sibling node before which the
* proxy should be inserted. Defaults to the parent's last child if not
* specified.
*/
moveProxy : function(parentNode, before){
if (this.proxy) {
parentNode.insertBefore(this.proxy.dom, before);
}
}
});
</pre>
</body>
</html>