more quote identeiifers fixessss
[Pman.Core] / widgets / DisplayText.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11 /**
12  * @class Roo.form.DisplayText
13  * @extends Roo.form.Field
14  * Display text field 
15  * @constructor
16  * Creates a new Display text fiedl
17  * @param {Object} config Configuration options
18  */
19 Roo.form.DisplayText = function(config){
20     Roo.form.DisplayText.superclass.constructor.call(this, config);
21     
22 };
23
24 Roo.extend(Roo.form.DisplayText, Roo.form.Field,  {
25      /**
26      * @cfg {Number} width  - mostly ignored
27      */
28     width : 100,
29     /**
30      * @cfg {Number} height - used to restrict height of image..
31      */
32     width : 50,
33     /**
34      * @cfg {String} focusClass The CSS class to use when the checkbox receives focus (defaults to undefined)
35      */
36     focusClass : undefined,
37     /**
38      * @cfg {String} fieldClass The default CSS class for the checkbox (defaults to "x-form-field")
39      */
40     fieldClass: 'x-form-field',
41     
42     /**
43      * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
44      * {tag: "input", type: "checkbox", autocomplete: "off"})
45      */
46      
47     defaultAutoCreate : { tag: 'input', type: 'hidden', autocomplete: 'off'},
48
49     /**
50      * @cfg {String} inputValue The value that should go into the generated input element's value attribute
51      */
52     //
53     onResize : function(){
54         Roo.form.Field.superclass.onResize.apply(this, arguments);
55         
56     },
57
58     initEvents : function(){
59         // Roo.form.Checkbox.superclass.initEvents.call(this);
60         // has no events...
61        
62     },
63
64
65     getResizeEl : function(){
66         return this.wrap;
67     },
68
69     getPositionEl : function(){
70         return this.wrap;
71     },
72
73     // private
74     onRender : function(ct, position){
75         Roo.form.DisplayText.superclass.onRender.call(this, ct, position);
76         //if(this.inputValue !== undefined){
77         
78         this.style = this.style || '';
79         var style = this.style;
80         delete this.style;
81         
82         Roo.form.DisplayImage.superclass.onRender.call(this, ct, position);
83         this.wrap = this.el.wrap({cls: 'x-menu-check-item'});
84         this.viewEl = this.wrap.createChild({ tag: 'div'});
85         
86         if (style) {
87             this.viewEl.applyStyles(style);
88         }
89         this.viewEl.setStyle('padding', '2px');
90         if (this.width) {
91             this.viewEl.setWidth(this.width);
92         }
93         if (this.height) {
94             this.viewEl.setHeight(this.height);
95         }
96         this.setValue(this.value);
97         
98
99         
100         
101     },
102
103     // private
104     initValue : Ext.emptyFn,
105
106   
107
108         // private
109     onClick : function(){
110         
111     },
112
113     /**
114      * Sets the checked state of the checkbox.
115      * @param {Boolean/String} checked True, 'true', '1', or 'on' to check the checkbox, any other value will uncheck it.
116      */
117     setValue : function(v){
118         this.value = v;
119         var html = this.renderer ?  this.renderer(v) : String.format('{0}', v);
120
121         this.viewEl.dom.innerHTML = html;
122         Roo.form.DisplayText.superclass.setValue.call(this, v);
123
124     }
125 });