Changeset 391


Ignore:
Timestamp:
08/08/12 13:16:32 (13 years ago)
Author:
jkraaijeveld
Message:

Reworked HeaderViewItem? and HeaderEditItem?

Location:
Dev/branches/rest-dojo-ui/client/rft/ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorToolkit.js

    r390 r391  
    109109            _setValueAttr: function(question) {
    110110                this.propertiesForm.set('value', question);
    111                 this._categories = question.categories;
     111                this._categories = question.categories || [];
    112112                this._setupListView();
    113113                this._setupCategories();
     
    145145                    removeCallback: lang.hitch(this, this._removeCategory)
    146146                }).placeAt(this.listNode);
     147                this._list.startup();               
    147148                for (var category in this._categories) {
    148149                    this._list.appendItem(this._categories[category]);
    149150                }   
    150                 this._list.startup();
    151151            },
    152152            _setupCategories: function() {
  • Dev/branches/rest-dojo-ui/client/rft/ui/content/ContentWidgetFactory.js

    r389 r391  
    1616                //            other type specific fields
    1717                var fun = this['create'+options.type+'ViewWidget'];
    18                 return fun !== undefined ? fun(options) : null;
     18                var view = fun !== undefined ? fun(options) : null;
     19                return view;
    1920            },
    2021            createEditWidget: function(/*Object*/options) {
    2122                var fun = this['create'+options.type+'EditWidget'];
    22                 return fun !== undefined ? fun(options) : null;
     23                var view = fun !== undefined ? fun() : null;
     24                if(view)
     25                    view.set('value', options);
     26                return view;
    2327            },
    2428
     
    2832                });
    2933            },
    30             createHeaderEditWidget: function(options) {
    31                 return null;
     34            createHeaderEditWidget: function() {
     35                return new HeaderEditItem();
    3236            }/*,
    3337
     
    7983        /* Contents */
    8084        var HeaderViewItem = declare(TextBox, {
     85            postCreate: function() {
     86                this.set('value', this.options.contents);
     87                this.set('readOnly', true);
     88            },
     89            _getValueAttr: function() {
     90                return {    type: 'Header',
     91                            contents: this.get('displayedValue'),
     92                }
     93            }
     94        });
     95
     96        var HeaderEditItem = declare(TextBox, {
    8197            _setValueAttr: function(value) {
     98                this.inherited(arguments, [value.contents || ""]);
    8299            },
    83100            _getValueAttr: function() {
    84                 return {};
     101                return { type: 'Header',
     102                         contents: this.get('displayedValue'),
     103                }
    85104            }
    86105        });
Note: See TracChangeset for help on using the changeset viewer.