Ext.data.JsonP.Ext_draw_Sprite({"mixins":["Ext.util.Observable","Ext.util.Animate"],"code_type":"ext_define","inheritable":false,"component":false,"meta":{},"mixedInto":[],"uses":[],"aliases":{},"parentMixins":[],"superclasses":["Ext.Base"],"members":{"event":[{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"beforedestroy","id":"event-beforedestroy"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"click","id":"event-click"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"destroy","id":"event-destroy"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"mousedown","id":"event-mousedown"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"mousemove","id":"event-mousemove"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"mouseout","id":"event-mouseout"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"mouseover","id":"event-mouseover"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"mouseup","id":"event-mouseup"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"event","name":"render","id":"event-render"}],"property":[{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"$className","id":"property-S-className"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"configMap","id":"property-configMap"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"property","name":"dd","id":"property-dd"},{"meta":{"private":true},"owner":"Ext.util.Observable","tagname":"property","name":"eventsSuspended","id":"property-eventsSuspended"},{"meta":{"readonly":true},"owner":"Ext.util.Observable","tagname":"property","name":"hasListeners","id":"property-hasListeners"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"initConfigList","id":"property-initConfigList"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"initConfigMap","id":"property-initConfigMap"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"property","name":"isInstance","id":"property-isInstance"},{"meta":{},"owner":"Ext.util.Observable","tagname":"property","name":"isObservable","id":"property-isObservable"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"property","name":"isSprite","id":"property-isSprite"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"property","name":"self","id":"property-self"}],"css_var":[],"method":[{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"addCls","id":"method-addCls"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"addEvents","id":"method-addEvents"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"addListener","id":"method-addListener"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"addManagedListener","id":"method-addManagedListener"},{"meta":{},"owner":"Ext.util.Animate","tagname":"method","name":"animate","id":"method-animate"},{"meta":{"deprecated":{"text":"as of 4.1. Use {@link #callParent} instead."},"protected":true},"owner":"Ext.Base","tagname":"method","name":"callOverridden","id":"method-callOverridden"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"method","name":"callParent","id":"method-callParent"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"clearListeners","id":"method-clearListeners"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"clearManagedListeners","id":"method-clearManagedListeners"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"configClass","id":"method-configClass"},{"meta":{"private":true},"owner":"Ext.util.Observable","tagname":"method","name":"continueFireEvent","id":"method-continueFireEvent"},{"meta":{"private":true},"owner":"Ext.util.Observable","tagname":"method","name":"createRelayer","id":"method-createRelayer"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"destroy","id":"method-destroy"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"enableBubble","id":"method-enableBubble"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"fireEvent","id":"method-fireEvent"},{"meta":{},"owner":"Ext.util.Animate","tagname":"method","name":"getActiveAnimation","id":"method-getActiveAnimation"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"getBBox","id":"method-getBBox"},{"meta":{"private":true},"owner":"Ext.util.Observable","tagname":"method","name":"getBubbleParent","id":"method-getBubbleParent"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"getConfig","id":"method-getConfig"},{"meta":{},"owner":"Ext.Base","tagname":"method","name":"getInitialConfig","id":"method-getInitialConfig"},{"meta":{"deprecated":{"text":"Replaced by {@link #getActiveAnimation}","version":"4.0"}},"owner":"Ext.util.Animate","tagname":"method","name":"hasActiveFx","id":"method-hasActiveFx"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"hasConfig","id":"method-hasConfig"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"hasListener","id":"method-hasListener"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"hide","id":"method-hide"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"method","name":"initConfig","id":"method-initConfig"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"mon","id":"method-mon"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"mun","id":"method-mun"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"on","id":"method-on"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"onConfigUpdate","id":"method-onConfigUpdate"},{"meta":{"private":true},"owner":"Ext.util.Observable","tagname":"method","name":"prepareClass","id":"method-prepareClass"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"redraw","id":"method-redraw"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"relayEvents","id":"method-relayEvents"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"remove","id":"method-remove"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"removeCls","id":"method-removeCls"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"removeListener","id":"method-removeListener"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"removeManagedListener","id":"method-removeManagedListener"},{"meta":{"private":true},"owner":"Ext.util.Observable","tagname":"method","name":"removeManagedListenerItem","id":"method-removeManagedListenerItem"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"resumeEvents","id":"method-resumeEvents"},{"meta":{},"owner":"Ext.util.Animate","tagname":"method","name":"sequenceFx","id":"method-sequenceFx"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"setAttributes","id":"method-setAttributes"},{"meta":{"private":true},"owner":"Ext.Base","tagname":"method","name":"setConfig","id":"method-setConfig"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"setStyle","id":"method-setStyle"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"method","name":"show","id":"method-show"},{"meta":{"protected":true},"owner":"Ext.Base","tagname":"method","name":"statics","id":"method-statics"},{"meta":{},"owner":"Ext.util.Animate","tagname":"method","name":"stopAnimation","id":"method-stopAnimation"},{"meta":{"deprecated":{"text":"Replaced by {@link #stopAnimation}","version":"4.0"}},"owner":"Ext.util.Animate","tagname":"method","name":"stopFx","id":"method-stopFx"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"suspendEvents","id":"method-suspendEvents"},{"meta":{},"owner":"Ext.util.Animate","tagname":"method","name":"syncFx","id":"method-syncFx"},{"meta":{},"owner":"Ext.util.Observable","tagname":"method","name":"un","id":"method-un"}],"css_mixin":[],"cfg":[{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"draggable","id":"cfg-draggable"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"fill","id":"cfg-fill"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"font","id":"cfg-font"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"group","id":"cfg-group"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"height","id":"cfg-height"},{"meta":{},"owner":"Ext.util.Observable","tagname":"cfg","name":"listeners","id":"cfg-listeners"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"opacity","id":"cfg-opacity"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"path","id":"cfg-path"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"radius","id":"cfg-radius"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"radiusX","id":"cfg-radiusX"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"radiusY","id":"cfg-radiusY"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"src","id":"cfg-src"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"stroke","id":"cfg-stroke"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"stroke-width","id":"cfg-stroke-width"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"text","id":"cfg-text"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"type","id":"cfg-type"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"width","id":"cfg-width"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"x","id":"cfg-x"},{"meta":{},"owner":"Ext.draw.Sprite","tagname":"cfg","name":"y","id":"cfg-y"}]},"tagname":"class","extends":"Ext.Base","html":"
Hierarchy
Ext.BaseExt.draw.SpriteMixins
Requires
Files
A Sprite is an object rendered in a Drawing surface.
\n\nThe following sprite types are supported:
\n\nRectangle requires width
and height
attributes:
Ext.create('Ext.draw.Component', {\n renderTo: Ext.getBody(),\n width: 200,\n height: 200,\n items: [{\n type: 'rect',\n width: 100,\n height: 50,\n radius: 10,\n fill: 'green',\n opacity: 0.5,\n stroke: 'red',\n 'stroke-width': 2\n }]\n});\n
\n\nCircle requires x
, y
and radius
attributes:
Ext.create('Ext.draw.Component', {\n renderTo: Ext.getBody(),\n width: 200,\n height: 200,\n items: [{\n type: 'circle',\n radius: 90,\n x: 100,\n y: 100,\n fill: 'blue',\n }]\n});\n
\n\nEllipse requires x
, y
, radiusX
and radiusY
attributes:
Ext.create('Ext.draw.Component', {\n renderTo: Ext.getBody(),\n width: 200,\n height: 200,\n items: [{\n type: \"ellipse\",\n radiusX: 100,\n radiusY: 50,\n x: 100,\n y: 100,\n fill: 'red'\n }]\n});\n
\n\nPath requires the path
attribute:
Ext.create('Ext.draw.Component', {\n renderTo: Ext.getBody(),\n width: 200,\n height: 200,\n items: [{\n type: \"path\",\n path: \"M-66.6 26C-66.6 26 -75 22 -78.2 18.4C-81.4 14.8 -80.948 19.966 \" +\n \"-85.8 19.6C-91.647 19.159 -90.6 3.2 -90.6 3.2L-94.6 10.8C-94.6 \" +\n \"10.8 -95.8 25.2 -87.8 22.8C-83.893 21.628 -82.6 23.2 -84.2 \" +\n \"24C-85.8 24.8 -78.6 25.2 -81.4 26.8C-84.2 28.4 -69.8 23.2 -72.2 \" +\n \"33.6L-66.6 26z\",\n fill: \"purple\"\n }]\n});\n
\n\nText requires the text
attribute:
Ext.create('Ext.draw.Component', {\n renderTo: Ext.getBody(),\n width: 200,\n height: 200,\n items: [{\n type: \"text\",\n text: \"Hello, Sprite!\",\n fill: \"green\",\n font: \"18px monospace\"\n }]\n});\n
\n\nImage requires width
, height
and src
attributes:
Ext.create('Ext.draw.Component', {\n renderTo: Ext.getBody(),\n width: 200,\n height: 200,\n items: [{\n type: \"image\",\n src: \"http://www.sencha.com/img/apple-touch-icon.png\",\n width: 200,\n height: 200\n }]\n});\n
\n\nSee Ext.draw.Surface documentation.
\n\nSee setAttributes method documentation for examples on how to translate, scale and rotate the sprites.
\nUsed with text type sprites. The full font description.\nUses the same syntax as the CSS font parameter
\nThe group that this sprite belongs to, or an array of groups.\nOnly relevant when added to a Surface.
\nA config object containing one or more event handlers to be added to this object during initialization. This\nshould be a valid listeners config object as specified in the addListener example for attaching multiple\nhandlers at once.
\n\nDOM events from Ext JS Components
\n\nWhile some Ext JS Component classes export selected DOM events (e.g. \"click\", \"mouseover\" etc), this is usually\nonly done when extra value can be added. For example the DataView's itemclick
event passing the node clicked on. To access DOM events directly from a\nchild element of a Component, we need to specify the element
option to identify the Component property to add a\nDOM listener to:
new Ext.panel.Panel({\n width: 400,\n height: 200,\n dockedItems: [{\n xtype: 'toolbar'\n }],\n listeners: {\n click: {\n element: 'el', //bind to the underlying el property on the panel\n fn: function(){ console.log('click el'); }\n },\n dblclick: {\n element: 'body', //bind to the underlying body property on the panel\n fn: function(){ console.log('dblclick body'); }\n }\n }\n});\n
\nThe path of the path sprite written in SVG-like path syntax.
\nThe path of the path sprite written in SVG-like path syntax.
\nThe radius of the circle sprite. Or in case of rect sprite, the border radius.
\nThe width of the stroke.
\n\nNote that this attribute needs to be quoted when used. Like so:
\n\n\"stroke-width\": 12,\n
\nThe type of the sprite.\nPossible options are 'circle', 'ellipse', 'path', 'rect', 'text', 'image'.
\n\nSee Ext.draw.Sprite class documentation for examples of all types.
\nIf this Sprite is configured draggable, this property will contain\nan instance of Ext.dd.DragSource which handles dragging the Sprite.
\n\nThe developer must provide implementations of the abstract methods of Ext.dd.DragSource\nin order to supply behaviour for each stage of the drag/drop process. See draggable.
\nInitial suspended call count. Incremented when suspendEvents is called, decremented when resumeEvents is called.
\nDefaults to: 0
This object holds a key for any event that has a listener. The listener may be set\ndirectly on the instance, or on its class or a super class (via observe) or\non the MVC EventBus. The values of this object are truthy\n(a non-zero number) and falsy (0 or undefined). They do not represent an exact count\nof listeners. The value for an event is truthy if the event must be fired and is\nfalsy if there is no need to fire the event.
\n\nThe intended use of this property is to avoid the expense of fireEvent calls when\nthere are no listeners. This can be particularly helpful when one would otherwise\nhave to call fireEvent hundreds or thousands of times. It is used like this:
\n\n if (this.hasListeners.foo) {\n this.fireEvent('foo', this, arg1);\n }\n
\ntrue
in this class to identify an object as an instantiated Observable, or subclass thereof.
Defaults to: true
true
in this class to identify an object as an instantiated Sprite, or subclass thereof.
Defaults to: true
Get the reference to the current class from which this object was instantiated. Unlike statics,\nthis.self
is scope-dependent and it's meant to be used for dynamic inheritance. See statics\nfor a detailed comparison
Ext.define('My.Cat', {\n statics: {\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n alert(this.self.speciesName); // dependent on 'this'\n },\n\n clone: function() {\n return new this.self();\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat'\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\n
\nAdds one or more CSS classes to the element. Duplicate classes are automatically filtered out. Note this method\nis severly limited in VML.
\nthis
\nAdds the specified events to the list of events which this Observable may fire.
\nEither an object with event names as properties with\na value of true
. For example:
this.addEvents({\n storeloaded: true,\n storecleared: true\n});\n
\n\nOr any number of event names as separate parameters. For example:
\n\nthis.addEvents('storeloaded', 'storecleared');\n
\nAppends an event handler to this object. For example:
\n\nmyGridPanel.on(\"mouseover\", this.onMouseOver, this);\n
\n\nThe method also allows for a single argument to be passed which is a config object\ncontaining properties which specify multiple events. For example:
\n\nmyGridPanel.on({\n cellClick: this.onCellClick,\n mouseover: this.onMouseOver,\n mouseout: this.onMouseOut,\n scope: this // Important. Ensure \"this\" is correct during handler execution\n});\n
\n\nOne can also specify options for each event handler separately:
\n\nmyGridPanel.on({\n cellClick: {fn: this.onCellClick, scope: this, single: true},\n mouseover: {fn: panel.onMouseOver, scope: panel}\n});\n
\n\nNames of methods in a specified scope may also be used. Note that\nscope
MUST be specified to use this option:
myGridPanel.on({\n cellClick: {fn: 'onCellClick', scope: this, single: true},\n mouseover: {fn: 'onMouseOver', scope: panel}\n});\n
\nThe name of the event to listen for.\nMay also be an object who's property names are event names.
\n\nThe method the event invokes, or if scope
is specified, the name* of the method within\nthe specified scope
. Will be called with arguments\ngiven to fireEvent plus the options
parameter described below.
The scope (this
reference) in which the handler function is\nexecuted. If omitted, defaults to the object which fired the event.
An object containing handler configuration.
\n\n\n\n\nNote: Unlike in ExtJS 3.x, the options object will also be passed as the last\nargument to every event handler.
\n\n\n\n\nThis object may contain any of the following properties:
\n\nThe scope (this
reference) in which the handler function is executed. If omitted,\n defaults to the object which fired the event.
The number of milliseconds to delay the invocation of the handler after the event fires.
\n\nTrue to add a handler to handle just the next firing of the event, and then remove itself.
\n\nCauses the handler to be scheduled to run in an Ext.util.DelayedTask delayed\n by the specified number of milliseconds. If the event fires again within that time,\n the original handler is not invoked, but the new handler is scheduled in its place.
\n\nOnly call the handler if the event was fired on the target Observable, not if the event\n was bubbled up from a child Observable.
\n\nThis option is only valid for listeners bound to Components.\n The name of a Component property which references an element to add a listener to.
\n\n\n\n\nThis option is useful during Component construction to add DOM event listeners to elements of\n Components which will exist only after the Component is rendered.\n For example, to add a click listener to a Panel's body:
\n\n\n\n\n new Ext.panel.Panel({\n title: 'The title',\n listeners: {\n click: this.handlePanelClick,\n element: 'body'\n }\n });\n
\n\n\n\n\nCombining Options
\n\n\n\n\nUsing the options argument, it is possible to combine different types of listeners:
\n\n\n\n\nA delayed, one-time listener.
\n\n\n\n\nmyPanel.on('hide', this.handleClick, this, {\n single: true,\n delay: 100\n});\n
\n\nAdds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is\ndestroyed.
\nThe item to which to add a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
If the ename
parameter was an event name, this is the\naddListener options.
Performs custom animation on this object.
\n\nThis method is applicable to both the Component class and the Sprite\nclass. It performs animated transitions of certain properties of this object over a specified timeline.
\n\nWhen animating a Component, the following properties may be specified in from
, to
, and keyframe
objects:
x
- The Component's page X position in pixels.
y
- The Component's page Y position in pixels
left
- The Component's left
value in pixels.
top
- The Component's top
value in pixels.
width
- The Component's width
value in pixels.
width
- The Component's width
value in pixels.
dynamic
- Specify as true to update the Component's layout (if it is a Container) at every frame of the animation.\nUse sparingly as laying out on every intermediate size change is an expensive operation.
For example, to animate a Window to a new size, ensuring that its internal layout and any shadow is correct:
\n\nmyWindow = Ext.create('Ext.window.Window', {\n title: 'Test Component animation',\n width: 500,\n height: 300,\n layout: {\n type: 'hbox',\n align: 'stretch'\n },\n items: [{\n title: 'Left: 33%',\n margins: '5 0 5 5',\n flex: 1\n }, {\n title: 'Left: 66%',\n margins: '5 5 5 5',\n flex: 2\n }]\n});\nmyWindow.show();\nmyWindow.header.el.on('click', function() {\n myWindow.animate({\n to: {\n width: (myWindow.getWidth() == 500) ? 700 : 500,\n height: (myWindow.getHeight() == 300) ? 400 : 300\n }\n });\n});\n
\n\nFor performance reasons, by default, the internal layout is only updated when the Window reaches its final \"to\"
\nsize. If dynamic updating of the Window's child Components is required, then configure the animation with\ndynamic: true
and the two child items will maintain their proportions during the animation.
Configuration for Ext.fx.Anim.\nNote that the to config is required.
\nthis
\nCall the original method that was previously overridden with override
\n\nExt.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n this.callOverridden();\n\n alert(\"Meeeeoooowwww\");\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n
\n This method has been deprecated
\nas of 4.1. Use callParent instead.
\n\nThe arguments, either an array or the arguments
object\nfrom the current method, for example: this.callOverridden(arguments)
Returns the result of calling the overridden method
\nCall the \"parent\" method of the current method. That is the method previously\noverridden by derivation or by an override (see Ext.define).
\n\n Ext.define('My.Base', {\n constructor: function (x) {\n this.x = x;\n },\n\n statics: {\n method: function (x) {\n return x;\n }\n }\n });\n\n Ext.define('My.Derived', {\n extend: 'My.Base',\n\n constructor: function () {\n this.callParent([21]);\n }\n });\n\n var obj = new My.Derived();\n\n alert(obj.x); // alerts 21\n
\n\nThis can be used with an override as follows:
\n\n Ext.define('My.DerivedOverride', {\n override: 'My.Derived',\n\n constructor: function (x) {\n this.callParent([x*2]); // calls original My.Derived constructor\n }\n });\n\n var obj = new My.Derived();\n\n alert(obj.x); // now alerts 42\n
\n\nThis also works with static methods.
\n\n Ext.define('My.Derived2', {\n extend: 'My.Base',\n\n statics: {\n method: function (x) {\n return this.callParent([x*2]); // calls My.Base.method\n }\n }\n });\n\n alert(My.Base.method(10); // alerts 10\n alert(My.Derived2.method(10); // alerts 20\n
\n\nLastly, it also works with overridden static methods.
\n\n Ext.define('My.Derived2Override', {\n override: 'My.Derived2',\n\n statics: {\n method: function (x) {\n return this.callParent([x*2]); // calls My.Derived2.method\n }\n }\n });\n\n alert(My.Derived2.method(10); // now alerts 40\n
\nThe arguments, either an array or the arguments
object\nfrom the current method, for example: this.callParent(arguments)
Returns the result of calling the parent method
\nRemoves all listeners for this object including the managed listeners
\nRemoves the sprite and clears all listeners.
\nOverrides: Ext.Base.destroy
Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget()
if\npresent. There is no implementation in the Observable base class.
This is commonly used by Ext.Components to bubble events to owner Containers.\nSee Ext.Component.getBubbleTarget. The default implementation in Ext.Component returns the\nComponent's immediate owner. But if a known target is required, this can be overridden to access the\nrequired target more quickly.
\n\nExample:
\n\nExt.override(Ext.form.field.Base, {\n // Add functionality to Field's initComponent to enable the change event to bubble\n initComponent : Ext.Function.createSequence(Ext.form.field.Base.prototype.initComponent, function() {\n this.enableBubble('change');\n }),\n\n // We know that we want Field's events to bubble directly to the FormPanel.\n getBubbleTarget : function() {\n if (!this.formPanel) {\n this.formPanel = this.findParentByType('form');\n }\n return this.formPanel;\n }\n});\n\nvar myForm = new Ext.formPanel({\n title: 'User Details',\n items: [{\n ...\n }],\n listeners: {\n change: function() {\n // Title goes red if form has been modified.\n myForm.header.setStyle('color', 'red');\n }\n }\n});\n
\nFires the specified event with the passed parameters (minus the event name, plus the options
object passed\nto addListener).
An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by\ncalling enableBubble.
\nThe name of the event to fire.
\nVariable number of parameters are passed to handlers.
\nreturns false if any of the handlers return false otherwise it returns true.
\nReturns the current animation if this object has any effects actively running or queued, else returns false.
\nAnim if element has active effects, else false
\n\nRetrieves the bounding box of the sprite.\nThis will be returned as an object with x, y, width, and height properties.
\nbbox
\nGets the bubbling parent for an Observable
\nThe bubble parent. null is returned if no bubble target exists
\nReturns the current animation if this object has any effects actively running or queued, else returns false.
\nThis method has been deprecated since 4.0
\nReplaced by getActiveAnimation
\n\nAnim if element has active effects, else false
\n\nChecks to see if this object has any listeners for a specified event, or whether the event bubbles. The answer\nindicates whether the event needs firing or not.
\nThe name of the event to check for
\ntrue
if the event is being listened for or bubbles, else false
Hides the sprite.
\nFlag to immediately draw the change.
\nthis
\nInitialize configuration for this class. a typical example:
\n\nExt.define('My.awesome.Class', {\n // The default config\n config: {\n name: 'Awesome',\n isAwesome: true\n },\n\n constructor: function(config) {\n this.initConfig(config);\n }\n});\n\nvar awesome = new My.awesome.Class({\n name: 'Super Awesome'\n});\n\nalert(awesome.getName()); // 'Super Awesome'\n
\nthis
\nShorthand for addManagedListener.
\n\nAdds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is\ndestroyed.
\nThe item to which to add a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
If the ename
parameter was an event name, this is the\naddListener options.
Shorthand for removeManagedListener.
\n\nRemoves listeners that were added by the mon method.
\nThe item from which to remove a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
Shorthand for addListener.
\n\nAppends an event handler to this object. For example:
\n\nmyGridPanel.on(\"mouseover\", this.onMouseOver, this);\n
\n\nThe method also allows for a single argument to be passed which is a config object\ncontaining properties which specify multiple events. For example:
\n\nmyGridPanel.on({\n cellClick: this.onCellClick,\n mouseover: this.onMouseOver,\n mouseout: this.onMouseOut,\n scope: this // Important. Ensure \"this\" is correct during handler execution\n});\n
\n\nOne can also specify options for each event handler separately:
\n\nmyGridPanel.on({\n cellClick: {fn: this.onCellClick, scope: this, single: true},\n mouseover: {fn: panel.onMouseOver, scope: panel}\n});\n
\n\nNames of methods in a specified scope may also be used. Note that\nscope
MUST be specified to use this option:
myGridPanel.on({\n cellClick: {fn: 'onCellClick', scope: this, single: true},\n mouseover: {fn: 'onMouseOver', scope: panel}\n});\n
\nThe name of the event to listen for.\nMay also be an object who's property names are event names.
\n\nThe method the event invokes, or if scope
is specified, the name* of the method within\nthe specified scope
. Will be called with arguments\ngiven to fireEvent plus the options
parameter described below.
The scope (this
reference) in which the handler function is\nexecuted. If omitted, defaults to the object which fired the event.
An object containing handler configuration.
\n\n\n\n\nNote: Unlike in ExtJS 3.x, the options object will also be passed as the last\nargument to every event handler.
\n\n\n\n\nThis object may contain any of the following properties:
\n\nThe scope (this
reference) in which the handler function is executed. If omitted,\n defaults to the object which fired the event.
The number of milliseconds to delay the invocation of the handler after the event fires.
\n\nTrue to add a handler to handle just the next firing of the event, and then remove itself.
\n\nCauses the handler to be scheduled to run in an Ext.util.DelayedTask delayed\n by the specified number of milliseconds. If the event fires again within that time,\n the original handler is not invoked, but the new handler is scheduled in its place.
\n\nOnly call the handler if the event was fired on the target Observable, not if the event\n was bubbled up from a child Observable.
\n\nThis option is only valid for listeners bound to Components.\n The name of a Component property which references an element to add a listener to.
\n\n\n\n\nThis option is useful during Component construction to add DOM event listeners to elements of\n Components which will exist only after the Component is rendered.\n For example, to add a click listener to a Panel's body:
\n\n\n\n\n new Ext.panel.Panel({\n title: 'The title',\n listeners: {\n click: this.handlePanelClick,\n element: 'body'\n }\n });\n
\n\n\n\n\nCombining Options
\n\n\n\n\nUsing the options argument, it is possible to combine different types of listeners:
\n\n\n\n\nA delayed, one-time listener.
\n\n\n\n\nmyPanel.on('hide', this.handleClick, this, {\n single: true,\n delay: 100\n});\n
\n\nPrepares a given class for observable instances. This method is called when a\nclass derives from this class or uses this class as a mixin.
\nThe class constructor to prepare.
\nRelays selected events from the specified Observable as if the events were fired by this
.
For example if you are extending Grid, you might decide to forward some events from store.\nSo you can do this inside your initComponent:
\n\nthis.relayEvents(this.getStore(), ['load']);\n
\n\nThe grid instance will then have an observable 'load' event which will be passed the\nparameters of the store's load event and any function fired with the grid's load event\nwould have access to the grid using the this
keyword.
The Observable whose events this object is to relay.
\nArray of event names to relay.
\nA common prefix to prepend to the event names. For example:
\n\nthis.relayEvents(this.getStore(), ['load', 'clear'], 'store');\n
\n\nNow the grid will forward 'load' and 'clear' events of store as 'storeload' and 'storeclear'.
\nRemoves the sprite.
\nTrue if sprite was successfully removed.\nFalse when there was no surface to remove it from.
\nRemoves one or more CSS classes from the element.
\nThe CSS class to remove, or an array of classes. Note this method\nis severly limited in VML.
\nthis
\nRemoves an event handler.
\nThe type of event the handler was associated with.
\n\nThe handler to remove. This must be a reference to the function passed into the\naddListener call.
\n\nThe scope originally specified for the handler. It must be the same as the\nscope argument specified in the original call to addListener or the listener will not be removed.
\n\nRemoves listeners that were added by the mon method.
\nThe item from which to remove a listener/listeners.
\n\nThe event name, or an object containing event name properties.
\n\nIf the ename
parameter was an event name, this is the handler function.
If the ename
parameter was an event name, this is the scope (this
reference)\nin which the handler function is executed.
Resumes firing events (see suspendEvents).
\n\nIf events were suspended using the queueSuspended
parameter, then all events fired\nduring event suspension will be sent to any listeners now.
Change the attributes of the sprite.
\n\nFor translate, the configuration object contains x and y attributes that indicate where to\ntranslate the object. For example:
\n\nsprite.setAttributes({\n translate: {\n x: 10,\n y: 10\n }\n}, true);\n
\n\nFor rotation, the configuration object contains x and y attributes for the center of the rotation (which are optional),\nand a degrees
attribute that specifies the rotation in degrees. For example:
sprite.setAttributes({\n rotate: {\n degrees: 90\n }\n}, true);\n
\n\nThat example will create a 90 degrees rotation using the centroid of the Sprite as center of rotation, whereas:
\n\nsprite.setAttributes({\n rotate: {\n x: 0,\n y: 0,\n degrees: 90\n }\n}, true);\n
\n\nwill create a rotation around the (0, 0)
axis.
For scaling, the configuration object contains x and y attributes for the x-axis and y-axis scaling. For example:
\n\nsprite.setAttributes({\n scale: {\n x: 10,\n y: 3\n }\n}, true);\n
\n\nYou can also specify the center of scaling by adding cx
and cy
as properties:
sprite.setAttributes({\n scale: {\n cx: 0,\n cy: 0,\n x: 10,\n y: 3\n }\n}, true);\n
\n\nThat last example will scale a sprite taking as centers of scaling the (0, 0)
coordinate.
attributes to be changed on the sprite.
\nFlag to immediately draw the change.
\nthis
\nWrapper for setting style properties, also takes single object parameter of multiple styles.
\nThe style property to be set, or an object of multiple styles.
\nThe value to apply to the given property, or null if an object was passed.
\nthis
\nShows the sprite.
\nFlag to immediately draw the change.
\nthis
\nGet the reference to the class from which this object was instantiated. Note that unlike self,\nthis.statics()
is scope-independent and it always returns the class from which it was called, regardless of what\nthis
points to during run-time
Ext.define('My.Cat', {\n statics: {\n totalCreated: 0,\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n var statics = this.statics();\n\n alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to\n // equivalent to: My.Cat.speciesName\n\n alert(this.self.speciesName); // dependent on 'this'\n\n statics.totalCreated++;\n },\n\n clone: function() {\n var cloned = new this.self; // dependent on 'this'\n\n cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName\n\n return cloned;\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n },\n\n constructor: function() {\n this.callParent();\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'\n\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\nalert(clone.groupName); // alerts 'Cat'\n\nalert(My.Cat.totalCreated); // alerts 3\n
\nStops any running effects and clears this object's internal effects queue if it contains any additional effects\nthat haven't started yet.
\nThe Element
\nStops any running effects and clears this object's internal effects queue if it contains any additional effects\nthat haven't started yet.
\nThis method has been deprecated since 4.0
\nReplaced by stopAnimation
\n\nThe Element
\nSuspends the firing of all events. (see resumeEvents)
\nPass as true to queue up suspended events to be fired\nafter the resumeEvents call instead of discarding all suspended events.
\nEnsures that all effects queued after syncFx is called on this object are run concurrently. This is the opposite\nof sequenceFx.
\nthis
\nShorthand for removeListener.
\n\nRemoves an event handler.
\nThe type of event the handler was associated with.
\n\nThe handler to remove. This must be a reference to the function passed into the\naddListener call.
\n\nThe scope originally specified for the handler. It must be the same as the\nscope argument specified in the original call to addListener or the listener will not be removed.
\n\nAdd methods / properties to the prototype of this class.
\n\nExt.define('My.awesome.Cat', {\n constructor: function() {\n ...\n }\n});\n\n My.awesome.Cat.addMembers({\n meow: function() {\n alert('Meowww...');\n }\n });\n\n var kitty = new My.awesome.Cat;\n kitty.meow();\n
\nAdd / override static properties of this class.
\n\nExt.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.addStatics({\n someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'\n method1: function() { ... }, // My.cool.Class.method1 = function() { ... };\n method2: function() { ... } // My.cool.Class.method2 = function() { ... };\n});\n
\nthis
\nBorrow another class' members to the prototype of this class.
\n\nExt.define('Bank', {\n money: '$$$',\n printMoney: function() {\n alert('$$$$$$$');\n }\n});\n\nExt.define('Thief', {\n ...\n});\n\nThief.borrow(Bank, ['money', 'printMoney']);\n\nvar steve = new Thief();\n\nalert(steve.money); // alerts '$$$'\nsteve.printMoney(); // alerts '$$$$$$$'\n
\nThe class to borrow members from
\nThe names of the members to borrow
\nthis
\nCreate a new instance of this Class.
\n\nExt.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.create({\n someConfig: true\n});\n
\n\nAll parameters are passed to the constructor of the class.
\nthe created instance.
\nCreate aliases for existing prototype methods. Example:
\n\nExt.define('My.cool.Class', {\n method1: function() { ... },\n method2: function() { ... }\n});\n\nvar test = new My.cool.Class();\n\nMy.cool.Class.createAlias({\n method3: 'method1',\n method4: 'method2'\n});\n\ntest.method3(); // test.method1()\n\nMy.cool.Class.createAlias('method5', 'method3');\n\ntest.method5(); // test.method3() -> test.method1()\n
\nThe new method name, or an object to set multiple aliases. See\nflexSetter
\nThe original method name
\nGet the current class' name in string format.
\n\nExt.define('My.cool.Class', {\n constructor: function() {\n alert(this.self.getName()); // alerts 'My.cool.Class'\n }\n});\n\nMy.cool.Class.getName(); // 'My.cool.Class'\n
\nclassName
\nAdds members to class.
\nThis method has been deprecated since 4.1
\nUse addMembers instead.
\n\nOverride members of this class. Overridden methods can be invoked via\ncallParent.
\n\nExt.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n this.callParent(arguments);\n\n alert(\"Meeeeoooowwww\");\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n
\n\nAs of 4.1, direct use of this method is deprecated. Use Ext.define\ninstead:
\n\nExt.define('My.CatOverride', {\n override: 'My.Cat',\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n this.callParent(arguments);\n\n alert(\"Meeeeoooowwww\");\n }\n});\n
\n\nThe above accomplishes the same result but can be managed by the Ext.Loader\nwhich can properly order the override and its target class and the build process\ncan determine whether the override is needed based on the required state of the\ntarget class (My.Cat).
\nThis method has been deprecated since 4.1.0
\nUse Ext.define instead
\n\nThe properties to add to this class. This should be\nspecified as an object literal containing one or more properties.
\nthis class
\nFires before the sprite is destroyed. Return false from an event handler to stop the destroy.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when a mouse click is detected within the element.
\nThe Ext.EventObject encapsulating the DOM event.
\nThe target of the event.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires after the sprite is destroyed.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when a mousedown is detected within the element.
\nThe Ext.EventObject encapsulating the DOM event.
\nThe target of the event.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when a mousemove is detected with the element.
\nThe Ext.EventObject encapsulating the DOM event.
\nThe target of the event.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when a mouseout is detected with the element.
\nThe Ext.EventObject encapsulating the DOM event.
\nThe target of the event.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when a mouseover is detected within the element.
\nThe Ext.EventObject encapsulating the DOM event.
\nThe target of the event.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires when a mouseup is detected within the element.
\nThe Ext.EventObject encapsulating the DOM event.
\nThe target of the event.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\nFires after the sprite markup is rendered.
\nThe options object passed to Ext.util.Observable.addListener.
\n\n\n\n