Roo/doc/Param.js
[roojs1] / Roo / doc / Param.js
1 /*
2  * - LGPL
3  *
4  */
5
6 /**
7  * @class Roo.doc.Param
8  * @extends Roo.bootstrap.Component
9  * Param Element class
10  * @cfg {bool} is_optional is the argument optional
11  * @cfg {String} type  argument type
12  * @cfg {String} name name of the parameter
13  * @cfg {String} desc  short description
14  * @cfg {String} defaultvalue default value
15  * 
16  * @constructor
17  * Create a new Param
18  * @param {Object} config The config object
19  */
20
21 Roo.doc.Param = function(config){
22     Roo.doc.Param.superclass.constructor.call(this, config);
23 };
24
25 Roo.extend(Roo.doc.Param, Roo.bootstrap.Component,  {
26     
27     is_optional : false,
28     type : '',
29     name: '',
30     defaultvalue:   '',
31     desc: '',
32      
33     getAutoCreate : function(){
34         
35         //?? this is the synopsis type....
36         
37         
38         if (this.parent().stype == 'parameter') {
39             
40             return {
41                 tag : 'li',
42                 cn : [
43                     {
44                         tag : 'p',
45                         cls: 'para',
46                         cn : [
47                             {
48                                 tag: 'code',
49                                 html : this.type + ' ' + this.name
50                             },
51                             this.desc
52                         ]
53                     }
54                 ]
55             };
56             
57         }
58          if (this.parent().stype == 'return') {
59             return {
60                     tag : 'p',
61                     cls: 'para',
62                     cn : [
63                         {
64                             tag: 'code',
65                             html : this.type
66                         },
67                         this.desc
68                     ]
69                 };
70                 
71          }
72        
73         
74         
75         // this is not very fancy...
76         
77         var cfg ={
78             tag: 'span',
79             cn : [
80                 this.is_optional ? '[' : '',
81                 this.type,
82                 ' ',
83                 {
84                     tag : 'b',
85                     html : this.name
86                 },
87                 this.defaultvalue == '' ? '' : ' = ',
88                 this.defaultvalue,
89                 this.is_optional ? ']' : '',
90                 ',' // not really.. but let's do it anyway...
91             ]
92         };
93          
94         
95         
96         
97         return cfg;
98     }
99      
100     
101     
102     
103     
104    
105 });
106
107  
108
109