123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
- MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
- MWF.xApplication.process.FormDesigner.Module.Relatedlink = MWF.FCRelatedlink = new Class({
- Extends: MWF.FC$Element,
- Implements: [Options, Events],
- options: {
- "style": "default",
- "propertyPath": "../x_component_process_FormDesigner/Module/Relatedlink/relatedlink.html"
- },
-
- initialize: function(form, options){
- this.setOptions(options);
-
- this.path = "../x_component_process_FormDesigner/Module/Relatedlink/";
- this.cssPath = "../x_component_process_FormDesigner/Module/Relatedlink/"+this.options.style+"/css.wcss";
- this._loadCss();
- this.moduleType = "element";
- this.moduleName = "relatedlink";
- this.form = form;
- this.container = null;
- this.containerNode = null;
- },
- _resetModuleDomNode: function(){
- this.contentNode = this.node.getElement(".rlcontent");
- this.buttonNode = this.node.getElement(".rlbutton");
- },
- _createMoveNode: function(){
- this.moveNode = new Element("div", {
- "MWFType": "relatedlink",
- "id": this.json.id,
- "styles": this.css.moduleNodeMove,
- "events": {
- "selectstart": function(){
- return false;
- }
- }
- }).inject(this.form.container);
- },
- _createNode: function(){
- this.node = this.moveNode.clone(true, true);
- this.node.setStyles(this.css.moduleNode);
- this.node.set("id", this.json.id);
- this.node.addEvent("selectstart", function(){
- return false;
- });
- if( this.json.activeType === "click" || !this.json.activeType ){
- this.loadButton();
- }else{
- this.loadContent();
- }
- },
- loadContent: function(){
- this.contentNode = new Element("div.rlcontent", {
- "styles": this.css.contentNode
- }).inject(this.node);
- this.loadIcon();
- },
- loadIcon: function(){
- this.iconNode = new Element("div", {
- "styles": this.css.iconNode
- }).inject(this.contentNode);
- new Element("div", {
- "styles": this.css.iconNodeIcon
- }).inject(this.iconNode);
- new Element("div", {
- "styles": this.css.iconNodeText,
- "text": "Relatedlink"
- }).inject(this.iconNode);
- },
- loadButton: function(){
- this.buttonNode = new Element("div.rlbutton", {
- "styles": this.json.buttonStyles || {},
- "text": this.json.buttonText
- }).inject( this.node, "top" );
- // this.contentNode.setStyle("min-height", 100 - this.buttonNode.getSize().y +"px")
- },
- clearTemplateStyles: function(styles){
- if (styles){
- if (styles.buttonStyles) this.removeStyles(styles.buttonStyles, "buttonStyles");
- if (styles.tableStyles) this.removeStyles(styles.tableStyles, "tableStyles");
- if (styles.tableTitleCellStyles) this.removeStyles(styles.tableTitleCellStyles, "tableTitleCellStyles");
- if (styles.tableContentLineStyles) this.removeStyles(styles.tableContentLineStyles, "tableContentLineStyles");
- if (styles.tableContentLineStyles_over) this.removeStyles(styles.tableContentLineStyles_over, "tableContentLineStyles_over");
- if (styles.tableContentCellStyles) this.removeStyles(styles.tableContentCellStyles, "tableContentCellStyles");
- if (styles.tableTitleCellStyles) this.removeStyles(styles.tableTitleCellStyles, "tableTitleCellStyles");
- }
- },
- setTemplateStyles: function(styles){
- if (styles.buttonStyles) this.copyStyles(styles.buttonStyles, "buttonStyles");
- if (styles.tableStyles) this.copyStyles(styles.tableStyles, "tableStyles");
- if (styles.tableTitleCellStyles) this.copyStyles(styles.tableTitleCellStyles, "tableTitleCellStyles");
- if (styles.tableContentLineStyles) this.copyStyles(styles.tableContentLineStyles, "tableContentLineStyles");
- if (styles.tableContentLineStyles_over) this.copyStyles(styles.tableContentLineStyles_over, "tableContentLineStyles_over");
- if (styles.tableContentCellStyles) this.copyStyles(styles.tableContentCellStyles, "tableContentCellStyles");
- if (styles.tableTitleCellStyles) this.copyStyles(styles.tableTitleCellStyles, "tableTitleCellStyles");
- },
- setAllStyles: function(){
- this.setPropertiesOrStyles("styles");
- this.setPropertiesOrStyles("buttonStyles");
- this.setPropertiesOrStyles("properties");
- this.reloadMaplist();
- },
- setPropertiesOrStyles: function(name){
- if (name=="styles"){
- try{
- this.setCustomStyles();
- }catch(e){}
- }
- if (name=="buttonStyles"){
- try{
- if( this.buttonNode ){
- this.buttonNode.clearStyles();
- this.buttonNode.setStyles(this.json.buttonStyles||{});
- }
- }catch(e){}
- }
- if (name=="properties"){
- try{
- this.setCustomProperties();
- }catch(e){}
- }
- },
- _setEditStyle_custom: function(name, obj, oldValue){
- switch ( name ){
- case "activeType":
- switch (this.json.activeType) {
- case "click":
- if (!this.buttonNode) this.loadButton();
- if (this.contentNode) {
- this.contentNode.destroy();
- this.contentNode = null;
- }
- break;
- case "delay":
- case "immediately":
- if (!this.contentNode) this.loadContent();
- if (this.buttonNode) {
- this.buttonNode.destroy();
- this.buttonNode = null;
- }
- break;
- }
- case "buttonText":
- if (this.buttonNode) this.buttonNode.set("text", this.json.buttonText);
- }
- }
- });
|