Common.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. /** @class Common 通用组件。
  3. * @example
  4. * //可以在脚本中获取该组件
  5. * //方法1:
  6. * var attachment = this.form.get("name"); //获取组件
  7. * //方法2
  8. * var attachment = this.target; //在组件事件脚本中获取
  9. * @extends MWF.xApplication.process.Xform.$Module
  10. * @hideconstructor
  11. */
  12. MWF.xApplication.process.Xform.Common = MWF.APPCommon = new Class({
  13. Extends: MWF.APP$Module,
  14. _loadUserInterface: function(){
  15. if (this.json.innerHTML){
  16. var nodes = this.node.childNodes;
  17. for (var i=0; i<nodes.length; i++){
  18. if (nodes[i].nodeType===Node.ELEMENT_NODE){
  19. if (!nodes[i].get("MWFtype")){
  20. nodes[i].destroy();
  21. i--;
  22. }
  23. }else{
  24. if (nodes[i].removeNode){
  25. nodes[i].removeNode();
  26. }else{
  27. nodes[i].parentNode.removeChild(nodes[i]);
  28. }
  29. i--;
  30. //nodes[i]
  31. }
  32. }
  33. this.node.appendHTML(this.json.innerHTML);
  34. // if (this.node.get("html") !== this.json.innerHTML){
  35. //this.node.appendHTML(this.json.innerHTML);
  36. // }
  37. }
  38. this.node.setProperties(this.json.properties);
  39. }
  40. });