3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
8 Ext.debug.Assistant = function(){
\r
16 disable: function(){
\r
20 init : function(classes){
\r
25 Ext.each(classes, function(cls){
\r
26 if(this.namespaceExists(cls.name)){
\r
27 klass = this.getClass(cls.name);
\r
28 method = cls.instance ? this.addInstanceCheck : this.addPrototypeCheck;
\r
29 Ext.each(cls.checks, function(check){
\r
30 intercept = check.intercept == true;
\r
31 fn = method.call(this, klass, check.name, check.fn, check.intercept == true);
\r
40 namespaceExists: function(name){
\r
41 var parent = window,
\r
44 Ext.each(name.split('.'), function(n){
\r
45 if(!Ext.isDefined(parent[n])){
\r
54 getClass : function(name){
\r
55 var parent = window;
\r
56 Ext.each(name.split('.'), function(n){
\r
63 if(enabled && window.console){
\r
64 console.warn.apply(console, arguments);
\r
69 if(enabled && window.console){
\r
70 console.error.apply(console, arguments);
\r
74 addPrototypeCheck : function(cls, method, fn, intercept){
\r
75 return (cls.prototype[method] = cls.prototype[method][intercept ? 'createInterceptor' : 'createSequence'](fn));
\r
78 addInstanceCheck : function(cls, method, fn, intercept){
\r
79 return (cls[method] = cls[method][intercept ? 'createInterceptor' : 'createSequence'](fn));
\r
85 var A = Ext.debug.Assistant,
\r
89 name: 'Ext.util.Observable',
\r
91 name: 'addListener',
\r
93 fn: function(eventName, fn){
\r
94 if(typeof eventName == 'object'){
\r
96 for(ev in eventName){
\r
97 if(!this.filterOptRe.test(ev)){
\r
99 o = o && o.fn ? o.fn : o;
\r
100 if(!Ext.isFunction(o)){
\r
101 A.error('Non function passed to event listener', this, ev);
\r
107 if(!Ext.isFunction(fn)){
\r
108 A.error('Non function passed to event listener', this, eventName);
\r
112 after: function(method){
\r
113 Ext.util.Observable.prototype.on = method;
\r
119 name: 'Ext.Component',
\r
123 fn: function(container, position){
\r
124 if(!container && !this.el){
\r
125 A.error('Unable to render to container', this, container);
\r
128 if(this.contentEl){
\r
129 var el = Ext.getDom(this.contentEl);
\r
131 A.error('Specified contentEl does not exist', this, this.contentEl);
\r
140 name: 'Ext.Container',
\r
142 name: 'onBeforeAdd',
\r
146 A.warn('Adding destroyed component to container', c, this);
\r
149 A.warn('Using renderTo while adding an item to a Container. You should use the add() method or put the item in the items configuration', c, this);
\r
152 A.warn('Using applyTo while adding an item to a Container. You should use the add() method or put the item in the items configuration', c, this);
\r
155 var type = this.layout.type;
\r
156 if(type == 'container' || type == 'auto'){
\r
157 A.warn('A non sizing layout is being used in a container that has child components. This means the child components will not be sized.', this);
\r
161 name: 'lookupComponent',
\r
165 if(Ext.isEmpty(c)){
\r
168 if(Ext.isString(c)){
\r
169 c = Ext.ComponentMgr.get(comp);
\r
170 valid = !Ext.isEmpty(c);
\r
173 A.error('Adding invalid component to container', this, c);
\r
181 name: 'Ext.DataView',
\r
183 name: 'initComponent',
\r
185 if(!this.itemSelector){
\r
186 A.error('No itemSelector specified', this);
\r
190 name: 'afterRender',
\r
193 A.error('No store attached to DataView', this);
\r
200 name: 'Ext.Window',
\r
205 if(this.isDestroyed){
\r
206 A.error('Trying to show a destroyed window. If you want to reuse the window, look at the closeAction configuration.', this);
\r
214 name: 'Ext.grid.GridPanel',
\r
216 name: 'initComponent',
\r
218 if(!this.colModel){
\r
219 A.error('No column model specified for grid', this);
\r
222 A.error('No store specified for grid', this);
\r
229 name: 'Ext.grid.GridView',
\r
231 name: 'autoExpand',
\r
234 var g = this.grid,
\r
236 if(!this.userResized && g.autoExpandColumn){
\r
237 var tw = cm.getTotalWidth(false),
\r
238 aw = this.grid.getGridEl().getWidth(true) - this.getScrollOffset();
\r
240 var ci = cm.getIndexById(g.autoExpandColumn);
\r
242 A.error('The autoExpandColumn does not exist in the column model', g, g.autoExpandColumn);
\r
252 name: 'Ext.chart.Chart',
\r
254 name: 'initComponent',
\r
257 A.error('No store specified for chart', this);
\r
264 name: 'Ext.tree.TreePanel',
\r
266 name: 'afterRender',
\r
270 A.error('No root node specified for tree', this);
\r
284 if(arguments.length == 2 && !arguments[0]){
\r
285 A.error('Invalid base class passed to extend', arguments[0]);
\r
288 if(arguments.length == 3){
\r
290 A.error('Invalid class to extend', arguments[0]);
\r
292 }else if(!arguments[1]){
\r
293 A.error('Invalid base class passed to extend', arguments[1]);
\r
303 A.error('Invalid class passed to override', c);
\r
311 name: 'Ext.ComponentMgr',
\r
317 if(this.all.indexOfKey(c.id) > -1){
\r
318 A.warn('A component with this id already exists', c, c.id);
\r
324 fn: function(config, defaultType){
\r
325 var types = Ext.ComponentMgr.types;
\r
326 if(!config.render){
\r
328 if(!types[config.xtype]){
\r
329 A.error('Unknown xtype specified', config, config.xtype);
\r
333 if(!types[defaultType]){
\r
334 A.error('Unknown defaultType specified', config, defaultType);
\r
344 name: 'Ext.layout.FitLayout',
\r
349 var ct = this.container;
\r
350 if(ct.items.getCount() > 1){
\r
351 A.warn('More than 1 item in the container. A fit layout will only display a single item.', ct);
\r
357 if(Ext.BLANK_IMAGE_URL == 'http:/' + '/www.extjs.com/s.gif'){
\r
358 A.warn('You should set the Ext.BLANK_IMAGE_URL to reference a local copy.');
\r