Label.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.Label = MWF.FCLabel = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Label/label.html"
  9. },
  10. initialize: function(form, options){
  11. debugger;
  12. this.setOptions(options);
  13. this.path = "/x_component_process_FormDesigner/Module/Label/";
  14. this.cssPath = "/x_component_process_FormDesigner/Module/Label/"+this.options.style+"/css.wcss";
  15. this._loadCss();
  16. this.moduleType = "element";
  17. this.moduleName = "label";
  18. this.form = form;
  19. this.container = null;
  20. this.containerNode = null;
  21. },
  22. clearTemplateStyles: function(styles){
  23. if (this.json.templateType){
  24. if (styles){
  25. if (styles[this.json.templateType]){
  26. if (styles[this.json.templateType].styles) this.removeStyles(styles[this.json.templateType].styles, "styles");
  27. if (styles[this.json.templateType].inputStyles) this.removeStyles(styles[this.json.templateType].inputStyles, "inputStyles");
  28. if (styles[this.json.templateType].properties) this.removeStyles(styles[this.json.templateType].properties, "properties");
  29. }
  30. }
  31. }
  32. },
  33. setTemplateStyles: function(styles){
  34. if (this.json.templateType){
  35. if (styles[this.json.templateType]){
  36. if (styles[this.json.templateType].styles) this.copyStyles(styles[this.json.templateType].styles, "styles");
  37. if (styles[this.json.templateType].properties) this.copyStyles(styles[this.json.templateType].properties, "properties");
  38. }
  39. }
  40. },
  41. _createMoveNode: function(){
  42. this.moveNode = new Element("div", {
  43. "MWFType": "label",
  44. "id": this.json.id,
  45. "styles": this.css.moduleNodeMove,
  46. "text": "(T)Text",
  47. "events": {
  48. "selectstart": function(){
  49. return false;
  50. }
  51. }
  52. }).inject(this.form.container);
  53. },
  54. _setEditStyle_custom: function(name, obj, oldValue){
  55. debugger;
  56. if (name=="valueType" || name=="text"){
  57. if (this.json.valueType=="text"){
  58. if (this.json.text){
  59. this.node.set("text", this.json.text);
  60. }else{
  61. this.node.set("text", "(T)Text");
  62. }
  63. }else{
  64. this.node.set("text", "(C)Text");
  65. }
  66. }
  67. if (name=="templateType"){
  68. if (this.form.templateStyles){
  69. var moduleStyles = this.form.templateStyles[this.moduleName];
  70. if (moduleStyles) {
  71. if (oldValue){
  72. if (moduleStyles[oldValue]){
  73. this.removeStyles(moduleStyles[oldValue].styles, "styles");
  74. this.removeStyles(moduleStyles[oldValue].styles, "properties");
  75. }
  76. }
  77. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].styles, "styles");
  78. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].properties, "properties");
  79. this.setPropertiesOrStyles("styles");
  80. this.setPropertiesOrStyles("properties");
  81. this.reloadMaplist();
  82. }
  83. }
  84. }
  85. }
  86. });