Ejemplo n.º 1
0
 public MessageFrame getMessageFrame() {
   try {
     MessageFrame view =
         Vovo.getViewManager().getView(Constants.ViewKey.MESSAGEFRAME.toString()); //
     if (view == null) {
       view =
           Vovo.getViewManager()
               .createView(MessageFrame.class, Constants.ViewKey.MESSAGEFRAME.toString());
       MessageTabPanel createView =
           Vovo.getViewManager()
               .createView(MessageTabPanel.class, Constants.ViewKey.MESSAGETABPANEL.toString());
       view.add(createView);
       LoginInfo loginInfo =
           Vovo.getMyContext().getDataManager().getValue(Constants.DataKey.LOGGININFO.toString());
       //				UserInfoUtil.setProperty("", value)
       String tabPlacement = UserInfoUtil.getProperty(loginInfo.getUsername(), "TabPlacement");
       if (tabPlacement == null || tabPlacement.equals("")) {
         tabPlacement = "2";
         UserInfoUtil.setProperty(loginInfo.getUsername() + "_TabPlacement", tabPlacement);
       }
       createView.getMainTabbedPane().setTabPlacement(Integer.parseInt(tabPlacement));
       view.setLocationRelativeTo(null);
     }
     return view;
   } catch (Exception e) {
     log.error("ChatController static", e);
     JOptionPane.showMessageDialog(
         null, "init msg frame error", "error", JOptionPane.ERROR_MESSAGE);
   }
   return null;
 }
Ejemplo n.º 2
0
  public void getFriendMessage(
      String lccno,
      final String msg,
      final FontStyle fontStyle,
      final Date sendDate,
      final Map<String, String> imgs)
      throws Exception {
    MessageFrame msgFrame = getMessageFrame();
    final MemberBean memberBean = TreeUtil.getMemberBeanByLccno(lccno);
    if (memberBean == null) {
      RightCornerPopMessageManager.showDefaultRightCornerPopMessage(lccno + "用户已被删除,他的离线信息无法显示");
      return;
    }
    final FriendChatPanel panel = getFriendChatPanel(memberBean);
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeAndWait(
          new Runnable() {

            @Override
            public void run() {
              try {
                handleFriendMsg(panel, memberBean, msg, fontStyle, sendDate, imgs);
              } catch (Exception e) {
                log.error("insertFriendMsg", e);
                showErrorDialog("error", e.getMessage());
              }
            }
          });
    } else {
      handleFriendMsg(panel, memberBean, msg, fontStyle, sendDate, imgs);
    }
    if (!msgFrame.isVisible()) {
      msgFrame.setVisible(true);
    }
  }
Ejemplo n.º 3
0
 public void showMessage(ControllerEvent event, int type) throws Exception {
   // 判断msgFrame是否visible
   MessageFrame msgFrame = getMessageFrame();
   if (msgFrame.isVisible()) {
     Vovo.exeC(event.getExClass(), event.getExMethod(), event.getParas());
   } else {
     String lccno = (String) event.getParas()[0];
     String key = null;
     if (Constants.MSG_TYPE_FRIEND == type) {
       key = Constants.FRIEND_CHAT_SESSION_PREFIX + lccno;
     } else if (Constants.MSG_TYPE_GROUP == type) {
       key = Constants.GROUP_CHAT_SESSION_PREFIX + lccno;
     }
     List<Object[]> notReadMsg = DataUtil.getNotReadMsg(key);
     Object[] temp = event.getParas();
     if (notReadMsg == null) { // 没有未读信息
       MyTrayIcon trayIcon =
           context.getViewManager().getView(Constants.ViewKey.TRAYICON.toString());
       event.setImage(ImageUtil.getImage(ImageUtil.TRAY_ICON_REC_MSG));
       event.setExClass("chat");
       event.setExMethod("showNotReadMessage");
       event.setParas(new Object[] {key});
       trayIcon.addEvent(event);
     }
     DataUtil.addNotReadMsg(key, temp);
   }
 }
Ejemplo n.º 4
0
 public void recSendFileMsg(String lccno, String fileName, long fileSize, String streamID) {
   MessageFrame msgFrame = getMessageFrame();
   MemberBean memberBean = TreeUtil.getMemberBeanByLccno(lccno);
   final FriendChatPanel panel = getFriendChatPanel(memberBean);
   panel.addRecvFileItem(fileName, fileSize, streamID);
   msgFrame.setVisible(true);
   msgFrame.setExtendedState(javax.swing.JFrame.NORMAL);
   //		FlashWindowUtil.start(msgFrame);
 }
Ejemplo n.º 5
0
 public void showFriendChat(MemberBean bean) {
   MessageFrame msgFrame = getMessageFrame();
   getFriendChatPanel(bean);
   String key = Constants.FRIEND_CHAT_SESSION_PREFIX + bean.getLccAccount();
   ControllerEvent event = new ControllerEvent();
   event.setExClass("chat");
   event.setExMethod("showNotReadMessage");
   event.setParas(new Object[] {key});
   MyTrayIcon trayIcon = context.getViewManager().getView(Constants.ViewKey.TRAYICON.toString());
   trayIcon.removeEvent(event);
   showNotReadMessage(key);
   msgFrame.setExtendedState(JFrame.NORMAL);
   msgFrame.setVisible(true);
 }
Ejemplo n.º 6
0
 public void getOtherMsg(String lccno, String operate, Message msg) throws Exception {
   if (Constants.OTHERMSG_OPERATE_CANCELSENDFILE.equals(operate)) {
     String streamID = (String) msg.getProperty("streamID");
     Date sendDate = new Date((Long) msg.getProperty("sendDate"));
     FileTransferRequest req = DataUtil.getFileTransferRequest(streamID);
     MessageFrame msgFrame = getMessageFrame();
     MemberBean memberBean = TreeUtil.getMemberBeanByLccno(lccno);
     final FriendChatPanel panel = getFriendChatPanel(memberBean);
     String info =
         StringUtil.getFormatString(
             getUIString("sendFile.otherCancel"), "\"" + req.getFileName() + "\"");
     panel.otherCancelSendFile(streamID, sendDate, info);
     msgFrame.setVisible(true);
   }
 }