Property.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. MWF.require("MWF.widget.Common", null, false);
  2. MWF.require("MWF.widget.JsonTemplate", null, false);
  3. MWF.xDesktop.requireApp("query.ViewDesigner", "Property", null, false);
  4. MWF.xApplication.query.StatementDesigner.Property = MWF.SDProperty = new Class({
  5. Extends: MWF.xApplication.query.ViewDesigner.Property,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default"
  9. },
  10. show: function () {
  11. if (!this.propertyContent) {
  12. this.getHtmlString(function () {
  13. if (this.htmlString) {
  14. this.htmlString = o2.bindJson(this.htmlString, {"lp": MWF.xApplication.query.StatementDesigner.LP.propertyTemplate});
  15. this.JsonTemplate = new MWF.widget.JsonTemplate(this.data, this.htmlString);
  16. this.propertyContent = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.propertyNode);
  17. //var htmlStr = this.JsonTemplate.load();
  18. this.propertyContent.set("html", this.JsonTemplate.load());
  19. this.setEditNodeEvent();
  20. this.setEditNodeStyles(this.propertyContent);
  21. this.loadPropertyTab();
  22. this.loadPersonInput();
  23. this.loadPersonSelectInput();
  24. this.loadViewFilter();
  25. this.loadScriptArea();
  26. this.loadColumnExportEditor();
  27. this.loadJSONArea();
  28. this.loadEventsEditor();
  29. this.loadViewStylesArea();
  30. this.loadPagingStylesArea();
  31. this.loadActionStylesArea();
  32. this.loadActionArea();
  33. this.loadStylesList();
  34. this.loadMaplist();
  35. this.loadDataPathSelect();
  36. }
  37. }.bind(this));
  38. } else {
  39. this.propertyContent.setStyle("display", "block");
  40. }
  41. },
  42. loadDataPathSelect : function(){
  43. var nodes = this.propertyContent.getElements(".MWFDataPathSelect");
  44. nodes.each( function (select) {
  45. select.empty();
  46. var option = new Element("option", {"text": "none", "value" : ""}).inject(select);
  47. this.module.getColumnDataPath().each(function(model){
  48. var option = new Element("option", {
  49. "text": model,
  50. "value": model,
  51. "selected": (this.data[name]==model)
  52. }).inject(select);
  53. }.bind(this));
  54. }.bind(this))
  55. },
  56. loadViewFilter: function () {
  57. var nodes = this.propertyContent.getElements(".MWFViewFilter");
  58. var parameterData = this.view.data.data.parameterList;
  59. var customData = this.view.data.data.customFilterList;
  60. nodes.each(function (node) {
  61. MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function () {
  62. var _slef = this;
  63. this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.view.designer, {
  64. "parameterData": parameterData,
  65. "customData": customData
  66. }, {
  67. "onChange": function (ids) {
  68. var data = this.getData();
  69. _slef.changeJsonDate(["data", "parameterList"], data.parameterData);
  70. _slef.changeJsonDate(["data", "customFilterList"], data.customData);
  71. }
  72. });
  73. }.bind(this));
  74. }.bind(this));
  75. },
  76. loadActionArea: function () {
  77. debugger;
  78. MWF.xApplication.process = MWF.xApplication.process || {};
  79. MWF.APPFD = MWF.xApplication.process.FormDesigner = MWF.xApplication.process.FormDesigner || {};
  80. MWF.xDesktop.requireApp("process.FormDesigner", "lp." + o2.language, null, false);
  81. var multiActionArea = this.propertyContent.getElements(".MWFMultiActionArea");
  82. multiActionArea.each(function(node){
  83. debugger;
  84. var name = node.get("name");
  85. var actionContent = this.data[name];
  86. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function(){
  87. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  88. "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  89. "systemToolsAddress": "../x_component_query_StatementDesigner/$Statement/toolbars.json",
  90. "isSystemTool" : true,
  91. "noEditShow": true,
  92. "noReadShow": true,
  93. "onChange": function(){
  94. this.data[name] = actionEditor.data;
  95. this.changeData(name);
  96. }.bind(this)
  97. });
  98. actionEditor.load(actionContent);
  99. }.bind(this));
  100. }.bind(this));
  101. var actionAreas = this.propertyContent.getElements(".MWFActionArea");
  102. actionAreas.each(function (node) {
  103. var name = node.get("name");
  104. var actionContent = this.data[name];
  105. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function () {
  106. // debugger;
  107. // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
  108. // "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  109. // "noCreate": true,
  110. // "noDelete": true,
  111. // "noCode": true,
  112. // "onChange": function(){
  113. // this.data[name] = actionEditor.data;
  114. // }.bind(this)
  115. // });
  116. // actionEditor.load(this.module.defaultToolBarsData);
  117. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  118. "maxObj": this.propertyNode.parentElement.parentElement,
  119. "noEditShow": true,
  120. "noReadShow": true,
  121. "onChange": function () {
  122. this.data[name] = actionEditor.data;
  123. this.changeData(name);
  124. }.bind(this)
  125. });
  126. actionEditor.load(actionContent);
  127. }.bind(this));
  128. }.bind(this));
  129. var actionAreas = this.propertyContent.getElements(".MWFDefaultActionArea");
  130. actionAreas.each(function (node) {
  131. var name = node.get("name");
  132. var actionContent = this.data[name] || this.module.defaultToolBarsData;
  133. MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function () {
  134. var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
  135. "maxObj": this.propertyNode.parentElement.parentElement,
  136. "isSystemTool": true,
  137. "systemToolsAddress": "../x_component_query_StatementDesigner/$Statement/toolbars.json",
  138. "noCreate": true,
  139. "noDelete": false,
  140. "noCode": true,
  141. "noReadShow": true,
  142. "noEditShow": true,
  143. "onChange": function () {
  144. this.data[name] = actionEditor.data;
  145. this.changeData(name);
  146. }.bind(this)
  147. });
  148. actionEditor.load(actionContent);
  149. // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
  150. // "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
  151. // "onChange": function(){
  152. // this.data[name] = actionEditor.data;
  153. // }.bind(this)
  154. // });
  155. // actionEditor.load(actionContent);
  156. }.bind(this));
  157. }.bind(this));
  158. }
  159. });