Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/docs/source/BoxLayout.html view on Meta::CPAN
boxes = calcs.boxes,
meta = calcs.meta;
//invoke the overflow handler, if one is configured
if (tSize.width > 0) {
var handler = this.overflowHandler,
method = meta.tooNarrow ? 'handleOverflow' : 'clearOverflow';
var results = handler[method](calcs, tSize);
if (results) {
if (results.targetSize) {
tSize = results.targetSize;
}
if (results.recalculate) {
items = this.getVisibleItems(container);
calcs = this.calculateChildBoxes(items, tSize);
boxes = calcs.boxes;
}
}
}
<span id='Ext-layout-BoxLayout-property-layoutTargetLastSize'> /**
</span> * @private
* @property layoutTargetLastSize
* @type Object
* Private cache of the last measured size of the layout target. This should never be used except by
* BoxLayout subclasses during their onLayout run.
*/
this.layoutTargetLastSize = tSize;
<span id='Ext-layout-BoxLayout-property-childBoxCache'> /**
</span> * @private
* @property childBoxCache
* @type Array
* Array of the last calculated height, width, top and left positions of each visible rendered component
* within the Box layout.
*/
this.childBoxCache = calcs;
this.updateInnerCtSize(tSize, calcs);
this.updateChildBoxes(boxes);
// Putting a box layout into an overflowed container is NOT correct and will make a second layout pass necessary.
this.handleTargetOverflow(tSize, container, target);
},
<span id='Ext-layout-BoxLayout-method-updateChildBoxes'> /**
</span> * Resizes and repositions each child component
* @param {Array} boxes The box measurements
*/
updateChildBoxes: function(boxes) {
for (var i = 0, length = boxes.length; i < length; i++) {
var box = boxes[i],
comp = box.component;
if (box.dirtySize) {
comp.setSize(box.width, box.height);
}
// Don't set positions to NaN
if (isNaN(box.left) || isNaN(box.top)) {
continue;
}
comp.setPosition(box.left, box.top);
}
},
<span id='Ext-layout-BoxLayout-method-updateInnerCtSize'> /**
</span> * @private
* Called by onRender just before the child components are sized and positioned. This resizes the innerCt
* to make sure all child items fit within it. We call this before sizing the children because if our child
* items are larger than the previous innerCt size the browser will insert scrollbars and then remove them
* again immediately afterwards, giving a performance hit.
* Subclasses should provide an implementation.
* @param {Object} currentSize The current height and width of the innerCt
* @param {Array} calculations The new box calculations of all items to be laid out
*/
updateInnerCtSize: function(tSize, calcs) {
var align = this.align,
padding = this.padding,
width = tSize.width,
height = tSize.height;
if (this.type == 'hbox') {
var innerCtWidth = width,
innerCtHeight = calcs.meta.maxHeight + padding.top + padding.bottom;
if (align == 'stretch') {
innerCtHeight = height;
} else if (align == 'middle') {
innerCtHeight = Math.max(height, innerCtHeight);
}
} else {
var innerCtHeight = height,
innerCtWidth = calcs.meta.maxWidth + padding.left + padding.right;
if (align == 'stretch') {
innerCtWidth = width;
} else if (align == 'center') {
innerCtWidth = Math.max(width, innerCtWidth);
}
}
this.innerCt.setSize(innerCtWidth || undefined, innerCtHeight || undefined);
},
<span id='Ext-layout-BoxLayout-method-handleTargetOverflow'> /**
</span> * @private
* This should be called after onLayout of any BoxLayout subclass. If the target's overflow is not set to 'hidden',
* we need to lay out a second time because the scrollbars may have modified the height and width of the layout
* target. Having a Box layout inside such a target is therefore not recommended.
* @param {Object} previousTargetSize The size and height of the layout target before we just laid out
* @param {Ext.Container} container The container
* @param {Ext.Element} target The target element
*/
handleTargetOverflow: function(previousTargetSize, container, target) {
var overflow = target.getStyle('overflow');
if (overflow && overflow != 'hidden' &&!this.adjustmentPass) {
var newTargetSize = this.getLayoutTargetSize();
( run in 1.250 second using v1.01-cache-2.11-cpan-787462296c9 )