WEB开发网
开发学院软件开发Java Flex tree基于数据库的数据源 阅读

Flex tree基于数据库的数据源

 2009-09-21 00:00:00 来源:WEB开发网   
核心提示: 2. flex 端 FlexTestService.as Java代码packagehessian.service{importmx.rpc.AsyncToken;importmx.controls.Alert;importhessian.client.HessianService;public

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); 
  } 
 } 
} 

Tags:

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接