Button.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. * @o2category FormComponents
  11. * @o2range {Process|CMS|Portal}
  12. * @hideconstructor
  13. */
  14. MWF.xApplication.process.Xform.Button = MWF.APPButton = new Class({
  15. Implements: [Events],
  16. Extends: MWF.APP$Module,
  17. iconStyle: "personfieldIcon",
  18. _loadUserInterface: function(){
  19. // var button = new Element("button");
  20. // button.inject(this.node, "after");
  21. // this.node.destroy();
  22. // this.node = button;
  23. var button = this.node.getElement("button");
  24. if (!button) button = new Element("button");
  25. button.inject(this.node, "after");
  26. this.node.destroy();
  27. this.node = button;
  28. this.node.set({
  29. "id": this.json.id,
  30. "text": this.json.name || this.json.id,
  31. "MWFType": this.json.type
  32. });
  33. if (!this.json.preprocessing) this.node.setStyles(this.form.css.buttonStyles);
  34. }
  35. });