Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1811 lines
74 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.Component"></div>/**
  16. * @class Ext.Component
  17. * @extends Ext.util.Observable
  18. * <p>Base class for all Ext components. All subclasses of Component may participate in the automated
  19. * Ext component lifecycle of creation, rendering and destruction which is provided by the {@link Ext.Container Container} class.
  20. * Components may be added to a Container through the {@link Ext.Container#items items} config option at the time the Container is created,
  21. * or they may be added dynamically via the {@link Ext.Container#add add} method.</p>
  22. * <p>The Component base class has built-in support for basic hide/show and enable/disable behavior.</p>
  23. * <p>All Components are registered with the {@link Ext.ComponentMgr} on construction so that they can be referenced at any time via
  24. * {@link Ext#getCmp}, passing the {@link #id}.</p>
  25. * <p>All user-developed visual widgets that are required to participate in automated lifecycle and size management should subclass Component (or
  26. * {@link Ext.BoxComponent} if managed box model handling is required, ie height and width management).</p>
  27. * <p>See the <a href="http://extjs.com/learn/Tutorial:Creating_new_UI_controls">Creating new UI controls</a> tutorial for details on how
  28. * and to either extend or augment ExtJs base classes to create custom Components.</p>
  29. * <p>Every component has a specific xtype, which is its Ext-specific type name, along with methods for checking the
  30. * xtype like {@link #getXType} and {@link #isXType}. This is the list of all valid xtypes:</p>
  31. * <pre>
  32. xtype Class
  33. ------------- ------------------
  34. box {@link Ext.BoxComponent}
  35. button {@link Ext.Button}
  36. buttongroup {@link Ext.ButtonGroup}
  37. colorpalette {@link Ext.ColorPalette}
  38. component {@link Ext.Component}
  39. container {@link Ext.Container}
  40. cycle {@link Ext.CycleButton}
  41. dataview {@link Ext.DataView}
  42. datepicker {@link Ext.DatePicker}
  43. editor {@link Ext.Editor}
  44. editorgrid {@link Ext.grid.EditorGridPanel}
  45. flash {@link Ext.FlashComponent}
  46. grid {@link Ext.grid.GridPanel}
  47. listview {@link Ext.ListView}
  48. multislider {@link Ext.slider.MultiSlider}
  49. panel {@link Ext.Panel}
  50. progress {@link Ext.ProgressBar}
  51. propertygrid {@link Ext.grid.PropertyGrid}
  52. slider {@link Ext.slider.SingleSlider}
  53. spacer {@link Ext.Spacer}
  54. splitbutton {@link Ext.SplitButton}
  55. tabpanel {@link Ext.TabPanel}
  56. treepanel {@link Ext.tree.TreePanel}
  57. viewport {@link Ext.ViewPort}
  58. window {@link Ext.Window}
  59. Toolbar components
  60. ---------------------------------------
  61. paging {@link Ext.PagingToolbar}
  62. toolbar {@link Ext.Toolbar}
  63. tbbutton {@link Ext.Toolbar.Button} (deprecated; use button)
  64. tbfill {@link Ext.Toolbar.Fill}
  65. tbitem {@link Ext.Toolbar.Item}
  66. tbseparator {@link Ext.Toolbar.Separator}
  67. tbspacer {@link Ext.Toolbar.Spacer}
  68. tbsplit {@link Ext.Toolbar.SplitButton} (deprecated; use splitbutton)
  69. tbtext {@link Ext.Toolbar.TextItem}
  70. Menu components
  71. ---------------------------------------
  72. menu {@link Ext.menu.Menu}
  73. colormenu {@link Ext.menu.ColorMenu}
  74. datemenu {@link Ext.menu.DateMenu}
  75. menubaseitem {@link Ext.menu.BaseItem}
  76. menucheckitem {@link Ext.menu.CheckItem}
  77. menuitem {@link Ext.menu.Item}
  78. menuseparator {@link Ext.menu.Separator}
  79. menutextitem {@link Ext.menu.TextItem}
  80. Form components
  81. ---------------------------------------
  82. form {@link Ext.form.FormPanel}
  83. checkbox {@link Ext.form.Checkbox}
  84. checkboxgroup {@link Ext.form.CheckboxGroup}
  85. combo {@link Ext.form.ComboBox}
  86. compositefield {@link Ext.form.CompositeField}
  87. datefield {@link Ext.form.DateField}
  88. displayfield {@link Ext.form.DisplayField}
  89. field {@link Ext.form.Field}
  90. fieldset {@link Ext.form.FieldSet}
  91. hidden {@link Ext.form.Hidden}
  92. htmleditor {@link Ext.form.HtmlEditor}
  93. label {@link Ext.form.Label}
  94. numberfield {@link Ext.form.NumberField}
  95. radio {@link Ext.form.Radio}
  96. radiogroup {@link Ext.form.RadioGroup}
  97. textarea {@link Ext.form.TextArea}
  98. textfield {@link Ext.form.TextField}
  99. timefield {@link Ext.form.TimeField}
  100. trigger {@link Ext.form.TriggerField}
  101. Chart components
  102. ---------------------------------------
  103. chart {@link Ext.chart.Chart}
  104. barchart {@link Ext.chart.BarChart}
  105. cartesianchart {@link Ext.chart.CartesianChart}
  106. columnchart {@link Ext.chart.ColumnChart}
  107. linechart {@link Ext.chart.LineChart}
  108. piechart {@link Ext.chart.PieChart}
  109. Store xtypes
  110. ---------------------------------------
  111. arraystore {@link Ext.data.ArrayStore}
  112. directstore {@link Ext.data.DirectStore}
  113. groupingstore {@link Ext.data.GroupingStore}
  114. jsonstore {@link Ext.data.JsonStore}
  115. simplestore {@link Ext.data.SimpleStore} (deprecated; use arraystore)
  116. store {@link Ext.data.Store}
  117. xmlstore {@link Ext.data.XmlStore}
  118. </pre>
  119. * @constructor
  120. * @param {Ext.Element/String/Object} config The configuration options may be specified as either:
  121. * <div class="mdetail-params"><ul>
  122. * <li><b>an element</b> :
  123. * <p class="sub-desc">it is set as the internal element and its id used as the component id</p></li>
  124. * <li><b>a string</b> :
  125. * <p class="sub-desc">it is assumed to be the id of an existing element and is used as the component id</p></li>
  126. * <li><b>anything else</b> :
  127. * <p class="sub-desc">it is assumed to be a standard config object and is applied to the component</p></li>
  128. * </ul></div>
  129. */
  130. Ext.Component = function(config){
  131. config = config || {};
  132. if(config.initialConfig){
  133. if(config.isAction){ // actions
  134. this.baseAction = config;
  135. }
  136. config = config.initialConfig; // component cloning / action set up
  137. }else if(config.tagName || config.dom || Ext.isString(config)){ // element object
  138. config = {applyTo: config, id: config.id || config};
  139. }
  140. <div id="prop-Ext.Component-initialConfig"></div>/**
  141. * This Component's initial configuration specification. Read-only.
  142. * @type Object
  143. * @property initialConfig
  144. */
  145. this.initialConfig = config;
  146. Ext.apply(this, config);
  147. this.addEvents(
  148. <div id="event-Ext.Component-added"></div>/**
  149. * @event added
  150. * Fires when a component is added to an Ext.Container
  151. * @param {Ext.Component} this
  152. * @param {Ext.Container} ownerCt Container which holds the component
  153. * @param {number} index Position at which the component was added
  154. */
  155. 'added',
  156. <div id="event-Ext.Component-disable"></div>/**
  157. * @event disable
  158. * Fires after the component is disabled.
  159. * @param {Ext.Component} this
  160. */
  161. 'disable',
  162. <div id="event-Ext.Component-enable"></div>/**
  163. * @event enable
  164. * Fires after the component is enabled.
  165. * @param {Ext.Component} this
  166. */
  167. 'enable',
  168. <div id="event-Ext.Component-beforeshow"></div>/**
  169. * @event beforeshow
  170. * Fires before the component is shown by calling the {@link #show} method.
  171. * Return false from an event handler to stop the show.
  172. * @param {Ext.Component} this
  173. */
  174. 'beforeshow',
  175. <div id="event-Ext.Component-show"></div>/**
  176. * @event show
  177. * Fires after the component is shown when calling the {@link #show} method.
  178. * @param {Ext.Component} this
  179. */
  180. 'show',
  181. <div id="event-Ext.Component-beforehide"></div>/**
  182. * @event beforehide
  183. * Fires before the component is hidden by calling the {@link #hide} method.
  184. * Return false from an event handler to stop the hide.
  185. * @param {Ext.Component} this
  186. */
  187. 'beforehide',
  188. <div id="event-Ext.Component-hide"></div>/**
  189. * @event hide
  190. * Fires after the component is hidden.
  191. * Fires after the component is hidden when calling the {@link #hide} method.
  192. * @param {Ext.Component} this
  193. */
  194. 'hide',
  195. <div id="event-Ext.Component-removed"></div>/**
  196. * @event removed
  197. * Fires when a component is removed from an Ext.Container
  198. * @param {Ext.Component} this
  199. * @param {Ext.Container} ownerCt Container which holds the component
  200. */
  201. 'removed',
  202. <div id="event-Ext.Component-beforerender"></div>/**
  203. * @event beforerender
  204. * Fires before the component is {@link #rendered}. Return false from an
  205. * event handler to stop the {@link #render}.
  206. * @param {Ext.Component} this
  207. */
  208. 'beforerender',
  209. <div id="event-Ext.Component-render"></div>/**
  210. * @event render
  211. * Fires after the component markup is {@link #rendered}.
  212. * @param {Ext.Component} this
  213. */
  214. 'render',
  215. <div id="event-Ext.Component-afterrender"></div>/**
  216. * @event afterrender
  217. * <p>Fires after the component rendering is finished.</p>
  218. * <p>The afterrender event is fired after this Component has been {@link #rendered}, been postprocesed
  219. * by any afterRender method defined for the Component, and, if {@link #stateful}, after state
  220. * has been restored.</p>
  221. * @param {Ext.Component} this
  222. */
  223. 'afterrender',
  224. <div id="event-Ext.Component-beforedestroy"></div>/**
  225. * @event beforedestroy
  226. * Fires before the component is {@link #destroy}ed. Return false from an event handler to stop the {@link #destroy}.
  227. * @param {Ext.Component} this
  228. */
  229. 'beforedestroy',
  230. <div id="event-Ext.Component-destroy"></div>/**
  231. * @event destroy
  232. * Fires after the component is {@link #destroy}ed.
  233. * @param {Ext.Component} this
  234. */
  235. 'destroy',
  236. <div id="event-Ext.Component-beforestaterestore"></div>/**
  237. * @event beforestaterestore
  238. * Fires before the state of the component is restored. Return false from an event handler to stop the restore.
  239. * @param {Ext.Component} this
  240. * @param {Object} state The hash of state values returned from the StateProvider. If this
  241. * event is not vetoed, then the state object is passed to <b><tt>applyState</tt></b>. By default,
  242. * that simply copies property values into this Component. The method maybe overriden to
  243. * provide custom state restoration.
  244. */
  245. 'beforestaterestore',
  246. <div id="event-Ext.Component-staterestore"></div>/**
  247. * @event staterestore
  248. * Fires after the state of the component is restored.
  249. * @param {Ext.Component} this
  250. * @param {Object} state The hash of state values returned from the StateProvider. This is passed
  251. * to <b><tt>applyState</tt></b>. By default, that simply copies property values into this
  252. * Component. The method maybe overriden to provide custom state restoration.
  253. */
  254. 'staterestore',
  255. <div id="event-Ext.Component-beforestatesave"></div>/**
  256. * @event beforestatesave
  257. * Fires before the state of the component is saved to the configured state provider. Return false to stop the save.
  258. * @param {Ext.Component} this
  259. * @param {Object} state The hash of state values. This is determined by calling
  260. * <b><tt>getState()</tt></b> on the Component. This method must be provided by the
  261. * developer to return whetever representation of state is required, by default, Ext.Component
  262. * has a null implementation.
  263. */
  264. 'beforestatesave',
  265. <div id="event-Ext.Component-statesave"></div>/**
  266. * @event statesave
  267. * Fires after the state of the component is saved to the configured state provider.
  268. * @param {Ext.Component} this
  269. * @param {Object} state The hash of state values. This is determined by calling
  270. * <b><tt>getState()</tt></b> on the Component. This method must be provided by the
  271. * developer to return whetever representation of state is required, by default, Ext.Component
  272. * has a null implementation.
  273. */
  274. 'statesave'
  275. );
  276. this.getId();
  277. Ext.ComponentMgr.register(this);
  278. Ext.Component.superclass.constructor.call(this);
  279. if(this.baseAction){
  280. this.baseAction.addComponent(this);
  281. }
  282. this.initComponent();
  283. if(this.plugins){
  284. if(Ext.isArray(this.plugins)){
  285. for(var i = 0, len = this.plugins.length; i < len; i++){
  286. this.plugins[i] = this.initPlugin(this.plugins[i]);
  287. }
  288. }else{
  289. this.plugins = this.initPlugin(this.plugins);
  290. }
  291. }
  292. if(this.stateful !== false){
  293. this.initState();
  294. }
  295. if(this.applyTo){
  296. this.applyToMarkup(this.applyTo);
  297. delete this.applyTo;
  298. }else if(this.renderTo){
  299. this.render(this.renderTo);
  300. delete this.renderTo;
  301. }
  302. };
  303. // private
  304. Ext.Component.AUTO_ID = 1000;
  305. Ext.extend(Ext.Component, Ext.util.Observable, {
  306. // Configs below are used for all Components when rendered by FormLayout.
  307. <div id="cfg-Ext.Component-fieldLabel"></div>/**
  308. * @cfg {String} fieldLabel <p>The label text to display next to this Component (defaults to '').</p>
  309. * <br><p><b>Note</b>: this config is only used when this Component is rendered by a Container which
  310. * has been configured to use the <b>{@link Ext.layout.FormLayout FormLayout}</b> layout manager (e.g.
  311. * {@link Ext.form.FormPanel} or specifying <tt>layout:'form'</tt>).</p><br>
  312. * <p>Also see <tt>{@link #hideLabel}</tt> and
  313. * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}.</p>
  314. * Example use:<pre><code>
  315. new Ext.FormPanel({
  316. height: 100,
  317. renderTo: Ext.getBody(),
  318. items: [{
  319. xtype: 'textfield',
  320. fieldLabel: 'Name'
  321. }]
  322. });
  323. </code></pre>
  324. */
  325. <div id="cfg-Ext.Component-labelStyle"></div>/**
  326. * @cfg {String} labelStyle <p>A CSS style specification string to apply directly to this field's
  327. * label. Defaults to the container's labelStyle value if set (e.g.,
  328. * <tt>{@link Ext.layout.FormLayout#labelStyle}</tt> , or '').</p>
  329. * <br><p><b>Note</b>: see the note for <code>{@link #clearCls}</code>.</p><br>
  330. * <p>Also see <code>{@link #hideLabel}</code> and
  331. * <code>{@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}.</code></p>
  332. * Example use:<pre><code>
  333. new Ext.FormPanel({
  334. height: 100,
  335. renderTo: Ext.getBody(),
  336. items: [{
  337. xtype: 'textfield',
  338. fieldLabel: 'Name',
  339. labelStyle: 'font-weight:bold;'
  340. }]
  341. });
  342. </code></pre>
  343. */
  344. <div id="cfg-Ext.Component-labelSeparator"></div>/**
  345. * @cfg {String} labelSeparator <p>The separator to display after the text of each
  346. * <tt>{@link #fieldLabel}</tt>. This property may be configured at various levels.
  347. * The order of precedence is:
  348. * <div class="mdetail-params"><ul>
  349. * <li>field / component level</li>
  350. * <li>container level</li>
  351. * <li>{@link Ext.layout.FormLayout#labelSeparator layout level} (defaults to colon <tt>':'</tt>)</li>
  352. * </ul></div>
  353. * To display no separator for this field's label specify empty string ''.</p>
  354. * <br><p><b>Note</b>: see the note for <tt>{@link #clearCls}</tt>.</p><br>
  355. * <p>Also see <tt>{@link #hideLabel}</tt> and
  356. * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}.</p>
  357. * Example use:<pre><code>
  358. new Ext.FormPanel({
  359. height: 100,
  360. renderTo: Ext.getBody(),
  361. layoutConfig: {
  362. labelSeparator: '~' // layout config has lowest priority (defaults to ':')
  363. },
  364. {@link Ext.layout.FormLayout#labelSeparator labelSeparator}: '>>', // config at container level
  365. items: [{
  366. xtype: 'textfield',
  367. fieldLabel: 'Field 1',
  368. labelSeparator: '...' // field/component level config supersedes others
  369. },{
  370. xtype: 'textfield',
  371. fieldLabel: 'Field 2' // labelSeparator will be '='
  372. }]
  373. });
  374. </code></pre>
  375. */
  376. <div id="cfg-Ext.Component-hideLabel"></div>/**
  377. * @cfg {Boolean} hideLabel <p><tt>true</tt> to completely hide the label element
  378. * ({@link #fieldLabel label} and {@link #labelSeparator separator}). Defaults to <tt>false</tt>.
  379. * By default, even if you do not specify a <tt>{@link #fieldLabel}</tt> the space will still be
  380. * reserved so that the field will line up with other fields that do have labels.
  381. * Setting this to <tt>true</tt> will cause the field to not reserve that space.</p>
  382. * <br><p><b>Note</b>: see the note for <tt>{@link #clearCls}</tt>.</p><br>
  383. * Example use:<pre><code>
  384. new Ext.FormPanel({
  385. height: 100,
  386. renderTo: Ext.getBody(),
  387. items: [{
  388. xtype: 'textfield'
  389. hideLabel: true
  390. }]
  391. });
  392. </code></pre>
  393. */
  394. <div id="cfg-Ext.Component-clearCls"></div>/**
  395. * @cfg {String} clearCls <p>The CSS class used to to apply to the special clearing div rendered
  396. * directly after each form field wrapper to provide field clearing (defaults to
  397. * <tt>'x-form-clear-left'</tt>).</p>
  398. * <br><p><b>Note</b>: this config is only used when this Component is rendered by a Container
  399. * which has been configured to use the <b>{@link Ext.layout.FormLayout FormLayout}</b> layout
  400. * manager (e.g. {@link Ext.form.FormPanel} or specifying <tt>layout:'form'</tt>) and either a
  401. * <tt>{@link #fieldLabel}</tt> is specified or <tt>isFormField=true</tt> is specified.</p><br>
  402. * <p>See {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl} also.</p>
  403. */
  404. <div id="cfg-Ext.Component-itemCls"></div>/**
  405. * @cfg {String} itemCls
  406. * <p><b>Note</b>: this config is only used when this Component is rendered by a Container which
  407. * has been configured to use the <b>{@link Ext.layout.FormLayout FormLayout}</b> layout manager (e.g.
  408. * {@link Ext.form.FormPanel} or specifying <tt>layout:'form'</tt>).</p><br>
  409. * <p>An additional CSS class to apply to the div wrapping the form item
  410. * element of this field. If supplied, <tt>itemCls</tt> at the <b>field</b> level will override
  411. * the default <tt>itemCls</tt> supplied at the <b>container</b> level. The value specified for
  412. * <tt>itemCls</tt> will be added to the default class (<tt>'x-form-item'</tt>).</p>
  413. * <p>Since it is applied to the item wrapper (see
  414. * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}), it allows
  415. * you to write standard CSS rules that can apply to the field, the label (if specified), or
  416. * any other element within the markup for the field.</p>
  417. * <br><p><b>Note</b>: see the note for <tt>{@link #fieldLabel}</tt>.</p><br>
  418. * Example use:<pre><code>
  419. // Apply a style to the field&#39;s label:
  420. &lt;style>
  421. .required .x-form-item-label {font-weight:bold;color:red;}
  422. &lt;/style>
  423. new Ext.FormPanel({
  424. height: 100,
  425. renderTo: Ext.getBody(),
  426. items: [{
  427. xtype: 'textfield',
  428. fieldLabel: 'Name',
  429. itemCls: 'required' //this label will be styled
  430. },{
  431. xtype: 'textfield',
  432. fieldLabel: 'Favorite Color'
  433. }]
  434. });
  435. </code></pre>
  436. */
  437. <div id="cfg-Ext.Component-id"></div>/**
  438. * @cfg {String} id
  439. * <p>The <b>unique</b> id of this component (defaults to an {@link #getId auto-assigned id}).
  440. * You should assign an id if you need to be able to access the component later and you do
  441. * not have an object reference available (e.g., using {@link Ext}.{@link Ext#getCmp getCmp}).</p>
  442. * <p>Note that this id will also be used as the element id for the containing HTML element
  443. * that is rendered to the page for this component. This allows you to write id-based CSS
  444. * rules to style the specific instance of this component uniquely, and also to select
  445. * sub-elements using this component's id as the parent.</p>
  446. * <p><b>Note</b>: to avoid complications imposed by a unique <tt>id</tt> also see
  447. * <code>{@link #itemId}</code> and <code>{@link #ref}</code>.</p>
  448. * <p><b>Note</b>: to access the container of an item see <code>{@link #ownerCt}</code>.</p>
  449. */
  450. <div id="cfg-Ext.Component-itemId"></div>/**
  451. * @cfg {String} itemId
  452. * <p>An <tt>itemId</tt> can be used as an alternative way to get a reference to a component
  453. * when no object reference is available. Instead of using an <code>{@link #id}</code> with
  454. * {@link Ext}.{@link Ext#getCmp getCmp}, use <code>itemId</code> with
  455. * {@link Ext.Container}.{@link Ext.Container#getComponent getComponent} which will retrieve
  456. * <code>itemId</code>'s or <tt>{@link #id}</tt>'s. Since <code>itemId</code>'s are an index to the
  457. * container's internal MixedCollection, the <code>itemId</code> is scoped locally to the container --
  458. * avoiding potential conflicts with {@link Ext.ComponentMgr} which requires a <b>unique</b>
  459. * <code>{@link #id}</code>.</p>
  460. * <pre><code>
  461. var c = new Ext.Panel({ //
  462. {@link Ext.BoxComponent#height height}: 300,
  463. {@link #renderTo}: document.body,
  464. {@link Ext.Container#layout layout}: 'auto',
  465. {@link Ext.Container#items items}: [
  466. {
  467. itemId: 'p1',
  468. {@link Ext.Panel#title title}: 'Panel 1',
  469. {@link Ext.BoxComponent#height height}: 150
  470. },
  471. {
  472. itemId: 'p2',
  473. {@link Ext.Panel#title title}: 'Panel 2',
  474. {@link Ext.BoxComponent#height height}: 150
  475. }
  476. ]
  477. })
  478. p1 = c.{@link Ext.Container#getComponent getComponent}('p1'); // not the same as {@link Ext#getCmp Ext.getCmp()}
  479. p2 = p1.{@link #ownerCt}.{@link Ext.Container#getComponent getComponent}('p2'); // reference via a sibling
  480. * </code></pre>
  481. * <p>Also see <tt>{@link #id}</tt> and <code>{@link #ref}</code>.</p>
  482. * <p><b>Note</b>: to access the container of an item see <tt>{@link #ownerCt}</tt>.</p>
  483. */
  484. <div id="cfg-Ext.Component-xtype"></div>/**
  485. * @cfg {String} xtype
  486. * The registered <tt>xtype</tt> to create. This config option is not used when passing
  487. * a config object into a constructor. This config option is used only when
  488. * lazy instantiation is being used, and a child item of a Container is being
  489. * specified not as a fully instantiated Component, but as a <i>Component config
  490. * object</i>. The <tt>xtype</tt> will be looked up at render time up to determine what
  491. * type of child Component to create.<br><br>
  492. * The predefined xtypes are listed {@link Ext.Component here}.
  493. * <br><br>
  494. * If you subclass Components to create your own Components, you may register
  495. * them using {@link Ext.ComponentMgr#registerType} in order to be able to
  496. * take advantage of lazy instantiation and rendering.
  497. */
  498. <div id="cfg-Ext.Component-ptype"></div>/**
  499. * @cfg {String} ptype
  500. * The registered <tt>ptype</tt> to create. This config option is not used when passing
  501. * a config object into a constructor. This config option is used only when
  502. * lazy instantiation is being used, and a Plugin is being
  503. * specified not as a fully instantiated Component, but as a <i>Component config
  504. * object</i>. The <tt>ptype</tt> will be looked up at render time up to determine what
  505. * type of Plugin to create.<br><br>
  506. * If you create your own Plugins, you may register them using
  507. * {@link Ext.ComponentMgr#registerPlugin} in order to be able to
  508. * take advantage of lazy instantiation and rendering.
  509. */
  510. <div id="cfg-Ext.Component-cls"></div>/**
  511. * @cfg {String} cls
  512. * An optional extra CSS class that will be added to this component's Element (defaults to ''). This can be
  513. * useful for adding customized styles to the component or any of its children using standard CSS rules.
  514. */
  515. <div id="cfg-Ext.Component-overCls"></div>/**
  516. * @cfg {String} overCls
  517. * An optional extra CSS class that will be added to this component's Element when the mouse moves
  518. * over the Element, and removed when the mouse moves out. (defaults to ''). This can be
  519. * useful for adding customized 'active' or 'hover' styles to the component or any of its children using standard CSS rules.
  520. */
  521. <div id="cfg-Ext.Component-style"></div>/**
  522. * @cfg {String} style
  523. * A custom style specification to be applied to this component's Element. Should be a valid argument to
  524. * {@link Ext.Element#applyStyles}.
  525. * <pre><code>
  526. new Ext.Panel({
  527. title: 'Some Title',
  528. renderTo: Ext.getBody(),
  529. width: 400, height: 300,
  530. layout: 'form',
  531. items: [{
  532. xtype: 'textarea',
  533. style: {
  534. width: '95%',
  535. marginBottom: '10px'
  536. }
  537. },
  538. new Ext.Button({
  539. text: 'Send',
  540. minWidth: '100',
  541. style: {
  542. marginBottom: '10px'
  543. }
  544. })
  545. ]
  546. });
  547. * </code></pre>
  548. */
  549. <div id="cfg-Ext.Component-ctCls"></div>/**
  550. * @cfg {String} ctCls
  551. * <p>An optional extra CSS class that will be added to this component's container. This can be useful for
  552. * adding customized styles to the container or any of its children using standard CSS rules. See
  553. * {@link Ext.layout.ContainerLayout}.{@link Ext.layout.ContainerLayout#extraCls extraCls} also.</p>
  554. * <p><b>Note</b>: <tt>ctCls</tt> defaults to <tt>''</tt> except for the following class
  555. * which assigns a value by default:
  556. * <div class="mdetail-params"><ul>
  557. * <li>{@link Ext.layout.Box Box Layout} : <tt>'x-box-layout-ct'</tt></li>
  558. * </ul></div>
  559. * To configure the above Class with an extra CSS class append to the default. For example,
  560. * for BoxLayout (Hbox and Vbox):<pre><code>
  561. * ctCls: 'x-box-layout-ct custom-class'
  562. * </code></pre>
  563. * </p>
  564. */
  565. <div id="cfg-Ext.Component-disabled"></div>/**
  566. * @cfg {Boolean} disabled
  567. * Render this component disabled (default is false).
  568. */
  569. disabled : false,
  570. <div id="cfg-Ext.Component-hidden"></div>/**
  571. * @cfg {Boolean} hidden
  572. * Render this component hidden (default is false). If <tt>true</tt>, the
  573. * {@link #hide} method will be called internally.
  574. */
  575. hidden : false,
  576. <div id="cfg-Ext.Component-plugins"></div>/**
  577. * @cfg {Object/Array} plugins
  578. * An object or array of objects that will provide custom functionality for this component. The only
  579. * requirement for a valid plugin is that it contain an init method that accepts a reference of type Ext.Component.
  580. * When a component is created, if any plugins are available, the component will call the init method on each
  581. * plugin, passing a reference to itself. Each plugin can then call methods or respond to events on the
  582. * component as needed to provide its functionality.
  583. */
  584. <div id="cfg-Ext.Component-applyTo"></div>/**
  585. * @cfg {Mixed} applyTo
  586. * <p>Specify the id of the element, a DOM element or an existing Element corresponding to a DIV
  587. * that is already present in the document that specifies some structural markup for this
  588. * component.</p><div><ul>
  589. * <li><b>Description</b> : <ul>
  590. * <div class="sub-desc">When <tt>applyTo</tt> is used, constituent parts of the component can also be specified
  591. * by id or CSS class name within the main element, and the component being created may attempt
  592. * to create its subcomponents from that markup if applicable.</div>
  593. * </ul></li>
  594. * <li><b>Notes</b> : <ul>
  595. * <div class="sub-desc">When using this config, a call to render() is not required.</div>
  596. * <div class="sub-desc">If applyTo is specified, any value passed for {@link #renderTo} will be ignored and the target
  597. * element's parent node will automatically be used as the component's container.</div>
  598. * </ul></li>
  599. * </ul></div>
  600. */
  601. <div id="cfg-Ext.Component-renderTo"></div>/**
  602. * @cfg {Mixed} renderTo
  603. * <p>Specify the id of the element, a DOM element or an existing Element that this component
  604. * will be rendered into.</p><div><ul>
  605. * <li><b>Notes</b> : <ul>
  606. * <div class="sub-desc">Do <u>not</u> use this option if the Component is to be a child item of
  607. * a {@link Ext.Container Container}. It is the responsibility of the
  608. * {@link Ext.Container Container}'s {@link Ext.Container#layout layout manager}
  609. * to render and manage its child items.</div>
  610. * <div class="sub-desc">When using this config, a call to render() is not required.</div>
  611. * </ul></li>
  612. * </ul></div>
  613. * <p>See <tt>{@link #render}</tt> also.</p>
  614. */
  615. <div id="cfg-Ext.Component-stateful"></div>/**
  616. * @cfg {Boolean} stateful
  617. * <p>A flag which causes the Component to attempt to restore the state of
  618. * internal properties from a saved state on startup. The component must have
  619. * either a <code>{@link #stateId}</code> or <code>{@link #id}</code> assigned
  620. * for state to be managed. Auto-generated ids are not guaranteed to be stable
  621. * across page loads and cannot be relied upon to save and restore the same
  622. * state for a component.<p>
  623. * <p>For state saving to work, the state manager's provider must have been
  624. * set to an implementation of {@link Ext.state.Provider} which overrides the
  625. * {@link Ext.state.Provider#set set} and {@link Ext.state.Provider#get get}
  626. * methods to save and recall name/value pairs. A built-in implementation,
  627. * {@link Ext.state.CookieProvider} is available.</p>
  628. * <p>To set the state provider for the current page:</p>
  629. * <pre><code>
  630. Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
  631. expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
  632. }));
  633. * </code></pre>
  634. * <p>A stateful Component attempts to save state when one of the events
  635. * listed in the <code>{@link #stateEvents}</code> configuration fires.</p>
  636. * <p>To save state, a stateful Component first serializes its state by
  637. * calling <b><code>getState</code></b>. By default, this function does
  638. * nothing. The developer must provide an implementation which returns an
  639. * object hash which represents the Component's restorable state.</p>
  640. * <p>The value yielded by getState is passed to {@link Ext.state.Manager#set}
  641. * which uses the configured {@link Ext.state.Provider} to save the object
  642. * keyed by the Component's <code>{@link stateId}</code>, or, if that is not
  643. * specified, its <code>{@link #id}</code>.</p>
  644. * <p>During construction, a stateful Component attempts to <i>restore</i>
  645. * its state by calling {@link Ext.state.Manager#get} passing the
  646. * <code>{@link #stateId}</code>, or, if that is not specified, the
  647. * <code>{@link #id}</code>.</p>
  648. * <p>The resulting object is passed to <b><code>applyState</code></b>.
  649. * The default implementation of <code>applyState</code> simply copies
  650. * properties into the object, but a developer may override this to support
  651. * more behaviour.</p>
  652. * <p>You can perform extra processing on state save and restore by attaching
  653. * handlers to the {@link #beforestaterestore}, {@link #staterestore},
  654. * {@link #beforestatesave} and {@link #statesave} events.</p>
  655. */
  656. <div id="cfg-Ext.Component-stateId"></div>/**
  657. * @cfg {String} stateId
  658. * The unique id for this component to use for state management purposes
  659. * (defaults to the component id if one was set, otherwise null if the
  660. * component is using a generated id).
  661. * <p>See <code>{@link #stateful}</code> for an explanation of saving and
  662. * restoring Component state.</p>
  663. */
  664. <div id="cfg-Ext.Component-stateEvents"></div>/**
  665. * @cfg {Array} stateEvents
  666. * <p>An array of events that, when fired, should trigger this component to
  667. * save its state (defaults to none). <code>stateEvents</code> may be any type
  668. * of event supported by this component, including browser or custom events
  669. * (e.g., <tt>['click', 'customerchange']</tt>).</p>
  670. * <p>See <code>{@link #stateful}</code> for an explanation of saving and
  671. * restoring Component state.</p>
  672. */
  673. <div id="cfg-Ext.Component-autoEl"></div>/**
  674. * @cfg {Mixed} autoEl
  675. * <p>A tag name or {@link Ext.DomHelper DomHelper} spec used to create the {@link #getEl Element} which will
  676. * encapsulate this Component.</p>
  677. * <p>You do not normally need to specify this. For the base classes {@link Ext.Component}, {@link Ext.BoxComponent},
  678. * and {@link Ext.Container}, this defaults to <b><tt>'div'</tt></b>. The more complex Ext classes use a more complex
  679. * DOM structure created by their own onRender methods.</p>
  680. * <p>This is intended to allow the developer to create application-specific utility Components encapsulated by
  681. * different DOM elements. Example usage:</p><pre><code>
  682. {
  683. xtype: 'box',
  684. autoEl: {
  685. tag: 'img',
  686. src: 'http://www.example.com/example.jpg'
  687. }
  688. }, {
  689. xtype: 'box',
  690. autoEl: {
  691. tag: 'blockquote',
  692. html: 'autoEl is cool!'
  693. }
  694. }, {
  695. xtype: 'container',
  696. autoEl: 'ul',
  697. cls: 'ux-unordered-list',
  698. items: {
  699. xtype: 'box',
  700. autoEl: 'li',
  701. html: 'First list item'
  702. }
  703. }
  704. </code></pre>
  705. */
  706. autoEl : 'div',
  707. <div id="cfg-Ext.Component-disabledClass"></div>/**
  708. * @cfg {String} disabledClass
  709. * CSS class added to the component when it is disabled (defaults to 'x-item-disabled').
  710. */
  711. disabledClass : 'x-item-disabled',
  712. <div id="cfg-Ext.Component-allowDomMove"></div>/**
  713. * @cfg {Boolean} allowDomMove
  714. * Whether the component can move the Dom node when rendering (defaults to true).
  715. */
  716. allowDomMove : true,
  717. <div id="cfg-Ext.Component-autoShow"></div>/**
  718. * @cfg {Boolean} autoShow
  719. * True if the component should check for hidden classes (e.g. 'x-hidden' or 'x-hide-display') and remove
  720. * them on render (defaults to false).
  721. */
  722. autoShow : false,
  723. <div id="cfg-Ext.Component-hideMode"></div>/**
  724. * @cfg {String} hideMode
  725. * <p>How this component should be hidden. Supported values are <tt>'visibility'</tt>
  726. * (css visibility), <tt>'offsets'</tt> (negative offset position) and <tt>'display'</tt>
  727. * (css display).</p>
  728. * <br><p><b>Note</b>: the default of <tt>'display'</tt> is generally preferred
  729. * since items are automatically laid out when they are first shown (no sizing
  730. * is done while hidden).</p>
  731. */
  732. hideMode : 'display',
  733. <div id="cfg-Ext.Component-hideParent"></div>/**
  734. * @cfg {Boolean} hideParent
  735. * True to hide and show the component's container when hide/show is called on the component, false to hide
  736. * and show the component itself (defaults to false). For example, this can be used as a shortcut for a hide
  737. * button on a window by setting hide:true on the button when adding it to its parent container.
  738. */
  739. hideParent : false,
  740. <div id="prop-Ext.Component-el"></div>/**
  741. * <p>The {@link Ext.Element} which encapsulates this Component. Read-only.</p>
  742. * <p>This will <i>usually</i> be a &lt;DIV> element created by the class's onRender method, but
  743. * that may be overridden using the <code>{@link #autoEl}</code> config.</p>
  744. * <br><p><b>Note</b>: this element will not be available until this Component has been rendered.</p><br>
  745. * <p>To add listeners for <b>DOM events</b> to this Component (as opposed to listeners
  746. * for this Component's own Observable events), see the {@link Ext.util.Observable#listeners listeners}
  747. * config for a suggestion, or use a render listener directly:</p><pre><code>
  748. new Ext.Panel({
  749. title: 'The Clickable Panel',
  750. listeners: {
  751. render: function(p) {
  752. // Append the Panel to the click handler&#39;s argument list.
  753. p.getEl().on('click', handlePanelClick.createDelegate(null, [p], true));
  754. },
  755. single: true // Remove the listener after first invocation
  756. }
  757. });
  758. </code></pre>
  759. * <p>See also <tt>{@link #getEl getEl}</p>
  760. * @type Ext.Element
  761. * @property el
  762. */
  763. <div id="prop-Ext.Component-ownerCt"></div>/**
  764. * This Component's owner {@link Ext.Container Container} (defaults to undefined, and is set automatically when
  765. * this Component is added to a Container). Read-only.
  766. * <p><b>Note</b>: to access items within the Container see <tt>{@link #itemId}</tt>.</p>
  767. * @type Ext.Container
  768. * @property ownerCt
  769. */
  770. <div id="prop-Ext.Component-hidden"></div>/**
  771. * True if this component is hidden. Read-only.
  772. * @type Boolean
  773. * @property hidden
  774. */
  775. <div id="prop-Ext.Component-disabled"></div>/**
  776. * True if this component is disabled. Read-only.
  777. * @type Boolean
  778. * @property disabled
  779. */
  780. <div id="prop-Ext.Component-rendered"></div>/**
  781. * True if this component has been rendered. Read-only.
  782. * @type Boolean
  783. * @property rendered
  784. */
  785. rendered : false,
  786. <div id="cfg-Ext.Component-contentEl"></div>/**
  787. * @cfg {String} contentEl
  788. * <p>Optional. Specify an existing HTML element, or the <code>id</code> of an existing HTML element to use as the content
  789. * for this component.</p>
  790. * <ul>
  791. * <li><b>Description</b> :
  792. * <div class="sub-desc">This config option is used to take an existing HTML element and place it in the layout element
  793. * 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>
  794. * <li><b>Notes</b> :
  795. * <div class="sub-desc">The specified HTML element is appended to the layout element of the component <i>after any configured
  796. * {@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>
  797. * <div class="sub-desc">The specified HTML element used will not participate in any <code><b>{@link Ext.Container#layout layout}</b></code>
  798. * scheme that the Component may use. It is just HTML. Layouts operate on child <code><b>{@link Ext.Container#items items}</b></code>.</div>
  799. * <div class="sub-desc">Add either the <code>x-hidden</code> or the <code>x-hide-display</code> CSS class to
  800. * prevent a brief flicker of the content before it is rendered to the panel.</div></li>
  801. * </ul>
  802. */
  803. <div id="cfg-Ext.Component-html"></div>/**
  804. * @cfg {String/Object} html
  805. * An HTML fragment, or a {@link Ext.DomHelper DomHelper} specification to use as the layout element
  806. * content (defaults to ''). The HTML content is added after the component is rendered,
  807. * so the document will not contain this HTML at the time the {@link #render} event is fired.
  808. * This content is inserted into the body <i>before</i> any configured {@link #contentEl} is appended.
  809. */
  810. <div id="cfg-Ext.Component-tpl"></div>/**
  811. * @cfg {Mixed} tpl
  812. * An <bold>{@link Ext.Template}</bold>, <bold>{@link Ext.XTemplate}</bold>
  813. * or an array of strings to form an Ext.XTemplate.
  814. * Used in conjunction with the <code>{@link #data}</code> and
  815. * <code>{@link #tplWriteMode}</code> configurations.
  816. */
  817. <div id="cfg-Ext.Component-tplWriteMode"></div>/**
  818. * @cfg {String} tplWriteMode The Ext.(X)Template method to use when
  819. * updating the content area of the Component. Defaults to <tt>'overwrite'</tt>
  820. * (see <code>{@link Ext.XTemplate#overwrite}</code>).
  821. */
  822. tplWriteMode : 'overwrite',
  823. <div id="cfg-Ext.Component-data"></div>/**
  824. * @cfg {Mixed} data
  825. * The initial set of data to apply to the <code>{@link #tpl}</code> to
  826. * update the content area of the Component.
  827. */
  828. <div id="cfg-Ext.Component-bubbleEvents"></div>/**
  829. * @cfg {Array} bubbleEvents
  830. * <p>An array of events that, when fired, should be bubbled to any parent container.
  831. * See {@link Ext.util.Observable#enableBubble}.
  832. * Defaults to <tt>[]</tt>.
  833. */
  834. bubbleEvents: [],
  835. // private
  836. ctype : 'Ext.Component',
  837. // private
  838. actionMode : 'el',
  839. // private
  840. getActionEl : function(){
  841. return this[this.actionMode];
  842. },
  843. initPlugin : function(p){
  844. if(p.ptype && !Ext.isFunction(p.init)){
  845. p = Ext.ComponentMgr.createPlugin(p);
  846. }else if(Ext.isString(p)){
  847. p = Ext.ComponentMgr.createPlugin({
  848. ptype: p
  849. });
  850. }
  851. p.init(this);
  852. return p;
  853. },
  854. /* // protected
  855. * Function to be implemented by Component subclasses to be part of standard component initialization flow (it is empty by default).
  856. * <pre><code>
  857. // Traditional constructor:
  858. Ext.Foo = function(config){
  859. // call superclass constructor:
  860. Ext.Foo.superclass.constructor.call(this, config);
  861. this.addEvents({
  862. // add events
  863. });
  864. };
  865. Ext.extend(Ext.Foo, Ext.Bar, {
  866. // class body
  867. }
  868. // initComponent replaces the constructor:
  869. Ext.Foo = Ext.extend(Ext.Bar, {
  870. initComponent : function(){
  871. // call superclass initComponent
  872. Ext.Container.superclass.initComponent.call(this);
  873. this.addEvents({
  874. // add events
  875. });
  876. }
  877. }
  878. </code></pre>
  879. */
  880. initComponent : function(){
  881. /*
  882. * this is double processing, however it allows people to be able to do
  883. * Ext.apply(this, {
  884. * listeners: {
  885. * //here
  886. * }
  887. * });
  888. * MyClass.superclass.initComponent.call(this);
  889. */
  890. if(this.listeners){
  891. this.on(this.listeners);
  892. delete this.listeners;
  893. }
  894. this.enableBubble(this.bubbleEvents);
  895. },
  896. <div id="method-Ext.Component-render"></div>/**
  897. * <p>Render this Component into the passed HTML element.</p>
  898. * <p><b>If you are using a {@link Ext.Container Container} object to house this Component, then
  899. * do not use the render method.</b></p>
  900. * <p>A Container's child Components are rendered by that Container's
  901. * {@link Ext.Container#layout layout} manager when the Container is first rendered.</p>
  902. * <p>Certain layout managers allow dynamic addition of child components. Those that do
  903. * include {@link Ext.layout.CardLayout}, {@link Ext.layout.AnchorLayout},
  904. * {@link Ext.layout.FormLayout}, {@link Ext.layout.TableLayout}.</p>
  905. * <p>If the Container is already rendered when a new child Component is added, you may need to call
  906. * the Container's {@link Ext.Container#doLayout doLayout} to refresh the view which causes any
  907. * unrendered child Components to be rendered. This is required so that you can add multiple
  908. * child components if needed while only refreshing the layout once.</p>
  909. * <p>When creating complex UIs, it is important to remember that sizing and positioning
  910. * of child items is the responsibility of the Container's {@link Ext.Container#layout layout} manager.
  911. * If you expect child items to be sized in response to user interactions, you must
  912. * configure the Container with a layout manager which creates and manages the type of layout you
  913. * have in mind.</p>
  914. * <p><b>Omitting the Container's {@link Ext.Container#layout layout} config means that a basic
  915. * layout manager is used which does nothing but render child components sequentially into the
  916. * Container. No sizing or positioning will be performed in this situation.</b></p>
  917. * @param {Element/HTMLElement/String} container (optional) The element this Component should be
  918. * rendered into. If it is being created from existing markup, this should be omitted.
  919. * @param {String/Number} position (optional) The element ID or DOM node index within the container <b>before</b>
  920. * which this component will be inserted (defaults to appending to the end of the container)
  921. */
  922. render : function(container, position){
  923. if(!this.rendered && this.fireEvent('beforerender', this) !== false){
  924. if(!container && this.el){
  925. this.el = Ext.get(this.el);
  926. container = this.el.dom.parentNode;
  927. this.allowDomMove = false;
  928. }
  929. this.container = Ext.get(container);
  930. if(this.ctCls){
  931. this.container.addClass(this.ctCls);
  932. }
  933. this.rendered = true;
  934. if(position !== undefined){
  935. if(Ext.isNumber(position)){
  936. position = this.container.dom.childNodes[position];
  937. }else{
  938. position = Ext.getDom(position);
  939. }
  940. }
  941. this.onRender(this.container, position || null);
  942. if(this.autoShow){
  943. this.el.removeClass(['x-hidden','x-hide-' + this.hideMode]);
  944. }
  945. if(this.cls){
  946. this.el.addClass(this.cls);
  947. delete this.cls;
  948. }
  949. if(this.style){
  950. this.el.applyStyles(this.style);
  951. delete this.style;
  952. }
  953. if(this.overCls){
  954. this.el.addClassOnOver(this.overCls);
  955. }
  956. this.fireEvent('render', this);
  957. // Populate content of the component with html, contentEl or
  958. // a tpl.
  959. var contentTarget = this.getContentTarget();
  960. if (this.html){
  961. contentTarget.update(Ext.DomHelper.markup(this.html));
  962. delete this.html;
  963. }
  964. if (this.contentEl){
  965. var ce = Ext.getDom(this.contentEl);
  966. Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
  967. contentTarget.appendChild(ce);
  968. }
  969. if (this.tpl) {
  970. if (!this.tpl.compile) {
  971. this.tpl = new Ext.XTemplate(this.tpl);
  972. }
  973. if (this.data) {
  974. this.tpl[this.tplWriteMode](contentTarget, this.data);
  975. delete this.data;
  976. }
  977. }
  978. this.afterRender(this.container);
  979. if(this.hidden){
  980. // call this so we don't fire initial hide events.
  981. this.doHide();
  982. }
  983. if(this.disabled){
  984. // pass silent so the event doesn't fire the first time.
  985. this.disable(true);
  986. }
  987. if(this.stateful !== false){
  988. this.initStateEvents();
  989. }
  990. this.fireEvent('afterrender', this);
  991. }
  992. return this;
  993. },
  994. <div id="method-Ext.Component-update"></div>/**
  995. * Update the content area of a component.
  996. * @param {Mixed} htmlOrData
  997. * If this component has been configured with a template via the tpl config
  998. * then it will use this argument as data to populate the template.
  999. * If this component was not configured with a template, the components
  1000. * content area will be updated via Ext.Element update
  1001. * @param {Boolean} loadScripts
  1002. * (optional) Only legitimate when using the html configuration. Defaults to false
  1003. * @param {Function} callback
  1004. * (optional) Only legitimate when using the html configuration. Callback to execute when scripts have finished loading
  1005. */
  1006. update: function(htmlOrData, loadScripts, cb) {
  1007. var contentTarget = this.getContentTarget();
  1008. if (this.tpl && typeof htmlOrData !== "string") {
  1009. this.tpl[this.tplWriteMode](contentTarget, htmlOrData || {});
  1010. } else {
  1011. var html = Ext.isObject(htmlOrData) ? Ext.DomHelper.markup(htmlOrData) : htmlOrData;
  1012. contentTarget.update(html, loadScripts, cb);
  1013. }
  1014. },
  1015. /**
  1016. * @private
  1017. * Method to manage awareness of when components are added to their
  1018. * respective Container, firing an added event.
  1019. * References are established at add time rather than at render time.
  1020. * @param {Ext.Container} container Container which holds the component
  1021. * @param {number} pos Position at which the component was added
  1022. */
  1023. onAdded : function(container, pos) {
  1024. this.ownerCt = container;
  1025. this.initRef();
  1026. this.fireEvent('added', this, container, pos);
  1027. },
  1028. /**
  1029. * @private
  1030. * Method to manage awareness of when components are removed from their
  1031. * respective Container, firing an removed event. References are properly
  1032. * cleaned up after removing a component from its owning container.
  1033. */
  1034. onRemoved : function() {
  1035. this.removeRef();
  1036. this.fireEvent('removed', this, this.ownerCt);
  1037. delete this.ownerCt;
  1038. },
  1039. /**
  1040. * @private
  1041. * Method to establish a reference to a component.
  1042. */
  1043. initRef : function() {
  1044. <div id="cfg-Ext.Component-ref"></div>/**
  1045. * @cfg {String} ref
  1046. * <p>A path specification, relative to the Component's <code>{@link #ownerCt}</code>
  1047. * specifying into which ancestor Container to place a named reference to this Component.</p>
  1048. * <p>The ancestor axis can be traversed by using '/' characters in the path.
  1049. * For example, to put a reference to a Toolbar Button into <i>the Panel which owns the Toolbar</i>:</p><pre><code>
  1050. var myGrid = new Ext.grid.EditorGridPanel({
  1051. title: 'My EditorGridPanel',
  1052. store: myStore,
  1053. colModel: myColModel,
  1054. tbar: [{
  1055. text: 'Save',
  1056. handler: saveChanges,
  1057. disabled: true,
  1058. ref: '../saveButton'
  1059. }],
  1060. listeners: {
  1061. afteredit: function() {
  1062. // The button reference is in the GridPanel
  1063. myGrid.saveButton.enable();
  1064. }
  1065. }
  1066. });
  1067. </code></pre>
  1068. * <p>In the code above, if the <code>ref</code> had been <code>'saveButton'</code>
  1069. * the reference would have been placed into the Toolbar. Each '/' in the <code>ref</code>
  1070. * moves up one level from the Component's <code>{@link #ownerCt}</code>.</p>
  1071. * <p>Also see the <code>{@link #added}</code> and <code>{@link #removed}</code> events.</p>
  1072. */
  1073. if(this.ref && !this.refOwner){
  1074. var levels = this.ref.split('/'),
  1075. last = levels.length,
  1076. i = 0,
  1077. t = this;
  1078. while(t && i < last){
  1079. t = t.ownerCt;
  1080. ++i;
  1081. }
  1082. if(t){
  1083. t[this.refName = levels[--i]] = this;
  1084. <div id="prop-Ext.Component-refOwner"></div>/**
  1085. * @type Ext.Container
  1086. * @property refOwner
  1087. * The ancestor Container into which the {@link #ref} reference was inserted if this Component
  1088. * is a child of a Container, and has been configured with a <code>ref</code>.
  1089. */
  1090. this.refOwner = t;
  1091. }
  1092. }
  1093. },
  1094. removeRef : function() {
  1095. if (this.refOwner && this.refName) {
  1096. delete this.refOwner[this.refName];
  1097. delete this.refOwner;
  1098. }
  1099. },
  1100. // private
  1101. initState : function(){
  1102. if(Ext.state.Manager){
  1103. var id = this.getStateId();
  1104. if(id){
  1105. var state = Ext.state.Manager.get(id);
  1106. if(state){
  1107. if(this.fireEvent('beforestaterestore', this, state) !== false){
  1108. this.applyState(Ext.apply({}, state));
  1109. this.fireEvent('staterestore', this, state);
  1110. }
  1111. }
  1112. }
  1113. }
  1114. },
  1115. // private
  1116. getStateId : function(){
  1117. return this.stateId || ((/^(ext-comp-|ext-gen)/).test(String(this.id)) ? null : this.id);
  1118. },
  1119. // private
  1120. initStateEvents : function(){
  1121. if(this.stateEvents){
  1122. for(var i = 0, e; e = this.stateEvents[i]; i++){
  1123. this.on(e, this.saveState, this, {delay:100});
  1124. }
  1125. }
  1126. },
  1127. // private
  1128. applyState : function(state){
  1129. if(state){
  1130. Ext.apply(this, state);
  1131. }
  1132. },
  1133. // private
  1134. getState : function(){
  1135. return null;
  1136. },
  1137. // private
  1138. saveState : function(){
  1139. if(Ext.state.Manager && this.stateful !== false){
  1140. var id = this.getStateId();
  1141. if(id){
  1142. var state = this.getState();
  1143. if(this.fireEvent('beforestatesave', this, state) !== false){
  1144. Ext.state.Manager.set(id, state);
  1145. this.fireEvent('statesave', this, state);
  1146. }
  1147. }
  1148. }
  1149. },
  1150. <div id="method-Ext.Component-applyToMarkup"></div>/**
  1151. * Apply this component to existing markup that is valid. With this function, no call to render() is required.
  1152. * @param {String/HTMLElement} el
  1153. */
  1154. applyToMarkup : function(el){
  1155. this.allowDomMove = false;
  1156. this.el = Ext.get(el);
  1157. this.render(this.el.dom.parentNode);
  1158. },
  1159. <div id="method-Ext.Component-addClass"></div>/**
  1160. * Adds a CSS class to the component's underlying element.
  1161. * @param {string} cls The CSS class name to add
  1162. * @return {Ext.Component} this
  1163. */
  1164. addClass : function(cls){
  1165. if(this.el){
  1166. this.el.addClass(cls);
  1167. }else{
  1168. this.cls = this.cls ? this.cls + ' ' + cls : cls;
  1169. }
  1170. return this;
  1171. },
  1172. <div id="method-Ext.Component-removeClass"></div>/**
  1173. * Removes a CSS class from the component's underlying element.
  1174. * @param {string} cls The CSS class name to remove
  1175. * @return {Ext.Component} this
  1176. */
  1177. removeClass : function(cls){
  1178. if(this.el){
  1179. this.el.removeClass(cls);
  1180. }else if(this.cls){
  1181. this.cls = this.cls.split(' ').remove(cls).join(' ');
  1182. }
  1183. return this;
  1184. },
  1185. // private
  1186. // default function is not really useful
  1187. onRender : function(ct, position){
  1188. if(!this.el && this.autoEl){
  1189. if(Ext.isString(this.autoEl)){
  1190. this.el = document.createElement(this.autoEl);
  1191. }else{
  1192. var div = document.createElement('div');
  1193. Ext.DomHelper.overwrite(div, this.autoEl);
  1194. this.el = div.firstChild;
  1195. }
  1196. if (!this.el.id) {
  1197. this.el.id = this.getId();
  1198. }
  1199. }
  1200. if(this.el){
  1201. this.el = Ext.get(this.el);
  1202. if(this.allowDomMove !== false){
  1203. ct.dom.insertBefore(this.el.dom, position);
  1204. if (div) {
  1205. Ext.removeNode(div);
  1206. div = null;
  1207. }
  1208. }
  1209. }
  1210. },
  1211. // private
  1212. getAutoCreate : function(){
  1213. var cfg = Ext.isObject(this.autoCreate) ?
  1214. this.autoCreate : Ext.apply({}, this.defaultAutoCreate);
  1215. if(this.id && !cfg.id){
  1216. cfg.id = this.id;
  1217. }
  1218. return cfg;
  1219. },
  1220. // private
  1221. afterRender : Ext.emptyFn,
  1222. <div id="method-Ext.Component-destroy"></div>/**
  1223. * Destroys this component by purging any event listeners, removing the component's element from the DOM,
  1224. * removing the component from its {@link Ext.Container} (if applicable) and unregistering it from
  1225. * {@link Ext.ComponentMgr}. Destruction is generally handled automatically by the framework and this method
  1226. * should usually not need to be called directly.
  1227. *
  1228. */
  1229. destroy : function(){
  1230. if(!this.isDestroyed){
  1231. if(this.fireEvent('beforedestroy', this) !== false){
  1232. this.destroying = true;
  1233. this.beforeDestroy();
  1234. if(this.ownerCt && this.ownerCt.remove){
  1235. this.ownerCt.remove(this, false);
  1236. }
  1237. if(this.rendered){
  1238. this.el.remove();
  1239. if(this.actionMode == 'container' || this.removeMode == 'container'){
  1240. this.container.remove();
  1241. }
  1242. }
  1243. // Stop any buffered tasks
  1244. if(this.focusTask && this.focusTask.cancel){
  1245. this.focusTask.cancel();
  1246. }
  1247. this.onDestroy();
  1248. Ext.ComponentMgr.unregister(this);
  1249. this.fireEvent('destroy', this);
  1250. this.purgeListeners();
  1251. this.destroying = false;
  1252. this.isDestroyed = true;
  1253. }
  1254. }
  1255. },
  1256. deleteMembers : function(){
  1257. var args = arguments;
  1258. for(var i = 0, len = args.length; i < len; ++i){
  1259. delete this[args[i]];
  1260. }
  1261. },
  1262. // private
  1263. beforeDestroy : Ext.emptyFn,
  1264. // private
  1265. onDestroy : Ext.emptyFn,
  1266. <div id="method-Ext.Component-getEl"></div>/**
  1267. * <p>Returns the {@link Ext.Element} which encapsulates this Component.</p>
  1268. * <p>This will <i>usually</i> be a &lt;DIV> element created by the class's onRender method, but
  1269. * that may be overridden using the {@link #autoEl} config.</p>
  1270. * <br><p><b>Note</b>: this element will not be available until this Component has been rendered.</p><br>
  1271. * <p>To add listeners for <b>DOM events</b> to this Component (as opposed to listeners
  1272. * for this Component's own Observable events), see the {@link #listeners} config for a suggestion,
  1273. * or use a render listener directly:</p><pre><code>
  1274. new Ext.Panel({
  1275. title: 'The Clickable Panel',
  1276. listeners: {
  1277. render: function(p) {
  1278. // Append the Panel to the click handler&#39;s argument list.
  1279. p.getEl().on('click', handlePanelClick.createDelegate(null, [p], true));
  1280. },
  1281. single: true // Remove the listener after first invocation
  1282. }
  1283. });
  1284. </code></pre>
  1285. * @return {Ext.Element} The Element which encapsulates this Component.
  1286. */
  1287. getEl : function(){
  1288. return this.el;
  1289. },
  1290. // private
  1291. getContentTarget : function(){
  1292. return this.el;
  1293. },
  1294. <div id="method-Ext.Component-getId"></div>/**
  1295. * Returns the <code>id</code> of this component or automatically generates and
  1296. * returns an <code>id</code> if an <code>id</code> is not defined yet:<pre><code>
  1297. * 'ext-comp-' + (++Ext.Component.AUTO_ID)
  1298. * </code></pre>
  1299. * @return {String} id
  1300. */
  1301. getId : function(){
  1302. return this.id || (this.id = 'ext-comp-' + (++Ext.Component.AUTO_ID));
  1303. },
  1304. <div id="method-Ext.Component-getItemId"></div>/**
  1305. * Returns the <code>{@link #itemId}</code> of this component. If an
  1306. * <code>{@link #itemId}</code> was not assigned through configuration the
  1307. * <code>id</code> is returned using <code>{@link #getId}</code>.
  1308. * @return {String}
  1309. */
  1310. getItemId : function(){
  1311. return this.itemId || this.getId();
  1312. },
  1313. <div id="method-Ext.Component-focus"></div>/**
  1314. * Try to focus this component.
  1315. * @param {Boolean} selectText (optional) If applicable, true to also select the text in this component
  1316. * @param {Boolean/Number} delay (optional) Delay the focus this number of milliseconds (true for 10 milliseconds)
  1317. * @return {Ext.Component} this
  1318. */
  1319. focus : function(selectText, delay){
  1320. if(delay){
  1321. this.focusTask = new Ext.util.DelayedTask(this.focus, this, [selectText, false]);
  1322. this.focusTask.delay(Ext.isNumber(delay) ? delay : 10);
  1323. return this;
  1324. }
  1325. if(this.rendered && !this.isDestroyed){
  1326. this.el.focus();
  1327. if(selectText === true){
  1328. this.el.dom.select();
  1329. }
  1330. }
  1331. return this;
  1332. },
  1333. // private
  1334. blur : function(){
  1335. if(this.rendered){
  1336. this.el.blur();
  1337. }
  1338. return this;
  1339. },
  1340. <div id="method-Ext.Component-disable"></div>/**
  1341. * Disable this component and fire the 'disable' event.
  1342. * @return {Ext.Component} this
  1343. */
  1344. disable : function(/* private */ silent){
  1345. if(this.rendered){
  1346. this.onDisable();
  1347. }
  1348. this.disabled = true;
  1349. if(silent !== true){
  1350. this.fireEvent('disable', this);
  1351. }
  1352. return this;
  1353. },
  1354. // private
  1355. onDisable : function(){
  1356. this.getActionEl().addClass(this.disabledClass);
  1357. this.el.dom.disabled = true;
  1358. },
  1359. <div id="method-Ext.Component-enable"></div>/**
  1360. * Enable this component and fire the 'enable' event.
  1361. * @return {Ext.Component} this
  1362. */
  1363. enable : function(){
  1364. if(this.rendered){
  1365. this.onEnable();
  1366. }
  1367. this.disabled = false;
  1368. this.fireEvent('enable', this);
  1369. return this;
  1370. },
  1371. // private
  1372. onEnable : function(){
  1373. this.getActionEl().removeClass(this.disabledClass);
  1374. this.el.dom.disabled = false;
  1375. },
  1376. <div id="method-Ext.Component-setDisabled"></div>/**
  1377. * Convenience function for setting disabled/enabled by boolean.
  1378. * @param {Boolean} disabled
  1379. * @return {Ext.Component} this
  1380. */
  1381. setDisabled : function(disabled){
  1382. return this[disabled ? 'disable' : 'enable']();
  1383. },
  1384. <div id="method-Ext.Component-show"></div>/**
  1385. * Show this component. Listen to the '{@link #beforeshow}' event and return
  1386. * <tt>false</tt> to cancel showing the component. Fires the '{@link #show}'
  1387. * event after showing the component.
  1388. * @return {Ext.Component} this
  1389. */
  1390. show : function(){
  1391. if(this.fireEvent('beforeshow', this) !== false){
  1392. this.hidden = false;
  1393. if(this.autoRender){
  1394. this.render(Ext.isBoolean(this.autoRender) ? Ext.getBody() : this.autoRender);
  1395. }
  1396. if(this.rendered){
  1397. this.onShow();
  1398. }
  1399. this.fireEvent('show', this);
  1400. }
  1401. return this;
  1402. },
  1403. // private
  1404. onShow : function(){
  1405. this.getVisibilityEl().removeClass('x-hide-' + this.hideMode);
  1406. },
  1407. <div id="method-Ext.Component-hide"></div>/**
  1408. * Hide this component. Listen to the '{@link #beforehide}' event and return
  1409. * <tt>false</tt> to cancel hiding the component. Fires the '{@link #hide}'
  1410. * event after hiding the component. Note this method is called internally if
  1411. * the component is configured to be <code>{@link #hidden}</code>.
  1412. * @return {Ext.Component} this
  1413. */
  1414. hide : function(){
  1415. if(this.fireEvent('beforehide', this) !== false){
  1416. this.doHide();
  1417. this.fireEvent('hide', this);
  1418. }
  1419. return this;
  1420. },
  1421. // private
  1422. doHide: function(){
  1423. this.hidden = true;
  1424. if(this.rendered){
  1425. this.onHide();
  1426. }
  1427. },
  1428. // private
  1429. onHide : function(){
  1430. this.getVisibilityEl().addClass('x-hide-' + this.hideMode);
  1431. },
  1432. // private
  1433. getVisibilityEl : function(){
  1434. return this.hideParent ? this.container : this.getActionEl();
  1435. },
  1436. <div id="method-Ext.Component-setVisible"></div>/**
  1437. * Convenience function to hide or show this component by boolean.
  1438. * @param {Boolean} visible True to show, false to hide
  1439. * @return {Ext.Component} this
  1440. */
  1441. setVisible : function(visible){
  1442. return this[visible ? 'show' : 'hide']();
  1443. },
  1444. <div id="method-Ext.Component-isVisible"></div>/**
  1445. * Returns true if this component is visible.
  1446. * @return {Boolean} True if this component is visible, false otherwise.
  1447. */
  1448. isVisible : function(){
  1449. return this.rendered && this.getVisibilityEl().isVisible();
  1450. },
  1451. <div id="method-Ext.Component-cloneConfig"></div>/**
  1452. * Clone the current component using the original config values passed into this instance by default.
  1453. * @param {Object} overrides A new config containing any properties to override in the cloned version.
  1454. * An id property can be passed on this object, otherwise one will be generated to avoid duplicates.
  1455. * @return {Ext.Component} clone The cloned copy of this component
  1456. */
  1457. cloneConfig : function(overrides){
  1458. overrides = overrides || {};
  1459. var id = overrides.id || Ext.id();
  1460. var cfg = Ext.applyIf(overrides, this.initialConfig);
  1461. cfg.id = id; // prevent dup id
  1462. return new this.constructor(cfg);
  1463. },
  1464. <div id="method-Ext.Component-getXType"></div>/**
  1465. * Gets the xtype for this component as registered with {@link Ext.ComponentMgr}. For a list of all
  1466. * available xtypes, see the {@link Ext.Component} header. Example usage:
  1467. * <pre><code>
  1468. var t = new Ext.form.TextField();
  1469. alert(t.getXType()); // alerts 'textfield'
  1470. </code></pre>
  1471. * @return {String} The xtype
  1472. */
  1473. getXType : function(){
  1474. return this.constructor.xtype;
  1475. },
  1476. <div id="method-Ext.Component-isXType"></div>/**
  1477. * <p>Tests whether or not this Component is of a specific xtype. This can test whether this Component is descended
  1478. * from the xtype (default) or whether it is directly of the xtype specified (shallow = true).</p>
  1479. * <p><b>If using your own subclasses, be aware that a Component must register its own xtype
  1480. * to participate in determination of inherited xtypes.</b></p>
  1481. * <p>For a list of all available xtypes, see the {@link Ext.Component} header.</p>
  1482. * <p>Example usage:</p>
  1483. * <pre><code>
  1484. var t = new Ext.form.TextField();
  1485. var isText = t.isXType('textfield'); // true
  1486. var isBoxSubclass = t.isXType('box'); // true, descended from BoxComponent
  1487. var isBoxInstance = t.isXType('box', true); // false, not a direct BoxComponent instance
  1488. </code></pre>
  1489. * @param {String/Ext.Component/Class} xtype The xtype to check for this Component. Note that the the component can either be an instance
  1490. * or a component class:
  1491. * <pre><code>
  1492. var c = new Ext.Component();
  1493. console.log(c.isXType(c));
  1494. console.log(c.isXType(Ext.Component));
  1495. </code></pre>
  1496. * @param {Boolean} shallow (optional) False to check whether this Component is descended from the xtype (this is
  1497. * the default), or true to check whether this Component is directly of the specified xtype.
  1498. * @return {Boolean} True if this component descends from the specified xtype, false otherwise.
  1499. */
  1500. isXType : function(xtype, shallow){
  1501. //assume a string by default
  1502. if (Ext.isFunction(xtype)){
  1503. xtype = xtype.xtype; //handle being passed the class, e.g. Ext.Component
  1504. }else if (Ext.isObject(xtype)){
  1505. xtype = xtype.constructor.xtype; //handle being passed an instance
  1506. }
  1507. return !shallow ? ('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1 : this.constructor.xtype == xtype;
  1508. },
  1509. <div id="method-Ext.Component-getXTypes"></div>/**
  1510. * <p>Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all
  1511. * available xtypes, see the {@link Ext.Component} header.</p>
  1512. * <p><b>If using your own subclasses, be aware that a Component must register its own xtype
  1513. * to participate in determination of inherited xtypes.</b></p>
  1514. * <p>Example usage:</p>
  1515. * <pre><code>
  1516. var t = new Ext.form.TextField();
  1517. alert(t.getXTypes()); // alerts 'component/box/field/textfield'
  1518. </code></pre>
  1519. * @return {String} The xtype hierarchy string
  1520. */
  1521. getXTypes : function(){
  1522. var tc = this.constructor;
  1523. if(!tc.xtypes){
  1524. var c = [], sc = this;
  1525. while(sc && sc.constructor.xtype){
  1526. c.unshift(sc.constructor.xtype);
  1527. sc = sc.constructor.superclass;
  1528. }
  1529. tc.xtypeChain = c;
  1530. tc.xtypes = c.join('/');
  1531. }
  1532. return tc.xtypes;
  1533. },
  1534. <div id="method-Ext.Component-findParentBy"></div>/**
  1535. * Find a container above this component at any level by a custom function. If the passed function returns
  1536. * true, the container will be returned.
  1537. * @param {Function} fn The custom function to call with the arguments (container, this component).
  1538. * @return {Ext.Container} The first Container for which the custom function returns true
  1539. */
  1540. findParentBy : function(fn) {
  1541. for (var p = this.ownerCt; (p != null) && !fn(p, this); p = p.ownerCt);
  1542. return p || null;
  1543. },
  1544. <div id="method-Ext.Component-findParentByType"></div>/**
  1545. * Find a container above this component at any level by xtype or class
  1546. * @param {String/Ext.Component/Class} xtype The xtype to check for this Component. Note that the the component can either be an instance
  1547. * or a component class:
  1548. * @param {Boolean} shallow (optional) False to check whether this Component is descended from the xtype (this is
  1549. * the default), or true to check whether this Component is directly of the specified xtype.
  1550. * @return {Ext.Container} The first Container which matches the given xtype or class
  1551. */
  1552. findParentByType : function(xtype, shallow){
  1553. return this.findParentBy(function(c){
  1554. return c.isXType(xtype, shallow);
  1555. });
  1556. },
  1557. <div id="method-Ext.Component-bubble"></div>/**
  1558. * Bubbles up the component/container heirarchy, calling the specified function with each component. The scope (<i>this</i>) of
  1559. * function call will be the scope provided or the current component. The arguments to the function
  1560. * will be the args provided or the current component. If the function returns false at any point,
  1561. * the bubble is stopped.
  1562. * @param {Function} fn The function to call
  1563. * @param {Object} scope (optional) The scope of the function (defaults to current node)
  1564. * @param {Array} args (optional) The args to call the function with (default to passing the current component)
  1565. * @return {Ext.Component} this
  1566. */
  1567. bubble : function(fn, scope, args){
  1568. var p = this;
  1569. while(p){
  1570. if(fn.apply(scope || p, args || [p]) === false){
  1571. break;
  1572. }
  1573. p = p.ownerCt;
  1574. }
  1575. return this;
  1576. },
  1577. // protected
  1578. getPositionEl : function(){
  1579. return this.positionEl || this.el;
  1580. },
  1581. // private
  1582. purgeListeners : function(){
  1583. Ext.Component.superclass.purgeListeners.call(this);
  1584. if(this.mons){
  1585. this.on('beforedestroy', this.clearMons, this, {single: true});
  1586. }
  1587. },
  1588. // private
  1589. clearMons : function(){
  1590. Ext.each(this.mons, function(m){
  1591. m.item.un(m.ename, m.fn, m.scope);
  1592. }, this);
  1593. this.mons = [];
  1594. },
  1595. // private
  1596. createMons: function(){
  1597. if(!this.mons){
  1598. this.mons = [];
  1599. this.on('beforedestroy', this.clearMons, this, {single: true});
  1600. }
  1601. },
  1602. <div id="method-Ext.Component-mon"></div>/**
  1603. * <p>Adds listeners to any Observable object (or Elements) which are automatically removed when this Component
  1604. * is destroyed. Usage:</p><code><pre>
  1605. myGridPanel.mon(myGridPanel.getSelectionModel(), 'selectionchange', handleSelectionChange, null, {buffer: 50});
  1606. </pre></code>
  1607. * <p>or:</p><code><pre>
  1608. myGridPanel.mon(myGridPanel.getSelectionModel(), {
  1609. selectionchange: handleSelectionChange,
  1610. buffer: 50
  1611. });
  1612. </pre></code>
  1613. * @param {Observable|Element} item The item to which to add a listener/listeners.
  1614. * @param {Object|String} ename The event name, or an object containing event name properties.
  1615. * @param {Function} fn Optional. If the <code>ename</code> parameter was an event name, this
  1616. * is the handler function.
  1617. * @param {Object} scope Optional. If the <code>ename</code> parameter was an event name, this
  1618. * is the scope (<code>this</code> reference) in which the handler function is executed.
  1619. * @param {Object} opt Optional. If the <code>ename</code> parameter was an event name, this
  1620. * is the {@link Ext.util.Observable#addListener addListener} options.
  1621. */
  1622. mon : function(item, ename, fn, scope, opt){
  1623. this.createMons();
  1624. if(Ext.isObject(ename)){
  1625. var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
  1626. var o = ename;
  1627. for(var e in o){
  1628. if(propRe.test(e)){
  1629. continue;
  1630. }
  1631. if(Ext.isFunction(o[e])){
  1632. // shared options
  1633. this.mons.push({
  1634. item: item, ename: e, fn: o[e], scope: o.scope
  1635. });
  1636. item.on(e, o[e], o.scope, o);
  1637. }else{
  1638. // individual options
  1639. this.mons.push({
  1640. item: item, ename: e, fn: o[e], scope: o.scope
  1641. });
  1642. item.on(e, o[e]);
  1643. }
  1644. }
  1645. return;
  1646. }
  1647. this.mons.push({
  1648. item: item, ename: ename, fn: fn, scope: scope
  1649. });
  1650. item.on(ename, fn, scope, opt);
  1651. },
  1652. <div id="method-Ext.Component-mun"></div>/**
  1653. * Removes listeners that were added by the {@link #mon} method.
  1654. * @param {Observable|Element} item The item from which to remove a listener/listeners.
  1655. * @param {Object|String} ename The event name, or an object containing event name properties.
  1656. * @param {Function} fn Optional. If the <code>ename</code> parameter was an event name, this
  1657. * is the handler function.
  1658. * @param {Object} scope Optional. If the <code>ename</code> parameter was an event name, this
  1659. * is the scope (<code>this</code> reference) in which the handler function is executed.
  1660. */
  1661. mun : function(item, ename, fn, scope){
  1662. var found, mon;
  1663. this.createMons();
  1664. for(var i = 0, len = this.mons.length; i < len; ++i){
  1665. mon = this.mons[i];
  1666. if(item === mon.item && ename == mon.ename && fn === mon.fn && scope === mon.scope){
  1667. this.mons.splice(i, 1);
  1668. item.un(ename, fn, scope);
  1669. found = true;
  1670. break;
  1671. }
  1672. }
  1673. return found;
  1674. },
  1675. <div id="method-Ext.Component-nextSibling"></div>/**
  1676. * Returns the next component in the owning container
  1677. * @return Ext.Component
  1678. */
  1679. nextSibling : function(){
  1680. if(this.ownerCt){
  1681. var index = this.ownerCt.items.indexOf(this);
  1682. if(index != -1 && index+1 < this.ownerCt.items.getCount()){
  1683. return this.ownerCt.items.itemAt(index+1);
  1684. }
  1685. }
  1686. return null;
  1687. },
  1688. <div id="method-Ext.Component-previousSibling"></div>/**
  1689. * Returns the previous component in the owning container
  1690. * @return Ext.Component
  1691. */
  1692. previousSibling : function(){
  1693. if(this.ownerCt){
  1694. var index = this.ownerCt.items.indexOf(this);
  1695. if(index > 0){
  1696. return this.ownerCt.items.itemAt(index-1);
  1697. }
  1698. }
  1699. return null;
  1700. },
  1701. <div id="method-Ext.Component-getBubbleTarget"></div>/**
  1702. * Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy.
  1703. * @return {Ext.Container} the Container which owns this Component.
  1704. */
  1705. getBubbleTarget : function(){
  1706. return this.ownerCt;
  1707. }
  1708. });
  1709. Ext.reg('component', Ext.Component);
  1710. </pre>
  1711. </body>
  1712. </html>