Web UI for ARGUS server
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.

600 lines
26 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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.BoxComponent"></div>/**
  16. * @class Ext.BoxComponent
  17. * @extends Ext.Component
  18. * <p>Base class for any {@link Ext.Component Component} that is to be sized as a box, using width and height.</p>
  19. * <p>BoxComponent provides automatic box model adjustments for sizing and positioning and will work correctly
  20. * within the Component rendering model.</p>
  21. * <p>A BoxComponent may be created as a custom Component which encapsulates any HTML element, either a pre-existing
  22. * element, or one that is created to your specifications at render time. Usually, to participate in layouts,
  23. * a Component will need to be a <b>Box</b>Component in order to have its width and height managed.</p>
  24. * <p>To use a pre-existing element as a BoxComponent, configure it so that you preset the <b>el</b> property to the
  25. * element to reference:<pre><code>
  26. var pageHeader = new Ext.BoxComponent({
  27. el: 'my-header-div'
  28. });</code></pre>
  29. * This may then be {@link Ext.Container#add added} to a {@link Ext.Container Container} as a child item.</p>
  30. * <p>To create a BoxComponent based around a HTML element to be created at render time, use the
  31. * {@link Ext.Component#autoEl autoEl} config option which takes the form of a
  32. * {@link Ext.DomHelper DomHelper} specification:<pre><code>
  33. var myImage = new Ext.BoxComponent({
  34. autoEl: {
  35. tag: 'img',
  36. src: '/images/my-image.jpg'
  37. }
  38. });</code></pre></p>
  39. * @constructor
  40. * @param {Ext.Element/String/Object} config The configuration options.
  41. * @xtype box
  42. */
  43. Ext.BoxComponent = Ext.extend(Ext.Component, {
  44. // Configs below are used for all Components when rendered by BoxLayout.
  45. <div id="cfg-Ext.BoxComponent-flex"></div>/**
  46. * @cfg {Number} flex
  47. * <p><b>Note</b>: this config is only used when this Component is rendered
  48. * by a Container which has been configured to use a <b>{@link Ext.layout.BoxLayout BoxLayout}.</b>
  49. * Each child Component with a <code>flex</code> property will be flexed either vertically (by a VBoxLayout)
  50. * or horizontally (by an HBoxLayout) according to the item's <b>relative</b> <code>flex</code> value
  51. * compared to the sum of all Components with <code>flex</flex> value specified. Any child items that have
  52. * either a <code>flex = 0</code> or <code>flex = undefined</code> will not be 'flexed' (the initial size will not be changed).
  53. */
  54. // Configs below are used for all Components when rendered by AnchorLayout.
  55. <div id="cfg-Ext.BoxComponent-anchor"></div>/**
  56. * @cfg {String} anchor <p><b>Note</b>: this config is only used when this Component is rendered
  57. * by a Container which has been configured to use an <b>{@link Ext.layout.AnchorLayout AnchorLayout} (or subclass thereof).</b>
  58. * based layout manager, for example:<div class="mdetail-params"><ul>
  59. * <li>{@link Ext.form.FormPanel}</li>
  60. * <li>specifying <code>layout: 'anchor' // or 'form', or 'absolute'</code></li>
  61. * </ul></div></p>
  62. * <p>See {@link Ext.layout.AnchorLayout}.{@link Ext.layout.AnchorLayout#anchor anchor} also.</p>
  63. */
  64. // tabTip config is used when a BoxComponent is a child of a TabPanel
  65. <div id="cfg-Ext.BoxComponent-tabTip"></div>/**
  66. * @cfg {String} tabTip
  67. * <p><b>Note</b>: this config is only used when this BoxComponent is a child item of a TabPanel.</p>
  68. * A string to be used as innerHTML (html tags are accepted) to show in a tooltip when mousing over
  69. * the associated tab selector element. {@link Ext.QuickTips}.init()
  70. * must be called in order for the tips to render.
  71. */
  72. // Configs below are used for all Components when rendered by BorderLayout.
  73. <div id="cfg-Ext.BoxComponent-region"></div>/**
  74. * @cfg {String} region <p><b>Note</b>: this config is only used when this BoxComponent is rendered
  75. * by a Container which has been configured to use the <b>{@link Ext.layout.BorderLayout BorderLayout}</b>
  76. * layout manager (e.g. specifying <tt>layout:'border'</tt>).</p><br>
  77. * <p>See {@link Ext.layout.BorderLayout} also.</p>
  78. */
  79. // margins config is used when a BoxComponent is rendered by BorderLayout or BoxLayout.
  80. <div id="cfg-Ext.BoxComponent-margins"></div>/**
  81. * @cfg {Object} margins <p><b>Note</b>: this config is only used when this BoxComponent is rendered
  82. * by a Container which has been configured to use the <b>{@link Ext.layout.BorderLayout BorderLayout}</b>
  83. * or one of the two <b>{@link Ext.layout.BoxLayout BoxLayout} subclasses.</b></p>
  84. * <p>An object containing margins to apply to this BoxComponent in the
  85. * format:</p><pre><code>
  86. {
  87. top: (top margin),
  88. right: (right margin),
  89. bottom: (bottom margin),
  90. left: (left margin)
  91. }</code></pre>
  92. * <p>May also be a string containing space-separated, numeric margin values. The order of the
  93. * sides associated with each value matches the way CSS processes margin values:</p>
  94. * <p><div class="mdetail-params"><ul>
  95. * <li>If there is only one value, it applies to all sides.</li>
  96. * <li>If there are two values, the top and bottom borders are set to the first value and the
  97. * right and left are set to the second.</li>
  98. * <li>If there are three values, the top is set to the first value, the left and right are set
  99. * to the second, and the bottom is set to the third.</li>
  100. * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
  101. * </ul></div></p>
  102. * <p>Defaults to:</p><pre><code>
  103. * {top:0, right:0, bottom:0, left:0}
  104. * </code></pre>
  105. */
  106. <div id="cfg-Ext.BoxComponent-x"></div>/**
  107. * @cfg {Number} x
  108. * The local x (left) coordinate for this component if contained within a positioning container.
  109. */
  110. <div id="cfg-Ext.BoxComponent-y"></div>/**
  111. * @cfg {Number} y
  112. * The local y (top) coordinate for this component if contained within a positioning container.
  113. */
  114. <div id="cfg-Ext.BoxComponent-pageX"></div>/**
  115. * @cfg {Number} pageX
  116. * The page level x coordinate for this component if contained within a positioning container.
  117. */
  118. <div id="cfg-Ext.BoxComponent-pageY"></div>/**
  119. * @cfg {Number} pageY
  120. * The page level y coordinate for this component if contained within a positioning container.
  121. */
  122. <div id="cfg-Ext.BoxComponent-height"></div>/**
  123. * @cfg {Number} height
  124. * The height of this component in pixels (defaults to auto).
  125. * <b>Note</b> to express this dimension as a percentage or offset see {@link Ext.Component#anchor}.
  126. */
  127. <div id="cfg-Ext.BoxComponent-width"></div>/**
  128. * @cfg {Number} width
  129. * The width of this component in pixels (defaults to auto).
  130. * <b>Note</b> to express this dimension as a percentage or offset see {@link Ext.Component#anchor}.
  131. */
  132. <div id="cfg-Ext.BoxComponent-boxMinHeight"></div>/**
  133. * @cfg {Number} boxMinHeight
  134. * <p>The minimum value in pixels which this BoxComponent will set its height to.</p>
  135. * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
  136. */
  137. <div id="cfg-Ext.BoxComponent-boxMinWidth"></div>/**
  138. * @cfg {Number} boxMinWidth
  139. * <p>The minimum value in pixels which this BoxComponent will set its width to.</p>
  140. * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
  141. */
  142. <div id="cfg-Ext.BoxComponent-boxMaxHeight"></div>/**
  143. * @cfg {Number} boxMaxHeight
  144. * <p>The maximum value in pixels which this BoxComponent will set its height to.</p>
  145. * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
  146. */
  147. <div id="cfg-Ext.BoxComponent-boxMaxWidth"></div>/**
  148. * @cfg {Number} boxMaxWidth
  149. * <p>The maximum value in pixels which this BoxComponent will set its width to.</p>
  150. * <p><b>Warning:</b> This will override any size management applied by layout managers.</p>
  151. */
  152. <div id="cfg-Ext.BoxComponent-autoHeight"></div>/**
  153. * @cfg {Boolean} autoHeight
  154. * <p>True to use height:'auto', false to use fixed height (or allow it to be managed by its parent
  155. * Container's {@link Ext.Container#layout layout manager}. Defaults to false.</p>
  156. * <p><b>Note</b>: Although many components inherit this config option, not all will
  157. * function as expected with a height of 'auto'. Setting autoHeight:true means that the
  158. * browser will manage height based on the element's contents, and that Ext will not manage it at all.</p>
  159. * <p>If the <i>browser</i> is managing the height, be aware that resizes performed by the browser in response
  160. * to changes within the structure of the Component cannot be detected. Therefore changes to the height might
  161. * result in elements needing to be synchronized with the new height. Example:</p><pre><code>
  162. var w = new Ext.Window({
  163. title: 'Window',
  164. width: 600,
  165. autoHeight: true,
  166. items: {
  167. title: 'Collapse Me',
  168. height: 400,
  169. collapsible: true,
  170. border: false,
  171. listeners: {
  172. beforecollapse: function() {
  173. w.el.shadow.hide();
  174. },
  175. beforeexpand: function() {
  176. w.el.shadow.hide();
  177. },
  178. collapse: function() {
  179. w.syncShadow();
  180. },
  181. expand: function() {
  182. w.syncShadow();
  183. }
  184. }
  185. }
  186. }).show();
  187. </code></pre>
  188. */
  189. <div id="cfg-Ext.BoxComponent-autoWidth"></div>/**
  190. * @cfg {Boolean} autoWidth
  191. * <p>True to use width:'auto', false to use fixed width (or allow it to be managed by its parent
  192. * Container's {@link Ext.Container#layout layout manager}. Defaults to false.</p>
  193. * <p><b>Note</b>: Although many components inherit this config option, not all will
  194. * function as expected with a width of 'auto'. Setting autoWidth:true means that the
  195. * browser will manage width based on the element's contents, and that Ext will not manage it at all.</p>
  196. * <p>If the <i>browser</i> is managing the width, be aware that resizes performed by the browser in response
  197. * to changes within the structure of the Component cannot be detected. Therefore changes to the width might
  198. * result in elements needing to be synchronized with the new width. For example, where the target element is:</p><pre><code>
  199. &lt;div id='grid-container' style='margin-left:25%;width:50%'>&lt;/div>
  200. </code></pre>
  201. * A Panel rendered into that target element must listen for browser window resize in order to relay its
  202. * child items when the browser changes its width:<pre><code>
  203. var myPanel = new Ext.Panel({
  204. renderTo: 'grid-container',
  205. monitorResize: true, // relay on browser resize
  206. title: 'Panel',
  207. height: 400,
  208. autoWidth: true,
  209. layout: 'hbox',
  210. layoutConfig: {
  211. align: 'stretch'
  212. },
  213. defaults: {
  214. flex: 1
  215. },
  216. items: [{
  217. title: 'Box 1',
  218. }, {
  219. title: 'Box 2'
  220. }, {
  221. title: 'Box 3'
  222. }],
  223. });
  224. </code></pre>
  225. */
  226. <div id="cfg-Ext.BoxComponent-autoScroll"></div>/**
  227. * @cfg {Boolean} autoScroll
  228. * <code>true</code> to use overflow:'auto' on the components layout element and show scroll bars automatically when
  229. * necessary, <code>false</code> to clip any overflowing content (defaults to <code>false</code>).
  230. */
  231. /* // private internal config
  232. * {Boolean} deferHeight
  233. * True to defer height calculations to an external component, false to allow this component to set its own
  234. * height (defaults to false).
  235. */
  236. // private
  237. initComponent : function(){
  238. Ext.BoxComponent.superclass.initComponent.call(this);
  239. this.addEvents(
  240. <div id="event-Ext.BoxComponent-resize"></div>/**
  241. * @event resize
  242. * Fires after the component is resized.
  243. * @param {Ext.Component} this
  244. * @param {Number} adjWidth The box-adjusted width that was set
  245. * @param {Number} adjHeight The box-adjusted height that was set
  246. * @param {Number} rawWidth The width that was originally specified
  247. * @param {Number} rawHeight The height that was originally specified
  248. */
  249. 'resize',
  250. <div id="event-Ext.BoxComponent-move"></div>/**
  251. * @event move
  252. * Fires after the component is moved.
  253. * @param {Ext.Component} this
  254. * @param {Number} x The new x position
  255. * @param {Number} y The new y position
  256. */
  257. 'move'
  258. );
  259. },
  260. // private, set in afterRender to signify that the component has been rendered
  261. boxReady : false,
  262. // private, used to defer height settings to subclasses
  263. deferHeight: false,
  264. <div id="method-Ext.BoxComponent-setSize"></div>/**
  265. * Sets the width and height of this BoxComponent. This method fires the {@link #resize} event. This method can accept
  266. * either width and height as separate arguments, or you can pass a size object like <code>{width:10, height:20}</code>.
  267. * @param {Mixed} width The new width to set. This may be one of:<div class="mdetail-params"><ul>
  268. * <li>A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).</li>
  269. * <li>A String used to set the CSS width style.</li>
  270. * <li>A size object in the format <code>{width: widthValue, height: heightValue}</code>.</li>
  271. * <li><code>undefined</code> to leave the width unchanged.</li>
  272. * </ul></div>
  273. * @param {Mixed} height The new height to set (not required if a size object is passed as the first arg).
  274. * This may be one of:<div class="mdetail-params"><ul>
  275. * <li>A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).</li>
  276. * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
  277. * <li><code>undefined</code> to leave the height unchanged.</li>
  278. * </ul></div>
  279. * @return {Ext.BoxComponent} this
  280. */
  281. setSize : function(w, h){
  282. // support for standard size objects
  283. if(typeof w == 'object'){
  284. h = w.height;
  285. w = w.width;
  286. }
  287. if (Ext.isDefined(w) && Ext.isDefined(this.boxMinWidth) && (w < this.boxMinWidth)) {
  288. w = this.boxMinWidth;
  289. }
  290. if (Ext.isDefined(h) && Ext.isDefined(this.boxMinHeight) && (h < this.boxMinHeight)) {
  291. h = this.boxMinHeight;
  292. }
  293. if (Ext.isDefined(w) && Ext.isDefined(this.boxMaxWidth) && (w > this.boxMaxWidth)) {
  294. w = this.boxMaxWidth;
  295. }
  296. if (Ext.isDefined(h) && Ext.isDefined(this.boxMaxHeight) && (h > this.boxMaxHeight)) {
  297. h = this.boxMaxHeight;
  298. }
  299. // not rendered
  300. if(!this.boxReady){
  301. this.width = w;
  302. this.height = h;
  303. return this;
  304. }
  305. // prevent recalcs when not needed
  306. if(this.cacheSizes !== false && this.lastSize && this.lastSize.width == w && this.lastSize.height == h){
  307. return this;
  308. }
  309. this.lastSize = {width: w, height: h};
  310. var adj = this.adjustSize(w, h),
  311. aw = adj.width,
  312. ah = adj.height,
  313. rz;
  314. if(aw !== undefined || ah !== undefined){ // this code is nasty but performs better with floaters
  315. rz = this.getResizeEl();
  316. if(!this.deferHeight && aw !== undefined && ah !== undefined){
  317. rz.setSize(aw, ah);
  318. }else if(!this.deferHeight && ah !== undefined){
  319. rz.setHeight(ah);
  320. }else if(aw !== undefined){
  321. rz.setWidth(aw);
  322. }
  323. this.onResize(aw, ah, w, h);
  324. this.fireEvent('resize', this, aw, ah, w, h);
  325. }
  326. return this;
  327. },
  328. <div id="method-Ext.BoxComponent-setWidth"></div>/**
  329. * Sets the width of the component. This method fires the {@link #resize} event.
  330. * @param {Mixed} width The new width to set. This may be one of:<div class="mdetail-params"><ul>
  331. * <li>A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit defaultUnit}s (by default, pixels).</li>
  332. * <li>A String used to set the CSS width style.</li>
  333. * </ul></div>
  334. * @return {Ext.BoxComponent} this
  335. */
  336. setWidth : function(width){
  337. return this.setSize(width);
  338. },
  339. <div id="method-Ext.BoxComponent-setHeight"></div>/**
  340. * Sets the height of the component. This method fires the {@link #resize} event.
  341. * @param {Mixed} height The new height to set. This may be one of:<div class="mdetail-params"><ul>
  342. * <li>A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit defaultUnit}s (by default, pixels).</li>
  343. * <li>A String used to set the CSS height style.</li>
  344. * <li><i>undefined</i> to leave the height unchanged.</li>
  345. * </ul></div>
  346. * @return {Ext.BoxComponent} this
  347. */
  348. setHeight : function(height){
  349. return this.setSize(undefined, height);
  350. },
  351. <div id="method-Ext.BoxComponent-getSize"></div>/**
  352. * Gets the current size of the component's underlying element.
  353. * @return {Object} An object containing the element's size {width: (element width), height: (element height)}
  354. */
  355. getSize : function(){
  356. return this.getResizeEl().getSize();
  357. },
  358. <div id="method-Ext.BoxComponent-getWidth"></div>/**
  359. * Gets the current width of the component's underlying element.
  360. * @return {Number}
  361. */
  362. getWidth : function(){
  363. return this.getResizeEl().getWidth();
  364. },
  365. <div id="method-Ext.BoxComponent-getHeight"></div>/**
  366. * Gets the current height of the component's underlying element.
  367. * @return {Number}
  368. */
  369. getHeight : function(){
  370. return this.getResizeEl().getHeight();
  371. },
  372. <div id="method-Ext.BoxComponent-getOuterSize"></div>/**
  373. * Gets the current size of the component's underlying element, including space taken by its margins.
  374. * @return {Object} An object containing the element's size {width: (element width + left/right margins), height: (element height + top/bottom margins)}
  375. */
  376. getOuterSize : function(){
  377. var el = this.getResizeEl();
  378. return {width: el.getWidth() + el.getMargins('lr'),
  379. height: el.getHeight() + el.getMargins('tb')};
  380. },
  381. <div id="method-Ext.BoxComponent-getPosition"></div>/**
  382. * Gets the current XY position of the component's underlying element.
  383. * @param {Boolean} local (optional) If true the element's left and top are returned instead of page XY (defaults to false)
  384. * @return {Array} The XY position of the element (e.g., [100, 200])
  385. */
  386. getPosition : function(local){
  387. var el = this.getPositionEl();
  388. if(local === true){
  389. return [el.getLeft(true), el.getTop(true)];
  390. }
  391. return this.xy || el.getXY();
  392. },
  393. <div id="method-Ext.BoxComponent-getBox"></div>/**
  394. * Gets the current box measurements of the component's underlying element.
  395. * @param {Boolean} local (optional) If true the element's left and top are returned instead of page XY (defaults to false)
  396. * @return {Object} box An object in the format {x, y, width, height}
  397. */
  398. getBox : function(local){
  399. var pos = this.getPosition(local);
  400. var s = this.getSize();
  401. s.x = pos[0];
  402. s.y = pos[1];
  403. return s;
  404. },
  405. <div id="method-Ext.BoxComponent-updateBox"></div>/**
  406. * Sets the current box measurements of the component's underlying element.
  407. * @param {Object} box An object in the format {x, y, width, height}
  408. * @return {Ext.BoxComponent} this
  409. */
  410. updateBox : function(box){
  411. this.setSize(box.width, box.height);
  412. this.setPagePosition(box.x, box.y);
  413. return this;
  414. },
  415. <div id="method-Ext.BoxComponent-getResizeEl"></div>/**
  416. * <p>Returns the outermost Element of this Component which defines the Components overall size.</p>
  417. * <p><i>Usually</i> this will return the same Element as <code>{@link #getEl}</code>,
  418. * but in some cases, a Component may have some more wrapping Elements around its main
  419. * active Element.</p>
  420. * <p>An example is a ComboBox. It is encased in a <i>wrapping</i> Element which
  421. * contains both the <code>&lt;input></code> Element (which is what would be returned
  422. * by its <code>{@link #getEl}</code> method, <i>and</i> the trigger button Element.
  423. * This Element is returned as the <code>resizeEl</code>.
  424. * @return {Ext.Element} The Element which is to be resized by size managing layouts.
  425. */
  426. getResizeEl : function(){
  427. return this.resizeEl || this.el;
  428. },
  429. <div id="method-Ext.BoxComponent-setAutoScroll"></div>/**
  430. * Sets the overflow on the content element of the component.
  431. * @param {Boolean} scroll True to allow the Component to auto scroll.
  432. * @return {Ext.BoxComponent} this
  433. */
  434. setAutoScroll : function(scroll){
  435. if(this.rendered){
  436. this.getContentTarget().setOverflow(scroll ? 'auto' : '');
  437. }
  438. this.autoScroll = scroll;
  439. return this;
  440. },
  441. <div id="method-Ext.BoxComponent-setPosition"></div>/**
  442. * Sets the left and top of the component. To set the page XY position instead, use {@link #setPagePosition}.
  443. * This method fires the {@link #move} event.
  444. * @param {Number} left The new left
  445. * @param {Number} top The new top
  446. * @return {Ext.BoxComponent} this
  447. */
  448. setPosition : function(x, y){
  449. if(x && typeof x[1] == 'number'){
  450. y = x[1];
  451. x = x[0];
  452. }
  453. this.x = x;
  454. this.y = y;
  455. if(!this.boxReady){
  456. return this;
  457. }
  458. var adj = this.adjustPosition(x, y);
  459. var ax = adj.x, ay = adj.y;
  460. var el = this.getPositionEl();
  461. if(ax !== undefined || ay !== undefined){
  462. if(ax !== undefined && ay !== undefined){
  463. el.setLeftTop(ax, ay);
  464. }else if(ax !== undefined){
  465. el.setLeft(ax);
  466. }else if(ay !== undefined){
  467. el.setTop(ay);
  468. }
  469. this.onPosition(ax, ay);
  470. this.fireEvent('move', this, ax, ay);
  471. }
  472. return this;
  473. },
  474. <div id="method-Ext.BoxComponent-setPagePosition"></div>/**
  475. * Sets the page XY position of the component. To set the left and top instead, use {@link #setPosition}.
  476. * This method fires the {@link #move} event.
  477. * @param {Number} x The new x position
  478. * @param {Number} y The new y position
  479. * @return {Ext.BoxComponent} this
  480. */
  481. setPagePosition : function(x, y){
  482. if(x && typeof x[1] == 'number'){
  483. y = x[1];
  484. x = x[0];
  485. }
  486. this.pageX = x;
  487. this.pageY = y;
  488. if(!this.boxReady){
  489. return;
  490. }
  491. if(x === undefined || y === undefined){ // cannot translate undefined points
  492. return;
  493. }
  494. var p = this.getPositionEl().translatePoints(x, y);
  495. this.setPosition(p.left, p.top);
  496. return this;
  497. },
  498. // private
  499. afterRender : function(){
  500. Ext.BoxComponent.superclass.afterRender.call(this);
  501. if(this.resizeEl){
  502. this.resizeEl = Ext.get(this.resizeEl);
  503. }
  504. if(this.positionEl){
  505. this.positionEl = Ext.get(this.positionEl);
  506. }
  507. this.boxReady = true;
  508. Ext.isDefined(this.autoScroll) && this.setAutoScroll(this.autoScroll);
  509. this.setSize(this.width, this.height);
  510. if(this.x || this.y){
  511. this.setPosition(this.x, this.y);
  512. }else if(this.pageX || this.pageY){
  513. this.setPagePosition(this.pageX, this.pageY);
  514. }
  515. },
  516. <div id="method-Ext.BoxComponent-syncSize"></div>/**
  517. * Force the component's size to recalculate based on the underlying element's current height and width.
  518. * @return {Ext.BoxComponent} this
  519. */
  520. syncSize : function(){
  521. delete this.lastSize;
  522. this.setSize(this.autoWidth ? undefined : this.getResizeEl().getWidth(), this.autoHeight ? undefined : this.getResizeEl().getHeight());
  523. return this;
  524. },
  525. /* // protected
  526. * Called after the component is resized, this method is empty by default but can be implemented by any
  527. * subclass that needs to perform custom logic after a resize occurs.
  528. * @param {Number} adjWidth The box-adjusted width that was set
  529. * @param {Number} adjHeight The box-adjusted height that was set
  530. * @param {Number} rawWidth The width that was originally specified
  531. * @param {Number} rawHeight The height that was originally specified
  532. */
  533. onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){
  534. },
  535. /* // protected
  536. * Called after the component is moved, this method is empty by default but can be implemented by any
  537. * subclass that needs to perform custom logic after a move occurs.
  538. * @param {Number} x The new x position
  539. * @param {Number} y The new y position
  540. */
  541. onPosition : function(x, y){
  542. },
  543. // private
  544. adjustSize : function(w, h){
  545. if(this.autoWidth){
  546. w = 'auto';
  547. }
  548. if(this.autoHeight){
  549. h = 'auto';
  550. }
  551. return {width : w, height: h};
  552. },
  553. // private
  554. adjustPosition : function(x, y){
  555. return {x : x, y: y};
  556. }
  557. });
  558. Ext.reg('box', Ext.BoxComponent);
  559. <div id="cls-Ext.Spacer"></div>/**
  560. * @class Ext.Spacer
  561. * @extends Ext.BoxComponent
  562. * <p>Used to provide a sizable space in a layout.</p>
  563. * @constructor
  564. * @param {Object} config
  565. */
  566. Ext.Spacer = Ext.extend(Ext.BoxComponent, {
  567. autoEl:'div'
  568. });
  569. Ext.reg('spacer', Ext.Spacer);</pre>
  570. </body>
  571. </html>