$Element.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Module", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.$Element = MWF.FC$Element = new Class({
  4. Extends: MWF.FC$Module,
  5. Implements: [Options, Events],
  6. _setNodeProperty: function(){
  7. if (this.form.moduleList.indexOf(this)==-1) this.form.moduleList.push(this);
  8. if (this.form.moduleNodeList.indexOf(this.node)==-1) this.form.moduleNodeList.push(this.node);
  9. if (this.form.moduleElementNodeList.indexOf(this.node)==-1) this.form.moduleElementNodeList.push(this.node);
  10. this.node.store("module", this);
  11. },
  12. _dragIn: function(module){
  13. module.onDragModule = this;
  14. if (this.parentContainer.moduleName == "datagrid$Data"){
  15. this.parentContainer._dragIn(module);
  16. }else{
  17. module.inContainer = null;
  18. module.parentContainer = this.parentContainer;
  19. module.nextModule = this;
  20. //this.parentContainer.node.setStyles({"border": "1px solid #ffa200"});
  21. this.node.setStyles({"border": "1px solid #ffa200"});
  22. if (module.controlMode){
  23. if (module.copyNode) module.copyNode.hide();
  24. }else{
  25. var copyNode = module._getCopyNode(this);
  26. copyNode.show();
  27. copyNode.inject(this.node, "before");
  28. }
  29. //this._showInjectAction( module );
  30. // var e = new Event(event);
  31. // if (e.control){
  32. //
  33. // }else{
  34. // var copyNode = module._getCopyNode(this);
  35. // copyNode.inject(this.node, "before");
  36. // }
  37. }
  38. },
  39. _setControlModeNode: function(){
  40. if (this.controlMode){
  41. if (this.copyNode) this.copyNode.hide();
  42. }else{
  43. if (this.onDragModule) this.onDragModule._dragIn(this);
  44. }
  45. },
  46. _dragOut: function(module){
  47. module.onDragModule = null;
  48. module.inContainer = null;
  49. module.parentContainer = null;
  50. module.nextModule = null;
  51. //this.parentContainer.node.setStyles(this.parentContainer.css.moduleNode);
  52. //this.parentContainer.setCustomStyles();
  53. this.node.setStyles(this.css.moduleNode);
  54. this.setCustomStyles();
  55. //this._hideInjectAction();
  56. // if (this._controlKeyEventFun){
  57. // this.node.removeEvent("keydown", this._controlKeyEventFun);
  58. // this._controlKeyEventFun = null;
  59. // }
  60. if (!module.controlMode){
  61. var copyNode = module._getCopyNode();
  62. copyNode.setStyle("display", "none");
  63. }
  64. },
  65. _dragDrop: function(module, flag){
  66. var f = flag || !(new Event(event)).control;
  67. if( f ){
  68. this.node.setStyles(this.css.moduleNode);
  69. this.setCustomStyles();
  70. }
  71. //this.parentContainer.node.setStyles(this.parentContainer.css.moduleNode);
  72. //this.parentContainer.setCustomStyles();
  73. //this._hideInjectAction();
  74. },
  75. destroy: function(){
  76. this.form.moduleList.erase(this);
  77. this.form.moduleNodeList.erase(this.node);
  78. this.form.moduleElementNodeList.erase(this.node);
  79. if (this.form.scriptDesigner){
  80. this.form.scriptDesigner.removeModule(this.json);
  81. }
  82. if (this.property) this.property.destroy();
  83. this.node.destroy();
  84. this.actionArea.destroy();
  85. delete this.form.json.moduleList[this.json.id];
  86. this.json = null;
  87. delete this.json;
  88. this.treeNode.destroy();
  89. o2.release(this);
  90. },
  91. parseModules: function(){},
  92. _deleteModule: function(){
  93. this.destroy();
  94. },
  95. getJson: function(){
  96. var json = Object.clone(this.json);
  97. var o = {};
  98. o[json.id] = json;
  99. return o;
  100. }
  101. });