接上面,继续讨论TreeRPCController。该类在TreeLoadingController上扩充了以下方法:
1:doMove的部分代码:
var params = {
// 移动的节点以及节点所在的树
child: this.getInfo(child),
childTree: this.getInfo(child.tree),
// 移动目的树,目的节点,以及目的位置。
newParent: this.getInfo(newParent),
newParentTree: this.getInfo(newParent.tree),
newIndex: index
};
var success;
this.runRPC({
url: this.getRPCUrl('move'),
load: function(response){
success = this.doMoveProcessResponse(response, child, newParent, index) ;
},
//同步处理
sync: true,
//锁定操作的两个节点。
lock: [child, newParent],
params: params
});
2:doRemoveNode
var params = {
node: this.getInfo(node),
tree: this.getInfo(node.tree)
}
this.runRPC({
url: this.getRPCUrl('removeNode'),
load: function(response){
this.doRemoveNodeProcessResponse(response, node, callObj, callFunc)
},
params: params,
lock: [node]
});
3:doCreateChild
var params = {
tree: this.getInfo(parent.tree),
parent: this.getInfo(parent),
index: index,
data: output
}
this.runRPC({
url: this.getRPCUrl('createChild'),
load: function(response) {
// 建议采用死数据?
this.doCreateChildProcessResponse( response, parent, index, callObj, callFunc)
},
params: params,
lock: [parent]
});
posted on 2006-11-22 23:19
不做浮躁的人 阅读(796)
评论(0) 编辑 收藏