Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / output / Ext.Class.js
1 Ext.data.JsonP.Ext_Class({
2   "allMixins": [
3
4   ],
5   "deprecated": null,
6   "docauthor": "Jacky Nguyen <jacky@sencha.com>",
7   "members": {
8     "cfg": [
9       {
10         "type": "[String]",
11         "deprecated": null,
12         "alias": null,
13         "protected": false,
14         "tagname": "cfg",
15         "href": "ClassManager.html#Ext-Class-cfg-alias",
16         "shortDoc": "List of short aliases for class names. ...",
17         "static": false,
18         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/ClassManager.js",
19         "private": false,
20         "name": "alias",
21         "owner": "Ext.Class",
22         "doc": "<p>List of short aliases for class names.  Most useful for defining xtypes for widgets:</p>\n\n<pre><code>Ext.define('MyApp.CoolPanel', {\n    extend: 'Ext.panel.Panel',\n    alias: ['widget.coolpanel'],\n    title: 'Yeah!'\n});\n\n// Using Ext.create\nExt.widget('widget.coolpanel');\n// Using the shorthand for widgets and in xtypes\nExt.widget('panel', {\n    items: [\n        {xtype: 'coolpanel', html: 'Foo'},\n        {xtype: 'coolpanel', html: 'Bar'}\n    ]\n});\n</code></pre>\n",
23         "linenr": 850,
24         "html_filename": "ClassManager.html"
25       },
26       {
27         "type": "String/[String]",
28         "deprecated": null,
29         "alias": null,
30         "protected": false,
31         "tagname": "cfg",
32         "href": "ClassManager.html#Ext-Class-cfg-alternateClassName",
33         "shortDoc": "Defines alternate names for this class. ...",
34         "static": false,
35         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/ClassManager.js",
36         "private": false,
37         "name": "alternateClassName",
38         "owner": "Ext.Class",
39         "doc": "<p>Defines alternate names for this class.  For example:</p>\n\n<pre><code>Ext.define('Developer', {\n    alternateClassName: ['Coder', 'Hacker'],\n    code: function(msg) {\n        alert('Typing... ' + msg);\n    }\n});\n\nvar joe = Ext.create('Developer');\njoe.code('stackoverflow');\n\nvar rms = Ext.create('Hacker');\nrms.code('hack hack');\n</code></pre>\n",
40         "linenr": 927,
41         "html_filename": "ClassManager.html"
42       },
43       {
44         "type": "Object",
45         "deprecated": null,
46         "alias": null,
47         "protected": false,
48         "tagname": "cfg",
49         "href": "Class.html#Ext-Class-cfg-config",
50         "shortDoc": "List of configuration options with their default values, for which automatically\naccessor methods are generated. ...",
51         "static": false,
52         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
53         "private": false,
54         "name": "config",
55         "owner": "Ext.Class",
56         "doc": "<p>List of configuration options with their default values, for which automatically\naccessor methods are generated.  For example:</p>\n\n<pre><code>Ext.define('SmartPhone', {\n     config: {\n         hasTouchScreen: false,\n         operatingSystem: 'Other',\n         price: 500\n     },\n     constructor: function(cfg) {\n         this.initConfig(cfg);\n     }\n});\n\nvar iPhone = new SmartPhone({\n     hasTouchScreen: true,\n     operatingSystem: 'iOS'\n});\n\niPhone.getPrice(); // 500;\niPhone.getOperatingSystem(); // 'iOS'\niPhone.getHasTouchScreen(); // true;\niPhone.hasTouchScreen(); // true\n</code></pre>\n",
57         "linenr": 580,
58         "html_filename": "Class.html"
59       },
60       {
61         "type": "String",
62         "deprecated": null,
63         "alias": null,
64         "protected": false,
65         "tagname": "cfg",
66         "href": "Class.html#Ext-Class-cfg-extend",
67         "shortDoc": "The parent class that this class extends. ...",
68         "static": false,
69         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
70         "private": false,
71         "name": "extend",
72         "owner": "Ext.Class",
73         "doc": "<p>The parent class that this class extends. For example:</p>\n\n<pre><code>Ext.define('Person', {\n    say: function(text) { alert(text); }\n});\n\nExt.define('Developer', {\n    extend: 'Person',\n    say: function(text) { this.callParent([\"print \"+text]); }\n});\n</code></pre>\n",
74         "linenr": 420,
75         "html_filename": "Class.html"
76       },
77       {
78         "type": "Object",
79         "deprecated": null,
80         "alias": null,
81         "protected": false,
82         "tagname": "cfg",
83         "href": "Class.html#Ext-Class-cfg-inheritableStatics",
84         "shortDoc": "List of inheritable static methods for this class. ...",
85         "static": false,
86         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
87         "private": false,
88         "name": "inheritableStatics",
89         "owner": "Ext.Class",
90         "doc": "<p>List of inheritable static methods for this class.\nOtherwise just like <a href=\"#/api/Ext.Class-cfg-statics\" rel=\"Ext.Class-cfg-statics\" class=\"docClass\">statics</a> but subclasses inherit these methods.</p>\n",
91         "linenr": 529,
92         "html_filename": "Class.html"
93       },
94       {
95         "type": "Object",
96         "deprecated": null,
97         "alias": null,
98         "protected": false,
99         "tagname": "cfg",
100         "href": "Class.html#Ext-Class-cfg-mixins",
101         "shortDoc": "List of classes to mix into this class. ...",
102         "static": false,
103         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
104         "private": false,
105         "name": "mixins",
106         "owner": "Ext.Class",
107         "doc": "<p>List of classes to mix into this class. For example:</p>\n\n<pre><code>Ext.define('CanSing', {\n     sing: function() {\n         alert(\"I'm on the highway to hell...\")\n     }\n});\n\nExt.define('Musician', {\n     extend: 'Person',\n\n     mixins: {\n         canSing: 'CanSing'\n     }\n})\n</code></pre>\n",
108         "linenr": 556,
109         "html_filename": "Class.html"
110       },
111       {
112         "type": "[String]",
113         "deprecated": null,
114         "alias": null,
115         "protected": false,
116         "tagname": "cfg",
117         "href": "Loader.html#Ext-Class-cfg-requires",
118         "shortDoc": "List of classes that have to be loaded before instanciating this class. ...",
119         "static": false,
120         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
121         "private": false,
122         "name": "requires",
123         "owner": "Ext.Class",
124         "doc": "<p>List of classes that have to be loaded before instanciating this class.\nFor example:</p>\n\n<pre><code>Ext.define('Mother', {\n    requires: ['Child'],\n    giveBirth: function() {\n        // we can be sure that child class is available.\n        return new Child();\n    }\n});\n</code></pre>\n",
125         "linenr": 971,
126         "html_filename": "Loader.html"
127       },
128       {
129         "type": "Boolean",
130         "deprecated": null,
131         "alias": null,
132         "protected": false,
133         "tagname": "cfg",
134         "href": "ClassManager.html#Ext-Class-cfg-singleton",
135         "shortDoc": "When set to true, the class will be instanciated as singleton. ...",
136         "static": false,
137         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/ClassManager.js",
138         "private": false,
139         "name": "singleton",
140         "owner": "Ext.Class",
141         "doc": "<p>When set to true, the class will be instanciated as singleton.  For example:</p>\n\n<pre><code>Ext.define('Logger', {\n    singleton: true,\n    log: function(msg) {\n        console.log(msg);\n    }\n});\n\nLogger.log('Hello');\n</code></pre>\n",
142         "linenr": 908,
143         "html_filename": "ClassManager.html"
144       },
145       {
146         "type": "Object",
147         "deprecated": null,
148         "alias": null,
149         "protected": false,
150         "tagname": "cfg",
151         "href": "Class.html#Ext-Class-cfg-statics",
152         "shortDoc": "List of static methods for this class. ...",
153         "static": false,
154         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
155         "private": false,
156         "name": "statics",
157         "owner": "Ext.Class",
158         "doc": "<p>List of static methods for this class. For example:</p>\n\n<pre><code>Ext.define('Computer', {\n     statics: {\n         factory: function(brand) {\n             // 'this' in static methods refer to the class itself\n             return new this(brand);\n         }\n     },\n\n     constructor: function() { ... }\n});\n\nvar dellComputer = Computer.factory('Dell');\n</code></pre>\n",
159         "linenr": 499,
160         "html_filename": "Class.html"
161       },
162       {
163         "type": "[String]",
164         "deprecated": null,
165         "alias": null,
166         "protected": false,
167         "tagname": "cfg",
168         "href": "Loader.html#Ext-Class-cfg-uses",
169         "shortDoc": "List of classes to load together with this class. ...",
170         "static": false,
171         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
172         "private": false,
173         "name": "uses",
174         "owner": "Ext.Class",
175         "doc": "<p>List of classes to load together with this class.  These aren't neccessarily loaded before\nthis class is instanciated. For example:</p>\n\n<pre><code>Ext.define('Mother', {\n    uses: ['Child'],\n    giveBirth: function() {\n        // This code might, or might not work:\n        // return new Child();\n\n        // Instead use Ext.create() to load the class at the spot if not loaded already:\n        return Ext.create('Child');\n    }\n});\n</code></pre>\n",
176         "linenr": 1132,
177         "html_filename": "Loader.html"
178       }
179     ],
180     "method": [
181       {
182         "deprecated": null,
183         "alias": null,
184         "href": "Class.html#Ext-Class-method-constructor",
185         "tagname": "method",
186         "protected": false,
187         "shortDoc": "Creates new class. ...",
188         "static": false,
189         "params": [
190           {
191             "type": "Object",
192             "optional": false,
193             "doc": "<p>An object represent the properties of this class</p>\n",
194             "name": "classData"
195           },
196           {
197             "type": "Function",
198             "optional": false,
199             "doc": "<p>Optional, the callback function to be executed when this class is fully created.\nNote that the creation process can be asynchronous depending on the pre-processors used.</p>\n",
200             "name": "createdFn"
201           }
202         ],
203         "private": false,
204         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
205         "doc": "<p>Creates new class.</p>\n",
206         "owner": "Ext.Class",
207         "name": "Class",
208         "html_filename": "Class.html",
209         "return": {
210           "type": "Ext.Base",
211           "doc": "<p>The newly created class</p>\n"
212         },
213         "linenr": 207
214       },
215       {
216         "deprecated": null,
217         "alias": null,
218         "protected": false,
219         "tagname": "method",
220         "href": "Class.html#Ext-Class-method-getDefaultPreprocessors",
221         "shortDoc": "Retrieve the array stack of default pre-processors ...",
222         "static": false,
223         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
224         "private": false,
225         "params": [
226
227         ],
228         "name": "getDefaultPreprocessors",
229         "owner": "Ext.Class",
230         "doc": "<p>Retrieve the array stack of default pre-processors</p>\n",
231         "linenr": 350,
232         "return": {
233           "type": "Function",
234           "doc": "<p>defaultPreprocessors</p>\n"
235         },
236         "html_filename": "Class.html"
237       },
238       {
239         "deprecated": null,
240         "alias": null,
241         "protected": false,
242         "tagname": "method",
243         "href": "Class.html#Ext-Class-method-getPreprocessor",
244         "shortDoc": "Retrieve a pre-processor callback function by its name, which has been registered before ...",
245         "static": false,
246         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
247         "private": false,
248         "params": [
249           {
250             "type": "String",
251             "optional": false,
252             "doc": "\n",
253             "name": "name"
254           }
255         ],
256         "name": "getPreprocessor",
257         "owner": "Ext.Class",
258         "doc": "<p>Retrieve a pre-processor callback function by its name, which has been registered before</p>\n",
259         "linenr": 336,
260         "return": {
261           "type": "Function",
262           "doc": "<p>preprocessor</p>\n"
263         },
264         "html_filename": "Class.html"
265       },
266       {
267         "deprecated": null,
268         "alias": null,
269         "protected": false,
270         "tagname": "method",
271         "href": "Class.html#Ext-Class-method-registerPreprocessor",
272         "shortDoc": "Register a new pre-processor to be used during the class creation process registerPreprocessor ...",
273         "static": false,
274         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
275         "private": false,
276         "params": [
277           {
278             "type": "String",
279             "optional": false,
280             "doc": "<p>The pre-processor's name</p>\n",
281             "name": "name"
282           },
283           {
284             "type": "Function",
285             "optional": false,
286             "doc": "<p>The callback function to be executed. Typical format:</p>\n\n<pre><code>function(cls, data, fn) {\n    // Your code here\n\n    // Execute this when the processing is finished.\n    // Asynchronous processing is perfectly ok\n    if (fn) {\n        fn.call(this, cls, data);\n    }\n});\n</code></pre>\n\n<p>Passed arguments for this function are:</p>\n\n<ul>\n<li><code>{Function} cls</code>: The created class</li>\n<li><code>{Object} data</code>: The set of properties passed in <a href=\"#/api/Ext.Class\" rel=\"Ext.Class\" class=\"docClass\">Ext.Class</a> constructor</li>\n<li><code>{Function} fn</code>: The callback function that <b>must</b> to be executed when this pre-processor finishes,\nregardless of whether the processing is synchronous or aynchronous</li>\n</ul>\n\n",
287             "name": "fn"
288           },
289           {
290             "type": "Object",
291             "optional": false,
292             "doc": "\n",
293             "name": "always"
294           }
295         ],
296         "name": "registerPreprocessor",
297         "owner": "Ext.Class",
298         "doc": "<p>Register a new pre-processor to be used during the class creation process registerPreprocessor</p>\n",
299         "linenr": 299,
300         "return": {
301           "type": "Ext.Class",
302           "doc": "<p>this</p>\n"
303         },
304         "html_filename": "Class.html"
305       },
306       {
307         "deprecated": null,
308         "alias": null,
309         "protected": false,
310         "tagname": "method",
311         "href": "Class.html#Ext-Class-method-setDefaultPreprocessorPosition",
312         "shortDoc": "Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. ...",
313         "static": false,
314         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
315         "private": false,
316         "params": [
317           {
318             "type": "String",
319             "optional": false,
320             "doc": "<p>The pre-processor name. Note that it needs to be registered with\nregisterPreprocessor before this</p>\n",
321             "name": "name"
322           },
323           {
324             "type": "String",
325             "optional": false,
326             "doc": "<p>The insertion position. Four possible values are:\n'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)</p>\n",
327             "name": "offset"
328           },
329           {
330             "type": "String",
331             "optional": false,
332             "doc": "\n",
333             "name": "relativeName"
334           }
335         ],
336         "name": "setDefaultPreprocessorPosition",
337         "owner": "Ext.Class",
338         "doc": "<p>Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. For example:</p>\n\n<pre><code>Ext.Class.registerPreprocessor('debug', function(cls, data, fn) {\n    // Your code here\n\n    if (fn) {\n        fn.call(this, cls, data);\n    }\n}).insertDefaultPreprocessor('debug', 'last');\n</code></pre>\n",
339         "linenr": 371,
340         "return": {
341           "type": "Ext.Class",
342           "doc": "<p>this</p>\n"
343         },
344         "html_filename": "Class.html"
345       },
346       {
347         "deprecated": null,
348         "alias": null,
349         "protected": false,
350         "tagname": "method",
351         "href": "Class.html#Ext-Class-method-setDefaultPreprocessors",
352         "shortDoc": "Set the default array stack of default pre-processors ...",
353         "static": false,
354         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
355         "private": false,
356         "params": [
357           {
358             "type": "Array",
359             "optional": false,
360             "doc": "\n",
361             "name": "preprocessors"
362           }
363         ],
364         "name": "setDefaultPreprocessors",
365         "owner": "Ext.Class",
366         "doc": "<p>Set the default array stack of default pre-processors</p>\n",
367         "linenr": 359,
368         "return": {
369           "type": "Ext.Class",
370           "doc": "<p>this</p>\n"
371         },
372         "html_filename": "Class.html"
373       }
374     ],
375     "property": [
376
377     ],
378     "cssVar": [
379
380     ],
381     "cssMixin": [
382
383     ],
384     "event": [
385
386     ]
387   },
388   "singleton": false,
389   "alias": null,
390   "superclasses": [
391
392   ],
393   "protected": false,
394   "tagname": "class",
395   "mixins": [
396
397   ],
398   "href": "Class.html#Ext-Class",
399   "subclasses": [
400
401   ],
402   "static": false,
403   "author": "Jacky Nguyen <jacky@sencha.com>",
404   "component": false,
405   "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
406   "private": false,
407   "alternateClassNames": [
408
409   ],
410   "name": "Ext.Class",
411   "doc": "<p>Handles class creation throughout the whole framework. Note that most of the time <a href=\"#/api/Ext-method-define\" rel=\"Ext-method-define\" class=\"docClass\">Ext.define</a> should\nbe used instead, since it's a higher level wrapper that aliases to <a href=\"#/api/Ext.ClassManager-method-create\" rel=\"Ext.ClassManager-method-create\" class=\"docClass\">Ext.ClassManager.create</a>\nto enable namespacing and dynamic dependency resolution.</p>\n\n<h1>Basic syntax:</h1>\n\n<pre><code>Ext.define(className, properties);\n</code></pre>\n\n<p>in which <code>properties</code> is an object represent a collection of properties that apply to the class. See\n<a href=\"#/api/Ext.ClassManager-method-create\" rel=\"Ext.ClassManager-method-create\" class=\"docClass\">Ext.ClassManager.create</a> for more detailed instructions.</p>\n\n<pre><code>Ext.define('Person', {\n     name: 'Unknown',\n\n     constructor: function(name) {\n         if (name) {\n             this.name = name;\n         }\n\n         return this;\n     },\n\n     eat: function(foodType) {\n         alert(\"I'm eating: \" + foodType);\n\n         return this;\n     }\n});\n\nvar aaron = new Person(\"Aaron\");\naaron.eat(\"Sandwich\"); // alert(\"I'm eating: Sandwich\");\n</code></pre>\n\n<p>Ext.Class has a powerful set of extensible <a href=\"#/api/Ext.Class-method-registerPreprocessor\" rel=\"Ext.Class-method-registerPreprocessor\" class=\"docClass\">pre-processors</a> which takes care of\neverything related to class creation, including but not limited to inheritance, mixins, configuration, statics, etc.</p>\n\n<h1>Inheritance:</h1>\n\n<pre><code>Ext.define('Developer', {\n     extend: 'Person',\n\n     constructor: function(name, isGeek) {\n         this.isGeek = isGeek;\n\n         // Apply a method from the parent class' prototype\n         this.callParent([name]);\n\n         return this;\n\n     },\n\n     code: function(language) {\n         alert(\"I'm coding in: \" + language);\n\n         this.eat(\"Bugs\");\n\n         return this;\n     }\n});\n\nvar jacky = new Developer(\"Jacky\", true);\njacky.code(\"JavaScript\"); // alert(\"I'm coding in: JavaScript\");\n                          // alert(\"I'm eating: Bugs\");\n</code></pre>\n\n<p>See <a href=\"#/api/Ext.Base-method-callParent\" rel=\"Ext.Base-method-callParent\" class=\"docClass\">Ext.Base.callParent</a> for more details on calling superclass' methods</p>\n\n<h1>Mixins:</h1>\n\n<pre><code>Ext.define('CanPlayGuitar', {\n     playGuitar: function() {\n        alert(\"F#...G...D...A\");\n     }\n});\n\nExt.define('CanComposeSongs', {\n     composeSongs: function() { ... }\n});\n\nExt.define('CanSing', {\n     sing: function() {\n         alert(\"I'm on the highway to hell...\")\n     }\n});\n\nExt.define('Musician', {\n     extend: 'Person',\n\n     mixins: {\n         canPlayGuitar: 'CanPlayGuitar',\n         canComposeSongs: 'CanComposeSongs',\n         canSing: 'CanSing'\n     }\n})\n\nExt.define('CoolPerson', {\n     extend: 'Person',\n\n     mixins: {\n         canPlayGuitar: 'CanPlayGuitar',\n         canSing: 'CanSing'\n     },\n\n     sing: function() {\n         alert(\"Ahem....\");\n\n         this.mixins.canSing.sing.call(this);\n\n         alert(\"[Playing guitar at the same time...]\");\n\n         this.playGuitar();\n     }\n});\n\nvar me = new CoolPerson(\"Jacky\");\n\nme.sing(); // alert(\"Ahem...\");\n           // alert(\"I'm on the highway to hell...\");\n           // alert(\"[Playing guitar at the same time...]\");\n           // alert(\"F#...G...D...A\");\n</code></pre>\n\n<h1>Config:</h1>\n\n<pre><code>Ext.define('SmartPhone', {\n     config: {\n         hasTouchScreen: false,\n         operatingSystem: 'Other',\n         price: 500\n     },\n\n     isExpensive: false,\n\n     constructor: function(config) {\n         this.initConfig(config);\n\n         return this;\n     },\n\n     applyPrice: function(price) {\n         this.isExpensive = (price &gt; 500);\n\n         return price;\n     },\n\n     applyOperatingSystem: function(operatingSystem) {\n         if (!(/^(iOS|Android|BlackBerry)$/i).test(operatingSystem)) {\n             return 'Other';\n         }\n\n         return operatingSystem;\n     }\n});\n\nvar iPhone = new SmartPhone({\n     hasTouchScreen: true,\n     operatingSystem: 'iOS'\n});\n\niPhone.getPrice(); // 500;\niPhone.getOperatingSystem(); // 'iOS'\niPhone.getHasTouchScreen(); // true;\niPhone.hasTouchScreen(); // true\n\niPhone.isExpensive; // false;\niPhone.setPrice(600);\niPhone.getPrice(); // 600\niPhone.isExpensive; // true;\n\niPhone.setOperatingSystem('AlienOS');\niPhone.getOperatingSystem(); // 'Other'\n</code></pre>\n\n<h1>Statics:</h1>\n\n<pre><code>Ext.define('Computer', {\n     statics: {\n         factory: function(brand) {\n            // 'this' in static methods refer to the class itself\n             return new this(brand);\n         }\n     },\n\n     constructor: function() { ... }\n});\n\nvar dellComputer = Computer.factory('Dell');\n</code></pre>\n\n<p>Also see <a href=\"#/api/Ext.Base-method-statics\" rel=\"Ext.Base-method-statics\" class=\"docClass\">Ext.Base.statics</a> and <a href=\"#/api/Ext.Base-property-self\" rel=\"Ext.Base-property-self\" class=\"docClass\">Ext.Base.self</a> for more details on accessing\nstatic properties within class methods</p>\n",
412   "mixedInto": [
413
414   ],
415   "linenr": 1,
416   "xtypes": [
417
418   ],
419   "html_filename": "Class.html",
420   "extends": null
421 });