X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..3789b528d8dd8aad4558e38e22d775bcab1cbd36:/docs/output/Ext.Class.js diff --git a/docs/output/Ext.Class.js b/docs/output/Ext.Class.js new file mode 100644 index 00000000..f7174781 --- /dev/null +++ b/docs/output/Ext.Class.js @@ -0,0 +1,195 @@ +Ext.data.JsonP.Ext_Class({ + "tagname": "class", + "name": "Ext.Class", + "doc": "

Handles class creation throughout the whole framework. Note that most of the time Ext.define should\nbe used instead, since it's a higher level wrapper that aliases to Ext.ClassManager.create\nto enable namespacing and dynamic dependency resolution.

\n\n

Basic syntax:

\n\n
Ext.define(className, properties);\n
\n\n

in which properties is an object represent a collection of properties that apply to the class. See\nExt.ClassManager.create for more detailed instructions.

\n\n
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
\n\n

Ext.Class has a powerful set of extensible pre-processors which takes care of\neverything related to class creation, including but not limited to inheritance, mixins, configuration, statics, etc.

\n\n

Inheritance:

\n\n
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
\n\n

See Ext.Base.callParent for more details on calling superclass' methods

\n\n

Mixins:

\n\n
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
\n\n

Config:

\n\n
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 > 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
\n\n

Statics:

\n\n
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
\n\n

Also see Ext.Base.statics and Ext.Base.self for more details on accessing\nstatic properties within class methods

\n", + "extends": null, + "mixins": [ + + ], + "alternateClassNames": [ + + ], + "xtype": null, + "author": "Jacky Nguyen ", + "docauthor": "Jacky Nguyen ", + "singleton": false, + "private": false, + "cfg": [ + + ], + "method": [ + { + "tagname": "method", + "name": "getDefaultPreprocessors", + "member": "Ext.Class", + "doc": "

Retrieve the array stack of default pre-processors

\n", + "params": [ + + ], + "return": { + "type": "Function", + "doc": "

defaultPreprocessors

\n" + }, + "private": false, + "static": false, + "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", + "linenr": 349, + "html_filename": "Class.html", + "href": "Class.html#Ext-Class-method-getDefaultPreprocessors", + "shortDoc": "

Retrieve the array stack of default pre-processors

\n" + }, + { + "tagname": "method", + "name": "getPreprocessor", + "member": "Ext.Class", + "doc": "

Retrieve a pre-processor callback function by its name, which has been registered before

\n", + "params": [ + { + "type": "String", + "name": "name", + "doc": "\n", + "optional": false + } + ], + "return": { + "type": "Function", + "doc": "

preprocessor

\n" + }, + "private": false, + "static": false, + "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", + "linenr": 335, + "html_filename": "Class.html", + "href": "Class.html#Ext-Class-method-getPreprocessor", + "shortDoc": "

Retrieve a pre-processor callback function by its name, which has been registered before

\n" + }, + { + "tagname": "method", + "name": "registerPreprocessor", + "member": "Ext.Class", + "doc": "

Register a new pre-processor to be used during the class creation process registerPreprocessor

\n", + "params": [ + { + "type": "String", + "name": "name", + "doc": "

The pre-processor's name

\n", + "optional": false + }, + { + "type": "Function", + "name": "fn", + "doc": "

The callback function to be executed. Typical format:

\n\n
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
\n\n

Passed arguments for this function are:

\n\n\n\n", + "optional": false + }, + { + "type": "Object", + "name": "always", + "doc": "\n", + "optional": false + } + ], + "return": { + "type": "Ext.Class", + "doc": "

this

\n" + }, + "private": false, + "static": false, + "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", + "linenr": 298, + "html_filename": "Class.html", + "href": "Class.html#Ext-Class-method-registerPreprocessor", + "shortDoc": "

Register a new pre-processor to be used during the class creation process registerPreprocessor

\n" + }, + { + "tagname": "method", + "name": "setDefaultPreprocessorPosition", + "member": "Ext.Class", + "doc": "

Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. For example:

\n\n
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
\n", + "params": [ + { + "type": "String", + "name": "name", + "doc": "

The pre-processor name. Note that it needs to be registered with\nregisterPreprocessor before this

\n", + "optional": false + }, + { + "type": "String", + "name": "offset", + "doc": "

The insertion position. Four possible values are:\n'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)

\n", + "optional": false + }, + { + "type": "String", + "name": "relativeName", + "doc": "\n", + "optional": false + } + ], + "return": { + "type": "Ext.Class", + "doc": "

this

\n" + }, + "private": false, + "static": false, + "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", + "linenr": 370, + "html_filename": "Class.html", + "href": "Class.html#Ext-Class-method-setDefaultPreprocessorPosition", + "shortDoc": "Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. For..." + }, + { + "tagname": "method", + "name": "setDefaultPreprocessors", + "member": "Ext.Class", + "doc": "

Set the default array stack of default pre-processors

\n", + "params": [ + { + "type": "Array", + "name": "preprocessors", + "doc": "\n", + "optional": false + } + ], + "return": { + "type": "Ext.Class", + "doc": "

this

\n" + }, + "private": false, + "static": false, + "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", + "linenr": 358, + "html_filename": "Class.html", + "href": "Class.html#Ext-Class-method-setDefaultPreprocessors", + "shortDoc": "

Set the default array stack of default pre-processors

\n" + } + ], + "property": [ + + ], + "event": [ + + ], + "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", + "linenr": 1, + "html_filename": "Class.html", + "href": "Class.html#Ext-Class", + "cssVar": [ + + ], + "cssMixin": [ + + ], + "component": false, + "superclasses": [ + + ], + "subclasses": [ + + ], + "mixedInto": [ + + ], + "allMixins": [ + + ] +}); \ No newline at end of file