<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js">// This override adds diagnostics to the Ext.layout.ContextItem class.
|
|
<span id='Ext-diag-layout-ContextItem'>/**
|
</span> */
|
Ext.define('Ext.diag.layout.ContextItem', {
|
override: 'Ext.layout.ContextItem',
|
|
<span id='global-property-requires'> /** @ignore */
|
</span> requires: [
|
'Ext.layout.Context',
|
'Ext.diag.layout.Context'
|
],
|
|
<span id='Ext-diag-layout-ContextItem-method-addBlock'> addBlock: function (name, layout, propName) {
|
</span> //Ext.log(this.id,'.',propName,' ',name,': ',this.getLayoutName(layout));
|
(layout.blockedBy || (layout.blockedBy = {}))[
|
this.id+'.'+propName+(name.substring(0,3)=='dom' ? ':dom' : '')] = 1;
|
|
return this.callParent(arguments);
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-addBoxChild'> addBoxChild: function (boxChildItem) {
|
</span> var ret = this.callParent(arguments),
|
boxChildren = this.boxChildren,
|
boxParents;
|
|
if (boxChildren && boxChildren.length == 1) {
|
// the boxParent collection is created by the run override found in
|
// Ext.diag.layout.Context, but IE sometimes does not load that override, so
|
// we work around it for now
|
boxParents = this.context.boxParents ||
|
(this.context.boxParents = new Ext.util.MixedCollection());
|
boxParents.add(this);
|
}
|
|
return ret;
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-addTrigger'> addTrigger: function (propName, inDom) {
|
</span> var layout = this.context.currentLayout,
|
triggers;
|
|
//Ext.log(this.id,'.',propName,' ',inDom ? ':dom' : '',' ',this.getLayoutName(layout));
|
this.callParent(arguments);
|
|
triggers = this.context.triggersByLayoutId;
|
(triggers[layout.id] || (triggers[layout.id] = {}))[
|
this.id+'.'+propName+(inDom ? ':dom' : '')] = {
|
item: this,
|
name: propName
|
};
|
},
|
|
<span id='Ext-layout-ContextItem-method-checkAuthority'> checkAuthority: function (prop) {
|
</span> var me = this,
|
model = me[prop + 'Model'], // not me.sizeModel[prop] since it is immutable
|
layout = me.context.currentLayout,
|
ok,
|
setBy;
|
|
if (layout == me.target.ownerLayout) {
|
// the ownerLayout is only allowed to set calculated dimensions
|
ok = model.calculated;
|
} else if (layout.isComponentLayout) {
|
// the component's componentLayout (normally) is only allowed to set auto or
|
// configured dimensions. The exception is when a component is run w/o its
|
// ownerLayout in the picture (isTopLevel), someone must publish the lastBox
|
// values and that lucky layout is the componentLayout (kinda had to be since
|
// the ownerLayout is not running)
|
ok = me.isTopLevel || model.auto || model.configured;
|
}
|
|
if (!ok) {
|
setBy = me.getLayoutName(layout);
|
|
Ext.log(setBy + ' cannot set ' + prop);
|
}
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-clearBlocks'> clearBlocks: function (name, propName) {
|
</span> var collection = this[name],
|
blockedLayouts = collection && collection[propName],
|
key = this.id+'.'+propName+(name.substring(0,3)=='dom' ? ':dom' : ''),
|
layout, layoutId;
|
|
if (blockedLayouts) {
|
for (layoutId in blockedLayouts) {
|
layout = blockedLayouts[layoutId];
|
delete layout.blockedBy[key];
|
}
|
}
|
return this.callParent(arguments);
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-getEl'> getEl: function (el) {
|
</span> var child = this.callParent(arguments);
|
if (child && child !== this && child.parent !== this) {
|
Ext.Error.raise({
|
msg: 'Got element from wrong component'
|
});
|
}
|
return child;
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-init'> init: function () {
|
</span> var me = this,
|
ret;
|
|
ret = me.callParent(arguments);
|
|
if (me.context.logOn.initItem) {
|
Ext.log(me.id, ' consumers: content=', me.consumersContentWidth,'/',me.consumersContentHeight,
|
', container=', me.consumersContainerWidth,'/',me.consumersContainerHeight,
|
', size=', me.consumersWidth,'/',me.consumersHeight);
|
}
|
|
return ret;
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-invalidate'> invalidate: function () {
|
</span> if (this.wrapsComponent) {
|
if (this.context.logOn.invalidate) {
|
Ext.log('invalidate: ', this.id);
|
}
|
} else {
|
Ext.Error.raise({
|
msg: 'Cannot invalidate an element contextItem'
|
});
|
}
|
return this.callParent(arguments);
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-setProp'> setProp: function (propName, value, dirty) {
|
</span> var me = this,
|
layout = me.context.currentLayout,
|
setBy = me.getLayoutName(layout),
|
fullName = me.id + '.' + propName,
|
setByProps;
|
|
if (value !== null) {
|
setByProps = me.setBy || (me.setBy = {});
|
if (!setByProps[propName]) {
|
setByProps[propName] = setBy;
|
} else if (setByProps[propName] != setBy) {
|
Ext.log({level: 'warn'}, 'BAD! ', fullName, ' set by ', setByProps[propName], ' and ', setBy);
|
}
|
}
|
|
if (me.context.logOn.setProp) {
|
if (typeof value != 'undefined' && !isNaN(value) && me.props[propName] !== value) {
|
Ext.log('set ', fullName, ' = ', value, ' (', dirty, ')');
|
}
|
}
|
|
return this.callParent(arguments);
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-setHeight'> setHeight: function (height, dirty, /* private */force) {
|
</span> if (!force && this.wrapsComponent) {
|
this.checkAuthority('height');
|
}
|
|
return this.callParent(arguments);
|
},
|
|
<span id='Ext-diag-layout-ContextItem-method-setWidth'> setWidth: function (width, dirty, /* private */force) {
|
</span> if (!force && this.wrapsComponent) {
|
this.checkAuthority('width');
|
}
|
|
return this.callParent(arguments);
|
}
|
},
|
function () {
|
this.prototype.getLayoutName = Ext.layout.Context.prototype.getLayoutName;
|
});
|
</pre>
|
</body>
|
</html>
|