3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.layout.BorderLayout"></div>/**
10 * @class Ext.layout.BorderLayout
11 * @extends Ext.layout.ContainerLayout
12 * <p>This is a multi-pane, application-oriented UI layout style that supports multiple
13 * nested panels, automatic {@link Ext.layout.BorderLayout.Region#split split} bars between
14 * {@link Ext.layout.BorderLayout.Region#BorderLayout.Region regions} and built-in
15 * {@link Ext.layout.BorderLayout.Region#collapsible expanding and collapsing} of regions.</p>
16 * <p>This class is intended to be extended or created via the <tt>layout:'border'</tt>
17 * {@link Ext.Container#layout} config, and should generally not need to be created directly
18 * via the new keyword.</p>
19 * <p>BorderLayout does not have any direct config options (other than inherited ones).
20 * All configuration options available for customizing the BorderLayout are at the
21 * {@link Ext.layout.BorderLayout.Region} and {@link Ext.layout.BorderLayout.SplitRegion}
23 * <p>Example usage:</p>
25 var myBorderPanel = new Ext.Panel({
26 {@link Ext.Component#renderTo renderTo}: document.body,
27 {@link Ext.BoxComponent#width width}: 700,
28 {@link Ext.BoxComponent#height height}: 500,
29 {@link Ext.Panel#title title}: 'Border Layout',
30 {@link Ext.Container#layout layout}: 'border',
31 {@link Ext.Container#items items}: [{
32 {@link Ext.Panel#title title}: 'South Region is resizable',
33 {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}: 'south', // position for region
34 {@link Ext.BoxComponent#height height}: 100,
35 {@link Ext.layout.BorderLayout.Region#split split}: true, // enable resizing
36 {@link Ext.SplitBar#minSize minSize}: 75, // defaults to {@link Ext.layout.BorderLayout.Region#minHeight 50}
37 {@link Ext.SplitBar#maxSize maxSize}: 150,
38 {@link Ext.layout.BorderLayout.Region#margins margins}: '0 5 5 5'
40 // xtype: 'panel' implied by default
41 {@link Ext.Panel#title title}: 'West Region is collapsible',
42 {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}:'west',
43 {@link Ext.layout.BorderLayout.Region#margins margins}: '5 0 0 5',
44 {@link Ext.BoxComponent#width width}: 200,
45 {@link Ext.layout.BorderLayout.Region#collapsible collapsible}: true, // make collapsible
46 {@link Ext.layout.BorderLayout.Region#cmargins cmargins}: '5 5 0 5', // adjust top margin when collapsed
47 {@link Ext.Component#id id}: 'west-region-container',
48 {@link Ext.Container#layout layout}: 'fit',
49 {@link Ext.Panel#unstyled unstyled}: true
51 {@link Ext.Panel#title title}: 'Center Region',
52 {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}: 'center', // center region is required, no width/height specified
53 {@link Ext.Component#xtype xtype}: 'container',
54 {@link Ext.Container#layout layout}: 'fit',
55 {@link Ext.layout.BorderLayout.Region#margins margins}: '5 5 0 0'
59 * <p><b><u>Notes</u></b>:</p><div class="mdetail-params"><ul>
60 * <li>Any container using the BorderLayout <b>must</b> have a child item with <tt>region:'center'</tt>.
61 * The child item in the center region will always be resized to fill the remaining space not used by
62 * the other regions in the layout.</li>
63 * <li>Any child items with a region of <tt>west</tt> or <tt>east</tt> must have <tt>width</tt> defined
64 * (an integer representing the number of pixels that the region should take up).</li>
65 * <li>Any child items with a region of <tt>north</tt> or <tt>south</tt> must have <tt>height</tt> defined.</li>
66 * <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
67 * Components within a BorderLayout, have them wrapped by an additional Container which is directly
68 * managed by the BorderLayout. If the region is to be collapsible, the Container used directly
69 * by the BorderLayout manager should be a Panel. In the following example a Container (an Ext.Panel)
70 * is added to the west region:
71 * <div style="margin-left:16px"><pre><code>
72 wrc = {@link Ext#getCmp Ext.getCmp}('west-region-container');
73 wrc.{@link Ext.Panel#removeAll removeAll}();
74 wrc.{@link Ext.Container#add add}({
78 wrc.{@link Ext.Container#doLayout doLayout}();
81 * <li> To reference a {@link Ext.layout.BorderLayout.Region Region}:
82 * <div style="margin-left:16px"><pre><code>
83 wr = myBorderPanel.layout.west;
88 Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {
96 targetCls: 'x-border-layout-ct',
98 getLayoutTargetSize : function() {
99 var target = this.container.getLayoutTarget();
100 return target ? target.getViewSize() : {};
104 onLayout : function(ct, target){
105 var collapsed, i, c, pos, items = ct.items.items, len = items.length;
108 for(i = 0; i < len; i++) {
117 c.getPositionEl().addClass('x-border-panel');
119 this[pos] = pos != 'center' && c.split ?
120 new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :
121 new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);
122 this[pos].render(target, c);
124 this.rendered = true;
127 var size = this.getLayoutTargetSize();
128 if(size.width < 20 || size.height < 20){ // display none?
130 this.restoreCollapsed = collapsed;
133 }else if(this.restoreCollapsed){
134 collapsed = this.restoreCollapsed;
135 delete this.restoreCollapsed;
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;
146 if(n && n.isVisible()){
149 b.width = w - (m.left+m.right);
152 centerY = b.height + b.y + m.bottom;
156 if(s && s.isVisible()){
159 b.width = w - (m.left+m.right);
161 totalHeight = (b.height + m.top + m.bottom);
162 b.y = h - totalHeight + m.top;
163 centerH -= totalHeight;
166 if(west && west.isVisible()){
168 m = west.getMargins();
169 b.height = centerH - (m.top+m.bottom);
171 b.y = centerY + m.top;
172 totalWidth = (b.width + m.left + m.right);
173 centerX += totalWidth;
174 centerW -= totalWidth;
177 if(e && e.isVisible()){
180 b.height = centerH - (m.top+m.bottom);
181 totalWidth = (b.width + m.left + m.right);
182 b.x = w - totalWidth + m.left;
183 b.y = centerY + m.top;
184 centerW -= totalWidth;
192 width: centerW - (m.left+m.right),
193 height: centerH - (m.top+m.bottom)
195 c.applyLayout(centerBox);
198 for(i = 0, len = collapsed.length; i < len; i++){
199 collapsed[i].collapse(false);
202 if(Ext.isIE && Ext.isStrict){ // workaround IE strict repainting issue
205 // Putting a border layout into an overflowed container is NOT correct and will make a second layout pass necessary.
206 if (i = target.getStyle('overflow') && i != 'hidden' && !this.adjustmentPass) {
207 var ts = this.getLayoutTargetSize();
208 if (ts.width != size.width || ts.height != size.height){
209 this.adjustmentPass = true;
210 this.onLayout(ct, target);
213 delete this.adjustmentPass;
216 destroy: function() {
217 var r = ['north', 'south', 'east', 'west'], i, region;
218 for (i = 0; i < r.length; i++) {
223 }else if (region.split){
224 region.split.destroy(true);
228 Ext.layout.BorderLayout.superclass.destroy.call(this);
231 <div id="prop-Ext.layout.BorderLayout-activeItem"></div>/**
232 * @property activeItem
237 <div id="cls-Ext.layout.BorderLayout.Region"></div>/**
238 * @class Ext.layout.BorderLayout.Region
239 * <p>This is a region of a {@link Ext.layout.BorderLayout BorderLayout} that acts as a subcontainer
240 * within the layout. Each region has its own {@link Ext.layout.ContainerLayout layout} that is
241 * independent of other regions and the containing BorderLayout, and can be any of the
242 * {@link Ext.layout.ContainerLayout valid Ext layout types}.</p>
243 * <p>Region size is managed automatically and cannot be changed by the user -- for
244 * {@link #split resizable regions}, see {@link Ext.layout.BorderLayout.SplitRegion}.</p>
246 * Create a new Region.
247 * @param {Layout} layout The {@link Ext.layout.BorderLayout BorderLayout} instance that is managing this Region.
248 * @param {Object} config The configuration options
249 * @param {String} position The region position. Valid values are: <tt>north</tt>, <tt>south</tt>,
250 * <tt>east</tt>, <tt>west</tt> and <tt>center</tt>. Every {@link Ext.layout.BorderLayout BorderLayout}
251 * <b>must have a center region</b> for the primary content -- all other regions are optional.
253 Ext.layout.BorderLayout.Region = function(layout, config, pos){
254 Ext.apply(this, config);
255 this.layout = layout;
258 if(typeof this.margins == 'string'){
259 this.margins = this.layout.parseMargins(this.margins);
261 this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);
262 if(this.collapsible){
263 if(typeof this.cmargins == 'string'){
264 this.cmargins = this.layout.parseMargins(this.cmargins);
266 if(this.collapseMode == 'mini' && !this.cmargins){
267 this.cmargins = {left:0,top:0,right:0,bottom:0};
269 this.cmargins = Ext.applyIf(this.cmargins || {},
270 pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);
275 Ext.layout.BorderLayout.Region.prototype = {
276 <div id="cfg-Ext.layout.BorderLayout.Region-animFloat"></div>/**
277 * @cfg {Boolean} animFloat
278 * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated
279 * panel that will close again once the user mouses out of that panel (or clicks out if
280 * <tt>{@link #autoHide} = false</tt>). Setting <tt>{@link #animFloat} = false</tt> will
281 * prevent the open and close of these floated panels from being animated (defaults to <tt>true</tt>).
283 <div id="cfg-Ext.layout.BorderLayout.Region-autoHide"></div>/**
284 * @cfg {Boolean} autoHide
285 * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated
286 * panel. If <tt>autoHide = true</tt>, the panel will automatically hide after the user mouses
287 * out of the panel. If <tt>autoHide = false</tt>, the panel will continue to display until the
288 * user clicks outside of the panel (defaults to <tt>true</tt>).
290 <div id="cfg-Ext.layout.BorderLayout.Region-collapseMode"></div>/**
291 * @cfg {String} collapseMode
292 * <tt>collapseMode</tt> supports two configuration values:<div class="mdetail-params"><ul>
293 * <li><b><tt>undefined</tt></b> (default)<div class="sub-desc">By default, {@link #collapsible}
294 * regions are collapsed by clicking the expand/collapse tool button that renders into the region's
295 * title bar.</div></li>
296 * <li><b><tt>'mini'</tt></b><div class="sub-desc">Optionally, when <tt>collapseMode</tt> is set to
297 * <tt>'mini'</tt> the region's split bar will also display a small collapse button in the center of
298 * the bar. In <tt>'mini'</tt> mode the region will collapse to a thinner bar than in normal mode.
301 * <p><b>Note</b>: if a collapsible region does not have a title bar, then set <tt>collapseMode =
302 * 'mini'</tt> and <tt>{@link #split} = true</tt> in order for the region to be {@link #collapsible}
303 * by the user as the expand/collapse tool button (that would go in the title bar) will not be rendered.</p>
304 * <p>See also <tt>{@link #cmargins}</tt>.</p>
306 <div id="cfg-Ext.layout.BorderLayout.Region-margins"></div>/**
307 * @cfg {Object} margins
308 * An object containing margins to apply to the region when in the expanded state in the
312 right: (right margin),
313 bottom: (bottom margin),
316 * <p>May also be a string containing space-separated, numeric margin values. The order of the
317 * sides associated with each value matches the way CSS processes margin values:</p>
318 * <p><div class="mdetail-params"><ul>
319 * <li>If there is only one value, it applies to all sides.</li>
320 * <li>If there are two values, the top and bottom borders are set to the first value and the
321 * right and left are set to the second.</li>
322 * <li>If there are three values, the top is set to the first value, the left and right are set
323 * to the second, and the bottom is set to the third.</li>
324 * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
326 * <p>Defaults to:</p><pre><code>
327 * {top:0, right:0, bottom:0, left:0}
330 <div id="cfg-Ext.layout.BorderLayout.Region-cmargins"></div>/**
331 * @cfg {Object} cmargins
332 * An object containing margins to apply to the region when in the collapsed state in the
336 right: (right margin),
337 bottom: (bottom margin),
340 * <p>May also be a string containing space-separated, numeric margin values. The order of the
341 * sides associated with each value matches the way CSS processes margin values.</p>
343 * <li>If there is only one value, it applies to all sides.</li>
344 * <li>If there are two values, the top and bottom borders are set to the first value and the
345 * right and left are set to the second.</li>
346 * <li>If there are three values, the top is set to the first value, the left and right are set
347 * to the second, and the bottom is set to the third.</li>
348 * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
351 <div id="cfg-Ext.layout.BorderLayout.Region-collapsible"></div>/**
352 * @cfg {Boolean} collapsible
353 * <p><tt>true</tt> to allow the user to collapse this region (defaults to <tt>false</tt>). If
354 * <tt>true</tt>, an expand/collapse tool button will automatically be rendered into the title
355 * bar of the region, otherwise the button will not be shown.</p>
356 * <p><b>Note</b>: that a title bar is required to display the collapse/expand toggle button -- if
357 * no <tt>title</tt> is specified for the region's panel, the region will only be collapsible if
358 * <tt>{@link #collapseMode} = 'mini'</tt> and <tt>{@link #split} = true</tt>.
361 <div id="cfg-Ext.layout.BorderLayout.Region-split"></div>/**
362 * @cfg {Boolean} split
363 * <p><tt>true</tt> to create a {@link Ext.layout.BorderLayout.SplitRegion SplitRegion} and
364 * display a 5px wide {@link Ext.SplitBar} between this region and its neighbor, allowing the user to
365 * resize the regions dynamically. Defaults to <tt>false</tt> creating a
366 * {@link Ext.layout.BorderLayout.Region Region}.</p><br>
367 * <p><b>Notes</b>:</p><div class="mdetail-params"><ul>
368 * <li>this configuration option is ignored if <tt>region='center'</tt></li>
369 * <li>when <tt>split == true</tt>, it is common to specify a
370 * <tt>{@link Ext.SplitBar#minSize minSize}</tt> and <tt>{@link Ext.SplitBar#maxSize maxSize}</tt>
371 * for the {@link Ext.BoxComponent BoxComponent} representing the region. These are not native
372 * configs of {@link Ext.BoxComponent BoxComponent}, and are used only by this class.</li>
373 * <li>if <tt>{@link #collapseMode} = 'mini'</tt> requires <tt>split = true</tt> to reserve space
374 * for the collapse tool</tt></li>
378 <div id="cfg-Ext.layout.BorderLayout.Region-floatable"></div>/**
379 * @cfg {Boolean} floatable
380 * <tt>true</tt> to allow clicking a collapsed region's bar to display the region's panel floated
381 * above the layout, <tt>false</tt> to force the user to fully expand a collapsed region by
382 * clicking the expand button to see it again (defaults to <tt>true</tt>).
385 <div id="cfg-Ext.layout.BorderLayout.Region-minWidth"></div>/**
386 * @cfg {Number} minWidth
387 * <p>The minimum allowable width in pixels for this region (defaults to <tt>50</tt>).
388 * <tt>maxWidth</tt> may also be specified.</p><br>
389 * <p><b>Note</b>: setting the <tt>{@link Ext.SplitBar#minSize minSize}</tt> /
390 * <tt>{@link Ext.SplitBar#maxSize maxSize}</tt> supersedes any specified
391 * <tt>minWidth</tt> / <tt>maxWidth</tt>.</p>
394 <div id="cfg-Ext.layout.BorderLayout.Region-minHeight"></div>/**
395 * @cfg {Number} minHeight
396 * The minimum allowable height in pixels for this region (defaults to <tt>50</tt>)
397 * <tt>maxHeight</tt> may also be specified.</p><br>
398 * <p><b>Note</b>: setting the <tt>{@link Ext.SplitBar#minSize minSize}</tt> /
399 * <tt>{@link Ext.SplitBar#maxSize maxSize}</tt> supersedes any specified
400 * <tt>minHeight</tt> / <tt>maxHeight</tt>.</p>
405 defaultMargins : {left:0,top:0,right:0,bottom:0},
407 defaultNSCMargins : {left:5,top:5,right:5,bottom:5},
409 defaultEWCMargins : {left:5,top:0,right:5,bottom:0},
412 <div id="prop-Ext.layout.BorderLayout.Region-isCollapsed"></div>/**
413 * True if this region is collapsed. Read-only.
419 <div id="prop-Ext.layout.BorderLayout.Region-panel"></div>/**
420 * This region's panel. Read-only.
424 <div id="prop-Ext.layout.BorderLayout.Region-layout"></div>/**
425 * This region's layout. Read-only.
429 <div id="prop-Ext.layout.BorderLayout.Region-position"></div>/**
430 * This region's layout position (north, south, east, west or center). Read-only.
436 render : function(ct, p){
438 p.el.enableDisplayMode();
442 var gs = p.getState, ps = this.position;
443 p.getState = function(){
444 return Ext.apply(gs.call(p) || {}, this.state);
445 }.createDelegate(this);
448 p.allowQueuedExpand = false;
450 beforecollapse: this.beforeCollapse,
451 collapse: this.onCollapse,
452 beforeexpand: this.beforeExpand,
453 expand: this.onExpand,
458 if(this.collapsible || this.floatable){
460 p.slideAnchor = this.getSlideAnchor();
462 if(p.tools && p.tools.toggle){
463 p.tools.toggle.addClass('x-tool-collapse-'+ps);
464 p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');
470 getCollapsedEl : function(){
471 if(!this.collapsedEl){
472 if(!this.toolTemplate){
473 var tt = new Ext.Template(
474 '<div class="x-tool x-tool-{id}"> </div>'
476 tt.disableFormats = true;
478 Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;
480 this.collapsedEl = this.targetEl.createChild({
481 cls: "x-layout-collapsed x-layout-collapsed-"+this.position,
482 id: this.panel.id + '-xcollapsed'
484 this.collapsedEl.enableDisplayMode('block');
486 if(this.collapseMode == 'mini'){
487 this.collapsedEl.addClass('x-layout-cmini-'+this.position);
488 this.miniCollapsedEl = this.collapsedEl.createChild({
489 cls: "x-layout-mini x-layout-mini-"+this.position, html: " "
491 this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');
492 this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
493 this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});
495 if(this.collapsible !== false && !this.hideCollapseTool) {
496 var t = this.toolTemplate.append(
497 this.collapsedEl.dom,
498 {id:'expand-'+this.position}, true);
499 t.addClassOnOver('x-tool-expand-'+this.position+'-over');
500 t.on('click', this.onExpandClick, this, {stopEvent:true});
502 if(this.floatable !== false || this.titleCollapse){
503 this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
504 this.collapsedEl.on("click", this[this.floatable ? 'collapseClick' : 'onExpandClick'], this);
508 return this.collapsedEl;
512 onExpandClick : function(e){
514 this.panel.expand(false);
521 onCollapseClick : function(e){
522 this.panel.collapse();
526 beforeCollapse : function(p, animate){
527 this.lastAnim = animate;
531 this.getCollapsedEl().show();
532 var el = this.panel.getEl();
533 this.originalZIndex = el.getStyle('z-index');
534 el.setStyle('z-index', 100);
535 this.isCollapsed = true;
536 this.layout.layout();
540 onCollapse : function(animate){
541 this.panel.el.setStyle('z-index', 1);
542 if(this.lastAnim === false || this.panel.animCollapse === false){
543 this.getCollapsedEl().dom.style.visibility = 'visible';
545 this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});
547 this.state.collapsed = true;
548 this.panel.saveState();
552 beforeExpand : function(animate){
556 var c = this.getCollapsedEl();
558 if(this.position == 'east' || this.position == 'west'){
559 this.panel.setSize(undefined, c.getHeight());
561 this.panel.setSize(c.getWidth(), undefined);
564 c.dom.style.visibility = 'hidden';
565 this.panel.el.setStyle('z-index', this.floatingZIndex);
569 onExpand : function(){
570 this.isCollapsed = false;
574 this.layout.layout();
575 this.panel.el.setStyle('z-index', this.originalZIndex);
576 this.state.collapsed = false;
577 this.panel.saveState();
581 collapseClick : function(e){
593 if(this.isCollapsed){
594 this.getCollapsedEl().hide();
595 }else if(this.splitEl){
602 if(this.isCollapsed){
603 this.getCollapsedEl().show();
604 }else if(this.splitEl){
609 <div id="method-Ext.layout.BorderLayout.Region-isVisible"></div>/**
610 * True if this region is currently visible, else false.
613 isVisible : function(){
614 return !this.panel.hidden;
617 <div id="method-Ext.layout.BorderLayout.Region-getMargins"></div>/**
618 * Returns the current margins for this region. If the region is collapsed, the
619 * {@link #cmargins} (collapsed margins) value will be returned, otherwise the
620 * {@link #margins} value will be returned.
621 * @return {Object} An object containing the element's margins: <tt>{left: (left
622 * margin), top: (top margin), right: (right margin), bottom: (bottom margin)}</tt>
624 getMargins : function(){
625 return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;
628 <div id="method-Ext.layout.BorderLayout.Region-getSize"></div>/**
629 * Returns the current size of this region. If the region is collapsed, the size of the
630 * collapsedEl will be returned, otherwise the size of the region's panel will be returned.
631 * @return {Object} An object containing the element's size: <tt>{width: (element width),
632 * height: (element height)}</tt>
634 getSize : function(){
635 return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();
638 <div id="method-Ext.layout.BorderLayout.Region-setPanel"></div>/**
639 * Sets the specified panel as the container element for this region.
640 * @param {Ext.Panel} panel The new panel
642 setPanel : function(panel){
646 <div id="method-Ext.layout.BorderLayout.Region-getMinWidth"></div>/**
647 * Returns the minimum allowable width for this region.
648 * @return {Number} The minimum width
650 getMinWidth: function(){
651 return this.minWidth;
654 <div id="method-Ext.layout.BorderLayout.Region-getMinHeight"></div>/**
655 * Returns the minimum allowable height for this region.
656 * @return {Number} The minimum height
658 getMinHeight: function(){
659 return this.minHeight;
663 applyLayoutCollapsed : function(box){
664 var ce = this.getCollapsedEl();
665 ce.setLeftTop(box.x, box.y);
666 ce.setSize(box.width, box.height);
670 applyLayout : function(box){
671 if(this.isCollapsed){
672 this.applyLayoutCollapsed(box);
674 this.panel.setPosition(box.x, box.y);
675 this.panel.setSize(box.width, box.height);
680 beforeSlide: function(){
681 this.panel.beforeEffect();
685 afterSlide : function(){
686 this.panel.afterEffect();
690 initAutoHide : function(){
691 if(this.autoHide !== false){
692 if(!this.autoHideHd){
693 var st = new Ext.util.DelayedTask(this.slideIn, this);
695 "mouseout": function(e){
696 if(!e.within(this.el, true)){
700 "mouseover" : function(e){
706 this.el.on(this.autoHideHd);
707 this.collapsedEl.on(this.autoHideHd);
712 clearAutoHide : function(){
713 if(this.autoHide !== false){
714 this.el.un("mouseout", this.autoHideHd.mouseout);
715 this.el.un("mouseover", this.autoHideHd.mouseover);
716 this.collapsedEl.un("mouseout", this.autoHideHd.mouseout);
717 this.collapsedEl.un("mouseover", this.autoHideHd.mouseover);
722 clearMonitor : function(){
723 Ext.getDoc().un("click", this.slideInIf, this);
726 <div id="method-Ext.layout.BorderLayout.Region-slideOut"></div>/**
727 * If this Region is {@link #floatable}, this method slides this Region into full visibility <i>over the top
728 * of the center Region</i> where it floats until either {@link #slideIn} is called, or other regions of the layout
729 * are clicked, or the mouse exits the Region.
731 slideOut : function(){
732 if(this.isSlid || this.el.hasActiveFx()){
736 var ts = this.panel.tools, dh, pc;
742 // Temporarily clear the collapsed flag so we can onResize the panel on the slide
743 pc = this.panel.collapsed;
744 this.panel.collapsed = false;
746 if(this.position == 'east' || this.position == 'west'){
747 // Temporarily clear the deferHeight flag so we can size the height on the slide
748 dh = this.panel.deferHeight;
749 this.panel.deferHeight = false;
751 this.panel.setSize(undefined, this.collapsedEl.getHeight());
753 // Put the deferHeight flag back after setSize
754 this.panel.deferHeight = dh;
756 this.panel.setSize(this.collapsedEl.getWidth(), undefined);
759 // Put the collapsed flag back after onResize
760 this.panel.collapsed = pc;
762 this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];
763 this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());
764 this.el.setStyle("z-index", this.floatingZIndex+2);
765 this.panel.el.replaceClass('x-panel-collapsed', 'x-panel-floating');
766 if(this.animFloat !== false){
768 this.el.slideIn(this.getSlideAnchor(), {
769 callback: function(){
772 Ext.getDoc().on("click", this.slideInIf, this);
779 Ext.getDoc().on("click", this.slideInIf, this);
784 afterSlideIn : function(){
785 this.clearAutoHide();
788 this.el.setStyle("z-index", "");
789 this.panel.el.replaceClass('x-panel-floating', 'x-panel-collapsed');
790 this.el.dom.style.left = this.restoreLT[0];
791 this.el.dom.style.top = this.restoreLT[1];
793 var ts = this.panel.tools;
799 <div id="method-Ext.layout.BorderLayout.Region-slideIn"></div>/**
800 * If this Region is {@link #floatable}, and this Region has been slid into floating visibility, then this method slides
801 * this region back into its collapsed state.
803 slideIn : function(cb){
804 if(!this.isSlid || this.el.hasActiveFx()){
809 if(this.animFloat !== false){
811 this.el.slideOut(this.getSlideAnchor(), {
812 callback: function(){
828 slideInIf : function(e){
829 if(!e.within(this.el)){
859 getAnchor : function(){
860 return this.anchors[this.position];
864 getCollapseAnchor : function(){
865 return this.canchors[this.position];
869 getSlideAnchor : function(){
870 return this.sanchors[this.position];
874 getAlignAdj : function(){
875 var cm = this.cmargins;
876 switch(this.position){
893 getExpandAdj : function(){
894 var c = this.collapsedEl, cm = this.cmargins;
895 switch(this.position){
897 return [-(cm.right+c.getWidth()+cm.left), 0];
900 return [cm.right+c.getWidth()+cm.left, 0];
903 return [0, -(cm.top+cm.bottom+c.getHeight())];
906 return [0, cm.top+cm.bottom+c.getHeight()];
911 destroy : function(){
912 Ext.destroy(this.miniCollapsedEl, this.collapsedEl);
916 <div id="cls-Ext.layout.BorderLayout.SplitRegion"></div>/**
917 * @class Ext.layout.BorderLayout.SplitRegion
918 * @extends Ext.layout.BorderLayout.Region
919 * <p>This is a specialized type of {@link Ext.layout.BorderLayout.Region BorderLayout region} that
920 * has a built-in {@link Ext.SplitBar} for user resizing of regions. The movement of the split bar
921 * is configurable to move either {@link #tickSize smooth or incrementally}.</p>
923 * Create a new SplitRegion.
924 * @param {Layout} layout The {@link Ext.layout.BorderLayout BorderLayout} instance that is managing this Region.
925 * @param {Object} config The configuration options
926 * @param {String} position The region position. Valid values are: north, south, east, west and center. Every
927 * BorderLayout must have a center region for the primary content -- all other regions are optional.
929 Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){
930 Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);
932 this.applyLayout = this.applyFns[pos];
935 Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {
936 <div id="cfg-Ext.layout.BorderLayout.SplitRegion-tickSize"></div>/**
937 * @cfg {Number} tickSize
938 * The increment, in pixels by which to move this Region's {@link Ext.SplitBar SplitBar}.
939 * By default, the {@link Ext.SplitBar SplitBar} moves smoothly.
941 <div id="cfg-Ext.layout.BorderLayout.SplitRegion-splitTip"></div>/**
942 * @cfg {String} splitTip
943 * The tooltip to display when the user hovers over a
944 * {@link Ext.layout.BorderLayout.Region#collapsible non-collapsible} region's split bar
945 * (defaults to <tt>"Drag to resize."</tt>). Only applies if
946 * <tt>{@link #useSplitTips} = true</tt>.
948 splitTip : "Drag to resize.",
949 <div id="cfg-Ext.layout.BorderLayout.SplitRegion-collapsibleSplitTip"></div>/**
950 * @cfg {String} collapsibleSplitTip
951 * The tooltip to display when the user hovers over a
952 * {@link Ext.layout.BorderLayout.Region#collapsible collapsible} region's split bar
953 * (defaults to "Drag to resize. Double click to hide."). Only applies if
954 * <tt>{@link #useSplitTips} = true</tt>.
956 collapsibleSplitTip : "Drag to resize. Double click to hide.",
957 <div id="cfg-Ext.layout.BorderLayout.SplitRegion-useSplitTips"></div>/**
958 * @cfg {Boolean} useSplitTips
959 * <tt>true</tt> to display a tooltip when the user hovers over a region's split bar
960 * (defaults to <tt>false</tt>). The tooltip text will be the value of either
961 * <tt>{@link #splitTip}</tt> or <tt>{@link #collapsibleSplitTip}</tt> as appropriate.
963 useSplitTips : false,
968 orientation: Ext.SplitBar.VERTICAL,
969 placement: Ext.SplitBar.TOP,
970 maxFn : 'getVMaxSize',
971 minProp: 'minHeight',
975 orientation: Ext.SplitBar.VERTICAL,
976 placement: Ext.SplitBar.BOTTOM,
977 maxFn : 'getVMaxSize',
978 minProp: 'minHeight',
982 orientation: Ext.SplitBar.HORIZONTAL,
983 placement: Ext.SplitBar.RIGHT,
984 maxFn : 'getHMaxSize',
989 orientation: Ext.SplitBar.HORIZONTAL,
990 placement: Ext.SplitBar.LEFT,
991 maxFn : 'getHMaxSize',
999 west : function(box){
1000 if(this.isCollapsed){
1001 return this.applyLayoutCollapsed(box);
1003 var sd = this.splitEl.dom, s = sd.style;
1004 this.panel.setPosition(box.x, box.y);
1005 var sw = sd.offsetWidth;
1006 s.left = (box.x+box.width-sw)+'px';
1007 s.top = (box.y)+'px';
1008 s.height = Math.max(0, box.height)+'px';
1009 this.panel.setSize(box.width-sw, box.height);
1011 east : function(box){
1012 if(this.isCollapsed){
1013 return this.applyLayoutCollapsed(box);
1015 var sd = this.splitEl.dom, s = sd.style;
1016 var sw = sd.offsetWidth;
1017 this.panel.setPosition(box.x+sw, box.y);
1018 s.left = (box.x)+'px';
1019 s.top = (box.y)+'px';
1020 s.height = Math.max(0, box.height)+'px';
1021 this.panel.setSize(box.width-sw, box.height);
1023 north : function(box){
1024 if(this.isCollapsed){
1025 return this.applyLayoutCollapsed(box);
1027 var sd = this.splitEl.dom, s = sd.style;
1028 var sh = sd.offsetHeight;
1029 this.panel.setPosition(box.x, box.y);
1030 s.left = (box.x)+'px';
1031 s.top = (box.y+box.height-sh)+'px';
1032 s.width = Math.max(0, box.width)+'px';
1033 this.panel.setSize(box.width, box.height-sh);
1035 south : function(box){
1036 if(this.isCollapsed){
1037 return this.applyLayoutCollapsed(box);
1039 var sd = this.splitEl.dom, s = sd.style;
1040 var sh = sd.offsetHeight;
1041 this.panel.setPosition(box.x, box.y+sh);
1042 s.left = (box.x)+'px';
1043 s.top = (box.y)+'px';
1044 s.width = Math.max(0, box.width)+'px';
1045 this.panel.setSize(box.width, box.height-sh);
1050 render : function(ct, p){
1051 Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
1053 var ps = this.position;
1055 this.splitEl = ct.createChild({
1056 cls: "x-layout-split x-layout-split-"+ps, html: " ",
1057 id: this.panel.id + '-xsplit'
1060 if(this.collapseMode == 'mini'){
1061 this.miniSplitEl = this.splitEl.createChild({
1062 cls: "x-layout-mini x-layout-mini-"+ps, html: " "
1064 this.miniSplitEl.addClassOnOver('x-layout-mini-over');
1065 this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});
1068 var s = this.splitSettings[ps];
1070 this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);
1071 this.split.tickSize = this.tickSize;
1072 this.split.placement = s.placement;
1073 this.split.getMaximumSize = this[s.maxFn].createDelegate(this);
1074 this.split.minSize = this.minSize || this[s.minProp];
1075 this.split.on("beforeapply", this.onSplitMove, this);
1076 this.split.useShim = this.useShim === true;
1077 this.maxSize = this.maxSize || this[s.maxProp];
1080 this.splitEl.hide();
1083 if(this.useSplitTips){
1084 this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;
1086 if(this.collapsible){
1087 this.splitEl.on("dblclick", this.onCollapseClick, this);
1091 //docs inherit from superclass
1092 getSize : function(){
1093 if(this.isCollapsed){
1094 return this.collapsedEl.getSize();
1096 var s = this.panel.getSize();
1097 if(this.position == 'north' || this.position == 'south'){
1098 s.height += this.splitEl.dom.offsetHeight;
1100 s.width += this.splitEl.dom.offsetWidth;
1106 getHMaxSize : function(){
1107 var cmax = this.maxSize || 10000;
1108 var center = this.layout.center;
1109 return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());
1113 getVMaxSize : function(){
1114 var cmax = this.maxSize || 10000;
1115 var center = this.layout.center;
1116 return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());
1120 onSplitMove : function(split, newSize){
1121 var s = this.panel.getSize();
1122 this.lastSplitSize = newSize;
1123 if(this.position == 'north' || this.position == 'south'){
1124 this.panel.setSize(s.width, newSize);
1125 this.state.height = newSize;
1127 this.panel.setSize(newSize, s.height);
1128 this.state.width = newSize;
1130 this.layout.layout();
1131 this.panel.saveState();
1135 <div id="method-Ext.layout.BorderLayout.SplitRegion-getSplitBar"></div>/**
1136 * Returns a reference to the split bar in use by this region.
1137 * @return {Ext.SplitBar} The split bar
1139 getSplitBar : function(){
1144 destroy : function() {
1145 Ext.destroy(this.miniSplitEl, this.split, this.splitEl);
1146 Ext.layout.BorderLayout.SplitRegion.superclass.destroy.call(this);
1150 Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout;</pre>
\r