接上面,繼續(xù)討論TreeRPCController。該類在TreeLoadingController上擴(kuò)充了以下方法:
1:doMove的部分代碼:
var params = {
???//?移動(dòng)的節(jié)點(diǎn)以及節(jié)點(diǎn)所在的樹(shù)
???child: this.getInfo(child),
???childTree: this.getInfo(child.tree),
???//?移動(dòng)目的樹(shù),目的節(jié)點(diǎn),以及目的位置。
???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,
???//鎖定操作的兩個(gè)節(jié)點(diǎn)。
???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)
評(píng)論(0) 編輯 收藏