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-AbstractComponent'>/**
19 </span> * @class Ext.AbstractComponent
20 * <p>An abstract base class which provides shared methods for Components across the Sencha product line.</p>
21 * <p>Please refer to sub class's documentation</p>
24 Ext.define('Ext.AbstractComponent', {
26 /* Begin Definitions */
29 observable: 'Ext.util.Observable',
30 animate: 'Ext.util.Animate',
31 state: 'Ext.state.Stateful'
36 'Ext.ComponentManager',
42 'Ext.ComponentLoader',
45 'Ext.layout.component.Auto'
48 // Please remember to add dependencies whenever you use it
49 // I had to fix these many times already
62 getAutoId: function() {
63 return ++Ext.AbstractComponent.AUTO_ID;
67 <span id='Ext-AbstractComponent-cfg-id'> /**
68 </span> * @cfg {String} id
69 * <p>The <b><u>unique id of this component instance</u></b> (defaults to an {@link #getId auto-assigned id}).</p>
70 * <p>It should not be necessary to use this configuration except for singleton objects in your application.
71 * Components created with an id may be accessed globally using {@link Ext#getCmp Ext.getCmp}.</p>
72 * <p>Instead of using assigned ids, use the {@link #itemId} config, and {@link Ext.ComponentQuery ComponentQuery} which
73 * provides selector-based searching for Sencha Components analogous to DOM querying. The {@link Ext.container.Container Container}
74 * class contains {@link Ext.container.Container#down shortcut methods} to query its descendant Components by selector.</p>
75 * <p>Note that this id will also be used as the element id for the containing HTML element
76 * that is rendered to the page for this component. This allows you to write id-based CSS
77 * rules to style the specific instance of this component uniquely, and also to select
78 * sub-elements using this component's id as the parent.</p>
79 * <p><b>Note</b>: to avoid complications imposed by a unique <tt>id</tt> also see <code>{@link #itemId}</code>.</p>
80 * <p><b>Note</b>: to access the container of a Component see <code>{@link #ownerCt}</code>.</p>
83 <span id='Ext-AbstractComponent-cfg-itemId'> /**
84 </span> * @cfg {String} itemId
85 * <p>An <tt>itemId</tt> can be used as an alternative way to get a reference to a component
86 * when no object reference is available. Instead of using an <code>{@link #id}</code> with
87 * {@link Ext}.{@link Ext#getCmp getCmp}, use <code>itemId</code> with
88 * {@link Ext.container.Container}.{@link Ext.container.Container#getComponent getComponent} which will retrieve
89 * <code>itemId</code>'s or <tt>{@link #id}</tt>'s. Since <code>itemId</code>'s are an index to the
90 * container's internal MixedCollection, the <code>itemId</code> is scoped locally to the container --
91 * avoiding potential conflicts with {@link Ext.ComponentManager} which requires a <b>unique</b>
92 * <code>{@link #id}</code>.</p>
93 * <pre><code>
94 var c = new Ext.panel.Panel({ //
95 {@link Ext.Component#height height}: 300,
96 {@link #renderTo}: document.body,
97 {@link Ext.container.Container#layout layout}: 'auto',
98 {@link Ext.container.Container#items items}: [
101 {@link Ext.panel.Panel#title title}: 'Panel 1',
102 {@link Ext.Component#height height}: 150
106 {@link Ext.panel.Panel#title title}: 'Panel 2',
107 {@link Ext.Component#height height}: 150
111 p1 = c.{@link Ext.container.Container#getComponent getComponent}('p1'); // not the same as {@link Ext#getCmp Ext.getCmp()}
112 p2 = p1.{@link #ownerCt}.{@link Ext.container.Container#getComponent getComponent}('p2'); // reference via a sibling
113 * </code></pre>
114 * <p>Also see <tt>{@link #id}</tt>, <code>{@link Ext.container.Container#query}</code>,
115 * <code>{@link Ext.container.Container#down}</code> and <code>{@link Ext.container.Container#child}</code>.</p>
116 * <p><b>Note</b>: to access the container of an item see <tt>{@link #ownerCt}</tt>.</p>
119 <span id='Ext-AbstractComponent-property-ownerCt'> /**
120 </span> * This Component's owner {@link Ext.container.Container Container} (defaults to undefined, and is set automatically when
121 * this Component is added to a Container). Read-only.
122 * <p><b>Note</b>: to access items within the Container see <tt>{@link #itemId}</tt>.</p>
123 * @type Ext.Container
127 <span id='Ext-AbstractComponent-property-layoutManagedWidth'> /**
129 * Flag set by the container layout to which this Component is added.
130 * If the layout manages this Component's width, it sets the value to 1.
131 * If it does NOT manage the width, it sets it to 2.
132 * If the layout MAY affect the width, but only if the owning Container has a fixed width, this is set to 0.
134 * @property layoutManagedWidth
137 <span id='Ext-AbstractComponent-property-layoutManagedHeight'> /**
139 * Flag set by the container layout to which this Component is added.
140 * If the layout manages this Component's height, it sets the value to 1.
141 * If it does NOT manage the height, it sets it to 2.
142 * If the layout MAY affect the height, but only if the owning Container has a fixed height, this is set to 0.
144 * @property layoutManagedHeight
147 <span id='Ext-AbstractComponent-cfg-autoEl'> /**
148 </span> * @cfg {Mixed} autoEl
149 * <p>A tag name or {@link Ext.core.DomHelper DomHelper} spec used to create the {@link #getEl Element} which will
150 * encapsulate this Component.</p>
151 * <p>You do not normally need to specify this. For the base classes {@link Ext.Component} and {@link Ext.container.Container},
152 * this defaults to <b><tt>'div'</tt></b>. The more complex Sencha classes use a more complex
153 * DOM structure specified by their own {@link #renderTpl}s.</p>
154 * <p>This is intended to allow the developer to create application-specific utility Components encapsulated by
155 * different DOM elements. Example usage:</p><pre><code>
160 src: 'http://www.example.com/example.jpg'
166 html: 'autoEl is cool!'
171 cls: 'ux-unordered-list',
175 html: 'First list item'
178 </code></pre>
181 <span id='Ext-AbstractComponent-cfg-renderTpl'> /**
182 </span> * @cfg {Mixed} renderTpl
183 * <p>An {@link Ext.XTemplate XTemplate} used to create the internal structure inside this Component's
184 * encapsulating {@link #getEl Element}.</p>
185 * <p>You do not normally need to specify this. For the base classes {@link Ext.Component}
186 * and {@link Ext.container.Container}, this defaults to <b><code>null</code></b> which means that they will be initially rendered
187 * with no internal structure; they render their {@link #getEl Element} empty. The more specialized ExtJS and Touch classes
188 * which use a more complex DOM structure, provide their own template definitions.</p>
189 * <p>This is intended to allow the developer to create application-specific utility Components with customized
190 * internal structure.</p>
191 * <p>Upon rendering, any created child elements may be automatically imported into object properties using the
192 * {@link #renderSelectors} option.</p>
196 <span id='Ext-AbstractComponent-cfg-renderSelectors'> /**
197 </span> * @cfg {Object} renderSelectors
199 An object containing properties specifying {@link Ext.DomQuery DomQuery} selectors which identify child elements
200 created by the render process.
202 After the Component's internal structure is rendered according to the {@link #renderTpl}, this object is iterated through,
203 and the found Elements are added as properties to the Component using the `renderSelector` property name.
205 For example, a Component which rendered an image, and description into its element might use the following properties
206 coded into its prototype:
208 renderTpl: '&lt;img src="{imageUrl}" class="x-image-component-img">&lt;div class="x-image-component-desc">{description}&gt;/div&lt;',
211 image: 'img.x-image-component-img',
212 descEl: 'div.x-image-component-desc'
215 After rendering, the Component would have a property <code>image</code> referencing its child `img` Element,
216 and a property `descEl` referencing the `div` Element which contains the description.
221 <span id='Ext-AbstractComponent-cfg-renderTo'> /**
222 </span> * @cfg {Mixed} renderTo
223 * <p>Specify the id of the element, a DOM element or an existing Element that this component
224 * will be rendered into.</p><div><ul>
225 * <li><b>Notes</b> : <ul>
226 * <div class="sub-desc">Do <u>not</u> use this option if the Component is to be a child item of
227 * a {@link Ext.container.Container Container}. It is the responsibility of the
228 * {@link Ext.container.Container Container}'s {@link Ext.container.Container#layout layout manager}
229 * to render and manage its child items.</div>
230 * <div class="sub-desc">When using this config, a call to render() is not required.</div>
231 * </ul></li>
232 * </ul></div>
233 * <p>See <code>{@link #render}</code> also.</p>
236 <span id='Ext-AbstractComponent-cfg-frame'> /**
237 </span> * @cfg {Boolean} frame
238 * <p>Specify as <code>true</code> to have the Component inject framing elements within the Component at render time to
239 * provide a graphical rounded frame around the Component content.</p>
240 * <p>This is only necessary when running on outdated, or non standard-compliant browsers such as Microsoft's Internet Explorer
241 * prior to version 9 which do not support rounded corners natively.</p>
242 * <p>The extra space taken up by this framing is available from the read only property {@link #frameSize}.</p>
245 <span id='Ext-AbstractComponent-property-frameSize'> /**
246 </span> * <p>Read-only property indicating the width of any framing elements which were added within the encapsulating element
247 * to provide graphical, rounded borders. See the {@link #frame} config.</p>
248 * <p> This is an object containing the frame width in pixels for all four sides of the Component containing
249 * the following properties:</p><div class="mdetail-params"><ul>
250 * <li><code>top</code> The width of the top framing element in pixels.</li>
251 * <li><code>right</code> The width of the right framing element in pixels.</li>
252 * <li><code>bottom</code> The width of the bottom framing element in pixels.</li>
253 * <li><code>left</code> The width of the left framing element in pixels.</li>
254 * </ul></div>
255 * @property frameSize
259 <span id='Ext-AbstractComponent-cfg-componentLayout'> /**
260 </span> * @cfg {String/Object} componentLayout
261 * <p>The sizing and positioning of a Component's internal Elements is the responsibility of
262 * the Component's layout manager which sizes a Component's internal structure in response to the Component being sized.</p>
263 * <p>Generally, developers will not use this configuration as all provided Components which need their internal
264 * elements sizing (Such as {@link Ext.form.field.Base input fields}) come with their own componentLayout managers.</p>
265 * <p>The {@link Ext.layout.container.Auto default layout manager} will be used on instances of the base Ext.Component class
266 * which simply sizes the Component's encapsulating element to the height and width specified in the {@link #setSize} method.</p>
269 <span id='Ext-AbstractComponent-cfg-tpl'> /**
270 </span> * @cfg {Mixed} tpl
271 * An <bold>{@link Ext.Template}</bold>, <bold>{@link Ext.XTemplate}</bold>
272 * or an array of strings to form an Ext.XTemplate.
273 * Used in conjunction with the <code>{@link #data}</code> and
274 * <code>{@link #tplWriteMode}</code> configurations.
277 <span id='Ext-AbstractComponent-cfg-data'> /**
278 </span> * @cfg {Mixed} data
279 * The initial set of data to apply to the <code>{@link #tpl}</code> to
280 * update the content area of the Component.
283 <span id='Ext-AbstractComponent-cfg-tplWriteMode'> /**
284 </span> * @cfg {String} tplWriteMode The Ext.(X)Template method to use when
285 * updating the content area of the Component. Defaults to <code>'overwrite'</code>
286 * (see <code>{@link Ext.XTemplate#overwrite}</code>).
288 tplWriteMode: 'overwrite',
290 <span id='Ext-AbstractComponent-cfg-baseCls'> /**
291 </span> * @cfg {String} baseCls
292 * The base CSS class to apply to this components's element. This will also be prepended to
293 * elements within this component like Panel's body will get a class x-panel-body. This means
294 * that if you create a subclass of Panel, and you want it to get all the Panels styling for the
295 * element and the body, you leave the baseCls x-panel and use componentCls to add specific styling for this
298 baseCls: Ext.baseCSSPrefix + 'component',
300 <span id='Ext-AbstractComponent-cfg-componentCls'> /**
301 </span> * @cfg {String} componentCls
302 * CSS Class to be added to a components root level element to give distinction to it
306 <span id='Ext-AbstractComponent-cfg-cls'> /**
307 </span> * @cfg {String} cls
308 * An optional extra CSS class that will be added to this component's Element (defaults to ''). This can be
309 * useful for adding customized styles to the component or any of its children using standard CSS rules.
312 <span id='Ext-AbstractComponent-cfg-overCls'> /**
313 </span> * @cfg {String} overCls
314 * An optional extra CSS class that will be added to this component's Element when the mouse moves
315 * over the Element, and removed when the mouse moves out. (defaults to ''). This can be
316 * useful for adding customized 'active' or 'hover' styles to the component or any of its children using standard CSS rules.
319 <span id='Ext-AbstractComponent-cfg-disabledCls'> /**
320 </span> * @cfg {String} disabledCls
321 * CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'.
323 disabledCls: Ext.baseCSSPrefix + 'item-disabled',
325 <span id='Ext-AbstractComponent-cfg-ui'> /**
326 </span> * @cfg {String/Array} ui
327 * A set style for a component. Can be a string or an Array of multiple strings (UIs)
331 <span id='Ext-AbstractComponent-cfg-uiCls'> /**
332 </span> * @cfg {Array} uiCls
333 * An array of of classNames which are currently applied to this component
338 <span id='Ext-AbstractComponent-cfg-style'> /**
339 </span> * @cfg {String} style
340 * A custom style specification to be applied to this component's Element. Should be a valid argument to
341 * {@link Ext.core.Element#applyStyles}.
342 * <pre><code>
343 new Ext.panel.Panel({
345 renderTo: Ext.getBody(),
346 width: 400, height: 300,
355 new Ext.button.Button({
364 </code></pre>
367 <span id='Ext-AbstractComponent-cfg-width'> /**
368 </span> * @cfg {Number} width
369 * The width of this component in pixels.
372 <span id='Ext-AbstractComponent-cfg-height'> /**
373 </span> * @cfg {Number} height
374 * The height of this component in pixels.
377 <span id='Ext-AbstractComponent-cfg-border'> /**
378 </span> * @cfg {Number/String} border
379 * Specifies the border for this component. The border can be a single numeric value to apply to all sides or
380 * it can be a CSS style specification for each style, for example: '10 5 3 10'.
383 <span id='Ext-AbstractComponent-cfg-padding'> /**
384 </span> * @cfg {Number/String} padding
385 * Specifies the padding for this component. The padding can be a single numeric value to apply to all sides or
386 * it can be a CSS style specification for each style, for example: '10 5 3 10'.
389 <span id='Ext-AbstractComponent-cfg-margin'> /**
390 </span> * @cfg {Number/String} margin
391 * Specifies the margin for this component. The margin can be a single numeric value to apply to all sides or
392 * it can be a CSS style specification for each style, for example: '10 5 3 10'.
395 <span id='Ext-AbstractComponent-cfg-hidden'> /**
396 </span> * @cfg {Boolean} hidden
401 <span id='Ext-AbstractComponent-cfg-disabled'> /**
402 </span> * @cfg {Boolean} disabled
407 <span id='Ext-AbstractComponent-cfg-draggable'> /**
408 </span> * @cfg {Boolean} draggable
409 * Allows the component to be dragged.
412 <span id='Ext-AbstractComponent-property-draggable'> /**
413 </span> * Read-only property indicating whether or not the component can be dragged
414 * @property draggable
419 <span id='Ext-AbstractComponent-cfg-floating'> /**
420 </span> * @cfg {Boolean} floating
421 * Create the Component as a floating and use absolute positioning.
426 <span id='Ext-AbstractComponent-cfg-hideMode'> /**
427 </span> * @cfg {String} hideMode
428 * A String which specifies how this Component's encapsulating DOM element will be hidden.
429 * Values may be<div class="mdetail-params"><ul>
430 * <li><code>'display'</code> : The Component will be hidden using the <code>display: none</code> style.</li>
431 * <li><code>'visibility'</code> : The Component will be hidden using the <code>visibility: hidden</code> style.</li>
432 * <li><code>'offsets'</code> : The Component will be hidden by absolutely positioning it out of the visible area of the document. This
433 * is useful when a hidden Component must maintain measurable dimensions. Hiding using <code>display</code> results
434 * in a Component having zero dimensions.</li></ul></div>
435 * Defaults to <code>'display'</code>.
439 <span id='Ext-AbstractComponent-cfg-contentEl'> /**
440 </span> * @cfg {String} contentEl
441 * <p>Optional. Specify an existing HTML element, or the <code>id</code> of an existing HTML element to use as the content
442 * for this component.</p>
444 * <li><b>Description</b> :
445 * <div class="sub-desc">This config option is used to take an existing HTML element and place it in the layout element
446 * of a new component (it simply moves the specified DOM element <i>after the Component is rendered</i> to use as the content.</div></li>
447 * <li><b>Notes</b> :
448 * <div class="sub-desc">The specified HTML element is appended to the layout element of the component <i>after any configured
449 * {@link #html HTML} has been inserted</i>, and so the document will not contain this element at the time the {@link #render} event is fired.</div>
450 * <div class="sub-desc">The specified HTML element used will not participate in any <code><b>{@link Ext.container.Container#layout layout}</b></code>
451 * scheme that the Component may use. It is just HTML. Layouts operate on child <code><b>{@link Ext.container.Container#items items}</b></code>.</div>
452 * <div class="sub-desc">Add either the <code>x-hidden</code> or the <code>x-hide-display</code> CSS class to
453 * prevent a brief flicker of the content before it is rendered to the panel.</div></li>
457 <span id='Ext-AbstractComponent-cfg-html'> /**
458 </span> * @cfg {String/Object} html
459 * An HTML fragment, or a {@link Ext.core.DomHelper DomHelper} specification to use as the layout element
460 * content (defaults to ''). The HTML content is added after the component is rendered,
461 * so the document will not contain this HTML at the time the {@link #render} event is fired.
462 * This content is inserted into the body <i>before</i> any configured {@link #contentEl} is appended.
465 <span id='Ext-AbstractComponent-cfg-styleHtmlContent'> /**
466 </span> * @cfg {Boolean} styleHtmlContent
467 * True to automatically style the html inside the content target of this component (body for panels).
470 styleHtmlContent: false,
472 <span id='Ext-AbstractComponent-cfg-styleHtmlCls'> /**
473 </span> * @cfg {String} styleHtmlCls
474 * The class that is added to the content target when you set styleHtmlContent to true.
475 * Defaults to 'x-html'
477 styleHtmlCls: Ext.baseCSSPrefix + 'html',
479 <span id='Ext-AbstractComponent-cfg-minHeight'> /**
480 </span> * @cfg {Number} minHeight
481 * <p>The minimum value in pixels which this Component will set its height to.</p>
482 * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
484 <span id='Ext-AbstractComponent-cfg-minWidth'> /**
485 </span> * @cfg {Number} minWidth
486 * <p>The minimum value in pixels which this Component will set its width to.</p>
487 * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
489 <span id='Ext-AbstractComponent-cfg-maxHeight'> /**
490 </span> * @cfg {Number} maxHeight
491 * <p>The maximum value in pixels which this Component will set its height to.</p>
492 * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
494 <span id='Ext-AbstractComponent-cfg-maxWidth'> /**
495 </span> * @cfg {Number} maxWidth
496 * <p>The maximum value in pixels which this Component will set its width to.</p>
497 * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
500 <span id='Ext-AbstractComponent-cfg-loader'> /**
501 </span> * @cfg {Ext.ComponentLoader/Object} loader
502 * A configuration object or an instance of a {@link Ext.ComponentLoader} to load remote
503 * content for this Component.
509 <span id='Ext-AbstractComponent-cfg-autoShow'> /**
510 </span> * @cfg {Boolean} autoShow True to automatically show the component upon creation.
511 * This config option may only be used for {@link #floating} components or components
512 * that use {@link #autoRender}. Defaults to <tt>false</tt>.
516 <span id='Ext-AbstractComponent-cfg-autoRender'> /**
517 </span> * @cfg {Mixed} autoRender
518 * <p>This config is intended mainly for {@link #floating} Components which may or may not be shown. Instead
519 * of using {@link #renderTo} in the configuration, and rendering upon construction, this allows a Component
520 * to render itself upon first <i>{@link #show}</i>.</p>
521 * <p>Specify as <code>true</code> to have this Component render to the document body upon first show.</p>
522 * <p>Specify as an element, or the ID of an element to have this Component render to a specific element upon first show.</p>
523 * <p><b>This defaults to <code>true</code> for the {@link Ext.window.Window Window} class.</b></p>
529 <span id='Ext-AbstractComponent-cfg-plugins'> /**
530 </span> * @cfg {Object/Array} plugins
531 * An object or array of objects that will provide custom functionality for this component. The only
532 * requirement for a valid plugin is that it contain an init method that accepts a reference of type Ext.Component.
533 * When a component is created, if any plugins are available, the component will call the init method on each
534 * plugin, passing a reference to itself. Each plugin can then call methods or respond to events on the
535 * component as needed to provide its functionality.
538 <span id='Ext-AbstractComponent-property-rendered'> /**
539 </span> * Read-only property indicating whether or not the component has been rendered.
547 trimRe: /^\s+|\s+$/g,
551 <span id='Ext-AbstractComponent-property-maskOnDisable'> /**
552 </span> * This is an internal flag that you use when creating custom components.
553 * By default this is set to true which means that every component gets a mask when its disabled.
554 * Components like FieldContainer, FieldSet, Field, Button, Tab override this property to false
555 * since they want to implement custom disable logic.
556 * @property maskOnDisable
561 <span id='Ext-AbstractComponent-method-constructor'> /**
562 </span> * Creates new Component.
563 * @param {Object} config (optional) Config object.
565 constructor : function(config) {
569 config = config || {};
570 me.initialConfig = config;
571 Ext.apply(me, config);
574 <span id='Ext-AbstractComponent-event-beforeactivate'> /**
575 </span> * @event beforeactivate
576 * Fires before a Component has been visually activated.
577 * Returning false from an event listener can prevent the activate
579 * @param {Ext.Component} this
582 <span id='Ext-AbstractComponent-event-activate'> /**
583 </span> * @event activate
584 * Fires after a Component has been visually activated.
585 * @param {Ext.Component} this
588 <span id='Ext-AbstractComponent-event-beforedeactivate'> /**
589 </span> * @event beforedeactivate
590 * Fires before a Component has been visually deactivated.
591 * Returning false from an event listener can prevent the deactivate
593 * @param {Ext.Component} this
596 <span id='Ext-AbstractComponent-event-deactivate'> /**
597 </span> * @event deactivate
598 * Fires after a Component has been visually deactivated.
599 * @param {Ext.Component} this
602 <span id='Ext-AbstractComponent-event-added'> /**
603 </span> * @event added
604 * Fires after a Component had been added to a Container.
605 * @param {Ext.Component} this
606 * @param {Ext.container.Container} container Parent Container
607 * @param {Number} pos position of Component
610 <span id='Ext-AbstractComponent-event-disable'> /**
611 </span> * @event disable
612 * Fires after the component is disabled.
613 * @param {Ext.Component} this
616 <span id='Ext-AbstractComponent-event-enable'> /**
617 </span> * @event enable
618 * Fires after the component is enabled.
619 * @param {Ext.Component} this
622 <span id='Ext-AbstractComponent-event-beforeshow'> /**
623 </span> * @event beforeshow
624 * Fires before the component is shown when calling the {@link #show} method.
625 * Return false from an event handler to stop the show.
626 * @param {Ext.Component} this
629 <span id='Ext-AbstractComponent-event-show'> /**
630 </span> * @event show
631 * Fires after the component is shown when calling the {@link #show} method.
632 * @param {Ext.Component} this
635 <span id='Ext-AbstractComponent-event-beforehide'> /**
636 </span> * @event beforehide
637 * Fires before the component is hidden when calling the {@link #hide} method.
638 * Return false from an event handler to stop the hide.
639 * @param {Ext.Component} this
642 <span id='Ext-AbstractComponent-event-hide'> /**
643 </span> * @event hide
644 * Fires after the component is hidden.
645 * Fires after the component is hidden when calling the {@link #hide} method.
646 * @param {Ext.Component} this
649 <span id='Ext-AbstractComponent-event-removed'> /**
650 </span> * @event removed
651 * Fires when a component is removed from an Ext.container.Container
652 * @param {Ext.Component} this
653 * @param {Ext.container.Container} ownerCt Container which holds the component
656 <span id='Ext-AbstractComponent-event-beforerender'> /**
657 </span> * @event beforerender
658 * Fires before the component is {@link #rendered}. Return false from an
659 * event handler to stop the {@link #render}.
660 * @param {Ext.Component} this
663 <span id='Ext-AbstractComponent-event-render'> /**
664 </span> * @event render
665 * Fires after the component markup is {@link #rendered}.
666 * @param {Ext.Component} this
669 <span id='Ext-AbstractComponent-event-afterrender'> /**
670 </span> * @event afterrender
671 * <p>Fires after the component rendering is finished.</p>
672 * <p>The afterrender event is fired after this Component has been {@link #rendered}, been postprocesed
673 * by any afterRender method defined for the Component.</p>
674 * @param {Ext.Component} this
677 <span id='Ext-AbstractComponent-event-beforedestroy'> /**
678 </span> * @event beforedestroy
679 * Fires before the component is {@link #destroy}ed. Return false from an event handler to stop the {@link #destroy}.
680 * @param {Ext.Component} this
683 <span id='Ext-AbstractComponent-event-destroy'> /**
684 </span> * @event destroy
685 * Fires after the component is {@link #destroy}ed.
686 * @param {Ext.Component} this
689 <span id='Ext-AbstractComponent-event-resize'> /**
690 </span> * @event resize
691 * Fires after the component is resized.
692 * @param {Ext.Component} this
693 * @param {Number} adjWidth The box-adjusted width that was set
694 * @param {Number} adjHeight The box-adjusted height that was set
697 <span id='Ext-AbstractComponent-event-move'> /**
698 </span> * @event move
699 * Fires after the component is moved.
700 * @param {Ext.Component} this
701 * @param {Number} x The new x position
702 * @param {Number} y The new y position
710 me.additionalCls = [];
711 me.renderData = me.renderData || {};
712 me.renderSelectors = me.renderSelectors || {};
715 me.plugins = [].concat(me.plugins);
716 for (i = 0, len = me.plugins.length; i < len; i++) {
717 me.plugins[i] = me.constructPlugin(me.plugins[i]);
723 // ititComponent gets a chance to change the id property before registering
724 Ext.ComponentManager.register(me);
726 // Dont pass the config so that it is not applied to 'this' again
727 me.mixins.observable.constructor.call(me);
728 me.mixins.state.constructor.call(me, config);
730 // Save state on resize.
731 this.addStateEvents('resize');
733 // Move this into Observable?
735 me.plugins = [].concat(me.plugins);
736 for (i = 0, len = me.plugins.length; i < len; i++) {
737 me.plugins[i] = me.initPlugin(me.plugins[i]);
741 me.loader = me.getLoader();
744 me.render(me.renderTo);
745 // EXTJSIV-1935 - should be a way to do afterShow or something, but that
746 // won't work. Likewise, rendering hidden and then showing (w/autoShow) has
747 // implications to afterRender so we cannot do that.
755 if (Ext.isDefined(me.disabledClass)) {
756 if (Ext.isDefined(Ext.global.console)) {
757 Ext.global.console.warn('Ext.Component: disabledClass has been deprecated. Please use disabledCls.');
759 me.disabledCls = me.disabledClass;
760 delete me.disabledClass;
765 initComponent: Ext.emptyFn,
767 <span id='Ext-AbstractComponent-method-getState'> /**
768 </span> * </p>The supplied default state gathering method for the AbstractComponent class.</p>
769 * This method returns dimension setings such as <code>flex</code>, <code>anchor</code>, <code>width</code>
770 * and <code>height</code> along with <code>collapsed</code> state.</p>
771 * <p>Subclasses which implement more complex state should call the superclass's implementation, and apply their state
772 * to the result if this basic state is to be saved.</p>
773 * <p>Note that Component state will only be saved if the Component has a {@link #stateId} and there as a StateProvider
774 * configured for the document.</p>
776 getState: function() {
778 layout = me.ownerCt ? (me.shadowOwnerCt || me.ownerCt).getLayout() : null,
780 collapsed: me.collapsed
784 cm = me.collapseMemento,
787 // If a Panel-local collapse has taken place, use remembered values as the dimensions.
788 // TODO: remove this coupling with Panel's privates! All collapse/expand logic should be refactored into one place.
789 if (me.collapsed && cm) {
790 if (Ext.isDefined(cm.data.width)) {
793 if (Ext.isDefined(cm.data.height)) {
798 // If we have flex, only store the perpendicular dimension.
799 if (layout && me.flex) {
800 state.flex = me.flex;
801 state[layout.perpendicularPrefix] = me['get' + layout.perpendicularPrefixCap]();
803 // If we have anchor, only store dimensions which are *not* being anchored
804 else if (layout && me.anchor) {
805 state.anchor = me.anchor;
806 anchors = me.anchor.split(' ').concat(null);
814 state.height = height;
824 state.height = height;
828 // Don't save dimensions if they are unchanged from the original configuration.
829 if (state.width == me.initialConfig.width) {
832 if (state.height == me.initialConfig.height) {
836 // If a Box layout was managing the perpendicular dimension, don't save that dimension
837 if (layout && layout.align && (layout.align.indexOf('stretch') !== -1)) {
838 delete state[layout.perpendicularPrefix];
845 animate: function(animObj) {
849 animObj = animObj || {};
850 to = animObj.to || {};
852 if (Ext.fx.Manager.hasFxBlock(me.id)) {
855 // Special processing for animating Component dimensions.
856 if (!animObj.dynamic && (to.height || to.width)) {
857 var curWidth = me.getWidth(),
859 curHeight = me.getHeight(),
863 if (to.height && to.height > curHeight) {
867 if (to.width && to.width > curWidth) {
872 // If any dimensions are being increased, we must resize the internal structure
873 // of the Component, but then clip it by sizing its encapsulating element back to original dimensions.
874 // The animation will then progressively reveal the larger content.
876 var clearWidth = !Ext.isNumber(me.width),
877 clearHeight = !Ext.isNumber(me.height);
879 me.componentLayout.childrenChanged = true;
880 me.setSize(w, h, me.ownerCt);
881 me.el.setSize(curWidth, curHeight);
890 return me.mixins.animate.animate.apply(me, arguments);
893 <span id='Ext-AbstractComponent-method-findLayoutController'> /**
894 </span> * <p>This method finds the topmost active layout who's processing will eventually determine the size and position of this
895 * Component.<p>
896 * <p>This method is useful when dynamically adding Components into Containers, and some processing must take place after the
897 * final sizing and positioning of the Component has been performed.</p>
900 findLayoutController: function() {
901 return this.findParentBy(function(c) {
902 // Return true if we are at the root of the Container tree
903 // or this Container's layout is busy but the next one up is not.
904 return !c.ownerCt || (c.layout.layoutBusy && !c.ownerCt.layout.layoutBusy);
908 onShow : function() {
910 var needsLayout = this.needsLayout;
911 if (Ext.isObject(needsLayout)) {
912 this.doComponentLayout(needsLayout.width, needsLayout.height, needsLayout.isSetSize, needsLayout.ownerCt);
916 constructPlugin: function(plugin) {
917 if (plugin.ptype && typeof plugin.init != 'function') {
919 plugin = Ext.PluginManager.create(plugin);
921 else if (typeof plugin == 'string') {
922 plugin = Ext.PluginManager.create({
931 initPlugin : function(plugin) {
937 <span id='Ext-AbstractComponent-method-doAutoRender'> /**
938 </span> * Handles autoRender.
939 * Floating Components may have an ownerCt. If they are asking to be constrained, constrain them within that
940 * ownerCt, and have their z-index managed locally. Floating Components are always rendered to document.body
942 doAutoRender: function() {
945 me.render(document.body);
947 me.render(Ext.isBoolean(me.autoRender) ? Ext.getBody() : me.autoRender);
952 render : function(container, position) {
955 if (!me.rendered && me.fireEvent('beforerender', me) !== false) {
956 // If this.el is defined, we want to make sure we are dealing with
959 me.el = Ext.get(me.el);
962 // Perform render-time processing for floating Components
967 container = me.initContainer(container);
969 me.onRender(container, position);
971 // Tell the encapsulating element to hide itself in the way the Component is configured to hide
972 // This means DISPLAY, VISIBILITY or OFFSETS.
973 me.el.setVisibilityMode(Ext.core.Element[me.hideMode.toUpperCase()]);
976 me.el.hover(me.addOverCls, me.removeOverCls, me);
979 me.fireEvent('render', me);
983 me.afterRender(container);
984 me.fireEvent('afterrender', me);
989 // Hiding during the render process should not perform any ancillary
990 // actions that the full hide process does; It is not hiding, it begins in a hidden state.'
991 // So just make the element hidden according to the configured hideMode
996 // pass silent so the event doesn't fire the first time.
1004 onRender : function(container, position) {
1007 styles = me.initStyles(),
1008 renderTpl, renderData, i;
1010 position = me.getInsertPosition(position);
1014 el = Ext.core.DomHelper.insertBefore(position, me.getElConfig(), true);
1017 el = Ext.core.DomHelper.append(container, me.getElConfig(), true);
1020 else if (me.allowDomMove !== false) {
1022 container.dom.insertBefore(el.dom, position);
1024 container.dom.appendChild(el.dom);
1028 if (Ext.scopeResetCSS && !me.ownerCt) {
1029 // If this component's el is the body element, we add the reset class to the html tag
1030 if (el.dom == Ext.getBody().dom) {
1031 el.parent().addCls(Ext.baseCSSPrefix + 'reset');
1034 // Else we wrap this element in an element that adds the reset class.
1035 me.resetEl = el.wrap({
1036 cls: Ext.baseCSSPrefix + 'reset'
1043 el.addCls(me.initCls());
1044 el.setStyle(styles);
1046 // Here we check if the component has a height set through style or css.
1047 // If it does then we set the this.height to that value and it won't be
1048 // considered an auto height component
1049 // if (this.height === undefined) {
1050 // var height = el.getHeight();
1051 // // This hopefully means that the panel has an explicit height set in style or css
1052 // if (height - el.getPadding('tb') - el.getBorderWidth('tb') > 0) {
1053 // this.height = height;
1061 renderTpl = me.initRenderTpl();
1063 renderData = me.initRenderData();
1064 renderTpl.append(me.getTargetEl(), renderData);
1067 me.applyRenderSelectors();
1073 afterRender : function() {
1078 me.getComponentLayout();
1080 // Set the size if a size is configured, or if this is the outermost Container
1081 if (!me.ownerCt || (me.height || me.width)) {
1082 me.setSize(me.width, me.height);
1085 // For floaters, calculate x and y if they aren't defined by aligning
1086 // the sized element to the center of either the container or the ownerCt
1087 if (me.floating && (me.x === undefined || me.y === undefined)) {
1088 if (me.floatParent) {
1089 xy = me.el.getAlignToXY(me.floatParent.getTargetEl(), 'c-c');
1090 pos = me.floatParent.getTargetEl().translatePoints(xy[0], xy[1]);
1092 xy = me.el.getAlignToXY(me.container, 'c-c');
1093 pos = me.container.translatePoints(xy[0], xy[1]);
1095 me.x = me.x === undefined ? pos.left: me.x;
1096 me.y = me.y === undefined ? pos.top: me.y;
1099 if (Ext.isDefined(me.x) || Ext.isDefined(me.y)) {
1100 me.setPosition(me.x, me.y);
1103 if (me.styleHtmlContent) {
1104 me.getTargetEl().addCls(me.styleHtmlCls);
1108 frameCls: Ext.baseCSSPrefix + 'frame',
1123 '<tpl if="top">',
1124 '<tpl if="left"><div class="{frameCls}-tl {baseCls}-tl {baseCls}-{ui}-tl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tl</tpl></tpl>" style="background-position: {tl}; padding-left: {frameWidth}px" role="presentation"></tpl>',
1125 '<tpl if="right"><div class="{frameCls}-tr {baseCls}-tr {baseCls}-{ui}-tr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tr</tpl></tpl>" style="background-position: {tr}; padding-right: {frameWidth}px" role="presentation"></tpl>',
1126 '<div class="{frameCls}-tc {baseCls}-tc {baseCls}-{ui}-tc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tc</tpl></tpl>" style="background-position: {tc}; height: {frameWidth}px" role="presentation"></div>',
1127 '<tpl if="right"></div></tpl>',
1128 '<tpl if="left"></div></tpl>',
1130 '<tpl if="left"><div class="{frameCls}-ml {baseCls}-ml {baseCls}-{ui}-ml<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-ml</tpl></tpl>" style="background-position: {ml}; padding-left: {frameWidth}px" role="presentation"></tpl>',
1131 '<tpl if="right"><div class="{frameCls}-mr {baseCls}-mr {baseCls}-{ui}-mr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mr</tpl></tpl>" style="background-position: {mr}; padding-right: {frameWidth}px" role="presentation"></tpl>',
1132 '<div class="{frameCls}-mc {baseCls}-mc {baseCls}-{ui}-mc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mc</tpl></tpl>" role="presentation"></div>',
1133 '<tpl if="right"></div></tpl>',
1134 '<tpl if="left"></div></tpl>',
1135 '<tpl if="bottom">',
1136 '<tpl if="left"><div class="{frameCls}-bl {baseCls}-bl {baseCls}-{ui}-bl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bl</tpl></tpl>" style="background-position: {bl}; padding-left: {frameWidth}px" role="presentation"></tpl>',
1137 '<tpl if="right"><div class="{frameCls}-br {baseCls}-br {baseCls}-{ui}-br<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-br</tpl></tpl>" style="background-position: {br}; padding-right: {frameWidth}px" role="presentation"></tpl>',
1138 '<div class="{frameCls}-bc {baseCls}-bc {baseCls}-{ui}-bc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bc</tpl></tpl>" style="background-position: {bc}; height: {frameWidth}px" role="presentation"></div>',
1139 '<tpl if="right"></div></tpl>',
1140 '<tpl if="left"></div></tpl>',
1145 '<table><tbody>',
1146 '<tpl if="top">',
1148 '<tpl if="left"><td class="{frameCls}-tl {baseCls}-tl {baseCls}-{ui}-tl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tl</tpl></tpl>" style="background-position: {tl}; padding-left:{frameWidth}px" role="presentation"></td></tpl>',
1149 '<td class="{frameCls}-tc {baseCls}-tc {baseCls}-{ui}-tc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tc</tpl></tpl>" style="background-position: {tc}; height: {frameWidth}px" role="presentation"></td>',
1150 '<tpl if="right"><td class="{frameCls}-tr {baseCls}-tr {baseCls}-{ui}-tr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-tr</tpl></tpl>" style="background-position: {tr}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
1154 '<tpl if="left"><td class="{frameCls}-ml {baseCls}-ml {baseCls}-{ui}-ml<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-ml</tpl></tpl>" style="background-position: {ml}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
1155 '<td class="{frameCls}-mc {baseCls}-mc {baseCls}-{ui}-mc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mc</tpl></tpl>" style="background-position: 0 0;" role="presentation"></td>',
1156 '<tpl if="right"><td class="{frameCls}-mr {baseCls}-mr {baseCls}-{ui}-mr<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-mr</tpl></tpl>" style="background-position: {mr}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
1158 '<tpl if="bottom">',
1160 '<tpl if="left"><td class="{frameCls}-bl {baseCls}-bl {baseCls}-{ui}-bl<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bl</tpl></tpl>" style="background-position: {bl}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
1161 '<td class="{frameCls}-bc {baseCls}-bc {baseCls}-{ui}-bc<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-bc</tpl></tpl>" style="background-position: {bc}; height: {frameWidth}px" role="presentation"></td>',
1162 '<tpl if="right"><td class="{frameCls}-br {baseCls}-br {baseCls}-{ui}-br<tpl if="uiCls"><tpl for="uiCls"> {parent.baseCls}-{parent.ui}-{.}-br</tpl></tpl>" style="background-position: {br}; padding-left: {frameWidth}px" role="presentation"></td></tpl>',
1165 '</tbody></table>'
1168 <span id='Ext-AbstractComponent-method-initFrame'> /**
1171 initFrame : function() {
1172 if (Ext.supports.CSS3BorderRadius) {
1177 frameInfo = me.getFrameInfo(),
1178 frameWidth = frameInfo.width,
1179 frameTpl = me.getFrameTpl(frameInfo.table);
1182 // Here we render the frameTpl to this component. This inserts the 9point div or the table framing.
1183 frameTpl.insertFirst(me.el, Ext.apply({}, {
1186 frameCls: me.frameCls,
1187 baseCls: me.baseCls,
1188 frameWidth: frameWidth,
1189 top: !!frameInfo.top,
1190 left: !!frameInfo.left,
1191 right: !!frameInfo.right,
1192 bottom: !!frameInfo.bottom
1193 }, me.getFramePositions(frameInfo)));
1195 // The frameBody is returned in getTargetEl, so that layouts render items to the correct target.=
1196 me.frameBody = me.el.down('.' + me.frameCls + '-mc');
1198 // Add the render selectors for each of the frame elements
1199 Ext.apply(me.renderSelectors, {
1200 frameTL: '.' + me.baseCls + '-tl',
1201 frameTC: '.' + me.baseCls + '-tc',
1202 frameTR: '.' + me.baseCls + '-tr',
1203 frameML: '.' + me.baseCls + '-ml',
1204 frameMC: '.' + me.baseCls + '-mc',
1205 frameMR: '.' + me.baseCls + '-mr',
1206 frameBL: '.' + me.baseCls + '-bl',
1207 frameBC: '.' + me.baseCls + '-bc',
1208 frameBR: '.' + me.baseCls + '-br'
1213 updateFrame: function() {
1214 if (Ext.supports.CSS3BorderRadius) {
1219 wasTable = this.frameSize && this.frameSize.table,
1220 oldFrameTL = this.frameTL,
1221 oldFrameBL = this.frameBL,
1222 oldFrameML = this.frameML,
1223 oldFrameMC = this.frameMC,
1230 // Reapply render selectors
1240 this.applyRenderSelectors();
1242 // Store the class names set on the new mc
1243 newMCClassName = this.frameMC.dom.className;
1245 // Replace the new mc with the old mc
1246 oldFrameMC.insertAfter(this.frameMC);
1247 this.frameMC.remove();
1249 // Restore the reference to the old frame mc as the framebody
1250 this.frameBody = this.frameMC = oldFrameMC;
1252 // Apply the new mc classes to the old mc element
1253 oldFrameMC.dom.className = newMCClassName;
1255 // Remove the old framing
1257 me.el.query('> table')[1].remove();
1261 oldFrameTL.remove();
1264 oldFrameBL.remove();
1266 oldFrameML.remove();
1270 // We were framed but not anymore. Move all content from the old frame to the body
1274 else if (me.frame) {
1275 this.applyRenderSelectors();
1279 getFrameInfo: function() {
1280 if (Ext.supports.CSS3BorderRadius) {
1285 left = me.el.getStyle('background-position-x'),
1286 top = me.el.getStyle('background-position-y'),
1287 info, frameInfo = false, max;
1289 // Some browsers dont support background-position-x and y, so for those
1290 // browsers let's split background-position into two parts.
1291 if (!left && !top) {
1292 info = me.el.getStyle('background-position').split(' ');
1297 // We actually pass a string in the form of '[type][tl][tr]px [type][br][bl]px' as
1298 // the background position of this.el from the css to indicate to IE that this component needs
1299 // framing. We parse it here and change the markup accordingly.
1300 if (parseInt(left, 10) >= 1000000 && parseInt(top, 10) >= 1000000) {
1304 // Table markup starts with 110, div markup with 100.
1305 table: left.substr(0, 3) == '110',
1307 // Determine if we are dealing with a horizontal or vertical component
1308 vertical: top.substr(0, 3) == '110',
1310 // Get and parse the different border radius sizes
1311 top: max(left.substr(3, 2), left.substr(5, 2)),
1312 right: max(left.substr(5, 2), top.substr(3, 2)),
1313 bottom: max(top.substr(3, 2), top.substr(5, 2)),
1314 left: max(top.substr(5, 2), left.substr(3, 2))
1317 frameInfo.width = max(frameInfo.top, frameInfo.right, frameInfo.bottom, frameInfo.left);
1319 // Just to be sure we set the background image of the el to none.
1320 me.el.setStyle('background-image', 'none');
1323 // This happens when you set frame: true explicitly without using the x-frame mixin in sass.
1324 // This way IE can't figure out what sizes to use and thus framing can't work.
1325 if (me.frame === true && !frameInfo) {
1326 //<debug error>
1327 Ext.Error.raise("You have set frame: true explicity on this component while it doesn't have any " +
1328 "framing defined in the CSS template. In this case IE can't figure out what sizes " +
1329 "to use and thus framing on this component will be disabled.");
1333 me.frame = me.frame || !!frameInfo;
1334 me.frameSize = frameInfo || false;
1339 getFramePositions: function(frameInfo) {
1341 frameWidth = frameInfo.width,
1343 positions, tc, bc, ml, mr;
1345 if (frameInfo.vertical) {
1346 tc = '0 -' + (frameWidth * 0) + 'px';
1347 bc = '0 -' + (frameWidth * 1) + 'px';
1349 if (dock && dock == "right") {
1350 tc = 'right -' + (frameWidth * 0) + 'px';
1351 bc = 'right -' + (frameWidth * 1) + 'px';
1355 tl: '0 -' + (frameWidth * 0) + 'px',
1356 tr: '0 -' + (frameWidth * 1) + 'px',
1357 bl: '0 -' + (frameWidth * 2) + 'px',
1358 br: '0 -' + (frameWidth * 3) + 'px',
1360 ml: '-' + (frameWidth * 1) + 'px 0',
1367 ml = '-' + (frameWidth * 0) + 'px 0';
1370 if (dock && dock == "bottom") {
1372 mr = 'right bottom';
1376 tl: '0 -' + (frameWidth * 2) + 'px',
1377 tr: 'right -' + (frameWidth * 3) + 'px',
1378 bl: '0 -' + (frameWidth * 4) + 'px',
1379 br: 'right -' + (frameWidth * 5) + 'px',
1384 tc: '0 -' + (frameWidth * 0) + 'px',
1385 bc: '0 -' + (frameWidth * 1) + 'px'
1392 <span id='Ext-AbstractComponent-method-getFrameTpl'> /**
1395 getFrameTpl : function(table) {
1396 return table ? this.getTpl('frameTableTpl') : this.getTpl('frameTpl');
1399 <span id='Ext-AbstractComponent-method-initCls'> /**
1400 </span> * <p>Creates an array of class names from the configurations to add to this Component's <code>el</code> on render.</p>
1401 * <p>Private, but (possibly) used by ComponentQuery for selection by class name if Component is not rendered.</p>
1402 * @return {Array} An array of class names with which the Component's element will be rendered.
1405 initCls: function() {
1409 cls.push(me.baseCls);
1411 //<deprecated since=0.99>
1412 if (Ext.isDefined(me.cmpCls)) {
1413 if (Ext.isDefined(Ext.global.console)) {
1414 Ext.global.console.warn('Ext.Component: cmpCls has been deprecated. Please use componentCls.');
1416 me.componentCls = me.cmpCls;
1419 //</deprecated>
1421 if (me.componentCls) {
1422 cls.push(me.componentCls);
1424 me.componentCls = me.baseCls;
1431 return cls.concat(me.additionalCls);
1434 <span id='Ext-AbstractComponent-method-setUI'> /**
1435 </span> * Sets the UI for the component. This will remove any existing UIs on the component. It will also
1436 * loop through any uiCls set on the component and rename them so they include the new UI
1437 * @param {String} ui The new UI for the component
1439 setUI: function(ui) {
1441 oldUICls = Ext.Array.clone(me.uiCls),
1447 //loop through all exisiting uiCls and update the ui in them
1448 for (i = 0; i < oldUICls.length; i++) {
1451 classes = classes.concat(me.removeClsWithUI(cls, true));
1455 if (classes.length) {
1456 me.removeCls(classes);
1459 //remove the UI from the element
1460 me.removeUIFromElement();
1465 //add the new UI to the elemend
1466 me.addUIToElement();
1468 //loop through all exisiting uiCls and update the ui in them
1470 for (i = 0; i < newUICls.length; i++) {
1472 classes = classes.concat(me.addClsWithUI(cls, true));
1475 if (classes.length) {
1480 <span id='Ext-AbstractComponent-method-addClsWithUI'> /**
1481 </span> * Adds a cls to the uiCls array, which will also call {@link #addUIClsToElement} and adds
1482 * to all elements of this component.
1483 * @param {String/Array} cls A string or an array of strings to add to the uiCls
1484 * @param (Boolean) skip True to skip adding it to the class and do it later (via the return)
1486 addClsWithUI: function(cls, skip) {
1491 if (!Ext.isArray(cls)) {
1495 for (i = 0; i < cls.length; i++) {
1496 if (cls[i] && !me.hasUICls(cls[i])) {
1497 me.uiCls = Ext.Array.clone(me.uiCls);
1498 me.uiCls.push(cls[i]);
1500 classes = classes.concat(me.addUIClsToElement(cls[i]));
1504 if (skip !== true) {
1511 <span id='Ext-AbstractComponent-method-removeClsWithUI'> /**
1512 </span> * Removes a cls to the uiCls array, which will also call {@link #removeUIClsFromElement} and removes
1513 * it from all elements of this component.
1514 * @param {String/Array} cls A string or an array of strings to remove to the uiCls
1516 removeClsWithUI: function(cls, skip) {
1521 if (!Ext.isArray(cls)) {
1525 for (i = 0; i < cls.length; i++) {
1526 if (cls[i] && me.hasUICls(cls[i])) {
1527 me.uiCls = Ext.Array.remove(me.uiCls, cls[i]);
1529 classes = classes.concat(me.removeUIClsFromElement(cls[i]));
1533 if (skip !== true) {
1534 me.removeCls(classes);
1540 <span id='Ext-AbstractComponent-method-hasUICls'> /**
1541 </span> * Checks if there is currently a specified uiCls
1542 * @param {String} cls The cls to check
1544 hasUICls: function(cls) {
1546 uiCls = me.uiCls || [];
1548 return Ext.Array.contains(uiCls, cls);
1551 <span id='Ext-AbstractComponent-method-addUIClsToElement'> /**
1552 </span> * Method which adds a specified UI + uiCls to the components element.
1553 * Can be overridden to remove the UI from more than just the components element.
1554 * @param {String} ui The UI to remove from the element
1556 addUIClsToElement: function(cls, force) {
1559 frameElementCls = me.frameElementCls;
1561 result.push(Ext.baseCSSPrefix + cls);
1562 result.push(me.baseCls + '-' + cls);
1563 result.push(me.baseCls + '-' + me.ui + '-' + cls);
1565 if (!force && me.frame && !Ext.supports.CSS3BorderRadius) {
1566 // define each element of the frame
1567 var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
1570 // loop through each of them, and if they are defined add the ui
1571 for (i = 0; i < els.length; i++) {
1572 el = me['frame' + els[i].toUpperCase()];
1573 classes = [me.baseCls + '-' + me.ui + '-' + els[i], me.baseCls + '-' + me.ui + '-' + cls + '-' + els[i]];
1574 if (el && el.dom) {
1577 for (j = 0; j < classes.length; j++) {
1578 if (Ext.Array.indexOf(frameElementCls[els[i]], classes[j]) == -1) {
1579 frameElementCls[els[i]].push(classes[j]);
1586 me.frameElementCls = frameElementCls;
1591 <span id='Ext-AbstractComponent-method-removeUIClsFromElement'> /**
1592 </span> * Method which removes a specified UI + uiCls from the components element.
1593 * The cls which is added to the element will be: `this.baseCls + '-' + ui`
1594 * @param {String} ui The UI to add to the element
1596 removeUIClsFromElement: function(cls, force) {
1599 frameElementCls = me.frameElementCls;
1601 result.push(Ext.baseCSSPrefix + cls);
1602 result.push(me.baseCls + '-' + cls);
1603 result.push(me.baseCls + '-' + me.ui + '-' + cls);
1605 if (!force && me.frame && !Ext.supports.CSS3BorderRadius) {
1606 // define each element of the frame
1607 var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
1609 cls = me.baseCls + '-' + me.ui + '-' + cls + '-' + els[i];
1610 // loop through each of them, and if they are defined add the ui
1611 for (i = 0; i < els.length; i++) {
1612 el = me['frame' + els[i].toUpperCase()];
1613 if (el && el.dom) {
1616 Ext.Array.remove(frameElementCls[els[i]], cls);
1621 me.frameElementCls = frameElementCls;
1626 <span id='Ext-AbstractComponent-method-addUIToElement'> /**
1627 </span> * Method which adds a specified UI to the components element.
1630 addUIToElement: function(force) {
1632 frameElementCls = me.frameElementCls;
1634 me.addCls(me.baseCls + '-' + me.ui);
1636 if (me.frame && !Ext.supports.CSS3BorderRadius) {
1637 // define each element of the frame
1638 var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
1641 // loop through each of them, and if they are defined add the ui
1642 for (i = 0; i < els.length; i++) {
1643 el = me['frame' + els[i].toUpperCase()];
1644 cls = me.baseCls + '-' + me.ui + '-' + els[i];
1648 if (!Ext.Array.contains(frameElementCls[els[i]], cls)) {
1649 frameElementCls[els[i]].push(cls);
1656 <span id='Ext-AbstractComponent-method-removeUIFromElement'> /**
1657 </span> * Method which removes a specified UI from the components element.
1660 removeUIFromElement: function() {
1662 frameElementCls = me.frameElementCls;
1664 me.removeCls(me.baseCls + '-' + me.ui);
1666 if (me.frame && !Ext.supports.CSS3BorderRadius) {
1667 // define each element of the frame
1668 var els = ['tl', 'tc', 'tr', 'ml', 'mc', 'mr', 'bl', 'bc', 'br'],
1671 // loop through each of them, and if they are defined add the ui
1672 for (i = 0; i < els.length; i++) {
1673 el = me['frame' + els[i].toUpperCase()];
1674 cls = me.baseCls + '-' + me.ui + '-' + els[i];
1679 Ext.Array.remove(frameElementCls[els[i]], cls);
1685 getElConfig : function() {
1686 var result = this.autoEl || {tag: 'div'};
1687 result.id = this.id;
1691 <span id='Ext-AbstractComponent-method-getInsertPosition'> /**
1692 </span> * This function takes the position argument passed to onRender and returns a
1693 * DOM element that you can use in the insertBefore.
1694 * @param {String/Number/Element/HTMLElement} position Index, element id or element you want
1695 * to put this component before.
1696 * @return {HTMLElement} DOM element that you can use in the insertBefore
1698 getInsertPosition: function(position) {
1699 // Convert the position to an element to insert before
1700 if (position !== undefined) {
1701 if (Ext.isNumber(position)) {
1702 position = this.container.dom.childNodes[position];
1705 position = Ext.getDom(position);
1712 <span id='Ext-AbstractComponent-method-initContainer'> /**
1713 </span> * Adds ctCls to container.
1714 * @return {Ext.core.Element} The initialized container
1717 initContainer: function(container) {
1720 // If you render a component specifying the el, we get the container
1721 // of the el, and make sure we dont move the el around in the dom
1722 // during the render
1723 if (!container && me.el) {
1724 container = me.el.dom.parentNode;
1725 me.allowDomMove = false;
1728 me.container = Ext.get(container);
1731 me.container.addCls(me.ctCls);
1734 return me.container;
1737 <span id='Ext-AbstractComponent-method-initRenderData'> /**
1738 </span> * Initialized the renderData to be used when rendering the renderTpl.
1739 * @return {Object} Object with keys and values that are going to be applied to the renderTpl
1742 initRenderData: function() {
1745 return Ext.applyIf(me.renderData, {
1748 baseCls: me.baseCls,
1749 componentCls: me.componentCls,
1754 <span id='Ext-AbstractComponent-method-getTpl'> /**
1757 getTpl: function(name) {
1759 prototype = me.self.prototype,
1763 if (me.hasOwnProperty(name)) {
1765 if (tpl && !(tpl instanceof Ext.XTemplate)) {
1766 me[name] = Ext.ClassManager.dynInstantiate('Ext.XTemplate', tpl);
1772 if (!(prototype[name] instanceof Ext.XTemplate)) {
1773 ownerPrototype = prototype;
1776 if (ownerPrototype.hasOwnProperty(name)) {
1777 tpl = ownerPrototype[name];
1778 if (tpl && !(tpl instanceof Ext.XTemplate)) {
1779 ownerPrototype[name] = Ext.ClassManager.dynInstantiate('Ext.XTemplate', tpl);
1784 ownerPrototype = ownerPrototype.superclass;
1785 } while (ownerPrototype);
1788 return prototype[name];
1791 <span id='Ext-AbstractComponent-method-initRenderTpl'> /**
1792 </span> * Initializes the renderTpl.
1793 * @return {Ext.XTemplate} The renderTpl XTemplate instance.
1796 initRenderTpl: function() {
1797 return this.getTpl('renderTpl');
1800 <span id='Ext-AbstractComponent-method-initStyles'> /**
1801 </span> * Function description
1802 * @return {String} A CSS style string with style, padding, margin and border.
1805 initStyles: function() {
1808 Element = Ext.core.Element;
1810 if (Ext.isString(me.style)) {
1811 style = Element.parseStyles(me.style);
1813 style = Ext.apply({}, me.style);
1816 // Convert the padding, margin and border properties from a space seperated string
1817 // into a proper style string
1818 if (me.padding !== undefined) {
1819 style.padding = Element.unitizeBox((me.padding === true) ? 5 : me.padding);
1822 if (me.margin !== undefined) {
1823 style.margin = Element.unitizeBox((me.margin === true) ? 5 : me.margin);
1830 <span id='Ext-AbstractComponent-method-initContent'> /**
1831 </span> * Initializes this components contents. It checks for the properties
1832 * html, contentEl and tpl/data.
1835 initContent: function() {
1837 target = me.getTargetEl(),
1842 target.update(Ext.core.DomHelper.markup(me.html));
1847 contentEl = Ext.get(me.contentEl);
1848 pre = Ext.baseCSSPrefix;
1849 contentEl.removeCls([pre + 'hidden', pre + 'hide-display', pre + 'hide-offsets', pre + 'hide-nosize']);
1850 target.appendChild(contentEl.dom);
1854 // Make sure this.tpl is an instantiated XTemplate
1855 if (!me.tpl.isTemplate) {
1856 me.tpl = Ext.create('Ext.XTemplate', me.tpl);
1860 me.tpl[me.tplWriteMode](target, me.data);
1867 initEvents : function() {
1869 afterRenderEvents = me.afterRenderEvents,
1872 fn = function(listeners){
1873 me.mon(el, listeners);
1875 if (afterRenderEvents) {
1876 for (property in afterRenderEvents) {
1877 if (afterRenderEvents.hasOwnProperty(property)) {
1879 if (el && el.on) {
1880 Ext.each(afterRenderEvents[property], fn);
1887 <span id='Ext-AbstractComponent-method-applyRenderSelectors'> /**
1888 </span> * Sets references to elements inside the component. E.g body -> x-panel-body
1891 applyRenderSelectors: function() {
1892 var selectors = this.renderSelectors || {},
1896 for (selector in selectors) {
1897 if (selectors.hasOwnProperty(selector) && selectors[selector]) {
1898 this[selector] = Ext.get(Ext.DomQuery.selectNode(selectors[selector], el));
1903 <span id='Ext-AbstractComponent-method-is'> /**
1904 </span> * Tests whether this Component matches the selector string.
1905 * @param {String} selector The selector string to test against.
1906 * @return {Boolean} True if this Component matches the selector.
1908 is: function(selector) {
1909 return Ext.ComponentQuery.is(this, selector);
1912 <span id='Ext-AbstractComponent-method-up'> /**
1913 </span> * <p>Walks up the <code>ownerCt</code> axis looking for an ancestor Container which matches
1914 * the passed simple selector.</p>
1915 * <p>Example:<pre><code>
1916 var owningTabPanel = grid.up('tabpanel');
1917 </code></pre>
1918 * @param {String} selector Optional. The simple selector to test.
1919 * @return {Container} The matching ancestor Container (or <code>undefined</code> if no match was found).
1921 up: function(selector) {
1922 var result = this.ownerCt;
1924 for (; result; result = result.ownerCt) {
1925 if (Ext.ComponentQuery.is(result, selector)) {
1933 <span id='Ext-AbstractComponent-method-nextSibling'> /**
1934 </span> * <p>Returns the next sibling of this Component.</p>
1935 * <p>Optionally selects the next sibling which matches the passed {@link Ext.ComponentQuery ComponentQuery} selector.</p>
1936 * <p>May also be refered to as <code><b>next()</b></code></p>
1937 * <p>Note that this is limited to siblings, and if no siblings of the item match, <code>null</code> is returned. Contrast with {@link #nextNode}</p>
1938 * @param {String} selector Optional A {@link Ext.ComponentQuery ComponentQuery} selector to filter the following items.
1939 * @returns The next sibling (or the next sibling which matches the selector). Returns null if there is no matching sibling.
1941 nextSibling: function(selector) {
1942 var o = this.ownerCt, it, last, idx, c;
1945 idx = it.indexOf(this) + 1;
1948 for (last = it.getCount(); idx < last; idx++) {
1949 if ((c = it.getAt(idx)).is(selector)) {
1954 if (idx < it.getCount()) {
1955 return it.getAt(idx);
1963 <span id='Ext-AbstractComponent-method-previousSibling'> /**
1964 </span> * <p>Returns the previous sibling of this Component.</p>
1965 * <p>Optionally selects the previous sibling which matches the passed {@link Ext.ComponentQuery ComponentQuery} selector.</p>
1966 * <p>May also be refered to as <code><b>prev()</b></code></p>
1967 * <p>Note that this is limited to siblings, and if no siblings of the item match, <code>null</code> is returned. Contrast with {@link #previousNode}</p>
1968 * @param {String} selector Optional. A {@link Ext.ComponentQuery ComponentQuery} selector to filter the preceding items.
1969 * @returns The previous sibling (or the previous sibling which matches the selector). Returns null if there is no matching sibling.
1971 previousSibling: function(selector) {
1972 var o = this.ownerCt, it, idx, c;
1975 idx = it.indexOf(this);
1978 for (--idx; idx >= 0; idx--) {
1979 if ((c = it.getAt(idx)).is(selector)) {
1985 return it.getAt(--idx);
1993 <span id='Ext-AbstractComponent-method-previousNode'> /**
1994 </span> * <p>Returns the previous node in the Component tree in tree traversal order.</p>
1995 * <p>Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will
1996 * walk the tree in reverse order to attempt to find a match. Contrast with {@link #previousSibling}.</p>
1997 * @param {String} selector Optional. A {@link Ext.ComponentQuery ComponentQuery} selector to filter the preceding nodes.
1998 * @returns The previous node (or the previous node which matches the selector). Returns null if there is no matching node.
2000 previousNode: function(selector, includeSelf) {
2005 // If asked to include self, test me
2006 if (includeSelf && node.is(selector)) {
2010 result = this.prev(selector);
2016 for (it = node.ownerCt.items.items, i = Ext.Array.indexOf(it, node) - 1; i > -1; i--) {
2018 result = it[i].query(selector);
2019 result = result[result.length - 1];
2025 return node.ownerCt.previousNode(selector, true);
2029 <span id='Ext-AbstractComponent-method-nextNode'> /**
2030 </span> * <p>Returns the next node in the Component tree in tree traversal order.</p>
2031 * <p>Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will
2032 * walk the tree to attempt to find a match. Contrast with {@link #nextSibling}.</p>
2033 * @param {String} selector Optional A {@link Ext.ComponentQuery ComponentQuery} selector to filter the following nodes.
2034 * @returns The next node (or the next node which matches the selector). Returns null if there is no matching node.
2036 nextNode: function(selector, includeSelf) {
2041 // If asked to include self, test me
2042 if (includeSelf && node.is(selector)) {
2046 result = this.next(selector);
2052 for (it = node.ownerCt.items, i = it.indexOf(node) + 1, it = it.items, len = it.length; i < len; i++) {
2054 result = it[i].down(selector);
2060 return node.ownerCt.nextNode(selector);
2064 <span id='Ext-AbstractComponent-method-getId'> /**
2065 </span> * Retrieves the id of this component.
2066 * Will autogenerate an id if one has not already been set.
2068 getId : function() {
2069 return this.id || (this.id = 'ext-comp-' + (this.getAutoId()));
2072 getItemId : function() {
2073 return this.itemId || this.id;
2076 <span id='Ext-AbstractComponent-method-getEl'> /**
2077 </span> * Retrieves the top level element representing this component.
2079 getEl : function() {
2083 <span id='Ext-AbstractComponent-method-getTargetEl'> /**
2084 </span> * This is used to determine where to insert the 'html', 'contentEl' and 'items' in this component.
2087 getTargetEl: function() {
2088 return this.frameBody || this.el;
2091 <span id='Ext-AbstractComponent-method-isXType'> /**
2092 </span> * <p>Tests whether or not this Component is of a specific xtype. This can test whether this Component is descended
2093 * from the xtype (default) or whether it is directly of the xtype specified (shallow = true).</p>
2094 * <p><b>If using your own subclasses, be aware that a Component must register its own xtype
2095 * to participate in determination of inherited xtypes.</b></p>
2096 * <p>For a list of all available xtypes, see the {@link Ext.Component} header.</p>
2097 * <p>Example usage:</p>
2098 * <pre><code>
2099 var t = new Ext.form.field.Text();
2100 var isText = t.isXType('textfield'); // true
2101 var isBoxSubclass = t.isXType('field'); // true, descended from Ext.form.field.Base
2102 var isBoxInstance = t.isXType('field', true); // false, not a direct Ext.form.field.Base instance
2103 </code></pre>
2104 * @param {String} xtype The xtype to check for this Component
2105 * @param {Boolean} shallow (optional) False to check whether this Component is descended from the xtype (this is
2106 * the default), or true to check whether this Component is directly of the specified xtype.
2107 * @return {Boolean} True if this component descends from the specified xtype, false otherwise.
2109 isXType: function(xtype, shallow) {
2110 //assume a string by default
2111 if (Ext.isFunction(xtype)) {
2112 xtype = xtype.xtype;
2113 //handle being passed the class, e.g. Ext.Component
2114 } else if (Ext.isObject(xtype)) {
2115 xtype = xtype.statics().xtype;
2116 //handle being passed an instance
2119 return !shallow ? ('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1: this.self.xtype == xtype;
2122 <span id='Ext-AbstractComponent-method-getXTypes'> /**
2123 </span> * <p>Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all
2124 * available xtypes, see the {@link Ext.Component} header.</p>
2125 * <p><b>If using your own subclasses, be aware that a Component must register its own xtype
2126 * to participate in determination of inherited xtypes.</b></p>
2127 * <p>Example usage:</p>
2128 * <pre><code>
2129 var t = new Ext.form.field.Text();
2130 alert(t.getXTypes()); // alerts 'component/field/textfield'
2131 </code></pre>
2132 * @return {String} The xtype hierarchy string
2134 getXTypes: function() {
2135 var self = this.self,
2137 parentPrototype = this,
2141 while (parentPrototype && Ext.getClass(parentPrototype)) {
2142 xtype = Ext.getClass(parentPrototype).xtype;
2144 if (xtype !== undefined) {
2145 xtypes.unshift(xtype);
2148 parentPrototype = parentPrototype.superclass;
2151 self.xtypeChain = xtypes;
2152 self.xtypes = xtypes.join('/');
2158 <span id='Ext-AbstractComponent-method-update'> /**
2159 </span> * Update the content area of a component.
2160 * @param {Mixed} htmlOrData
2161 * If this component has been configured with a template via the tpl config
2162 * then it will use this argument as data to populate the template.
2163 * If this component was not configured with a template, the components
2164 * content area will be updated via Ext.core.Element update
2165 * @param {Boolean} loadScripts
2166 * (optional) Only legitimate when using the html configuration. Defaults to false
2167 * @param {Function} callback
2168 * (optional) Only legitimate when using the html configuration. Callback to execute when scripts have finished loading
2170 update : function(htmlOrData, loadScripts, cb) {
2173 if (me.tpl && !Ext.isString(htmlOrData)) {
2174 me.data = htmlOrData;
2176 me.tpl[me.tplWriteMode](me.getTargetEl(), htmlOrData || {});
2179 me.html = Ext.isObject(htmlOrData) ? Ext.core.DomHelper.markup(htmlOrData) : htmlOrData;
2181 me.getTargetEl().update(me.html, loadScripts, cb);
2186 me.doComponentLayout();
2190 <span id='Ext-AbstractComponent-method-setVisible'> /**
2191 </span> * Convenience function to hide or show this component by boolean.
2192 * @param {Boolean} visible True to show, false to hide
2193 * @return {Ext.Component} this
2195 setVisible : function(visible) {
2196 return this[visible ? 'show': 'hide']();
2199 <span id='Ext-AbstractComponent-method-isVisible'> /**
2200 </span> * Returns true if this component is visible.
2201 * @param {Boolean} deep. <p>Optional. Pass <code>true</code> to interrogate the visibility status of all
2202 * parent Containers to determine whether this Component is truly visible to the user.</p>
2203 * <p>Generally, to determine whether a Component is hidden, the no argument form is needed. For example
2204 * when creating dynamically laid out UIs in a hidden Container before showing them.</p>
2205 * @return {Boolean} True if this component is visible, false otherwise.
2207 isVisible: function(deep) {
2210 visible = !me.hidden,
2211 ancestor = me.ownerCt;
2213 // Clear hiddenOwnerCt property
2214 me.hiddenAncestor = false;
2219 if (deep && visible && me.rendered && ancestor) {
2221 // If any ancestor is hidden, then this is hidden.
2222 // If an ancestor Panel (only Panels have a collapse method) is collapsed,
2223 // then its layoutTarget (body) is hidden, so this is hidden unless its within a
2224 // docked item; they are still visible when collapsed (Unless they themseves are hidden)
2225 if (ancestor.hidden || (ancestor.collapsed &&
2226 !(ancestor.getDockedItems && Ext.Array.contains(ancestor.getDockedItems(), child)))) {
2227 // Store hiddenOwnerCt property if needed
2228 me.hiddenAncestor = ancestor;
2233 ancestor = ancestor.ownerCt;
2239 <span id='Ext-AbstractComponent-method-enable'> /**
2240 </span> * Enable the component
2241 * @param {Boolean} silent
2242 * Passing false will supress the 'enable' event from being fired.
2244 enable: function(silent) {
2248 me.el.removeCls(me.disabledCls);
2249 me.el.dom.disabled = false;
2253 me.disabled = false;
2255 if (silent !== true) {
2256 me.fireEvent('enable', me);
2262 <span id='Ext-AbstractComponent-method-disable'> /**
2263 </span> * Disable the component.
2264 * @param {Boolean} silent
2265 * Passing true, will supress the 'disable' event from being fired.
2267 disable: function(silent) {
2271 me.el.addCls(me.disabledCls);
2272 me.el.dom.disabled = true;
2278 if (silent !== true) {
2279 me.fireEvent('disable', me);
2286 onEnable: function() {
2287 if (this.maskOnDisable) {
2293 onDisable : function() {
2294 if (this.maskOnDisable) {
2299 <span id='Ext-AbstractComponent-method-isDisabled'> /**
2300 </span> * Method to determine whether this Component is currently disabled.
2301 * @return {Boolean} the disabled state of this Component.
2303 isDisabled : function() {
2304 return this.disabled;
2307 <span id='Ext-AbstractComponent-method-setDisabled'> /**
2308 </span> * Enable or disable the component.
2309 * @param {Boolean} disabled
2311 setDisabled : function(disabled) {
2312 return this[disabled ? 'disable': 'enable']();
2315 <span id='Ext-AbstractComponent-method-isHidden'> /**
2316 </span> * Method to determine whether this Component is currently set to hidden.
2317 * @return {Boolean} the hidden state of this Component.
2319 isHidden : function() {
2323 <span id='Ext-AbstractComponent-method-addCls'> /**
2324 </span> * Adds a CSS class to the top level element representing this component.
2325 * @param {String} cls The CSS class name to add
2326 * @return {Ext.Component} Returns the Component to allow method chaining.
2328 addCls : function(className) {
2333 if (!Ext.isArray(className)){
2334 className = className.replace(me.trimRe, '').split(me.spacesRe);
2337 me.el.addCls(className);
2340 me.additionalCls = Ext.Array.unique(me.additionalCls.concat(className));
2345 <span id='Ext-AbstractComponent-method-addClass'> /**
2346 </span> * @deprecated 4.0 Replaced by {@link #addCls}
2347 * Adds a CSS class to the top level element representing this component.
2348 * @param {String} cls The CSS class name to add
2349 * @return {Ext.Component} Returns the Component to allow method chaining.
2351 addClass : function() {
2352 return this.addCls.apply(this, arguments);
2355 <span id='Ext-AbstractComponent-method-removeCls'> /**
2356 </span> * Removes a CSS class from the top level element representing this component.
2357 * @returns {Ext.Component} Returns the Component to allow method chaining.
2359 removeCls : function(className) {
2365 if (!Ext.isArray(className)){
2366 className = className.replace(me.trimRe, '').split(me.spacesRe);
2369 me.el.removeCls(className);
2371 else if (me.additionalCls.length) {
2372 Ext.each(className, function(cls) {
2373 Ext.Array.remove(me.additionalCls, cls);
2380 removeClass : function() {
2381 if (Ext.isDefined(Ext.global.console)) {
2382 Ext.global.console.warn('Ext.Component: removeClass has been deprecated. Please use removeCls.');
2384 return this.removeCls.apply(this, arguments);
2388 addOverCls: function() {
2391 me.el.addCls(me.overCls);
2395 removeOverCls: function() {
2396 this.el.removeCls(this.overCls);
2399 addListener : function(element, listeners, scope, options) {
2404 if (Ext.isString(element) && (Ext.isObject(listeners) || options && options.element)) {
2405 if (options.element) {
2409 listeners[element] = fn;
2410 element = options.element;
2412 listeners.scope = scope;
2415 for (option in options) {
2416 if (options.hasOwnProperty(option)) {
2417 if (me.eventOptionsRe.test(option)) {
2418 listeners[option] = options[option];
2424 // At this point we have a variable called element,
2425 // and a listeners object that can be passed to on
2426 if (me[element] && me[element].on) {
2427 me.mon(me[element], listeners);
2429 me.afterRenderEvents = me.afterRenderEvents || {};
2430 if (!me.afterRenderEvents[element]) {
2431 me.afterRenderEvents[element] = [];
2433 me.afterRenderEvents[element].push(listeners);
2437 return me.mixins.observable.addListener.apply(me, arguments);
2441 removeManagedListenerItem: function(isClear, managedListener, item, ename, fn, scope){
2443 element = managedListener.options ? managedListener.options.element : null;
2446 element = me[element];
2447 if (element && element.un) {
2448 if (isClear || (managedListener.item === item && managedListener.ename === ename && (!fn || managedListener.fn === fn) && (!scope || managedListener.scope === scope))) {
2449 element.un(managedListener.ename, managedListener.fn, managedListener.scope);
2451 Ext.Array.remove(me.managedListeners, managedListener);
2456 return me.mixins.observable.removeManagedListenerItem.apply(me, arguments);
2460 <span id='Ext-AbstractComponent-method-getBubbleTarget'> /**
2461 </span> * Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy.
2462 * @return {Ext.container.Container} the Container which owns this Component.
2464 getBubbleTarget : function() {
2465 return this.ownerCt;
2468 <span id='Ext-AbstractComponent-method-isFloating'> /**
2469 </span> * Method to determine whether this Component is floating.
2470 * @return {Boolean} the floating state of this component.
2472 isFloating : function() {
2473 return this.floating;
2476 <span id='Ext-AbstractComponent-method-isDraggable'> /**
2477 </span> * Method to determine whether this Component is draggable.
2478 * @return {Boolean} the draggable state of this component.
2480 isDraggable : function() {
2481 return !!this.draggable;
2484 <span id='Ext-AbstractComponent-method-isDroppable'> /**
2485 </span> * Method to determine whether this Component is droppable.
2486 * @return {Boolean} the droppable state of this component.
2488 isDroppable : function() {
2489 return !!this.droppable;
2492 <span id='Ext-AbstractComponent-method-onAdded'> /**
2494 * Method to manage awareness of when components are added to their
2495 * respective Container, firing an added event.
2496 * References are established at add time rather than at render time.
2497 * @param {Ext.container.Container} container Container which holds the component
2498 * @param {number} pos Position at which the component was added
2500 onAdded : function(container, pos) {
2501 this.ownerCt = container;
2502 this.fireEvent('added', this, container, pos);
2505 <span id='Ext-AbstractComponent-method-onRemoved'> /**
2507 * Method to manage awareness of when components are removed from their
2508 * respective Container, firing an removed event. References are properly
2509 * cleaned up after removing a component from its owning container.
2511 onRemoved : function() {
2514 me.fireEvent('removed', me, me.ownerCt);
2519 beforeDestroy : Ext.emptyFn,
2522 onResize : Ext.emptyFn,
2524 <span id='Ext-AbstractComponent-method-setSize'> /**
2525 </span> * Sets the width and height of this Component. This method fires the {@link #resize} event. This method can accept
2526 * either width and height as separate arguments, or you can pass a size object like <code>{width:10, height:20}</code>.
2527 * @param {Mixed} width The new width to set. This may be one of:<div class="mdetail-params"><ul>
2528 * <li>A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.core.Element#defaultUnit}s (by default, pixels).</li>
2529 * <li>A String used to set the CSS width style.</li>
2530 * <li>A size object in the format <code>{width: widthValue, height: heightValue}</code>.</li>
2531 * <li><code>undefined</code> to leave the width unchanged.</li>
2532 * </ul></div>
2533 * @param {Mixed} height The new height to set (not required if a size object is passed as the first arg).
2534 * This may be one of:<div class="mdetail-params"><ul>
2535 * <li>A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.core.Element#defaultUnit}s (by default, pixels).</li>
2536 * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
2537 * <li><code>undefined</code> to leave the height unchanged.</li>
2538 * </ul></div>
2539 * @return {Ext.Component} this
2541 setSize : function(width, height) {
2545 // support for standard size objects
2546 if (Ext.isObject(width)) {
2547 height = width.height;
2548 width = width.width;
2551 // Constrain within configured maxima
2552 if (Ext.isNumber(width)) {
2553 width = Ext.Number.constrain(width, me.minWidth, me.maxWidth);
2555 if (Ext.isNumber(height)) {
2556 height = Ext.Number.constrain(height, me.minHeight, me.maxHeight);
2559 if (!me.rendered || !me.isVisible()) {
2560 // If an ownerCt is hidden, add my reference onto the layoutOnShow stack. Set the needsLayout flag.
2561 if (me.hiddenAncestor) {
2562 layoutCollection = me.hiddenAncestor.layoutOnShow;
2563 layoutCollection.remove(me);
2564 layoutCollection.add(me);
2572 me.width = (width !== undefined) ? width : me.width;
2573 me.height = (height !== undefined) ? height : me.height;
2577 me.doComponentLayout(width, height, true);
2582 isFixedWidth: function() {
2584 layoutManagedWidth = me.layoutManagedWidth;
2586 if (Ext.isDefined(me.width) || layoutManagedWidth == 1) {
2589 if (layoutManagedWidth == 2) {
2592 return (me.ownerCt && me.ownerCt.isFixedWidth());
2595 isFixedHeight: function() {
2597 layoutManagedHeight = me.layoutManagedHeight;
2599 if (Ext.isDefined(me.height) || layoutManagedHeight == 1) {
2602 if (layoutManagedHeight == 2) {
2605 return (me.ownerCt && me.ownerCt.isFixedHeight());
2608 setCalculatedSize : function(width, height, callingContainer) {
2612 // support for standard size objects
2613 if (Ext.isObject(width)) {
2614 callingContainer = width.ownerCt;
2615 height = width.height;
2616 width = width.width;
2619 // Constrain within configured maxima
2620 if (Ext.isNumber(width)) {
2621 width = Ext.Number.constrain(width, me.minWidth, me.maxWidth);
2623 if (Ext.isNumber(height)) {
2624 height = Ext.Number.constrain(height, me.minHeight, me.maxHeight);
2627 if (!me.rendered || !me.isVisible()) {
2628 // If an ownerCt is hidden, add my reference onto the layoutOnShow stack. Set the needsLayout flag.
2629 if (me.hiddenAncestor) {
2630 layoutCollection = me.hiddenAncestor.layoutOnShow;
2631 layoutCollection.remove(me);
2632 layoutCollection.add(me);
2638 ownerCt: callingContainer
2642 me.doComponentLayout(width, height, false, callingContainer);
2647 <span id='Ext-AbstractComponent-method-doComponentLayout'> /**
2648 </span> * This method needs to be called whenever you change something on this component that requires the Component's
2649 * layout to be recalculated.
2650 * @return {Ext.container.Container} this
2652 doComponentLayout : function(width, height, isSetSize, callingContainer) {
2654 componentLayout = me.getComponentLayout(),
2655 lastComponentSize = componentLayout.lastComponentSize || {
2660 // collapsed state is not relevant here, so no testing done.
2661 // Only Panels have a collapse method, and that just sets the width/height such that only
2662 // a single docked Header parallel to the collapseTo side are visible, and the Panel body is hidden.
2663 if (me.rendered && componentLayout) {
2666 // If no width passed, then only insert a value if the Component is NOT ALLOWED to autowidth itself.
2667 if (!Ext.isDefined(width)) {
2668 if (me.isFixedWidth()) {
2669 width = Ext.isDefined(me.width) ? me.width : lastComponentSize.width;
2673 // If no height passed, then only insert a value if the Component is NOT ALLOWED to autoheight itself.
2674 if (!Ext.isDefined(height)) {
2675 if (me.isFixedHeight()) {
2676 height = Ext.isDefined(me.height) ? me.height : lastComponentSize.height;
2685 componentLayout.layout(width, height, isSetSize, callingContainer);
2690 <span id='Ext-AbstractComponent-method-forceComponentLayout'> /**
2691 </span> * Forces this component to redo its componentLayout.
2693 forceComponentLayout: function () {
2694 this.doComponentLayout();
2698 setComponentLayout : function(layout) {
2699 var currentLayout = this.componentLayout;
2700 if (currentLayout && currentLayout.isLayout && currentLayout != layout) {
2701 currentLayout.setOwner(null);
2703 this.componentLayout = layout;
2704 layout.setOwner(this);
2707 getComponentLayout : function() {
2710 if (!me.componentLayout || !me.componentLayout.isLayout) {
2711 me.setComponentLayout(Ext.layout.Layout.create(me.componentLayout, 'autocomponent'));
2713 return me.componentLayout;
2716 <span id='Ext-AbstractComponent-method-afterComponentLayout'> /**
2717 </span> * @param {Number} adjWidth The box-adjusted width that was set
2718 * @param {Number} adjHeight The box-adjusted height that was set
2719 * @param {Boolean} isSetSize Whether or not the height/width are stored on the component permanently
2720 * @param {Ext.Component} callingContainer Container requesting the layout. Only used when isSetSize is false.
2722 afterComponentLayout: function(width, height, isSetSize, callingContainer) {
2723 this.fireEvent('resize', this, width, height);
2726 <span id='Ext-AbstractComponent-method-beforeComponentLayout'> /**
2727 </span> * Occurs before componentLayout is run. Returning false from this method will prevent the componentLayout
2728 * from being executed.
2729 * @param {Number} adjWidth The box-adjusted width that was set
2730 * @param {Number} adjHeight The box-adjusted height that was set
2731 * @param {Boolean} isSetSize Whether or not the height/width are stored on the component permanently
2732 * @param {Ext.Component} callingContainer Container requesting sent the layout. Only used when isSetSize is false.
2734 beforeComponentLayout: function(width, height, isSetSize, callingContainer) {
2738 <span id='Ext-AbstractComponent-method-setPosition'> /**
2739 </span> * Sets the left and top of the component. To set the page XY position instead, use
2740 * {@link Ext.Component#setPagePosition setPagePosition}.
2741 * This method fires the {@link #move} event.
2742 * @param {Number} left The new left
2743 * @param {Number} top The new top
2744 * @return {Ext.Component} this
2746 setPosition : function(x, y) {
2749 if (Ext.isObject(x)) {
2758 if (x !== undefined || y !== undefined) {
2760 me.onPosition(x, y);
2761 me.fireEvent('move', me, x, y);
2767 * Called after the component is moved, this method is empty by default but can be implemented by any
2768 * subclass that needs to perform custom logic after a move occurs.
2769 * @param {Number} x The new x position
2770 * @param {Number} y The new y position
2772 onPosition: Ext.emptyFn,
2774 <span id='Ext-AbstractComponent-method-setWidth'> /**
2775 </span> * Sets the width of the component. This method fires the {@link #resize} event.
2776 * @param {Number} width The new width to setThis may be one of:<div class="mdetail-params"><ul>
2777 * <li>A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.core.Element#defaultUnit}s (by default, pixels).</li>
2778 * <li>A String used to set the CSS width style.</li>
2779 * </ul></div>
2780 * @return {Ext.Component} this
2782 setWidth : function(width) {
2783 return this.setSize(width);
2786 <span id='Ext-AbstractComponent-method-setHeight'> /**
2787 </span> * Sets the height of the component. This method fires the {@link #resize} event.
2788 * @param {Number} height The new height to set. This may be one of:<div class="mdetail-params"><ul>
2789 * <li>A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.core.Element#defaultUnit}s (by default, pixels).</li>
2790 * <li>A String used to set the CSS height style.</li>
2791 * <li><i>undefined</i> to leave the height unchanged.</li>
2792 * </ul></div>
2793 * @return {Ext.Component} this
2795 setHeight : function(height) {
2796 return this.setSize(undefined, height);
2799 <span id='Ext-AbstractComponent-method-getSize'> /**
2800 </span> * Gets the current size of the component's underlying element.
2801 * @return {Object} An object containing the element's size {width: (element width), height: (element height)}
2803 getSize : function() {
2804 return this.el.getSize();
2807 <span id='Ext-AbstractComponent-method-getWidth'> /**
2808 </span> * Gets the current width of the component's underlying element.
2811 getWidth : function() {
2812 return this.el.getWidth();
2815 <span id='Ext-AbstractComponent-method-getHeight'> /**
2816 </span> * Gets the current height of the component's underlying element.
2819 getHeight : function() {
2820 return this.el.getHeight();
2823 <span id='Ext-AbstractComponent-method-getLoader'> /**
2824 </span> * Gets the {@link Ext.ComponentLoader} for this Component.
2825 * @return {Ext.ComponentLoader} The loader instance, null if it doesn't exist.
2827 getLoader: function(){
2829 autoLoad = me.autoLoad ? (Ext.isObject(me.autoLoad) ? me.autoLoad : {url: me.autoLoad}) : null,
2830 loader = me.loader || autoLoad;
2833 if (!loader.isLoader) {
2834 me.loader = Ext.create('Ext.ComponentLoader', Ext.apply({
2839 loader.setTarget(me);
2847 <span id='Ext-AbstractComponent-method-setLoading'> /**
2848 </span> * This method allows you to show or hide a LoadMask on top of this component.
2849 * @param {Boolean/Object/String} load True to show the default LoadMask, a config object
2850 * that will be passed to the LoadMask constructor, or a message String to show. False to
2851 * hide the current LoadMask.
2852 * @param {Boolean} targetEl True to mask the targetEl of this Component instead of the this.el.
2853 * For example, setting this to true on a Panel will cause only the body to be masked. (defaults to false)
2854 * @return {Ext.LoadMask} The LoadMask instance that has just been shown.
2856 setLoading : function(load, targetEl) {
2861 if (load !== false && !me.collapsed) {
2862 if (Ext.isObject(load)) {
2865 else if (Ext.isString(load)) {
2866 config = {msg: load};
2871 me.loadMask = me.loadMask || Ext.create('Ext.LoadMask', targetEl ? me.getTargetEl() : me.el, config);
2873 } else if (me.loadMask) {
2874 Ext.destroy(me.loadMask);
2882 <span id='Ext-AbstractComponent-method-setDocked'> /**
2883 </span> * Sets the dock position of this component in its parent panel. Note that
2884 * this only has effect if this item is part of the dockedItems collection
2885 * of a parent that has a DockLayout (note that any Panel has a DockLayout
2887 * @return {Component} this
2889 setDocked : function(dock, layoutParent) {
2893 if (layoutParent && me.ownerCt && me.rendered) {
2894 me.ownerCt.doComponentLayout();
2899 onDestroy : function() {
2902 if (me.monitorResize && Ext.EventManager.resizeEvent) {
2903 Ext.EventManager.resizeEvent.removeListener(me.setSize, me);
2905 Ext.destroy(me.componentLayout, me.loadMask);
2908 <span id='Ext-AbstractComponent-method-destroy'> /**
2909 </span> * Destroys the Component.
2911 destroy : function() {
2914 if (!me.isDestroyed) {
2915 if (me.fireEvent('beforedestroy', me) !== false) {
2916 me.destroying = true;
2920 delete me.floatParent;
2921 // A zIndexManager is stamped into a *floating* Component when it is added to a Container.
2922 // If it has no zIndexManager at render time, it is assigned to the global Ext.WindowManager instance.
2923 if (me.zIndexManager) {
2924 me.zIndexManager.unregister(me);
2926 } else if (me.ownerCt && me.ownerCt.remove) {
2927 me.ownerCt.remove(me, false);
2932 // Attempt to destroy all plugins
2933 Ext.destroy(me.plugins);
2939 Ext.ComponentManager.unregister(me);
2940 me.fireEvent('destroy', me);
2942 me.mixins.state.destroy.call(me);
2944 me.clearListeners();
2945 me.destroying = false;
2946 me.isDestroyed = true;
2951 <span id='Ext-AbstractComponent-method-getPlugin'> /**
2952 </span> * Retrieves a plugin by its pluginId which has been bound to this
2954 * @returns {Ext.AbstractPlugin} pluginInstance
2956 getPlugin: function(pluginId) {
2958 plugins = this.plugins,
2959 ln = plugins.length;
2960 for (; i < ln; i++) {
2961 if (plugins[i].pluginId === pluginId) {
2967 <span id='Ext-AbstractComponent-method-isDescendantOf'> /**
2968 </span> * Determines whether this component is the descendant of a particular container.
2969 * @param {Ext.Container} container
2970 * @returns {Boolean} isDescendant
2972 isDescendantOf: function(container) {
2973 return !!this.findParentBy(function(p){
2974 return p === container;
2980 prev: 'previousSibling',