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.

1161 lines
44 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.layout.BorderLayout"></div>/**
  16. * @class Ext.layout.BorderLayout
  17. * @extends Ext.layout.ContainerLayout
  18. * <p>This is a multi-pane, application-oriented UI layout style that supports multiple
  19. * nested panels, automatic {@link Ext.layout.BorderLayout.Region#split split} bars between
  20. * {@link Ext.layout.BorderLayout.Region#BorderLayout.Region regions} and built-in
  21. * {@link Ext.layout.BorderLayout.Region#collapsible expanding and collapsing} of regions.</p>
  22. * <p>This class is intended to be extended or created via the <tt>layout:'border'</tt>
  23. * {@link Ext.Container#layout} config, and should generally not need to be created directly
  24. * via the new keyword.</p>
  25. * <p>BorderLayout does not have any direct config options (other than inherited ones).
  26. * All configuration options available for customizing the BorderLayout are at the
  27. * {@link Ext.layout.BorderLayout.Region} and {@link Ext.layout.BorderLayout.SplitRegion}
  28. * levels.</p>
  29. * <p>Example usage:</p>
  30. * <pre><code>
  31. var myBorderPanel = new Ext.Panel({
  32. {@link Ext.Component#renderTo renderTo}: document.body,
  33. {@link Ext.BoxComponent#width width}: 700,
  34. {@link Ext.BoxComponent#height height}: 500,
  35. {@link Ext.Panel#title title}: 'Border Layout',
  36. {@link Ext.Container#layout layout}: 'border',
  37. {@link Ext.Container#items items}: [{
  38. {@link Ext.Panel#title title}: 'South Region is resizable',
  39. {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}: 'south', // position for region
  40. {@link Ext.BoxComponent#height height}: 100,
  41. {@link Ext.layout.BorderLayout.Region#split split}: true, // enable resizing
  42. {@link Ext.SplitBar#minSize minSize}: 75, // defaults to {@link Ext.layout.BorderLayout.Region#minHeight 50}
  43. {@link Ext.SplitBar#maxSize maxSize}: 150,
  44. {@link Ext.layout.BorderLayout.Region#margins margins}: '0 5 5 5'
  45. },{
  46. // xtype: 'panel' implied by default
  47. {@link Ext.Panel#title title}: 'West Region is collapsible',
  48. {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}:'west',
  49. {@link Ext.layout.BorderLayout.Region#margins margins}: '5 0 0 5',
  50. {@link Ext.BoxComponent#width width}: 200,
  51. {@link Ext.layout.BorderLayout.Region#collapsible collapsible}: true, // make collapsible
  52. {@link Ext.layout.BorderLayout.Region#cmargins cmargins}: '5 5 0 5', // adjust top margin when collapsed
  53. {@link Ext.Component#id id}: 'west-region-container',
  54. {@link Ext.Container#layout layout}: 'fit',
  55. {@link Ext.Panel#unstyled unstyled}: true
  56. },{
  57. {@link Ext.Panel#title title}: 'Center Region',
  58. {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}: 'center', // center region is required, no width/height specified
  59. {@link Ext.Component#xtype xtype}: 'container',
  60. {@link Ext.Container#layout layout}: 'fit',
  61. {@link Ext.layout.BorderLayout.Region#margins margins}: '5 5 0 0'
  62. }]
  63. });
  64. </code></pre>
  65. * <p><b><u>Notes</u></b>:</p><div class="mdetail-params"><ul>
  66. * <li>Any container using the BorderLayout <b>must</b> have a child item with <tt>region:'center'</tt>.
  67. * The child item in the center region will always be resized to fill the remaining space not used by
  68. * the other regions in the layout.</li>
  69. * <li>Any child items with a region of <tt>west</tt> or <tt>east</tt> must have <tt>width</tt> defined
  70. * (an integer representing the number of pixels that the region should take up).</li>
  71. * <li>Any child items with a region of <tt>north</tt> or <tt>south</tt> must have <tt>height</tt> defined.</li>
  72. * <li>The regions of a BorderLayout are <b>fixed at render time</b> and thereafter, its child Components may not be removed or added</b>. To add/remove
  73. * Components within a BorderLayout, have them wrapped by an additional Container which is directly
  74. * managed by the BorderLayout. If the region is to be collapsible, the Container used directly
  75. * by the BorderLayout manager should be a Panel. In the following example a Container (an Ext.Panel)
  76. * is added to the west region:
  77. * <div style="margin-left:16px"><pre><code>
  78. wrc = {@link Ext#getCmp Ext.getCmp}('west-region-container');
  79. wrc.{@link Ext.Panel#removeAll removeAll}();
  80. wrc.{@link Ext.Container#add add}({
  81. title: 'Added Panel',
  82. html: 'Some content'
  83. });
  84. wrc.{@link Ext.Container#doLayout doLayout}();
  85. * </code></pre></div>
  86. * </li>
  87. * <li> To reference a {@link Ext.layout.BorderLayout.Region Region}:
  88. * <div style="margin-left:16px"><pre><code>
  89. wr = myBorderPanel.layout.west;
  90. * </code></pre></div>
  91. * </li>
  92. * </ul></div>
  93. */
  94. Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {
  95. // private
  96. monitorResize:true,
  97. // private
  98. rendered : false,
  99. type: 'border',
  100. targetCls: 'x-border-layout-ct',
  101. getLayoutTargetSize : function() {
  102. var target = this.container.getLayoutTarget();
  103. return target ? target.getViewSize() : {};
  104. },
  105. // private
  106. onLayout : function(ct, target){
  107. var collapsed, i, c, pos, items = ct.items.items, len = items.length;
  108. if(!this.rendered){
  109. collapsed = [];
  110. for(i = 0; i < len; i++) {
  111. c = items[i];
  112. pos = c.region;
  113. if(c.collapsed){
  114. collapsed.push(c);
  115. }
  116. c.collapsed = false;
  117. if(!c.rendered){
  118. c.render(target, i);
  119. c.getPositionEl().addClass('x-border-panel');
  120. }
  121. this[pos] = pos != 'center' && c.split ?
  122. new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :
  123. new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);
  124. this[pos].render(target, c);
  125. }
  126. this.rendered = true;
  127. }
  128. var size = this.getLayoutTargetSize();
  129. if(size.width < 20 || size.height < 20){ // display none?
  130. if(collapsed){
  131. this.restoreCollapsed = collapsed;
  132. }
  133. return;
  134. }else if(this.restoreCollapsed){
  135. collapsed = this.restoreCollapsed;
  136. delete this.restoreCollapsed;
  137. }
  138. var w = size.width, h = size.height,
  139. centerW = w, centerH = h, centerY = 0, centerX = 0,
  140. n = this.north, s = this.south, west = this.west, e = this.east, c = this.center,
  141. b, m, totalWidth, totalHeight;
  142. if(!c && Ext.layout.BorderLayout.WARN !== false){
  143. throw 'No center region defined in BorderLayout ' + ct.id;
  144. }
  145. if(n && n.isVisible()){
  146. b = n.getSize();
  147. m = n.getMargins();
  148. b.width = w - (m.left+m.right);
  149. b.x = m.left;
  150. b.y = m.top;
  151. centerY = b.height + b.y + m.bottom;
  152. centerH -= centerY;
  153. n.applyLayout(b);
  154. }
  155. if(s && s.isVisible()){
  156. b = s.getSize();
  157. m = s.getMargins();
  158. b.width = w - (m.left+m.right);
  159. b.x = m.left;
  160. totalHeight = (b.height + m.top + m.bottom);
  161. b.y = h - totalHeight + m.top;
  162. centerH -= totalHeight;
  163. s.applyLayout(b);
  164. }
  165. if(west && west.isVisible()){
  166. b = west.getSize();
  167. m = west.getMargins();
  168. b.height = centerH - (m.top+m.bottom);
  169. b.x = m.left;
  170. b.y = centerY + m.top;
  171. totalWidth = (b.width + m.left + m.right);
  172. centerX += totalWidth;
  173. centerW -= totalWidth;
  174. west.applyLayout(b);
  175. }
  176. if(e && e.isVisible()){
  177. b = e.getSize();
  178. m = e.getMargins();
  179. b.height = centerH - (m.top+m.bottom);
  180. totalWidth = (b.width + m.left + m.right);
  181. b.x = w - totalWidth + m.left;
  182. b.y = centerY + m.top;
  183. centerW -= totalWidth;
  184. e.applyLayout(b);
  185. }
  186. if(c){
  187. m = c.getMargins();
  188. var centerBox = {
  189. x: centerX + m.left,
  190. y: centerY + m.top,
  191. width: centerW - (m.left+m.right),
  192. height: centerH - (m.top+m.bottom)
  193. };
  194. c.applyLayout(centerBox);
  195. }
  196. if(collapsed){
  197. for(i = 0, len = collapsed.length; i < len; i++){
  198. collapsed[i].collapse(false);
  199. }
  200. }
  201. if(Ext.isIE && Ext.isStrict){ // workaround IE strict repainting issue
  202. target.repaint();
  203. }
  204. // Putting a border layout into an overflowed container is NOT correct and will make a second layout pass necessary.
  205. if (i = target.getStyle('overflow') && i != 'hidden' && !this.adjustmentPass) {
  206. var ts = this.getLayoutTargetSize();
  207. if (ts.width != size.width || ts.height != size.height){
  208. this.adjustmentPass = true;
  209. this.onLayout(ct, target);
  210. }
  211. }
  212. delete this.adjustmentPass;
  213. },
  214. destroy: function() {
  215. var r = ['north', 'south', 'east', 'west'], i, region;
  216. for (i = 0; i < r.length; i++) {
  217. region = this[r[i]];
  218. if(region){
  219. if(region.destroy){
  220. region.destroy();
  221. }else if (region.split){
  222. region.split.destroy(true);
  223. }
  224. }
  225. }
  226. Ext.layout.BorderLayout.superclass.destroy.call(this);
  227. }
  228. <div id="prop-Ext.layout.BorderLayout-activeItem"></div>/**
  229. * @property activeItem
  230. * @hide
  231. */
  232. });
  233. <div id="cls-Ext.layout.BorderLayout.Region"></div>/**
  234. * @class Ext.layout.BorderLayout.Region
  235. * <p>This is a region of a {@link Ext.layout.BorderLayout BorderLayout} that acts as a subcontainer
  236. * within the layout. Each region has its own {@link Ext.layout.ContainerLayout layout} that is
  237. * independent of other regions and the containing BorderLayout, and can be any of the
  238. * {@link Ext.layout.ContainerLayout valid Ext layout types}.</p>
  239. * <p>Region size is managed automatically and cannot be changed by the user -- for
  240. * {@link #split resizable regions}, see {@link Ext.layout.BorderLayout.SplitRegion}.</p>
  241. * @constructor
  242. * Create a new Region.
  243. * @param {Layout} layout The {@link Ext.layout.BorderLayout BorderLayout} instance that is managing this Region.
  244. * @param {Object} config The configuration options
  245. * @param {String} position The region position. Valid values are: <tt>north</tt>, <tt>south</tt>,
  246. * <tt>east</tt>, <tt>west</tt> and <tt>center</tt>. Every {@link Ext.layout.BorderLayout BorderLayout}
  247. * <b>must have a center region</b> for the primary content -- all other regions are optional.
  248. */
  249. Ext.layout.BorderLayout.Region = function(layout, config, pos){
  250. Ext.apply(this, config);
  251. this.layout = layout;
  252. this.position = pos;
  253. this.state = {};
  254. if(typeof this.margins == 'string'){
  255. this.margins = this.layout.parseMargins(this.margins);
  256. }
  257. this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);
  258. if(this.collapsible){
  259. if(typeof this.cmargins == 'string'){
  260. this.cmargins = this.layout.parseMargins(this.cmargins);
  261. }
  262. if(this.collapseMode == 'mini' && !this.cmargins){
  263. this.cmargins = {left:0,top:0,right:0,bottom:0};
  264. }else{
  265. this.cmargins = Ext.applyIf(this.cmargins || {},
  266. pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);
  267. }
  268. }
  269. };
  270. Ext.layout.BorderLayout.Region.prototype = {
  271. <div id="cfg-Ext.layout.BorderLayout.Region-animFloat"></div>/**
  272. * @cfg {Boolean} animFloat
  273. * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated
  274. * panel that will close again once the user mouses out of that panel (or clicks out if
  275. * <tt>{@link #autoHide} = false</tt>). Setting <tt>{@link #animFloat} = false</tt> will
  276. * prevent the open and close of these floated panels from being animated (defaults to <tt>true</tt>).
  277. */
  278. <div id="cfg-Ext.layout.BorderLayout.Region-autoHide"></div>/**
  279. * @cfg {Boolean} autoHide
  280. * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated
  281. * panel. If <tt>autoHide = true</tt>, the panel will automatically hide after the user mouses
  282. * out of the panel. If <tt>autoHide = false</tt>, the panel will continue to display until the
  283. * user clicks outside of the panel (defaults to <tt>true</tt>).
  284. */
  285. <div id="cfg-Ext.layout.BorderLayout.Region-collapseMode"></div>/**
  286. * @cfg {String} collapseMode
  287. * <tt>collapseMode</tt> supports two configuration values:<div class="mdetail-params"><ul>
  288. * <li><b><tt>undefined</tt></b> (default)<div class="sub-desc">By default, {@link #collapsible}
  289. * regions are collapsed by clicking the expand/collapse tool button that renders into the region's
  290. * title bar.</div></li>
  291. * <li><b><tt>'mini'</tt></b><div class="sub-desc">Optionally, when <tt>collapseMode</tt> is set to
  292. * <tt>'mini'</tt> the region's split bar will also display a small collapse button in the center of
  293. * the bar. In <tt>'mini'</tt> mode the region will collapse to a thinner bar than in normal mode.
  294. * </div></li>
  295. * </ul></div></p>
  296. * <p><b>Note</b>: if a collapsible region does not have a title bar, then set <tt>collapseMode =
  297. * 'mini'</tt> and <tt>{@link #split} = true</tt> in order for the region to be {@link #collapsible}
  298. * by the user as the expand/collapse tool button (that would go in the title bar) will not be rendered.</p>
  299. * <p>See also <tt>{@link #cmargins}</tt>.</p>
  300. */
  301. <div id="cfg-Ext.layout.BorderLayout.Region-margins"></div>/**
  302. * @cfg {Object} margins
  303. * An object containing margins to apply to the region when in the expanded state in the
  304. * format:<pre><code>
  305. {
  306. top: (top margin),
  307. right: (right margin),
  308. bottom: (bottom margin),
  309. left: (left margin)
  310. }</code></pre>
  311. * <p>May also be a string containing space-separated, numeric margin values. The order of the
  312. * sides associated with each value matches the way CSS processes margin values:</p>
  313. * <p><div class="mdetail-params"><ul>
  314. * <li>If there is only one value, it applies to all sides.</li>
  315. * <li>If there are two values, the top and bottom borders are set to the first value and the
  316. * right and left are set to the second.</li>
  317. * <li>If there are three values, the top is set to the first value, the left and right are set
  318. * to the second, and the bottom is set to the third.</li>
  319. * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
  320. * </ul></div></p>
  321. * <p>Defaults to:</p><pre><code>
  322. * {top:0, right:0, bottom:0, left:0}
  323. * </code></pre>
  324. */
  325. <div id="cfg-Ext.layout.BorderLayout.Region-cmargins"></div>/**
  326. * @cfg {Object} cmargins
  327. * An object containing margins to apply to the region when in the collapsed state in the
  328. * format:<pre><code>
  329. {
  330. top: (top margin),
  331. right: (right margin),
  332. bottom: (bottom margin),
  333. left: (left margin)
  334. }</code></pre>
  335. * <p>May also be a string containing space-separated, numeric margin values. The order of the
  336. * sides associated with each value matches the way CSS processes margin values.</p>
  337. * <p><ul>
  338. * <li>If there is only one value, it applies to all sides.</li>
  339. * <li>If there are two values, the top and bottom borders are set to the first value and the
  340. * right and left are set to the second.</li>
  341. * <li>If there are three values, the top is set to the first value, the left and right are set
  342. * to the second, and the bottom is set to the third.</li>
  343. * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
  344. * </ul></p>
  345. */
  346. <div id="cfg-Ext.layout.BorderLayout.Region-collapsible"></div>/**
  347. * @cfg {Boolean} collapsible
  348. * <p><tt>true</tt> to allow the user to collapse this region (defaults to <tt>false</tt>). If
  349. * <tt>true</tt>, an expand/collapse tool button will automatically be rendered into the title
  350. * bar of the region, otherwise the button will not be shown.</p>
  351. * <p><b>Note</b>: that a title bar is required to display the collapse/expand toggle button -- if
  352. * no <tt>title</tt> is specified for the region's panel, the region will only be collapsible if
  353. * <tt>{@link #collapseMode} = 'mini'</tt> and <tt>{@link #split} = true</tt>.
  354. */
  355. collapsible : false,
  356. <div id="cfg-Ext.layout.BorderLayout.Region-split"></div>/**
  357. * @cfg {Boolean} split
  358. * <p><tt>true</tt> to create a {@link Ext.layout.BorderLayout.SplitRegion SplitRegion} and
  359. * display a 5px wide {@link Ext.SplitBar} between this region and its neighbor, allowing the user to
  360. * resize the regions dynamically. Defaults to <tt>false</tt> creating a
  361. * {@link Ext.layout.BorderLayout.Region Region}.</p><br>
  362. * <p><b>Notes</b>:</p><div class="mdetail-params"><ul>
  363. * <li>this configuration option is ignored if <tt>region='center'</tt></li>
  364. * <li>when <tt>split == true</tt>, it is common to specify a
  365. * <tt>{@link Ext.SplitBar#minSize minSize}</tt> and <tt>{@link Ext.SplitBar#maxSize maxSize}</tt>
  366. * for the {@link Ext.BoxComponent BoxComponent} representing the region. These are not native
  367. * configs of {@link Ext.BoxComponent BoxComponent}, and are used only by this class.</li>
  368. * <li>if <tt>{@link #collapseMode} = 'mini'</tt> requires <tt>split = true</tt> to reserve space
  369. * for the collapse tool</tt></li>
  370. * </ul></div>
  371. */
  372. split:false,
  373. <div id="cfg-Ext.layout.BorderLayout.Region-floatable"></div>/**
  374. * @cfg {Boolean} floatable
  375. * <tt>true</tt> to allow clicking a collapsed region's bar to display the region's panel floated
  376. * above the layout, <tt>false</tt> to force the user to fully expand a collapsed region by
  377. * clicking the expand button to see it again (defaults to <tt>true</tt>).
  378. */
  379. floatable: true,
  380. <div id="cfg-Ext.layout.BorderLayout.Region-minWidth"></div>/**
  381. * @cfg {Number} minWidth
  382. * <p>The minimum allowable width in pixels for this region (defaults to <tt>50</tt>).
  383. * <tt>maxWidth</tt> may also be specified.</p><br>
  384. * <p><b>Note</b>: setting the <tt>{@link Ext.SplitBar#minSize minSize}</tt> /
  385. * <tt>{@link Ext.SplitBar#maxSize maxSize}</tt> supersedes any specified
  386. * <tt>minWidth</tt> / <tt>maxWidth</tt>.</p>
  387. */
  388. minWidth:50,
  389. <div id="cfg-Ext.layout.BorderLayout.Region-minHeight"></div>/**
  390. * @cfg {Number} minHeight
  391. * The minimum allowable height in pixels for this region (defaults to <tt>50</tt>)
  392. * <tt>maxHeight</tt> may also be specified.</p><br>
  393. * <p><b>Note</b>: setting the <tt>{@link Ext.SplitBar#minSize minSize}</tt> /
  394. * <tt>{@link Ext.SplitBar#maxSize maxSize}</tt> supersedes any specified
  395. * <tt>minHeight</tt> / <tt>maxHeight</tt>.</p>
  396. */
  397. minHeight:50,
  398. // private
  399. defaultMargins : {left:0,top:0,right:0,bottom:0},
  400. // private
  401. defaultNSCMargins : {left:5,top:5,right:5,bottom:5},
  402. // private
  403. defaultEWCMargins : {left:5,top:0,right:5,bottom:0},
  404. floatingZIndex: 100,
  405. <div id="prop-Ext.layout.BorderLayout.Region-isCollapsed"></div>/**
  406. * True if this region is collapsed. Read-only.
  407. * @type Boolean
  408. * @property
  409. */
  410. isCollapsed : false,
  411. <div id="prop-Ext.layout.BorderLayout.Region-panel"></div>/**
  412. * This region's panel. Read-only.
  413. * @type Ext.Panel
  414. * @property panel
  415. */
  416. <div id="prop-Ext.layout.BorderLayout.Region-layout"></div>/**
  417. * This region's layout. Read-only.
  418. * @type Layout
  419. * @property layout
  420. */
  421. <div id="prop-Ext.layout.BorderLayout.Region-position"></div>/**
  422. * This region's layout position (north, south, east, west or center). Read-only.
  423. * @type String
  424. * @property position
  425. */
  426. // private
  427. render : function(ct, p){
  428. this.panel = p;
  429. p.el.enableDisplayMode();
  430. this.targetEl = ct;
  431. this.el = p.el;
  432. var gs = p.getState, ps = this.position;
  433. p.getState = function(){
  434. return Ext.apply(gs.call(p) || {}, this.state);
  435. }.createDelegate(this);
  436. if(ps != 'center'){
  437. p.allowQueuedExpand = false;
  438. p.on({
  439. beforecollapse: this.beforeCollapse,
  440. collapse: this.onCollapse,
  441. beforeexpand: this.beforeExpand,
  442. expand: this.onExpand,
  443. hide: this.onHide,
  444. show: this.onShow,
  445. scope: this
  446. });
  447. if(this.collapsible || this.floatable){
  448. p.collapseEl = 'el';
  449. p.slideAnchor = this.getSlideAnchor();
  450. }
  451. if(p.tools && p.tools.toggle){
  452. p.tools.toggle.addClass('x-tool-collapse-'+ps);
  453. p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');
  454. }
  455. }
  456. },
  457. // private
  458. getCollapsedEl : function(){
  459. if(!this.collapsedEl){
  460. if(!this.toolTemplate){
  461. var tt = new Ext.Template(
  462. '<div class="x-tool x-tool-{id}">&#160;</div>'
  463. );
  464. tt.disableFormats = true;
  465. tt.compile();
  466. Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;
  467. }
  468. this.collapsedEl = this.targetEl.createChild({
  469. cls: "x-layout-collapsed x-layout-collapsed-"+this.position,
  470. id: this.panel.id + '-xcollapsed'
  471. });
  472. this.collapsedEl.enableDisplayMode('block');
  473. if(this.collapseMode == 'mini'){
  474. this.collapsedEl.addClass('x-layout-cmini-'+this.position);
  475. this.miniCollapsedEl = this.collapsedEl.createChild({
  476. cls: "x-layout-mini x-layout-mini-"+this.position, html: "&#160;"
  477. });
  478. this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');
  479. this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
  480. this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});
  481. }else {
  482. if(this.collapsible !== false && !this.hideCollapseTool) {
  483. var t = this.expandToolEl = this.toolTemplate.append(
  484. this.collapsedEl.dom,
  485. {id:'expand-'+this.position}, true);
  486. t.addClassOnOver('x-tool-expand-'+this.position+'-over');
  487. t.on('click', this.onExpandClick, this, {stopEvent:true});
  488. }
  489. if(this.floatable !== false || this.titleCollapse){
  490. this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
  491. this.collapsedEl.on("click", this[this.floatable ? 'collapseClick' : 'onExpandClick'], this);
  492. }
  493. }
  494. }
  495. return this.collapsedEl;
  496. },
  497. // private
  498. onExpandClick : function(e){
  499. if(this.isSlid){
  500. this.panel.expand(false);
  501. }else{
  502. this.panel.expand();
  503. }
  504. },
  505. // private
  506. onCollapseClick : function(e){
  507. this.panel.collapse();
  508. },
  509. // private
  510. beforeCollapse : function(p, animate){
  511. this.lastAnim = animate;
  512. if(this.splitEl){
  513. this.splitEl.hide();
  514. }
  515. this.getCollapsedEl().show();
  516. var el = this.panel.getEl();
  517. this.originalZIndex = el.getStyle('z-index');
  518. el.setStyle('z-index', 100);
  519. this.isCollapsed = true;
  520. this.layout.layout();
  521. },
  522. // private
  523. onCollapse : function(animate){
  524. this.panel.el.setStyle('z-index', 1);
  525. if(this.lastAnim === false || this.panel.animCollapse === false){
  526. this.getCollapsedEl().dom.style.visibility = 'visible';
  527. }else{
  528. this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});
  529. }
  530. this.state.collapsed = true;
  531. this.panel.saveState();
  532. },
  533. // private
  534. beforeExpand : function(animate){
  535. if(this.isSlid){
  536. this.afterSlideIn();
  537. }
  538. var c = this.getCollapsedEl();
  539. this.el.show();
  540. if(this.position == 'east' || this.position == 'west'){
  541. this.panel.setSize(undefined, c.getHeight());
  542. }else{
  543. this.panel.setSize(c.getWidth(), undefined);
  544. }
  545. c.hide();
  546. c.dom.style.visibility = 'hidden';
  547. this.panel.el.setStyle('z-index', this.floatingZIndex);
  548. },
  549. // private
  550. onExpand : function(){
  551. this.isCollapsed = false;
  552. if(this.splitEl){
  553. this.splitEl.show();
  554. }
  555. this.layout.layout();
  556. this.panel.el.setStyle('z-index', this.originalZIndex);
  557. this.state.collapsed = false;
  558. this.panel.saveState();
  559. },
  560. // private
  561. collapseClick : function(e){
  562. if(this.isSlid){
  563. e.stopPropagation();
  564. this.slideIn();
  565. }else{
  566. e.stopPropagation();
  567. this.slideOut();
  568. }
  569. },
  570. // private
  571. onHide : function(){
  572. if(this.isCollapsed){
  573. this.getCollapsedEl().hide();
  574. }else if(this.splitEl){
  575. this.splitEl.hide();
  576. }
  577. },
  578. // private
  579. onShow : function(){
  580. if(this.isCollapsed){
  581. this.getCollapsedEl().show();
  582. }else if(this.splitEl){
  583. this.splitEl.show();
  584. }
  585. },
  586. <div id="method-Ext.layout.BorderLayout.Region-isVisible"></div>/**
  587. * True if this region is currently visible, else false.
  588. * @return {Boolean}
  589. */
  590. isVisible : function(){
  591. return !this.panel.hidden;
  592. },
  593. <div id="method-Ext.layout.BorderLayout.Region-getMargins"></div>/**
  594. * Returns the current margins for this region. If the region is collapsed, the
  595. * {@link #cmargins} (collapsed margins) value will be returned, otherwise the
  596. * {@link #margins} value will be returned.
  597. * @return {Object} An object containing the element's margins: <tt>{left: (left
  598. * margin), top: (top margin), right: (right margin), bottom: (bottom margin)}</tt>
  599. */
  600. getMargins : function(){
  601. return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;
  602. },
  603. <div id="method-Ext.layout.BorderLayout.Region-getSize"></div>/**
  604. * Returns the current size of this region. If the region is collapsed, the size of the
  605. * collapsedEl will be returned, otherwise the size of the region's panel will be returned.
  606. * @return {Object} An object containing the element's size: <tt>{width: (element width),
  607. * height: (element height)}</tt>
  608. */
  609. getSize : function(){
  610. return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();
  611. },
  612. <div id="method-Ext.layout.BorderLayout.Region-setPanel"></div>/**
  613. * Sets the specified panel as the container element for this region.
  614. * @param {Ext.Panel} panel The new panel
  615. */
  616. setPanel : function(panel){
  617. this.panel = panel;
  618. },
  619. <div id="method-Ext.layout.BorderLayout.Region-getMinWidth"></div>/**
  620. * Returns the minimum allowable width for this region.
  621. * @return {Number} The minimum width
  622. */
  623. getMinWidth: function(){
  624. return this.minWidth;
  625. },
  626. <div id="method-Ext.layout.BorderLayout.Region-getMinHeight"></div>/**
  627. * Returns the minimum allowable height for this region.
  628. * @return {Number} The minimum height
  629. */
  630. getMinHeight: function(){
  631. return this.minHeight;
  632. },
  633. // private
  634. applyLayoutCollapsed : function(box){
  635. var ce = this.getCollapsedEl();
  636. ce.setLeftTop(box.x, box.y);
  637. ce.setSize(box.width, box.height);
  638. },
  639. // private
  640. applyLayout : function(box){
  641. if(this.isCollapsed){
  642. this.applyLayoutCollapsed(box);
  643. }else{
  644. this.panel.setPosition(box.x, box.y);
  645. this.panel.setSize(box.width, box.height);
  646. }
  647. },
  648. // private
  649. beforeSlide: function(){
  650. this.panel.beforeEffect();
  651. },
  652. // private
  653. afterSlide : function(){
  654. this.panel.afterEffect();
  655. },
  656. // private
  657. initAutoHide : function(){
  658. if(this.autoHide !== false){
  659. if(!this.autoHideHd){
  660. this.autoHideSlideTask = new Ext.util.DelayedTask(this.slideIn, this);
  661. this.autoHideHd = {
  662. "mouseout": function(e){
  663. if(!e.within(this.el, true)){
  664. this.autoHideSlideTask.delay(500);
  665. }
  666. },
  667. "mouseover" : function(e){
  668. this.autoHideSlideTask.cancel();
  669. },
  670. scope : this
  671. };
  672. }
  673. this.el.on(this.autoHideHd);
  674. this.collapsedEl.on(this.autoHideHd);
  675. }
  676. },
  677. // private
  678. clearAutoHide : function(){
  679. if(this.autoHide !== false){
  680. this.el.un("mouseout", this.autoHideHd.mouseout);
  681. this.el.un("mouseover", this.autoHideHd.mouseover);
  682. this.collapsedEl.un("mouseout", this.autoHideHd.mouseout);
  683. this.collapsedEl.un("mouseover", this.autoHideHd.mouseover);
  684. }
  685. },
  686. // private
  687. clearMonitor : function(){
  688. Ext.getDoc().un("click", this.slideInIf, this);
  689. },
  690. <div id="method-Ext.layout.BorderLayout.Region-slideOut"></div>/**
  691. * If this Region is {@link #floatable}, this method slides this Region into full visibility <i>over the top
  692. * of the center Region</i> where it floats until either {@link #slideIn} is called, or other regions of the layout
  693. * are clicked, or the mouse exits the Region.
  694. */
  695. slideOut : function(){
  696. if(this.isSlid || this.el.hasActiveFx()){
  697. return;
  698. }
  699. this.isSlid = true;
  700. var ts = this.panel.tools, dh, pc;
  701. if(ts && ts.toggle){
  702. ts.toggle.hide();
  703. }
  704. this.el.show();
  705. // Temporarily clear the collapsed flag so we can onResize the panel on the slide
  706. pc = this.panel.collapsed;
  707. this.panel.collapsed = false;
  708. if(this.position == 'east' || this.position == 'west'){
  709. // Temporarily clear the deferHeight flag so we can size the height on the slide
  710. dh = this.panel.deferHeight;
  711. this.panel.deferHeight = false;
  712. this.panel.setSize(undefined, this.collapsedEl.getHeight());
  713. // Put the deferHeight flag back after setSize
  714. this.panel.deferHeight = dh;
  715. }else{
  716. this.panel.setSize(this.collapsedEl.getWidth(), undefined);
  717. }
  718. // Put the collapsed flag back after onResize
  719. this.panel.collapsed = pc;
  720. this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];
  721. this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());
  722. this.el.setStyle("z-index", this.floatingZIndex+2);
  723. this.panel.el.replaceClass('x-panel-collapsed', 'x-panel-floating');
  724. if(this.animFloat !== false){
  725. this.beforeSlide();
  726. this.el.slideIn(this.getSlideAnchor(), {
  727. callback: function(){
  728. this.afterSlide();
  729. this.initAutoHide();
  730. Ext.getDoc().on("click", this.slideInIf, this);
  731. },
  732. scope: this,
  733. block: true
  734. });
  735. }else{
  736. this.initAutoHide();
  737. Ext.getDoc().on("click", this.slideInIf, this);
  738. }
  739. },
  740. // private
  741. afterSlideIn : function(){
  742. this.clearAutoHide();
  743. this.isSlid = false;
  744. this.clearMonitor();
  745. this.el.setStyle("z-index", "");
  746. this.panel.el.replaceClass('x-panel-floating', 'x-panel-collapsed');
  747. this.el.dom.style.left = this.restoreLT[0];
  748. this.el.dom.style.top = this.restoreLT[1];
  749. var ts = this.panel.tools;
  750. if(ts && ts.toggle){
  751. ts.toggle.show();
  752. }
  753. },
  754. <div id="method-Ext.layout.BorderLayout.Region-slideIn"></div>/**
  755. * If this Region is {@link #floatable}, and this Region has been slid into floating visibility, then this method slides
  756. * this region back into its collapsed state.
  757. */
  758. slideIn : function(cb){
  759. if(!this.isSlid || this.el.hasActiveFx()){
  760. Ext.callback(cb);
  761. return;
  762. }
  763. this.isSlid = false;
  764. if(this.animFloat !== false){
  765. this.beforeSlide();
  766. this.el.slideOut(this.getSlideAnchor(), {
  767. callback: function(){
  768. this.el.hide();
  769. this.afterSlide();
  770. this.afterSlideIn();
  771. Ext.callback(cb);
  772. },
  773. scope: this,
  774. block: true
  775. });
  776. }else{
  777. this.el.hide();
  778. this.afterSlideIn();
  779. }
  780. },
  781. // private
  782. slideInIf : function(e){
  783. if(!e.within(this.el)){
  784. this.slideIn();
  785. }
  786. },
  787. // private
  788. anchors : {
  789. "west" : "left",
  790. "east" : "right",
  791. "north" : "top",
  792. "south" : "bottom"
  793. },
  794. // private
  795. sanchors : {
  796. "west" : "l",
  797. "east" : "r",
  798. "north" : "t",
  799. "south" : "b"
  800. },
  801. // private
  802. canchors : {
  803. "west" : "tl-tr",
  804. "east" : "tr-tl",
  805. "north" : "tl-bl",
  806. "south" : "bl-tl"
  807. },
  808. // private
  809. getAnchor : function(){
  810. return this.anchors[this.position];
  811. },
  812. // private
  813. getCollapseAnchor : function(){
  814. return this.canchors[this.position];
  815. },
  816. // private
  817. getSlideAnchor : function(){
  818. return this.sanchors[this.position];
  819. },
  820. // private
  821. getAlignAdj : function(){
  822. var cm = this.cmargins;
  823. switch(this.position){
  824. case "west":
  825. return [0, 0];
  826. break;
  827. case "east":
  828. return [0, 0];
  829. break;
  830. case "north":
  831. return [0, 0];
  832. break;
  833. case "south":
  834. return [0, 0];
  835. break;
  836. }
  837. },
  838. // private
  839. getExpandAdj : function(){
  840. var c = this.collapsedEl, cm = this.cmargins;
  841. switch(this.position){
  842. case "west":
  843. return [-(cm.right+c.getWidth()+cm.left), 0];
  844. break;
  845. case "east":
  846. return [cm.right+c.getWidth()+cm.left, 0];
  847. break;
  848. case "north":
  849. return [0, -(cm.top+cm.bottom+c.getHeight())];
  850. break;
  851. case "south":
  852. return [0, cm.top+cm.bottom+c.getHeight()];
  853. break;
  854. }
  855. },
  856. destroy : function(){
  857. if (this.autoHideSlideTask && this.autoHideSlideTask.cancel){
  858. this.autoHideSlideTask.cancel();
  859. }
  860. Ext.destroyMembers(this, 'miniCollapsedEl', 'collapsedEl', 'expandToolEl');
  861. }
  862. };
  863. <div id="cls-Ext.layout.BorderLayout.SplitRegion"></div>/**
  864. * @class Ext.layout.BorderLayout.SplitRegion
  865. * @extends Ext.layout.BorderLayout.Region
  866. * <p>This is a specialized type of {@link Ext.layout.BorderLayout.Region BorderLayout region} that
  867. * has a built-in {@link Ext.SplitBar} for user resizing of regions. The movement of the split bar
  868. * is configurable to move either {@link #tickSize smooth or incrementally}.</p>
  869. * @constructor
  870. * Create a new SplitRegion.
  871. * @param {Layout} layout The {@link Ext.layout.BorderLayout BorderLayout} instance that is managing this Region.
  872. * @param {Object} config The configuration options
  873. * @param {String} position The region position. Valid values are: north, south, east, west and center. Every
  874. * BorderLayout must have a center region for the primary content -- all other regions are optional.
  875. */
  876. Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){
  877. Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);
  878. // prevent switch
  879. this.applyLayout = this.applyFns[pos];
  880. };
  881. Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {
  882. <div id="cfg-Ext.layout.BorderLayout.SplitRegion-tickSize"></div>/**
  883. * @cfg {Number} tickSize
  884. * The increment, in pixels by which to move this Region's {@link Ext.SplitBar SplitBar}.
  885. * By default, the {@link Ext.SplitBar SplitBar} moves smoothly.
  886. */
  887. <div id="cfg-Ext.layout.BorderLayout.SplitRegion-splitTip"></div>/**
  888. * @cfg {String} splitTip
  889. * The tooltip to display when the user hovers over a
  890. * {@link Ext.layout.BorderLayout.Region#collapsible non-collapsible} region's split bar
  891. * (defaults to <tt>"Drag to resize."</tt>). Only applies if
  892. * <tt>{@link #useSplitTips} = true</tt>.
  893. */
  894. splitTip : "Drag to resize.",
  895. <div id="cfg-Ext.layout.BorderLayout.SplitRegion-collapsibleSplitTip"></div>/**
  896. * @cfg {String} collapsibleSplitTip
  897. * The tooltip to display when the user hovers over a
  898. * {@link Ext.layout.BorderLayout.Region#collapsible collapsible} region's split bar
  899. * (defaults to "Drag to resize. Double click to hide."). Only applies if
  900. * <tt>{@link #useSplitTips} = true</tt>.
  901. */
  902. collapsibleSplitTip : "Drag to resize. Double click to hide.",
  903. <div id="cfg-Ext.layout.BorderLayout.SplitRegion-useSplitTips"></div>/**
  904. * @cfg {Boolean} useSplitTips
  905. * <tt>true</tt> to display a tooltip when the user hovers over a region's split bar
  906. * (defaults to <tt>false</tt>). The tooltip text will be the value of either
  907. * <tt>{@link #splitTip}</tt> or <tt>{@link #collapsibleSplitTip}</tt> as appropriate.
  908. */
  909. useSplitTips : false,
  910. // private
  911. splitSettings : {
  912. north : {
  913. orientation: Ext.SplitBar.VERTICAL,
  914. placement: Ext.SplitBar.TOP,
  915. maxFn : 'getVMaxSize',
  916. minProp: 'minHeight',
  917. maxProp: 'maxHeight'
  918. },
  919. south : {
  920. orientation: Ext.SplitBar.VERTICAL,
  921. placement: Ext.SplitBar.BOTTOM,
  922. maxFn : 'getVMaxSize',
  923. minProp: 'minHeight',
  924. maxProp: 'maxHeight'
  925. },
  926. east : {
  927. orientation: Ext.SplitBar.HORIZONTAL,
  928. placement: Ext.SplitBar.RIGHT,
  929. maxFn : 'getHMaxSize',
  930. minProp: 'minWidth',
  931. maxProp: 'maxWidth'
  932. },
  933. west : {
  934. orientation: Ext.SplitBar.HORIZONTAL,
  935. placement: Ext.SplitBar.LEFT,
  936. maxFn : 'getHMaxSize',
  937. minProp: 'minWidth',
  938. maxProp: 'maxWidth'
  939. }
  940. },
  941. // private
  942. applyFns : {
  943. west : function(box){
  944. if(this.isCollapsed){
  945. return this.applyLayoutCollapsed(box);
  946. }
  947. var sd = this.splitEl.dom, s = sd.style;
  948. this.panel.setPosition(box.x, box.y);
  949. var sw = sd.offsetWidth;
  950. s.left = (box.x+box.width-sw)+'px';
  951. s.top = (box.y)+'px';
  952. s.height = Math.max(0, box.height)+'px';
  953. this.panel.setSize(box.width-sw, box.height);
  954. },
  955. east : function(box){
  956. if(this.isCollapsed){
  957. return this.applyLayoutCollapsed(box);
  958. }
  959. var sd = this.splitEl.dom, s = sd.style;
  960. var sw = sd.offsetWidth;
  961. this.panel.setPosition(box.x+sw, box.y);
  962. s.left = (box.x)+'px';
  963. s.top = (box.y)+'px';
  964. s.height = Math.max(0, box.height)+'px';
  965. this.panel.setSize(box.width-sw, box.height);
  966. },
  967. north : function(box){
  968. if(this.isCollapsed){
  969. return this.applyLayoutCollapsed(box);
  970. }
  971. var sd = this.splitEl.dom, s = sd.style;
  972. var sh = sd.offsetHeight;
  973. this.panel.setPosition(box.x, box.y);
  974. s.left = (box.x)+'px';
  975. s.top = (box.y+box.height-sh)+'px';
  976. s.width = Math.max(0, box.width)+'px';
  977. this.panel.setSize(box.width, box.height-sh);
  978. },
  979. south : function(box){
  980. if(this.isCollapsed){
  981. return this.applyLayoutCollapsed(box);
  982. }
  983. var sd = this.splitEl.dom, s = sd.style;
  984. var sh = sd.offsetHeight;
  985. this.panel.setPosition(box.x, box.y+sh);
  986. s.left = (box.x)+'px';
  987. s.top = (box.y)+'px';
  988. s.width = Math.max(0, box.width)+'px';
  989. this.panel.setSize(box.width, box.height-sh);
  990. }
  991. },
  992. // private
  993. render : function(ct, p){
  994. Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
  995. var ps = this.position;
  996. this.splitEl = ct.createChild({
  997. cls: "x-layout-split x-layout-split-"+ps, html: "&#160;",
  998. id: this.panel.id + '-xsplit'
  999. });
  1000. if(this.collapseMode == 'mini'){
  1001. this.miniSplitEl = this.splitEl.createChild({
  1002. cls: "x-layout-mini x-layout-mini-"+ps, html: "&#160;"
  1003. });
  1004. this.miniSplitEl.addClassOnOver('x-layout-mini-over');
  1005. this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});
  1006. }
  1007. var s = this.splitSettings[ps];
  1008. this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);
  1009. this.split.tickSize = this.tickSize;
  1010. this.split.placement = s.placement;
  1011. this.split.getMaximumSize = this[s.maxFn].createDelegate(this);
  1012. this.split.minSize = this.minSize || this[s.minProp];
  1013. this.split.on("beforeapply", this.onSplitMove, this);
  1014. this.split.useShim = this.useShim === true;
  1015. this.maxSize = this.maxSize || this[s.maxProp];
  1016. if(p.hidden){
  1017. this.splitEl.hide();
  1018. }
  1019. if(this.useSplitTips){
  1020. this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;
  1021. }
  1022. if(this.collapsible){
  1023. this.splitEl.on("dblclick", this.onCollapseClick, this);
  1024. }
  1025. },
  1026. //docs inherit from superclass
  1027. getSize : function(){
  1028. if(this.isCollapsed){
  1029. return this.collapsedEl.getSize();
  1030. }
  1031. var s = this.panel.getSize();
  1032. if(this.position == 'north' || this.position == 'south'){
  1033. s.height += this.splitEl.dom.offsetHeight;
  1034. }else{
  1035. s.width += this.splitEl.dom.offsetWidth;
  1036. }
  1037. return s;
  1038. },
  1039. // private
  1040. getHMaxSize : function(){
  1041. var cmax = this.maxSize || 10000;
  1042. var center = this.layout.center;
  1043. return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());
  1044. },
  1045. // private
  1046. getVMaxSize : function(){
  1047. var cmax = this.maxSize || 10000;
  1048. var center = this.layout.center;
  1049. return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());
  1050. },
  1051. // private
  1052. onSplitMove : function(split, newSize){
  1053. var s = this.panel.getSize();
  1054. this.lastSplitSize = newSize;
  1055. if(this.position == 'north' || this.position == 'south'){
  1056. this.panel.setSize(s.width, newSize);
  1057. this.state.height = newSize;
  1058. }else{
  1059. this.panel.setSize(newSize, s.height);
  1060. this.state.width = newSize;
  1061. }
  1062. this.layout.layout();
  1063. this.panel.saveState();
  1064. return false;
  1065. },
  1066. <div id="method-Ext.layout.BorderLayout.SplitRegion-getSplitBar"></div>/**
  1067. * Returns a reference to the split bar in use by this region.
  1068. * @return {Ext.SplitBar} The split bar
  1069. */
  1070. getSplitBar : function(){
  1071. return this.split;
  1072. },
  1073. // inherit docs
  1074. destroy : function() {
  1075. Ext.destroy(this.miniSplitEl, this.split, this.splitEl);
  1076. Ext.layout.BorderLayout.SplitRegion.superclass.destroy.call(this);
  1077. }
  1078. });
  1079. Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout;
  1080. </pre>
  1081. </body>
  1082. </html>