接上面,繼續(xù)討論TreeRPCController。該類在TreeLoadingController上擴充了以下方法:
1:doMove的部分代碼:
var params = {
???//?移動的節(jié)點以及節(jié)點所在的樹
???child: this.getInfo(child),
???childTree: this.getInfo(child.tree),
???//?移動目的樹,目的節(jié)點,以及目的位置。
???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,
???//鎖定操作的兩個節(jié)點。
???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) {
?????//?建議采用死數(shù)據(jù)?
?????this.doCreateChildProcessResponse( response, parent, index, callObj, callFunc)
????},
????params: params,
????lock: [parent]
???});
posted on 2006-11-22 23:19
不做浮躁的人 閱讀(797)
評論(0) 編輯 收藏