Button.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. /** @class Button 按钮组件。
  3. * @example
  4. * //可以在脚本中获取该组件
  5. * //方法1:
  6. * var button = this.form.get("name"); //获取组件
  7. * //方法2
  8. * var button = this.target; //在组件事件脚本中获取
  9. * @extends MWF.xApplication.process.Xform.$Module
  10. * @category FormComponents
  11. * @hideconstructor
  12. */
  13. MWF.xApplication.process.Xform.Button = MWF.APPButton = new Class({
  14. Implements: [Events],
  15. Extends: MWF.APP$Module,
  16. iconStyle: "personfieldIcon",
  17. _loadUserInterface: function(){
  18. // var button = new Element("button");
  19. // button.inject(this.node, "after");
  20. // this.node.destroy();
  21. // this.node = button;
  22. var button = this.node.getElement("button");
  23. if (!button) button = new Element("button");
  24. button.inject(this.node, "after");
  25. this.node.destroy();
  26. this.node = button;
  27. this.node.set({
  28. "id": this.json.id,
  29. "text": this.json.name || this.json.id,
  30. "MWFType": this.json.type
  31. });
  32. if (!this.json.preprocessing) this.node.setStyles(this.form.css.buttonStyles);
  33. }
  34. });