Button.js 1.2 KB
Newer Older
R
roo00 已提交
1
MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
U
jsdoc  
unknown 已提交
2
/** @class Button 按钮组件。
U
jsdoc  
unknown 已提交
3 4 5
 * @example
 * //可以在脚本中获取该组件
 * //方法1:
U
jsdoc  
unknown 已提交
6
 * var button = this.form.get("name"); //获取组件
U
jsdoc  
unknown 已提交
7
 * //方法2
U
jsdoc  
unknown 已提交
8
 * var button = this.target; //在组件事件脚本中获取
U
jsdoc  
unknown 已提交
9
 * @extends MWF.xApplication.process.Xform.$Module
U
jsodc  
unknown 已提交
10 11
 * @o2category FormComponents
 * @o2range {Process|CMS|Portal}
U
jsdoc  
unknown 已提交
12 13
 * @hideconstructor
 */
R
roo00 已提交
14 15 16 17 18 19
MWF.xApplication.process.Xform.Button = MWF.APPButton =  new Class({
    Implements: [Events],
    Extends: MWF.APP$Module,
    iconStyle: "personfieldIcon",

    _loadUserInterface: function(){
20 21 22 23 24 25
        // var button = new Element("button");
        // button.inject(this.node, "after");
        // this.node.destroy();
        // this.node = button;

        var button = this.node.getElement("button");
NoSubject's avatar
NoSubject 已提交
26 27
        if (!button) button = new Element("button");
            button.inject(this.node, "after");
R
roo00 已提交
28 29
        this.node.destroy();
        this.node = button;
30

R
roo00 已提交
31 32 33 34 35
        this.node.set({
            "id": this.json.id,
            "text": this.json.name || this.json.id,
            "MWFType": this.json.type
        });
36 37
        if (!this.json.preprocessing) this.node.setStyles(this.form.css.buttonStyles);

R
roo00 已提交
38 39
    }

40
});