4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-ClassManager'>/**
19 </span> * @author Jacky Nguyen <jacky@sencha.com>
20 * @docauthor Jacky Nguyen <jacky@sencha.com>
21 * @class Ext.ClassManager
23 * Ext.ClassManager manages all classes and handles mapping from string class name to
24 * actual class objects throughout the whole framework. It is not generally accessed directly, rather through
25 * these convenient shorthands:
27 * - {@link Ext#define Ext.define}
28 * - {@link Ext#create Ext.create}
29 * - {@link Ext#widget Ext.widget}
30 * - {@link Ext#getClass Ext.getClass}
31 * - {@link Ext#getClassName Ext.getClassName}
35 (function(Class, alias) {
37 var slice = Array.prototype.slice;
39 var Manager = Ext.ClassManager = {
41 <span id='Ext-ClassManager-property-classes'> /**
42 </span> * @property {Object} classes
43 * All classes which were defined through the ClassManager. Keys are the
44 * name of the classes and the values are references to the classes.
49 <span id='Ext-ClassManager-property-existCache'> /**
54 <span id='Ext-ClassManager-property-namespaceRewrites'> /**
62 <span id='Ext-ClassManager-property-maps'> /**
71 <span id='Ext-ClassManager-property-enableNamespaceParseCache'> /** @private */
72 </span> enableNamespaceParseCache: true,
74 <span id='Ext-ClassManager-property-namespaceParseCache'> /** @private */
75 </span> namespaceParseCache: {},
77 <span id='Ext-ClassManager-property-instantiators'> /** @private */
78 </span> instantiators: [],
81 <span id='Ext-ClassManager-property-instantiationCounts'> /** @private */
82 </span> instantiationCounts: {},
85 <span id='Ext-ClassManager-method-isCreated'> /**
86 </span> * Checks if a class has already been created.
88 * @param {String} className
89 * @return {Boolean} exist
91 isCreated: function(className) {
92 var i, ln, part, root, parts;
95 if (typeof className !== 'string' || className.length < 1) {
97 sourceClass: "Ext.ClassManager",
98 sourceMethod: "exist",
99 msg: "Invalid classname, must be a string and must not be empty"
104 if (this.classes.hasOwnProperty(className) || this.existCache.hasOwnProperty(className)) {
109 parts = this.parseNamespace(className);
111 for (i = 0, ln = parts.length; i < ln; i++) {
114 if (typeof part !== 'string') {
117 if (!root || !root[part]) {
125 Ext.Loader.historyPush(className);
127 this.existCache[className] = true;
132 <span id='Ext-ClassManager-method-parseNamespace'> /**
133 </span> * Supports namespace rewriting
136 parseNamespace: function(namespace) {
137 //<debug error>
138 if (typeof namespace !== 'string') {
140 sourceClass: "Ext.ClassManager",
141 sourceMethod: "parseNamespace",
142 msg: "Invalid namespace, must be a string"
147 var cache = this.namespaceParseCache;
149 if (this.enableNamespaceParseCache) {
150 if (cache.hasOwnProperty(namespace)) {
151 return cache[namespace];
156 rewrites = this.namespaceRewrites,
157 rewrite, from, to, i, ln, root = Ext.global;
159 for (i = 0, ln = rewrites.length; i < ln; i++) {
160 rewrite = rewrites[i];
164 if (namespace === from || namespace.substring(0, from.length) === from) {
165 namespace = namespace.substring(from.length);
167 if (typeof to !== 'string') {
170 parts = parts.concat(to.split('.'));
179 parts = parts.concat(namespace.split('.'));
181 if (this.enableNamespaceParseCache) {
182 cache[namespace] = parts;
188 <span id='Ext-ClassManager-method-setNamespace'> /**
189 </span> * Creates a namespace and assign the `value` to the created object
191 * Ext.ClassManager.setNamespace('MyCompany.pkg.Example', someObject);
193 * alert(MyCompany.pkg.Example === someObject); // alerts true
195 * @param {String} name
196 * @param {Mixed} value
198 setNamespace: function(name, value) {
199 var root = Ext.global,
200 parts = this.parseNamespace(name),
204 for (i = 0, ln = parts.length; i < ln; i++) {
207 if (typeof part !== 'string') {
223 <span id='Ext-ClassManager-method-createNamespaces'> /**
224 </span> * The new Ext.ns, supports namespace rewriting
227 createNamespaces: function() {
228 var root = Ext.global,
229 parts, part, i, j, ln, subLn;
231 for (i = 0, ln = arguments.length; i < ln; i++) {
232 parts = this.parseNamespace(arguments[i]);
234 for (j = 0, subLn = parts.length; j < subLn; j++) {
237 if (typeof part !== 'string') {
252 <span id='Ext-ClassManager-method-set'> /**
253 </span> * Sets a name reference to a class.
255 * @param {String} name
256 * @param {Object} value
257 * @return {Ext.ClassManager} this
259 set: function(name, value) {
260 var targetName = this.getName(value);
262 this.classes[name] = this.setNamespace(name, value);
264 if (targetName && targetName !== name) {
265 this.maps.alternateToName[name] = targetName;
271 <span id='Ext-ClassManager-method-get'> /**
272 </span> * Retrieve a class by its name.
274 * @param {String} name
275 * @return {Class} class
277 get: function(name) {
278 if (this.classes.hasOwnProperty(name)) {
279 return this.classes[name];
282 var root = Ext.global,
283 parts = this.parseNamespace(name),
286 for (i = 0, ln = parts.length; i < ln; i++) {
289 if (typeof part !== 'string') {
292 if (!root || !root[part]) {
303 <span id='Ext-ClassManager-method-setAlias'> /**
304 </span> * Register the alias for a class.
306 * @param {Class/String} cls a reference to a class or a className
307 * @param {String} alias Alias to use when referring to this class
309 setAlias: function(cls, alias) {
310 var aliasToNameMap = this.maps.aliasToName,
311 nameToAliasesMap = this.maps.nameToAliases,
314 if (typeof cls === 'string') {
317 className = this.getName(cls);
320 if (alias && aliasToNameMap[alias] !== className) {
322 if (aliasToNameMap.hasOwnProperty(alias) && Ext.isDefined(Ext.global.console)) {
323 Ext.global.console.log("[Ext.ClassManager] Overriding existing alias: '" + alias + "' " +
324 "of: '" + aliasToNameMap[alias] + "' with: '" + className + "'. Be sure it's intentional.");
328 aliasToNameMap[alias] = className;
331 if (!nameToAliasesMap[className]) {
332 nameToAliasesMap[className] = [];
336 Ext.Array.include(nameToAliasesMap[className], alias);
342 <span id='Ext-ClassManager-method-getByAlias'> /**
343 </span> * Get a reference to the class by its alias.
345 * @param {String} alias
346 * @return {Class} class
348 getByAlias: function(alias) {
349 return this.get(this.getNameByAlias(alias));
352 <span id='Ext-ClassManager-method-getNameByAlias'> /**
353 </span> * Get the name of a class by its alias.
355 * @param {String} alias
356 * @return {String} className
358 getNameByAlias: function(alias) {
359 return this.maps.aliasToName[alias] || '';
362 <span id='Ext-ClassManager-method-getNameByAlternate'> /**
363 </span> * Get the name of a class by its alternate name.
365 * @param {String} alternate
366 * @return {String} className
368 getNameByAlternate: function(alternate) {
369 return this.maps.alternateToName[alternate] || '';
372 <span id='Ext-ClassManager-method-getAliasesByName'> /**
373 </span> * Get the aliases of a class by the class name
375 * @param {String} name
376 * @return {Array} aliases
378 getAliasesByName: function(name) {
379 return this.maps.nameToAliases[name] || [];
382 <span id='Ext-ClassManager-method-getName'> /**
383 </span> * Get the name of the class by its reference or its instance.
385 * Ext.ClassManager.getName(Ext.Action); // returns "Ext.Action"
387 * {@link Ext#getClassName Ext.getClassName} is alias for {@link Ext.ClassManager#getName Ext.ClassManager.getName}.
389 * @param {Class/Object} object
390 * @return {String} className
392 getName: function(object) {
393 return object && object.$className || '';
396 <span id='Ext-ClassManager-method-getClass'> /**
397 </span> * Get the class of the provided object; returns null if it's not an instance
398 * of any class created with Ext.define.
400 * var component = new Ext.Component();
402 * Ext.ClassManager.getClass(component); // returns Ext.Component
404 * {@link Ext#getClass Ext.getClass} is alias for {@link Ext.ClassManager#getClass Ext.ClassManager.getClass}.
406 * @param {Object} object
407 * @return {Class} class
409 getClass: function(object) {
410 return object && object.self || null;
413 <span id='Ext-ClassManager-method-create'> /**
414 </span> * Defines a class.
416 * Ext.ClassManager.create('My.awesome.Class', {
417 * someProperty: 'something',
418 * someMethod: function() { ... }
423 * alert(this === My.awesome.Class); // alerts true
425 * var myInstance = new this();
428 * {@link Ext#define Ext.define} is alias for {@link Ext.ClassManager#create Ext.ClassManager.create}.
430 * @param {String} className The class name to create in string dot-namespaced format, for example:
431 * 'My.very.awesome.Class', 'FeedViewer.plugin.CoolPager'
432 * It is highly recommended to follow this simple convention:
434 * - The root and the class name are 'CamelCased'
435 * - Everything else is lower-cased
437 * @param {Object} data The key - value pairs of properties to apply to this class. Property names can be of any valid
438 * strings, except those in the reserved list below:
440 * - {@link Ext.Base#self self}
441 * - {@link Ext.Class#alias alias}
442 * - {@link Ext.Class#alternateClassName alternateClassName}
443 * - {@link Ext.Class#config config}
444 * - {@link Ext.Class#extend extend}
445 * - {@link Ext.Class#inheritableStatics inheritableStatics}
446 * - {@link Ext.Class#mixins mixins}
447 * - {@link Ext.Class#requires requires}
448 * - {@link Ext.Class#singleton singleton}
449 * - {@link Ext.Class#statics statics}
450 * - {@link Ext.Class#uses uses}
452 * @param {Function} createdFn Optional callback to execute after the class is created, the execution scope of which
453 * (`this`) will be the newly created class itself.
456 create: function(className, data, createdFn) {
459 //<debug error>
460 if (typeof className !== 'string') {
462 sourceClass: "Ext",
463 sourceMethod: "define",
464 msg: "Invalid class name '" + className + "' specified, must be a non-empty string"
469 data.$className = className;
471 return new Class(data, function() {
472 var postprocessorStack = data.postprocessors || manager.defaultPostprocessors,
473 registeredPostprocessors = manager.postprocessors,
476 postprocessor, postprocessors, process, i, ln;
478 delete data.postprocessors;
480 for (i = 0, ln = postprocessorStack.length; i < ln; i++) {
481 postprocessor = postprocessorStack[i];
483 if (typeof postprocessor === 'string') {
484 postprocessor = registeredPostprocessors[postprocessor];
486 if (!postprocessor.always) {
487 if (data[postprocessor.name] !== undefined) {
488 postprocessors.push(postprocessor.fn);
492 postprocessors.push(postprocessor.fn);
496 postprocessors.push(postprocessor);
500 process = function(clsName, cls, clsData) {
501 postprocessor = postprocessors[index++];
503 if (!postprocessor) {
504 manager.set(className, cls);
506 Ext.Loader.historyPush(className);
509 createdFn.call(cls, cls);
515 if (postprocessor.call(this, clsName, cls, clsData, process) !== false) {
516 process.apply(this, arguments);
520 process.call(manager, className, this, data);
524 <span id='Ext-ClassManager-method-instantiateByAlias'> /**
525 </span> * Instantiate a class by its alias.
527 * If {@link Ext.Loader} is {@link Ext.Loader#setConfig enabled} and the class has not been defined yet, it will
528 * attempt to load the class via synchronous loading.
530 * var window = Ext.ClassManager.instantiateByAlias('widget.window', { width: 600, height: 800, ... });
532 * {@link Ext#createByAlias Ext.createByAlias} is alias for {@link Ext.ClassManager#instantiateByAlias Ext.ClassManager.instantiateByAlias}.
534 * @param {String} alias
535 * @param {Mixed} args,... Additional arguments after the alias will be passed to the
537 * @return {Object} instance
539 instantiateByAlias: function() {
540 var alias = arguments[0],
541 args = slice.call(arguments),
542 className = this.getNameByAlias(alias);
545 className = this.maps.aliasToName[alias];
547 //<debug error>
550 sourceClass: "Ext",
551 sourceMethod: "createByAlias",
552 msg: "Cannot create an instance of unrecognized alias: " + alias
558 if (Ext.global.console) {
559 Ext.global.console.warn("[Ext.Loader] Synchronously loading '" + className + "'; consider adding " +
560 "Ext.require('" + alias + "') above Ext.onReady");
564 Ext.syncRequire(className);
569 return this.instantiate.apply(this, args);
572 <span id='Ext-ClassManager-method-instantiate'> /**
573 </span> * Instantiate a class by either full name, alias or alternate name.
575 * If {@link Ext.Loader} is {@link Ext.Loader#setConfig enabled} and the class has not been defined yet, it will
576 * attempt to load the class via synchronous loading.
578 * For example, all these three lines return the same result:
581 * var window = Ext.ClassManager.instantiate('widget.window', { width: 600, height: 800, ... });
584 * var window = Ext.ClassManager.instantiate('Ext.Window', { width: 600, height: 800, ... });
587 * var window = Ext.ClassManager.instantiate('Ext.window.Window', { width: 600, height: 800, ... });
589 * {@link Ext#create Ext.create} is alias for {@link Ext.ClassManager#instantiate Ext.ClassManager.instantiate}.
591 * @param {String} name
592 * @param {Mixed} args,... Additional arguments after the name will be passed to the class' constructor.
593 * @return {Object} instance
595 instantiate: function() {
596 var name = arguments[0],
597 args = slice.call(arguments, 1),
601 if (typeof name !== 'function') {
602 //<debug error>
603 if ((typeof name !== 'string' || name.length < 1)) {
605 sourceClass: "Ext",
606 sourceMethod: "create",
607 msg: "Invalid class name or alias '" + name + "' specified, must be a non-empty string"
612 cls = this.get(name);
618 // No record of this class name, it's possibly an alias, so look it up
620 possibleName = this.getNameByAlias(name);
625 cls = this.get(name);
629 // Still no record of this class name, it's possibly an alternate name, so look it up
631 possibleName = this.getNameByAlternate(name);
636 cls = this.get(name);
640 // Still not existing at this point, try to load it via synchronous mode as the last resort
643 if (Ext.global.console) {
644 Ext.global.console.warn("[Ext.Loader] Synchronously loading '" + name + "'; consider adding " +
645 "Ext.require('" + ((possibleName) ? alias : name) + "') above Ext.onReady");
649 Ext.syncRequire(name);
651 cls = this.get(name);
654 //<debug error>
657 sourceClass: "Ext",
658 sourceMethod: "create",
659 msg: "Cannot create an instance of unrecognized class name / alias: " + alias
663 if (typeof cls !== 'function') {
665 sourceClass: "Ext",
666 sourceMethod: "create",
667 msg: "'" + name + "' is a singleton and cannot be instantiated"
673 if (!this.instantiationCounts[name]) {
674 this.instantiationCounts[name] = 0;
677 this.instantiationCounts[name]++;
680 return this.getInstantiator(args.length)(cls, args);
683 <span id='Ext-ClassManager-method-dynInstantiate'> /**
688 dynInstantiate: function(name, args) {
689 args = Ext.Array.from(args, true);
692 return this.instantiate.apply(this, args);
695 <span id='Ext-ClassManager-method-getInstantiator'> /**
699 getInstantiator: function(length) {
700 if (!this.instantiators[length]) {
704 for (i = 0; i < length; i++) {
705 args.push('a['+i+']');
708 this.instantiators[length] = new Function('c', 'a', 'return new c('+args.join(',')+')');
711 return this.instantiators[length];
714 <span id='Ext-ClassManager-property-postprocessors'> /**
719 <span id='Ext-ClassManager-property-defaultPostprocessors'> /**
722 defaultPostprocessors: [],
724 <span id='Ext-ClassManager-method-registerPostprocessor'> /**
725 </span> * Register a post-processor function.
727 * @param {String} name
728 * @param {Function} postprocessor
730 registerPostprocessor: function(name, fn, always) {
731 this.postprocessors[name] = {
733 always: always || false,
740 <span id='Ext-ClassManager-method-setDefaultPostprocessors'> /**
741 </span> * Set the default post processors array stack which are applied to every class.
743 * @param {String/Array} The name of a registered post processor or an array of registered names.
744 * @return {Ext.ClassManager} this
746 setDefaultPostprocessors: function(postprocessors) {
747 this.defaultPostprocessors = Ext.Array.from(postprocessors);
752 <span id='Ext-ClassManager-method-setDefaultPostprocessorPosition'> /**
753 </span> * Insert this post-processor at a specific position in the stack, optionally relative to
754 * any existing post-processor
756 * @param {String} name The post-processor name. Note that it needs to be registered with
757 * {@link Ext.ClassManager#registerPostprocessor} before this
758 * @param {String} offset The insertion position. Four possible values are:
759 * 'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)
760 * @param {String} relativeName
761 * @return {Ext.ClassManager} this
763 setDefaultPostprocessorPosition: function(name, offset, relativeName) {
764 var defaultPostprocessors = this.defaultPostprocessors,
767 if (typeof offset === 'string') {
768 if (offset === 'first') {
769 defaultPostprocessors.unshift(name);
773 else if (offset === 'last') {
774 defaultPostprocessors.push(name);
779 offset = (offset === 'after') ? 1 : -1;
782 index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
785 Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
791 <span id='Ext-ClassManager-method-getNamesByExpression'> /**
792 </span> * Converts a string expression to an array of matching class names. An expression can either refers to class aliases
793 * or class names. Expressions support wildcards:
795 * // returns ['Ext.window.Window']
796 * var window = Ext.ClassManager.getNamesByExpression('widget.window');
798 * // returns ['widget.panel', 'widget.window', ...]
799 * var allWidgets = Ext.ClassManager.getNamesByExpression('widget.*');
801 * // returns ['Ext.data.Store', 'Ext.data.ArrayProxy', ...]
802 * var allData = Ext.ClassManager.getNamesByExpression('Ext.data.*');
804 * @param {String} expression
805 * @return {Array} classNames
808 getNamesByExpression: function(expression) {
809 var nameToAliasesMap = this.maps.nameToAliases,
811 name, alias, aliases, possibleName, regex, i, ln;
813 //<debug error>
814 if (typeof expression !== 'string' || expression.length < 1) {
816 sourceClass: "Ext.ClassManager",
817 sourceMethod: "getNamesByExpression",
818 msg: "Expression " + expression + " is invalid, must be a non-empty string"
823 if (expression.indexOf('*') !== -1) {
824 expression = expression.replace(/\*/g, '(.*?)');
825 regex = new RegExp('^' + expression + '$');
827 for (name in nameToAliasesMap) {
828 if (nameToAliasesMap.hasOwnProperty(name)) {
829 aliases = nameToAliasesMap[name];
831 if (name.search(regex) !== -1) {
835 for (i = 0, ln = aliases.length; i < ln; i++) {
838 if (alias.search(regex) !== -1) {
848 possibleName = this.getNameByAlias(expression);
851 names.push(possibleName);
853 possibleName = this.getNameByAlternate(expression);
856 names.push(possibleName);
858 names.push(expression);
867 <span id='Ext-Class-cfg-alias'> /**
868 </span> * @cfg {[String]} alias
870 * List of short aliases for class names. Most useful for defining xtypes for widgets:
872 * Ext.define('MyApp.CoolPanel', {
873 * extend: 'Ext.panel.Panel',
874 * alias: ['widget.coolpanel'],
878 * // Using Ext.create
879 * Ext.widget('widget.coolpanel');
880 * // Using the shorthand for widgets and in xtypes
881 * Ext.widget('panel', {
883 * {xtype: 'coolpanel', html: 'Foo'},
884 * {xtype: 'coolpanel', html: 'Bar'}
888 Manager.registerPostprocessor('alias', function(name, cls, data) {
889 var aliases = data.alias,
890 widgetPrefix = 'widget.',
893 if (!(aliases instanceof Array)) {
897 for (i = 0, ln = aliases.length; i < ln; i++) {
900 //<debug error>
901 if (typeof alias !== 'string') {
903 sourceClass: "Ext",
904 sourceMethod: "define",
905 msg: "Invalid alias of: '" + alias + "' for class: '" + name + "'; must be a valid string"
910 this.setAlias(cls, alias);
913 // This is ugly, will change to make use of parseNamespace for alias later on
914 for (i = 0, ln = aliases.length; i < ln; i++) {
917 if (alias.substring(0, widgetPrefix.length) === widgetPrefix) {
918 // Only the first alias with 'widget.' prefix will be used for xtype
919 cls.xtype = cls.$xtype = alias.substring(widgetPrefix.length);
925 <span id='Ext-Class-cfg-singleton'> /**
926 </span> * @cfg {Boolean} singleton
928 * When set to true, the class will be instanciated as singleton. For example:
930 * Ext.define('Logger', {
932 * log: function(msg) {
937 * Logger.log('Hello');
939 Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
940 fn.call(this, name, new cls(), data);
944 <span id='Ext-Class-cfg-alternateClassName'> /**
945 </span> * @cfg {String/[String]} alternateClassName
947 * Defines alternate names for this class. For example:
949 * Ext.define('Developer', {
950 * alternateClassName: ['Coder', 'Hacker'],
951 * code: function(msg) {
952 * alert('Typing... ' + msg);
956 * var joe = Ext.create('Developer');
957 * joe.code('stackoverflow');
959 * var rms = Ext.create('Hacker');
960 * rms.code('hack hack');
962 Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
963 var alternates = data.alternateClassName,
966 if (!(alternates instanceof Array)) {
967 alternates = [alternates];
970 for (i = 0, ln = alternates.length; i < ln; i++) {
971 alternate = alternates[i];
973 //<debug error>
974 if (typeof alternate !== 'string') {
976 sourceClass: "Ext",
977 sourceMethod: "define",
978 msg: "Invalid alternate of: '" + alternate + "' for class: '" + name + "'; must be a valid string"
983 this.set(alternate, cls);
987 Manager.setDefaultPostprocessors(['alias', 'singleton', 'alternateClassName']);
990 <span id='Ext-method-create'> /**
993 * @alias Ext.ClassManager#instantiate
995 create: alias(Manager, 'instantiate'),
997 <span id='Ext-ClassManager-method-factory'> /**
999 * API to be stablized
1001 * @param {Mixed} item
1002 * @param {String} namespace
1004 factory: function(item, namespace) {
1005 if (item instanceof Array) {
1008 for (i = 0, ln = item.length; i < ln; i++) {
1009 item[i] = Ext.factory(item[i], namespace);
1015 var isString = (typeof item === 'string');
1017 if (isString || (item instanceof Object && item.constructor === Object)) {
1018 var name, config = {};
1024 name = item.className;
1026 delete config.className;
1029 if (namespace !== undefined && name.indexOf(namespace) === -1) {
1030 name = namespace + '.' + Ext.String.capitalize(name);
1033 return Ext.create(name, config);
1036 if (typeof item === 'function') {
1037 return Ext.create(item);
1043 <span id='Ext-method-widget'> /**
1044 </span> * Convenient shorthand to create a widget by its xtype, also see {@link Ext.ClassManager#instantiateByAlias}
1046 * var button = Ext.widget('button'); // Equivalent to Ext.create('widget.button')
1047 * var panel = Ext.widget('panel'); // Equivalent to Ext.create('widget.panel')
1051 * @param {String} name xtype of the widget to create.
1052 * @return {Object} widget instance
1054 widget: function(name) {
1055 var args = slice.call(arguments);
1056 args[0] = 'widget.' + name;
1058 return Manager.instantiateByAlias.apply(Manager, args);
1061 <span id='Ext-method-createByAlias'> /**
1064 * @alias Ext.ClassManager#instantiateByAlias
1066 createByAlias: alias(Manager, 'instantiateByAlias'),
1068 <span id='Ext-method-define'> /**
1071 * @alias Ext.ClassManager#create
1073 define: alias(Manager, 'create'),
1075 <span id='Ext-method-getClassName'> /**
1078 * @alias Ext.ClassManager#getName
1080 getClassName: alias(Manager, 'getName'),
1082 <span id='Ext-ClassManager-method-getDisplayName'> /**
1084 * @param {Mixed} object
1086 getDisplayName: function(object) {
1087 if (object.displayName) {
1088 return object.displayName;
1091 if (object.$name && object.$class) {
1092 return Ext.getClassName(object.$class) + '#' + object.$name;
1095 if (object.$className) {
1096 return object.$className;
1102 <span id='Ext-method-getClass'> /**
1105 * @alias Ext.ClassManager#getClass
1107 getClass: alias(Manager, 'getClass'),
1109 <span id='Ext-method-namespace'> /**
1110 </span> * Creates namespaces to be used for scoping variables and classes so that they are not global.
1111 * Specifying the last node of a namespace implicitly creates all other nodes. Usage:
1113 * Ext.namespace('Company', 'Company.data');
1115 * // equivalent and preferable to the above syntax
1116 * Ext.namespace('Company.data');
1118 * Company.Widget = function() { ... };
1120 * Company.data.CustomStore = function(config) { ... };
1124 * @param {String} namespace1
1125 * @param {String} namespace2
1126 * @param {String} etc
1127 * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)
1129 namespace: alias(Manager, 'createNamespaces')
1132 <span id='Ext-method-createWidget'> /**
1133 </span> * Old name for {@link Ext#widget}.
1134 * @deprecated 4.0.0 Use {@link Ext#widget} instead.
1139 Ext.createWidget = Ext.widget;
1141 <span id='Ext-method-ns'> /**
1142 </span> * Convenient alias for {@link Ext#namespace Ext.namespace}
1145 * @alias Ext#namespace
1147 Ext.ns = Ext.namespace;
1149 Class.registerPreprocessor('className', function(cls, data) {
1150 if (data.$className) {
1151 cls.$className = data.$className;
1153 cls.displayName = cls.$className;
1158 Class.setDefaultPreprocessorPosition('className', 'first');
1160 })(Ext.Class, Ext.Function.alias);