Roo/doc/Para.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 
11  * @cfg {String} type  argument type
12  * @cfg {String} name
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.mailer.Param = function(config){
22     Roo.mailer.Param.superclass.constructor.call(this, config);
23 };
24
25 Roo.extend(Roo.mailer.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                 is_optional ? '[' : '',
81                 this.type,
82                 ' ',
83                 this.name,
84                 this.defaultvalue == '' ? '' : ' = ',
85                 this.defaultvalue,
86                 ',' // not really.. but let's do it anyway...
87             ]
88         };
89          
90         
91         
92         
93         return cfg;
94     }
95      
96     
97     
98     
99     
100    
101 });
102
103  
104
105