Package net.solosky.maplefetion.event

Examples of net.solosky.maplefetion.event.ActionEvent


      Dialog.assertActionEvent(future.waitActionEventWithException(), ActionEventType.SUCCESS);
     
      //用户验证
      future.clear();
      serverDialog.userAuth(presence, listener);
      ActionEvent event = future.waitActionEventWithoutException();
      if(event.getEventType()==ActionEventType.SUCCESS){
        this.updateLoginState(LoginState.SIPC_REGISGER_SUCCESS, null);
      }else if(event.getEventType()==ActionEventType.FAILURE){
        FailureEvent evt = (FailureEvent) event;
        FailureType type =  evt.getFailureType();
        if(type==FailureType.REGISTER_FORBIDDEN){
          throw new LoginException(LoginState.SIPC_ACCOUNT_FORBIDDEN); //帐号限制登录,可能存在不安全因素,请修改密码后再登录
        }else if(type==FailureType.AUTHORIZATION_FAIL){
View Full Code Here


      ScheduleSMS sc = it.next();
      readyList.add(sc);
      if(readyList.size()==20){
        future.clear();
        dialog.getScheduleSMSInfo(readyList, future);
        ActionEvent event = future.waitActionEventWithoutException();
        if(event.getEventType()==ActionEventType.SUCCESS){
          readyList.clear();    //成功继续下一次请求
        }else{
          return event;      //失败返回这个错误事件
        }
      }
View Full Code Here

    }
  }
 
  @Override
  public void run() {
    ActionEvent event = this.getScheduleSMSList();
    if(event.getEventType()==ActionEventType.SUCCESS){
      event = this.getScheduleSMSInfo();
    }
   
    if(listener!=nulllistener.fireEevent(event);
  }
View Full Code Here

      if(state==LoginState.LOGIN_SUCCESS){  //登录成功
        System.out.println("登录成功,正在发送消息至 "+args[2]+",请稍候...");                     
         
        ActionEventFuture future = new ActionEventFuture()//建立一个Future来等待操作事件     
        client.sendChatMessage(Long.parseLong(args[2]), new Message(args[3]), future);
        ActionEvent event = future.waitActionEventWithoutException()//等待操作完成事件
        switch(event.getEventType()){
         
          case SUCCESS:
            SendChatMessageSuccessEvent evt = (SendChatMessageSuccessEvent) event;
            if(evt.isSendToMobile()){
              System.out.println("发送成功,消息已通过短信发送到对方手机!");
            }else if(evt.isSendToClient()){
              System.out.println("发送成功,消息已通过服务直接发送到对方客户端!");
            }
            break;
           
          case FAILURE:
            FailureEvent evt2 = (FailureEvent) event;
            switch(evt2.getFailureType()){
              case BUDDY_NOT_FOUND:
                System.out.println("发送失败, 该用户可能不是你好友,请尝试添加该用户为好友后再发送消息。");
                break;
              case USER_NOT_FOUND:
                System.out.println("发送失败, 该用户不是移动用户。");
                break;
              case SIPC_FAIL:
                System.out.println("发送失败, 服务器返回了错误的信息。");
                break;
              case UNKNOWN_FAIL:
                System.out.println("发送失败, 不知道错在哪里。");
               
              case REQEUST_FAIL:
                RequestFailureEvent evt3 = (RequestFailureEvent) event;
                System.out.println("提示:"+evt3.getReason()+", 更多信息请访问:"+evt3.getReason());
               
              default:
                System.out.println("发送消息失败!"+event.toString());
            }
            break;
         
          /* 以下三个错误状态是在异步发送消息的情况才会发生,
           * 为了方便处理,使用waitActionEventWithException()同步的情况下,这三个错误是通过异常来处理的
 
View Full Code Here

    @Override
    public void handle(SipcResponse response) throws FetionException
    {
      try {
        //交给子类处理这个回复,并捕获所有异常
        ActionEvent event = this.doHandle(response);
        if(event!=null) {
          this.fireEvent(event);
        }
    } catch (FetionException e) {
      this.fireEvent(new SystemErrorEvent(e));
View Full Code Here

TOP

Related Classes of net.solosky.maplefetion.event.ActionEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.