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.

1166 lines
48 KiB

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