Ext.data.JsonP.Ext_util_Positionable({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":"Ext.Base","uses":[],"html":"
Hierarchy
Ext.BaseExt.util.PositionableMixed into
Files
This mixin provides a common interface for objects that can be positioned, e.g.\nComponents and Elements
\nBy default this method does nothing but return the position spec passed to it. In\nrtl mode it is overridden to convert \"l\" to \"r\" and vice versa when required.
\nGet 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
\nStub implementation called after positioning.\nMay be implemented in subclasses. AbstractComponent has an implementation.
\nAligns the element with another element relative to the specified anchor points. If\nthe other element is the document it aligns it to the viewport. The position\nparameter is optional, and can be specified in any one of the following formats:
\n\nIn addition to the anchor points, the position parameter also supports the \"?\"\ncharacter. If \"?\" is passed at the end of the position string, the element will\nattempt to align as specified, but the position will be adjusted to constrain to\nthe viewport if necessary. Note that the element being aligned might be swapped to\nalign to a different position than that specified in order to enforce the viewport\nconstraints. Following are all of the supported anchor positions:
\n\nValue Description\n----- -----------------------------\ntl The top left corner (default)\nt The center of the top edge\ntr The top right corner\nl The center of the left edge\nc In the center of the element\nr The center of the right edge\nbl The bottom left corner\nb The center of the bottom edge\nbr The bottom right corner\n\n\n\n
Example Usage:
\n\n// align el to other-el using the default positioning\n// (\"tl-bl\", non-constrained)\nel.alignTo(\"other-el\");\n\n// align the top left corner of el with the top right corner of other-el\n// (constrained to viewport)\nel.alignTo(\"other-el\", \"tr?\");\n\n// align the bottom right corner of el with the center left edge of other-el\nel.alignTo(\"other-el\", \"br-l?\");\n\n// align the center of el with the bottom left corner of other-el and\n// adjust the x position by -6 pixels (and the y position by 0)\nel.alignTo(\"other-el\", \"c-bl\", [-6, 0]);\n
\nThe Positionable,\nHTMLElement, or id of the element to align to.
\nThe position to align to
\nDefaults to: "tl-bl?"
Offset the positioning by [x, y]
\ntrue for the default animation or a standard\nElement animation config object
\nthis
\nAnchors an element to another element and realigns it when the window is resized.
\nThe Positionable,\nHTMLElement, or id of the element to align to.
\nThe position to align to
\nDefaults to: "tl-bl?"
Offset the positioning by [x, y]
\ntrue for the default animation or a standard\nElement animation config object
\nTrue to monitor body scroll and\nreposition. If this parameter is a number, it is used as the buffer delay in\nmilliseconds.
\nDefaults to: 50
The function to call after the animation finishes
\nthis
\nCalculates x,y coordinates specified by the anchor position on the element, adding\nextraX and extraY values.
\nThe specified anchor position.\nSee alignTo for details on supported anchor positions.
\nDefaults to: 'tl'
value to be added to the x coordinate
\nvalue to be added to the y coordinate
\nAn object containing the size to use for calculating anchor\nposition {width: (target width), height: (target height)} (defaults to the\nelement's current size)
\n[x, y] An array containing the element's x and y coordinates
\nCalculates the new [x,y] position to move this Positionable into a constrain region.
\n\nBy default, this Positionable is constrained to be within the container it was added to, or the element it was\nrendered to.
\n\nPriority is given to constraining the top and left within the constraint.
\n\nAn alternative constraint may be passed.
\nThe Element or Region\ninto which this Component is to be constrained. Defaults to the element into which this Positionable\nwas rendered, or this Component's {@link Ext.Component.constrainTo.
\nA proposed [X, Y]
position to test for validity\nand to coerce into constraints instead of using this Positionable's current position.
The proposedPosition is local (relative to floatParent if a floating Component)
\nA proposed [width, height]
size to use when calculating\nconstraints instead of using this Positionable's current size.
If the element needs to be translated, the new [X, Y]
position within\nconstraints if possible, giving priority to keeping the top and left edge in the constrain region.\nOtherwise, false
.
Call 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
\n\nTo override a method and replace it and also call the superclass method, use\ncallSuper. This is often done to patch a method to fix a bug.
\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
\nThis method is used by an override to call the superclass method but bypass any\noverridden method. This is often done to \"patch\" a method that contains a bug\nbut for whatever reason cannot be fixed directly.
\n\nConsider:
\n\n Ext.define('Ext.some.Class', {\n method: function () {\n console.log('Good');\n }\n });\n\n Ext.define('Ext.some.DerivedClass', {\n method: function () {\n console.log('Bad');\n\n // ... logic but with a bug ...\n\n this.callParent();\n }\n });\n
\n\nTo patch the bug in DerivedClass.method
, the typical solution is to create an\noverride:
Ext.define('App.paches.DerivedClass', {\n override: 'Ext.some.DerivedClass',\n\n method: function () {\n console.log('Fixed');\n\n // ... logic but with bug fixed ...\n\n this.callSuper();\n }\n });\n
\n\nThe patch method cannot use callParent
to call the superclass method
since\nthat would call the overridden method containing the bug. In other words, the\nabove patch would only produce \"Fixed\" then \"Good\" in the console log, whereas,\nusing callParent
would produce \"Fixed\" then \"Bad\" then \"Good\".
The arguments, either an array or the arguments
object\nfrom the current method, for example: this.callSuper(arguments)
Returns the result of calling the superclass method
\nGets the x,y coordinates to align this element with another element. See\nalignTo for more info on the supported position values.
\nThe Positionable,\nHTMLElement, or id of the element to align to.
\nThe position to align to
\nDefaults to: "tl-bl?"
Offset the positioning by [x, y]
\n[x, y]
\nGets the x,y coordinates of an element specified by the anchor position on the\nelement.
\nThe element
\nThe specified anchor position.\nSee alignTo for details on supported anchor positions.
\nDefaults to: 'tl'
True to get the local (element top/left-relative) anchor\nposition instead of page coordinates
\nAn object containing the size to use for calculating anchor\nposition {width: (target width), height: (target height)} (defaults to the\nelement's current size)
\n[x, y] An array containing the element's x and y coordinates
\nGets the x,y coordinates specified by the anchor position on the element.
\nThe specified anchor position.\nSee alignTo for details on supported anchor positions.
\nDefaults to: 'tl'
True to get the local (element top/left-relative) anchor\nposition instead of page coordinates
\nAn object containing the size to use for calculating anchor\nposition {width: (target width), height: (target height)} (defaults to the\nelement's current size)
\n[x, y] An array containing the element's x and y coordinates
\nReturns the size of the element's borders and padding.
\nan object with the following numeric properties\n- beforeX\n- afterX\n- beforeY\n- afterY
\nReturn an object defining the area of this Element which can be passed to\nsetBox to set another Element's size/location to match this element.
\nIf true a box for the content of the element is\nreturned.
\nIf true the element's left and top relative to its\noffsetParent
are returned instead of page x/y.
box An object in the format:
\n\n{\n x: <Element's X position>,\n y: <Element's Y position>,\n left: <Element's X position (an alias for x)>,\n top: <Element's Y position (an alias for y)>,\n width: <Element's width>,\n height: <Element's height>,\n bottom: <Element's lower bound>,\n right: <Element's rightmost bound>\n}\n
\n\nThe returned object may also be addressed as an Array where index 0 contains the X\nposition and index 1 contains the Y position. The result may also be used for\nsetXY
\nReturns the [X, Y]
vector by which this Positionable's element must be translated to make a best\nattempt to constrain within the passed constraint. Returns false
if the element\ndoes not need to be moved.
Priority is given to constraining the top and left within the constraint.
\n\nThe constraint may either be an existing element into which the element is to be\nconstrained, or a Region into which this element is to be\nconstrained.
\n\nBy default, any extra shadow around the element is not included in the constrain calculations - the edges\nof the element are used as the element bounds. To constrain the shadow within the constrain region, set the\nconstrainShadow
property on this element to true
.
The\nPositionable, HTMLElement, element id, or Region into which the element is to be\nconstrained.
\nA proposed [X, Y]
position to test for validity\nand to produce a vector for instead of using the element's current position
A proposed [width, height]
size to constrain\ninstead of using the element's current size
Returns the x coordinate of this element reletive to its offsetParent
.
The local x coordinate
\nReturns the x and y coordinates of this element relative to its offsetParent
.
The local XY position of the element
\nReturns the y coordinate of this element reletive to its offsetParent
.
The local y coordinate
\nReturns the offsets of this element from the passed element. The element must both\nbe part of the DOM tree and not have display:none to have page coordinates.
\nThe Positionable,\nHTMLElement, or element id to get get the offsets from.
\nThe XY page offsets (e.g. [100, -200]
)
Returns a region object that defines the area of this element.
\nA Region containing \"top, left, bottom, right\" properties.
\nReturns the content region of this element. That is the region within the borders\nand padding.
\nA Region containing \"top, left, bottom, right\" member data.
\nGets the current X position of the DOM element based on page coordinates.
\nThe X position of the element
\nGets the current position of the DOM element based on page coordinates.
\nThe XY position of the element
\nGets the current Y position of the DOM element based on page coordinates.
\nThe Y position of the element
\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
\nMove the element relative to its current position.
\nPossible values are:
\n\n\"l\"
(or \"left\"
)\"r\"
(or \"right\"
)\"t\"
(or \"top\"
, or \"up\"
)\"b\"
(or \"bottom\"
, or \"down\"
)How far to move the element in pixels
\ntrue for the default animation or a standard\nElement animation config object
\nSets the element's box. If animate is true then x, y, width, and height will be\nanimated concurrently.
\nThe box to fill {x, y, width, height}
\ntrue for the default animation or a standard\nElement animation config object
\nthis
\nSets the local x coordinate of this element using CSS style. When used on an\nabsolute positioned element this method is symmetrical with getLocalX, but\nmay not be symmetrical when used on a relatively positioned element.
\nThe x coordinate. A value of null
sets the left style to 'auto'.
this
\nSets the local x and y coordinates of this element using CSS style. When used on an\nabsolute positioned element this method is symmetrical with getLocalXY, but\nmay not be symmetrical when used on a relatively positioned element.
\nThe x coordinate or an array containing [x, y]. A value of\nnull
sets the left style to 'auto'
The y coordinate, required if x is not an array. A value of\nnull
sets the top style to 'auto'
this
\nSets the local y coordinate of this element using CSS style. When used on an\nabsolute positioned element this method is symmetrical with getLocalY, but\nmay not be symmetrical when used on a relatively positioned element.
\nThe y coordinate. A value of null
sets the top style to 'auto'.
this
\nSets the element's position and size to the specified region. If animation is true\nthen width, height, x and y will be animated concurrently.
\nThe region to fill
\ntrue for the default animation or a standard\nElement animation config object
\nthis
\nSets the X position of the DOM element based on page coordinates.
\nX position
\nTrue for the default animation, or a standard\nElement animation config object
\nthis
\nSets the position of the DOM element in page coordinates.
\nContains X & Y [x, y] values for new position (coordinates\nare page-based)
\nTrue for the default animation, or a standard\nElement animation config object
\nthis
\nSets the Y position of the DOM element based on page coordinates.
\nY position
\nTrue for the default animation, or a standard\nElement animation config object
\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
\nTranslates the passed page coordinates into left/top css values for the element
\nThe page x or an array containing [x, y]
\nThe page y, required if x is not an array
\nAn object with left and top properties. e.g.\n{left: (value), top: (value)}
\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
\n