Button.js 1.3 KB

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