-<html>\r
-<head>\r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js">Ext.sql.Proxy = function(conn, table, keyName, store, readonly){\r
- Ext.sql.Proxy.superclass.constructor.call(this);\r
- this.conn = conn;\r
- this.table = this.conn.getTable(table, keyName);\r
- this.store = store;\r
-\r
- if (readonly !== true) {\r
- this.store.on('add', this.onAdd, this);\r
- this.store.on('update', this.onUpdate, this);\r
- this.store.on('remove', this.onRemove, this);\r
- }\r
-};\r
-\r
-Ext.sql.Proxy.DATE_FORMAT = 'Y-m-d H:i:s';\r
-\r
-Ext.extend(Ext.sql.Proxy, Ext.data.DataProxy, {\r
- load : function(params, reader, callback, scope, arg){\r
- if(!this.conn.isOpen()){ // assume that the connection is in the process of opening\r
- this.conn.on('open', function(){\r
- this.load(params, reader, callback, scope, arg);\r
- }, this, {single:true});\r
- return;\r
- };\r
- if(this.fireEvent("beforeload", this, params, reader, callback, scope, arg) !== false){\r
- var clause = params.where || '';\r
- var args = params.args || [];\r
- var group = params.groupBy;\r
- var sort = params.sort;\r
- var dir = params.dir;\r
-\r
- if(group || sort){\r
- clause += ' ORDER BY ';\r
- if(group && group != sort){\r
- clause += group + ' ASC, ';\r
- }\r
- clause += sort + ' ' + (dir || 'ASC');\r
- }\r
-\r
- var rs = this.table.selectBy(clause, args);\r
- this.onLoad({callback:callback, scope:scope, arg:arg, reader: reader}, rs);\r
- }else{\r
- callback.call(scope||this, null, arg, false);\r
- }\r
- },\r
-\r
- onLoad : function(trans, rs, e, stmt){\r
- if(rs === false){\r
- this.fireEvent("loadexception", this, null, trans.arg, e);\r
- trans.callback.call(trans.scope||window, null, trans.arg, false);\r
- return;\r
- }\r
- var result = trans.reader.readRecords(rs);\r
- this.fireEvent("load", this, rs, trans.arg);\r
- trans.callback.call(trans.scope||window, result, trans.arg, true);\r
- },\r
-\r
- processData : function(o){\r
- var fs = this.store.fields;\r
- var r = {};\r
- for(var key in o){\r
- var f = fs.key(key), v = o[key];\r
- if(f){\r
- if(f.type == 'date'){\r
- r[key] = v ? v.format(Ext.sql.Proxy.DATE_FORMAT,10) : '';\r
- }else if(f.type == 'boolean'){\r
- r[key] = v ? 1 : 0;\r
- }else{\r
- r[key] = v;\r
- }\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- onUpdate : function(ds, record){\r
- var changes = record.getChanges();\r
- var kn = this.table.keyName;\r
- this.table.updateBy(this.processData(changes), kn + ' = ?', [record.data[kn]]);\r
- record.commit(true);\r
- },\r
-\r
- onAdd : function(ds, records, index){\r
- for(var i = 0, len = records.length; i < len; i++){\r
- this.table.insert(this.processData(records[i].data));\r
- }\r
- },\r
-\r
- onRemove : function(ds, record, index){\r
- var kn = this.table.keyName;\r
- this.table.removeBy(kn + ' = ?', [record.data[kn]]);\r
- }\r
-});</pre> \r
-</body>\r
-</html>
\ No newline at end of file
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>The source code</title>
+ <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../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> * @class Ext.panel.Proxy
+ * @extends Object
+ * 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.
+ */
+Ext.define('Ext.panel.Proxy', {
+
+ alternateClassName: 'Ext.dd.PanelProxy',
+
+<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 (optional) Config object
+ */
+ constructor: function(panel, config){
+<span id='Ext-panel-Proxy-property-panel'> /**
+</span> * @property panel
+ * @type Ext.panel.Panel
+ */
+ this.panel = panel;
+ this.id = this.panel.id +'-ddproxy';
+ Ext.apply(this, 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 (defaults to true).
+ * 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 {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 {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 {Element} The proxy's element
+ */
+ getProxy: function(){
+ return this.proxy;
+ },
+
+<span id='Ext-panel-Proxy-method-hide'> /**
+</span> * Hides the proxy
+ */
+ hide : function(){
+ if (this.ghost) {
+ if (this.proxy) {
+ this.proxy.remove();
+ delete this.proxy;
+ }
+
+ // Unghost the Panel, do not move the Panel to where the ghost was
+ this.panel.unghost(null, false);
+ delete this.ghost;
+ }
+ },
+
+<span id='Ext-panel-Proxy-method-show'> /**
+</span> * Shows the proxy
+ */
+ show: function(){
+ if (!this.ghost) {
+ var panelSize = this.panel.getSize();
+ this.panel.el.setVisibilityMode(Ext.core.Element.DISPLAY);
+ this.ghost = this.panel.ghost();
+ if (this.insertProxy) {
+ // bc Panels aren't absolute positioned we need to take up the space
+ // of where the panel previously was
+ this.proxy = this.panel.el.insertSibling({cls: Ext.baseCSSPrefix + 'panel-dd-spacer'});
+ this.proxy.setSize(panelSize);
+ }
+ }
+ },
+
+ // private
+ repair: function(xy, callback, scope) {
+ this.hide();
+ if (typeof callback == "function") {
+ callback.call(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 (optional) 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>