提交 26578c48 编写于 作者: U unknown

eltreee

上级 440b5750
...@@ -99,6 +99,12 @@ ...@@ -99,6 +99,12 @@
"float": "right", "float": "right",
"background": "url("+o2.session.path+"/widget/$Tree/form/script.png) center center no-repeat" "background": "url("+o2.session.path+"/widget/$Tree/form/script.png) center center no-repeat"
}, },
"itemPropertyActionNode": {
"width": "20px",
"height": "22px",
"float": "right",
"background": "url("+o2.session.path+"/widget/$Tree/editor/code.png) center center no-repeat"
},
"scriptNode":{ "scriptNode":{
"width": "98%", "width": "98%",
"height": "98%", "height": "98%",
......
...@@ -203,12 +203,12 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree = new Class({ ...@@ -203,12 +203,12 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree = new Class({
return treeNode; return treeNode;
}, },
expandOrCollapseNode: function(treeNode){ expandOrCollapseNode: function(treeNode){
if (treeNode.data.expand){ if (treeNode.options.expand){
this.collapse(treeNode); this.collapse(treeNode);
treeNode.data.expand = false; treeNode.options.expand = false;
}else{ }else{
this.expand(treeNode); this.expand(treeNode);
treeNode.data.expand = true; treeNode.options.expand = true;
} }
treeNode.setOperateIcon(); treeNode.setOperateIcon();
this.editor.fireEvent("change"); this.editor.fireEvent("change");
...@@ -245,12 +245,12 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree = new Class({ ...@@ -245,12 +245,12 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree = new Class({
MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class({ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class({
Implements: [Options, Events], Implements: [Options, Events],
// options: { options: {
// "expand": true, "expand": true
// "label": "", // "label": "",
// "default" : false, // "default" : false,
// "icon": "" // "icon": ""
// }, },
srciptOption: { srciptOption: {
"width": 300, "width": 300,
"height": 300, "height": 300,
...@@ -266,10 +266,10 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -266,10 +266,10 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
initialize: function(tree, data){ initialize: function(tree, data){
debugger; debugger;
Object.each({ Object.each({
"expand": true, // "expand": true,
"label": "", "label": ""
"default" : false, // "default" : false,
"icon": "" // "icon": ""
}, function(value, key){ }, function(value, key){
if( !data.hasOwnProperty(key) ){ if( !data.hasOwnProperty(key) ){
data[key] = value; data[key] = value;
...@@ -296,22 +296,26 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -296,22 +296,26 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
"styles": this.tree.css.treeChildrenNode "styles": this.tree.css.treeChildrenNode
}).inject(this.node); }).inject(this.node);
if (!this.data.expand){ if (!this.options.expand){
this.childrenNode.setStyle("display", "none"); this.childrenNode.setStyle("display", "none");
} }
this.itemNode.addEvents({ this.itemNode.addEvents({
"mouseover": function(){ "mouseover": function(){
if (!this.isEditScript) this.itemNode.setStyles(this.tree.css.treeItemNodeOver); if (this.tree.currentEditNode!==this) {
this.itemNode.setStyles(this.tree.css.treeItemNodeOver);
this.showItemAction(); this.showItemAction();
}
}.bind(this), }.bind(this),
"mouseout": function(){ "mouseout": function(){
if (!this.isEditScript) this.itemNode.setStyles(this.tree.css.treeItemNode); if (this.tree.currentEditNode!==this) {
this.itemNode.setStyles(this.tree.css.treeItemNode);
this.hideItemAction(); this.hideItemAction();
}.bind(this), }
"click": function () {
this.editItemProperties();
}.bind(this) }.bind(this)
// "click": function () {
// this.editItemProperties();
// }.bind(this)
}); });
}, },
load: function(){ load: function(){
...@@ -379,9 +383,9 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -379,9 +383,9 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
}.bind(this)); }.bind(this));
textDivNode.inject(this.textNode); textDivNode.inject(this.textNode);
if( this.data.default ){ // if( this.data.default ){
textDivNode.click(); // textDivNode.click();
} // }
}, },
clickNode: function(e){ clickNode: function(e){
this.selectNode(e); this.selectNode(e);
...@@ -402,7 +406,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -402,7 +406,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
this.tree.fireEvent("afterSelect", [this]); this.tree.fireEvent("afterSelect", [this]);
}, },
setOperateIcon: function(){ setOperateIcon: function(){
var imgStr = (this.data.expand) ? this.imgs.expand : this.imgs.collapse; var imgStr = (this.options.expand) ? this.imgs.expand : this.imgs.collapse;
imgStr = this.tree.path+this.tree.options.style+"/"+imgStr; imgStr = this.tree.path+this.tree.options.style+"/"+imgStr;
if (!this.firstChild) imgStr = this.tree.path+this.tree.options.style+"/"+this.imgs.blank; if (!this.firstChild) imgStr = this.tree.path+this.tree.options.style+"/"+this.imgs.blank;
...@@ -503,25 +507,29 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -503,25 +507,29 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
"events": { "events": {
"click": function(e){ "click": function(e){
this.deleteItem(e); this.deleteItem(e);
e.stopPropagation();
}.bind(this) }.bind(this)
} }
}).inject(this.actionNode); }).inject(this.actionNode);
// var scriptAction = new Element("div", { var propertyAction = new Element("div", {
// "styles": this.tree.css.itemScriptActionNode, "styles": this.tree.css.itemPropertyActionNode,
// "title": o2.LP.process.formAction["script"], "title": o2.LP.process.formAction["property"],
// "events": { "events": {
// "click": function(e){ "click": function(e){
// this.editScriptItem(e); this.editItemProperties(e);
// }.bind(this) }.bind(this)
// } }
// }).inject(this.actionNode); }).inject(this.actionNode);
var addAction = new Element("div", { var addAction = new Element("div", {
"styles": this.tree.css.itemAddActionNode, "styles": this.tree.css.itemAddActionNode,
"title": o2.LP.process.formAction.add, "title": o2.LP.process.formAction.add,
"events": { "events": {
"click": this.addChild.bind(this) "click": function(ev){
this.addChild();
ev.stopPropagation();
}.bind(this)
} }
}).inject(this.actionNode); }).inject(this.actionNode);
}, },
...@@ -624,6 +632,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -624,6 +632,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
}, },
completeItemProperties: function(){ completeItemProperties: function(){
this.hideItemAction();
this.itemNode.setStyles(this.tree.css.treeItemNode); this.itemNode.setStyles(this.tree.css.treeItemNode);
this.isEditProperty = false; this.isEditProperty = false;
this.tree.currentEditNode = null; this.tree.currentEditNode = null;
...@@ -654,6 +663,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -654,6 +663,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
events: { events: {
blur: function () { blur: function () {
this.data.label = this.labelInput.get("value"); this.data.label = this.labelInput.get("value");
this.textNode.getElement("div").set("text", this.data.label);
}.bind(this) }.bind(this)
} }
}).inject(td); }).inject(td);
...@@ -675,7 +685,6 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -675,7 +685,6 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
MWF.require("MWF.widget.Maplist", function() { MWF.require("MWF.widget.Maplist", function() {
var maplist = new MWF.widget.Maplist(td, { var maplist = new MWF.widget.Maplist(td, {
"title": "其他属性", "title": "其他属性",
"ignoreKeyList": ["id", "label", "children"],
"collapse": false, "collapse": false,
"onChange": function () { "onChange": function () {
// var oldData = this.data[name]; // var oldData = this.data[name];
...@@ -696,7 +705,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -696,7 +705,7 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
if( !["id","label", "children"].contains(key) )data[key] = this.data[key] if( !["id","label", "children"].contains(key) )data[key] = this.data[key]
} }
maplist.load(data); maplist.load(data);
}) }.bind(this))
} }
this.propertyArea.setStyle("display", "block"); this.propertyArea.setStyle("display", "block");
...@@ -718,8 +727,11 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -718,8 +727,11 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
var treeNode = this.appendChild(obj); var treeNode = this.appendChild(obj);
if (!this.data.expand) this.tree.expandOrCollapseNode(this); if (!this.options.expand) this.tree.expandOrCollapseNode(this);
treeNode.selectNode(); treeNode.selectNode();
treeNode.showItemAction();
treeNode.editItemProperties();
var textDivNode = treeNode.textNode.getElement("div"); var textDivNode = treeNode.textNode.getElement("div");
treeNode.editItem(textDivNode); treeNode.editItem(textDivNode);
...@@ -799,6 +811,8 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class( ...@@ -799,6 +811,8 @@ MWF.xApplication.process.FormDesigner.widget.ElTreeEditor.Tree.Node = new Class(
node.set("html", text); node.set("html", text);
if( this.labelInput )this.labelInput.set("value", text);
this.tree.editor.fireEvent("change"); this.tree.editor.fireEvent("change");
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册