Log.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Log = MWF.FCLog = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Log/log.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_process_FormDesigner/Module/Log/";
  13. this.cssPath = "/x_component_process_FormDesigner/Module/Log/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "log";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. load : function(json, node, parent){
  22. this.json = json;
  23. this.node= node;
  24. this.node.store("module", this);
  25. //this.node.empty();
  26. this.node.setStyles(this.css.moduleNode);
  27. this._loadNodeStyles();
  28. this._initModule();
  29. this._loadTreeNode(parent);
  30. this.setCustomStyles();
  31. this.parentContainer = this.treeNode.parentNode.module;
  32. this._setEditStyle_custom("id");
  33. this.parseModules();
  34. this.json.moduleName = this.moduleName;
  35. },
  36. clearTemplateStyles: function(styles){
  37. if (styles){
  38. if (styles.properties) this.removeStyles(styles.properties, "tableProperties");
  39. if (styles.tableStyles) this.removeStyles(styles.tableStyles, "tableStyles");
  40. if (styles.titleStyles) this.removeStyles(styles.titleStyles, "titleTdStyles");
  41. if (styles.contentStyles) this.removeStyles(styles.contentStyles, "contentTdStyles");
  42. }
  43. },
  44. setTemplateStyles: function(styles){
  45. if (styles.properties) this.copyStyles(styles.properties, "tableProperties");
  46. if (styles.tableStyles) this.copyStyles(styles.tableStyles, "tableStyles");
  47. if (styles.titleStyles) this.copyStyles(styles.titleStyles, "titleTdStyles");
  48. if (styles.contentStyles) this.copyStyles(styles.contentStyles, "contentTdStyles");
  49. },
  50. _createMoveNode: function(){
  51. this.moveNode = new Element("div", {
  52. "MWFType": "log",
  53. "id": this.json.id,
  54. "styles": this.css.moduleNodeMove,
  55. "events": {
  56. "selectstart": function(){
  57. return false;
  58. }
  59. }
  60. }).inject(this.form.container);
  61. },
  62. _createNode: function(){
  63. this.node = this.moveNode.clone(true, true);
  64. this.node.setStyles(this.css.moduleNode);
  65. this.node.set("id", this.json.id);
  66. this.node.addEvent("selectstart", function(){
  67. return false;
  68. });
  69. this.iconNode = new Element("div", {
  70. "styles": this.css.iconNode
  71. }).inject(this.node);
  72. new Element("div", {
  73. "styles": this.css.iconNodeIcon
  74. }).inject(this.iconNode);
  75. new Element("div", {
  76. "styles": this.css.iconNodeText,
  77. "text": "LOG"
  78. }).inject(this.iconNode);
  79. },
  80. _loadNodeStyles: function(){
  81. this.iconNode = this.node.getElement("div").setStyles(this.css.iconNode);
  82. this.iconNode.getFirst("div").setStyles(this.css.iconNodeIcon);
  83. this.iconNode.getLast("div").setStyles(this.css.iconNodeText);
  84. }
  85. });