Radio.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.Radio = MWF.FCRadio = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Radio/radio.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_process_FormDesigner/Module/Radio/";
  13. this.cssPath = "/x_component_process_FormDesigner/Module/Radio/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "radio";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. _createMoveNode: function(){
  22. this.moveNode = new Element("div", {
  23. "MWFType": "radio",
  24. "id": this.json.id,
  25. "styles": this.css.moduleNodeMove,
  26. "events": {
  27. "selectstart": function(){
  28. return false;
  29. }
  30. }
  31. }).inject(this.form.container);
  32. var icon = new Element("div", {
  33. "styles": this.css.radioIcon
  34. }).inject(this.moveNode);
  35. var text = new Element("div", {
  36. "styles": this.css.moduleText,
  37. "text": this.json.id
  38. }).inject(this.moveNode);
  39. },
  40. _loadNodeStyles: function(){
  41. var icon = this.node.getFirst("div");
  42. var text = this.node.getLast("div");
  43. icon.setStyles(this.css.radioIcon);
  44. text.setStyles(this.css.moduleText);
  45. },
  46. _getCopyNode: function(){
  47. if (!this.copyNode) this._createCopyNode();
  48. this.copyNode.setStyle("display", "inline-block");
  49. return this.copyNode;
  50. },
  51. unSelected: function(){
  52. this.node.setStyles({
  53. "border-width": "1px",
  54. "border-color": "#999"
  55. });
  56. if (this.actionArea) this.actionArea.setStyle("display", "none");
  57. this.form.currentSelectedModule = null;
  58. this.hideProperty();
  59. },
  60. unOver: function(){
  61. if (!this.form.moveModule) if (this.form.currentSelectedModule!=this) this.node.setStyles({
  62. "border-width": "1px",
  63. "border-color": "#999"
  64. });
  65. },
  66. _setEditStyle_custom: function(name){
  67. if (name=="id"){
  68. this.node.getLast().set("text", this.json.id);
  69. }
  70. }
  71. });