X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/docs/api/Ext.ClassManager.html?ds=sidebyside diff --git a/docs/api/Ext.ClassManager.html b/docs/api/Ext.ClassManager.html new file mode 100644 index 00000000..99505f1a --- /dev/null +++ b/docs/api/Ext.ClassManager.html @@ -0,0 +1,264 @@ +Ext.ClassManager | Ext JS 4.0 Documentation +
For up to date documentation and features, visit +http://docs.sencha.com/ext-js/4-0

Sencha Documentation

+ + + + + +

Ext.ClassManager manages all classes and handles mapping from string class name to +actual class objects throughout the whole framework. It is not generally accessed directly, rather through +these convenient shorthands:

+ + + +
Defined By

Methods

 
create( +String className, Object data, Function createdFn) + : Ext.Base
Defines a class. This is usually invoked via the alias Ext.define + +Ext.ClassManager.create('My.awesome.Class', { + ...

Defines a class. This is usually invoked via the alias Ext.define

+ +
Ext.ClassManager.create('My.awesome.Class', {
+    someProperty: 'something',
+    someMethod: function() { ... }
+    ...
+
+}, function() {
+    alert('Created!');
+    alert(this === My.awesome.Class); // alerts true
+
+    var myInstance = new this();
+});
+
+

Parameters

  • className : String

    The class name to create in string dot-namespaced format, for example: +'My.very.awesome.Class', 'FeedViewer.plugin.CoolPager' +It is highly recommended to follow this simple convention:

    + +
      +
    • The root and the class name are 'CamelCased'
    • +
    • Everything else is lower-cased
    • +
    + +
  • data : Object

    The key - value pairs of properties to apply to this class. Property names can be of any valid +strings, except those in the reserved listed below:

    + +
      +
    • mixins
    • +
    • statics
    • +
    • config
    • +
    • alias
    • +
    • self
    • +
    • singleton
    • +
    • alternateClassName
    • +
    + +
  • createdFn : Function

    Optional callback to execute after the class is created, the execution scope of which +(this) will be the newly created class itself.

    +

Returns

  • Ext.Base    +
 
get( +String name) + : Class

Retrieve a class by its name.

+

Retrieve a class by its name.

+

Parameters

  • name : String
    +

Returns

  • Class   

    class

    +
 

Get the aliases of a class by the class name

+

Get the aliases of a class by the class name

+

Parameters

  • name : String
    +

Returns

  • Array   

    aliases

    +
 
getByAlias( +String alias) + : Class

Get a reference to the class by its alias.

+

Get a reference to the class by its alias.

+

Parameters

  • alias : String
    +

Returns

  • Class   

    class

    +
 
getClass( +Object object) + : Class
Get the class of the provided object; returns null if it's not an instance +of any class created with Ext.define. This...

Get the class of the provided object; returns null if it's not an instance +of any class created with Ext.define. This is usually invoked by the shorthand Ext.getClass

+ +
var component = new Ext.Component();
+
+Ext.ClassManager.getClass(component); // returns Ext.Component
+
+

Parameters

  • object : Object
    +

Returns

  • Class   

    class

    +
 

 

+

Parameters

  • object : Mixed
    +

Returns

  • void    +
 
getName( +Class/Object object) + : String
Get the name of the class by its reference or its instance; +usually invoked by the shorthand Ext.getClassName + +Ext.Cl...

Get the name of the class by its reference or its instance; +usually invoked by the shorthand Ext.getClassName

+ +
Ext.ClassManager.getName(Ext.Action); // returns "Ext.Action"
+
+

Parameters

  • object : Class/Object
    +

Returns

  • String   

    className

    +
 

Get the name of a class by its alias.

+

Get the name of a class by its alias.

+

Parameters

  • alias : String
    +

Returns

  • String   

    className

    +
 
getNameByAlternate( +String alternate) + : String

Get the name of a class by its alternate name.

+

Get the name of a class by its alternate name.

+

Parameters

  • alternate : String
    +

Returns

  • String   

    className

    +
 
Converts a string expression to an array of matching class names. An expression can either refers to class aliases +or...

Converts a string expression to an array of matching class names. An expression can either refers to class aliases +or class names. Expressions support wildcards:

+ +
 // returns ['Ext.window.Window']
+var window = Ext.ClassManager.getNamesByExpression('widget.window');
+
+// returns ['widget.panel', 'widget.window', ...]
+var allWidgets = Ext.ClassManager.getNamesByExpression('widget.*');
+
+// returns ['Ext.data.Store', 'Ext.data.ArrayProxy', ...]
+var allData = Ext.ClassManager.getNamesByExpression('Ext.data.*');
+
+

Parameters

  • expression : String
    +

Returns

  • Array   

    classNames

    +
 
instantiate( +String name, Mixed args) + : Object
Instantiate a class by either full name, alias or alternate name; usually invoked by the convenient +shorthand Ext.cre...

Instantiate a class by either full name, alias or alternate name; usually invoked by the convenient +shorthand Ext.create

+ +

If Ext.Loader is enabled and the class has not been defined yet, it will +attempt to load the class via synchronous loading.

+ +

For example, all these three lines return the same result:

+ +
// alias
+var window = Ext.ClassManager.instantiate('widget.window', { width: 600, height: 800, ... });
+
+// alternate name
+var window = Ext.ClassManager.instantiate('Ext.Window', { width: 600, height: 800, ... });
+
+// full class name
+var window = Ext.ClassManager.instantiate('Ext.window.Window', { width: 600, height: 800, ... });
+
+

Parameters

  • name : String
    +
  • args : Mixed

    ,... Additional arguments after the name will be passed to the class' constructor.

    +

Returns

  • Object   

    instance

    +
 
instantiateByAlias( +String alias, Mixed args) + : Object
Instantiate a class by its alias; usually invoked by the convenient shorthand Ext.createByAlias +If Ext.Loader is enab...

Instantiate a class by its alias; usually invoked by the convenient shorthand Ext.createByAlias +If Ext.Loader is enabled and the class has not been defined yet, it will +attempt to load the class via synchronous loading.

+ +
var window = Ext.ClassManager.instantiateByAlias('widget.window', { width: 600, height: 800, ... });
+
+

Parameters

  • alias : String
    +
  • args : Mixed

    ,... Additional arguments after the alias will be passed to the +class constructor.

    +

Returns

  • Object   

    instance

    +
 
isCreated( +String className) + : Boolean

Checks if a class has already been created.

+

Checks if a class has already been created.

+

Parameters

  • className : String
    +

Returns

  • Boolean   

    exist

    +
 
registerPostprocessor( +String name, Function postprocessor, Object always) + : void

Register a post-processor function.

+

Register a post-processor function.

+

Parameters

  • name : String
    +
  • postprocessor : Function
    +
  • always : Object
    +

Returns

  • void    +
 
set( +String name, Object value) + : Ext.ClassManager

Sets a name reference to a class.

+

Sets a name reference to a class.

+

Parameters

  • name : String
    +
  • value : Object
    +

Returns

  • Ext.ClassManager   

    this

    +
 
setAlias( +Class/String cls, String alias) + : void

Register the alias for a class.

+

Register the alias for a class.

+

Parameters

  • cls : Class/String

    a reference to a class or a className

    +
  • alias : String

    Alias to use when referring to this class

    +

Returns

  • void    +
 
setDefaultPostprocessorPosition( +String name, String offset, String relativeName) + : Ext.ClassManager

Insert this post-processor at a specific position in the stack, optionally relative to +any existing post-processor

+

Insert this post-processor at a specific position in the stack, optionally relative to +any existing post-processor

+

Parameters

  • name : String

    The post-processor name. Note that it needs to be registered with +registerPostprocessor before this

    +
  • offset : String

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

    +
  • relativeName : String
    +

Returns

  • Ext.ClassManager   

    this

    +
 
setDefaultPostprocessors( +String/Array The) + : Ext.ClassManager

Set the default post processors array stack which are applied to every class.

+

Set the default post processors array stack which are applied to every class.

+

Parameters

  • The : String/Array

    name of a registered post processor or an array of registered names.

    +

Returns

  • Ext.ClassManager   

    this

    +
 
setNamespace( +String name, Mixed value) + : void
Creates a namespace and assign the value to the created object + +Ext.ClassManager.setNamespace('MyCompany.pkg.Example'...

Creates a namespace and assign the value to the created object

+ +
Ext.ClassManager.setNamespace('MyCompany.pkg.Example', someObject);
+
+alert(MyCompany.pkg.Example === someObject); // alerts true
+
+

Parameters

  • name : String
    +
  • value : Mixed
    +

Returns

  • void    +
\ No newline at end of file