Flex tree基于数据库的数据源
2009-09-21 00:00:00 来源:WEB开发网2. flex 端 FlexTestService.as
Java代码
package hessian.service {
import mx.rpc.AsyncToken;
import mx.controls.Alert;
import hessian.client.HessianService;
public class FlexTestService extends BaseService {
private static var _userService : HessianService;
//调用java端服务,调用的方法名要与java端服务接口名一致
protected static function getFlexTestService():HessianService {
if (!_userService) {
_userService = new HessianService("http://localhost/remoting/testService");
}
return _userService;
}
public function FlexTestService(resultCallback:Function = null, faultCallback:Function = null) {
super(resultCallback, faultCallback);
}
//获得tree数据
public function getTree():void {
var token:AsyncToken = getFlexTestService().getTree.send();
token.addResponder(this);
}
//增加节点
public function addNote(sid:String, name:String):void {
var token:AsyncToken = getFlexTestService().addNode.send(sid, name);
token.addResponder(this);
}
//删除节点
public function delNote(sid:String):void {
var token:AsyncToken = getFlexTestService().delNode.send(sid);
token.addResponder(this);
}
//更新节点
public function updateNote(sid:String, name:String):void {
var token:AsyncToken = getFlexTestService().updateNode.send(sid, name);
token.addResponder(this);
}
}
}
更多精彩
赞助商链接