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