Tab$Content.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Container", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Tab$Content = MWF.FCTab$Content = new Class({
  4. Extends: MWF.FC$Container,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Tab$Content/tab$Content.html",
  9. "actions": [
  10. {
  11. "name": "selectParent",
  12. "icon": "selectParent.png",
  13. "event": "click",
  14. "action": "selectParent",
  15. "title": MWF.APPFD.LP.formAction["selectParent"]
  16. }
  17. ],
  18. "injectActions" : [
  19. {
  20. "name" : "top",
  21. "styles" : "injectActionTop",
  22. "event" : "click",
  23. "action" : "injectTop",
  24. "title": MWF.APPFD.LP.formAction["insertTop"]
  25. },
  26. {
  27. "name" : "bottom",
  28. "styles" : "injectActionBottom",
  29. "event" : "click",
  30. "action" : "injectBottom",
  31. "title": MWF.APPFD.LP.formAction["insertBottom"]
  32. }
  33. ]
  34. },
  35. initialize: function(tab, page, options){
  36. this.setOptions(options);
  37. this.path = "../x_component_process_FormDesigner/Module/Tab$Content/";
  38. this.cssPath = "../x_component_process_FormDesigner/Module/Tab$Content/"+this.options.style+"/css.wcss";
  39. this._loadCss();
  40. this.moduleType = "container";
  41. this.moduleName = "tab$Content";
  42. this.form = tab.form;
  43. this.tab = tab;
  44. this.page = page;
  45. },
  46. _dragInLikeElement: function(module){
  47. return false;
  48. },
  49. load : function(json, node, parent){
  50. this.json = json;
  51. this.node= node;
  52. this.node.store("module", this);
  53. this.node.setStyles(this.css.moduleNode);
  54. if (!this.json.id){
  55. var id = this._getNewId(parent.json.id);
  56. this.json.id = id;
  57. }
  58. node.set({
  59. "MWFType": "tab$Content",
  60. "id": this.json.id
  61. });
  62. if (!this.form.json.moduleList[this.json.id]){
  63. this.form.json.moduleList[this.json.id] = this.json;
  64. }
  65. this._initModule();
  66. this._loadTreeNode(parent);
  67. this.setCustomStyles();
  68. this.parentContainer = this.treeNode.parentNode.module;
  69. this._setEditStyle_custom("id");
  70. this.parseModules();
  71. this.json.moduleName = this.moduleName;
  72. },
  73. _deleteModule: function(){
  74. this.form.moduleList.erase(this);
  75. this.form.moduleNodeList.erase(this.node);
  76. this.form.moduleElementNodeList.erase(this.node);
  77. //this.tab.containers.erase(this);
  78. this.node.destroy();
  79. this.actionArea.destroy();
  80. delete this.form.json.moduleList[this.json.id];
  81. this.json = null;
  82. delete this.json;
  83. this.treeNode.destroy();
  84. },
  85. _preprocessingModuleData: function(){
  86. this.recoveryWidgetstyle = this.node.get("style");
  87. this.node.clearStyles();
  88. //if (this.initialStyles) this.node.setStyles(this.initialStyles);
  89. this.json.recoveryStyles = Object.clone(this.json.styles);
  90. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  91. if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
  92. //需要运行时处理
  93. }else{
  94. this.node.setStyle(key, value);
  95. delete this.json.styles[key];
  96. }
  97. }.bind(this));
  98. },
  99. _recoveryModuleData: function(){
  100. if (this.recoveryWidgetstyle) this.node.set("style", this.recoveryWidgetstyle);
  101. this.recoveryWidgetstyle = null;
  102. if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;
  103. this.json.recoveryStyles = null;
  104. }
  105. // setCustomStyles: function(){
  106. // this._recoveryModuleData();
  107. // //debugger;
  108. // var border = this.node.getStyle("border");
  109. // this.node.clearStyles();
  110. // this.node.setStyles(this.css.moduleNode);
  111. //
  112. // if (this.initialStyles) this.node.setStyles(this.initialStyles);
  113. // this.node.setStyle("border", border);
  114. //
  115. // if (this.json.styles) Object.each(this.json.styles, function(value, key){
  116. // if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
  117. // var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
  118. // var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
  119. // if (value.indexOf("/x_processplatform_assemble_surface")!==-1){
  120. // value = value.replace("/x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
  121. // }else if (value.indexOf("x_processplatform_assemble_surface")!==-1){
  122. // value = value.replace("x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
  123. // }
  124. // if (value.indexOf("/x_portal_assemble_surface")!==-1){
  125. // value = value.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  126. // }else if (value.indexOf("x_portal_assemble_surface")!==-1){
  127. // value = value.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
  128. // }
  129. // }
  130. //
  131. // var reg = /^border\w*/ig;
  132. // if (!key.test(reg)){
  133. // if (key){
  134. // if (key.toString().toLowerCase()==="display"){
  135. // if (value.toString().toLowerCase()==="none"){
  136. // this.node.setStyle("opacity", 0.3);
  137. // }else{
  138. // this.node.setStyle("opacity", 1);
  139. // this.node.setStyle(key, value);
  140. // }
  141. // }else{
  142. // this.node.setStyle(key, value);
  143. // }
  144. // }
  145. // }
  146. // }.bind(this));
  147. // }
  148. });