remove debugging code
[roojs1] / Roo / Component.js
index 1e03b98..7f78933 100644 (file)
@@ -93,7 +93,7 @@ Roo.Component = function(config){
         destroy : true
     });
     if(!this.id){
-        this.id = "ext-comp-" + (++Roo.Component.AUTO_ID);
+        this.id = "roo-comp-" + (++Roo.Component.AUTO_ID);
     }
     Roo.ComponentMgr.register(this);
     Roo.Component.superclass.constructor.call(this);
@@ -104,20 +104,23 @@ Roo.Component = function(config){
     }
 };
 
-// private
+/** @private */
 Roo.Component.AUTO_ID = 1000;
 
 Roo.extend(Roo.Component, Roo.util.Observable, {
     /**
-     * @property {Boolean} hidden
+     * @scope Roo.Component.prototype
+     * @type {Boolean}
      * true if this component is hidden. Read-only.
      */
     hidden : false,
     /**
+     * @type {Boolean}
      * true if this component is disabled. Read-only.
      */
     disabled : false,
     /**
+     * @type {Boolean}
      * true if this component has been rendered. Read-only.
      */
     rendered : false,
@@ -130,23 +133,24 @@ Roo.extend(Roo.Component, Roo.util.Observable, {
         * Whether the component can move the Dom node when rendering (defaults to true).
         */
     allowDomMove : true,
-    /** @cfg {String} hideMode
+    /** @cfg {String} hideMode (display|visibility)
      * How this component should hidden. Supported values are
      * "visibility" (css visibility), "offsets" (negative offset position) and
      * "display" (css display) - defaults to "display".
      */
     hideMode: 'display',
 
-    // private
+    /** @private */
     ctype : "Roo.Component",
 
-    /** @cfg {String} actionMode 
+    /**
+     * @cfg {String} actionMode 
      * which property holds the element that used for  hide() / show() / disable() / enable()
-     * default is 'el' 
+     * default is 'el' for forms you probably want to set this to fieldEl 
      */
     actionMode : "el",
 
-    // private
+    /** @private */
     getActionEl : function(){
         return this[this.actionMode];
     },
@@ -157,43 +161,52 @@ Roo.extend(Roo.Component, Roo.util.Observable, {
      * @param {String/HTMLElement/Element} container (optional) The element this component should be rendered into. If it is being applied to existing markup, this should be left off.
      */
     render : function(container, position){
-        if(!this.rendered && this.fireEvent("beforerender", this) !== false){
-            if(!container && this.el){
-                this.el = Roo.get(this.el);
-                container = this.el.dom.parentNode;
-                this.allowDomMove = false;
-            }
-            this.container = Roo.get(container);
-            this.rendered = true;
-            if(position !== undefined){
-                if(typeof position == 'number'){
-                    position = this.container.dom.childNodes[position];
-                }else{
-                    position = Roo.getDom(position);
-                }
-            }
-            this.onRender(this.container, position || null);
-            if(this.cls){
-                this.el.addClass(this.cls);
-                delete this.cls;
-            }
-            if(this.style){
-                this.el.applyStyles(this.style);
-                delete this.style;
-            }
-            this.fireEvent("render", this);
-            this.afterRender(this.container);
-            if(this.hidden){
-                this.hide();
-            }
-            if(this.disabled){
-                this.disable();
+        
+        if(this.rendered){
+            return this;
+        }
+        
+        if(this.fireEvent("beforerender", this) === false){
+            return false;
+        }
+        
+        if(!container && this.el){
+            this.el = Roo.get(this.el);
+            container = this.el.dom.parentNode;
+            this.allowDomMove = false;
+        }
+        this.container = Roo.get(container);
+        this.rendered = true;
+        if(position !== undefined){
+            if(typeof position == 'number'){
+                position = this.container.dom.childNodes[position];
+            }else{
+                position = Roo.getDom(position);
             }
         }
+        this.onRender(this.container, position || null);
+        if(this.cls){
+            this.el.addClass(this.cls);
+            delete this.cls;
+        }
+        if(this.style){
+            this.el.applyStyles(this.style);
+            delete this.style;
+        }
+        this.fireEvent("render", this);
+        this.afterRender(this.container);
+        if(this.hidden){
+            this.hide();
+        }
+        if(this.disabled){
+            this.disable();
+        }
+
         return this;
+        
     },
 
-    // private
+    /** @private */
     // default function is not really useful
     onRender : function(ct, position){
         if(this.el){
@@ -204,7 +217,7 @@ Roo.extend(Roo.Component, Roo.util.Observable, {
         }
     },
 
-    // private
+    /** @private */
     getAutoCreate : function(){
         var cfg = typeof this.autoCreate == "object" ?
                       this.autoCreate : Roo.apply({}, this.defaultAutoCreate);
@@ -214,7 +227,7 @@ Roo.extend(Roo.Component, Roo.util.Observable, {
         return cfg;
     },
 
-    // private
+    /** @private */
     afterRender : Roo.emptyFn,
 
     /**
@@ -238,12 +251,12 @@ Roo.extend(Roo.Component, Roo.util.Observable, {
         }
     },
 
-       // private
+       /** @private */
     beforeDestroy : function(){
 
     },
 
-       // private
+       /** @private */
        onDestroy : function(){
 
     },
@@ -279,7 +292,7 @@ Roo.extend(Roo.Component, Roo.util.Observable, {
         return this;
     },
 
-    // private
+    /** @private */
     blur : function(){
         if(this.rendered){
             this.el.blur();