Changeset 394
- Timestamp:
- 08/08/12 15:58:41 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js
r393 r394 7 7 'dijit/form/Textarea', 8 8 'dijit/form/TextBox', 9 'dijit/form/CheckBox', 9 10 'dijit/layout/StackContainer', 10 11 'dojox/form/CheckedMultiSelect', 11 12 'dojox/layout/TableContainer' 12 ],function(declare, lang, _WidgetBase, _Container, NumberSpinner, Textarea, TextBox, StackContainer, CheckedMultiSelect, TableContainer) {13 ],function(declare, lang, _WidgetBase, _Container, NumberSpinner, Textarea, TextBox, CheckBox, StackContainer, CheckedMultiSelect, TableContainer) { 13 14 var factory = declare('rft.ui.content.ContentWidgetFactory', [], { 14 15 /* No default type, all should be valid */ … … 48 49 49 50 createFreeTextInputViewWidget: function(options) { 50 return new FreeText InputViewItem({51 return new FreeTextViewItem({ 51 52 options: options 52 53 }); 53 54 }, 54 55 createFreeTextInputEditWidget: function() { 55 return new FreeText InputEditItem();56 return new FreeTextEditItem(); 56 57 }/*, 57 58 … … 143 144 144 145 /* Inputs */ 145 var FreeTextViewItem = declare(Textarea, { 146 postCreate: function() { 147 this.set('value', this.options.defaultValue); 148 this.set('readOnly', this.options.readOnly); 149 this._onBlur = undefined; 150 }, 151 _getValueAttr: function() { 152 return { type: "FreeText", 146 var FreeTextViewItem = declare([_WidgetBase, _Container], { 147 _textArea: null, 148 postCreate: function() { 149 this._textArea = new Textarea(); 150 this._textArea.set('maxLength', this.options.maxLength || 1000); 151 this._textArea.set('readOnly', this.options.readOnly || false); 152 this._textArea.set('value', this.options.defaultValue || ""); 153 this.addChild(this._textArea); 154 }, 155 _getValueAttr: function() { 156 return { type: "FreeTextInput", 153 157 defaultValue: this.options.defaultValue, 154 readOnly: this.options.readOnly 155 }; 156 } 157 }); 158 159 var FreeTextEditItem = declare(Textarea, { 158 readOnly: this.options.readOnly, 159 maxLength: this.options.maxLength 160 }; 161 } 162 }); 163 164 var FreeTextEditItem = declare(StackContainer, { 165 _propertiesTable: null, 166 _maxLength: null, _readOnly: null, _defaultValue: null, 167 168 169 postCreate: function() { 170 this._textArea = new Textarea(); 171 this._propertiesTable = new TableContainer({ cols: 1, customClass: "labelsAndValues"} ); 172 this._maxLength = new NumberSpinner( { title: "Maximum length", constraints: {min:0}} ); 173 this._readOnly = new CheckBox( { title: "Read only" } ); 174 this._defaultValue = new Textarea( { title: "Default value" }); 175 this._propertiesTable.addChild(this._maxLength); 176 this._propertiesTable.addChild(this._readOnly); 177 this._propertiesTable.addChild(this._defaultValue); 178 this.addChild(this._propertiesTable); 179 }, 180 160 181 _setValueAttr: function(value) { 161 this.inherited(arguments, [value]) 162 } 182 this._maxLength.set('value', value.maxLength); 183 this._readOnly.set('value', value.readOnly); 184 this._defaultValue.set('value', value.defaultValue); 185 }, 186 _getValueAttr: function() { 187 return { type: "FreeTextInput", 188 defaultValue: this._defaultValue.get('value'), 189 readOnly: this._readOnly.get('value'), 190 maxLength: this._maxLength.get('value') 191 }; 192 } 193 194 163 195 }) 164 196
Note: See TracChangeset
for help on using the changeset viewer.