@IMEventHandler(IMEventType.SHOW_MSG_HISTORY_WINDOW) protected void processIMShowWindow(IMEvent event) { namedObject = (UINamedObject) event.getTarget(); setTitle(namedObject.getName() + " - Message History."); Window win = event.getData("view"); Rectangle rect = win.getBounds(); setLocation(rect.x + rect.width - 50, rect.y); setSize(getWidth(), rect.height); validate(); setVisible(true); currentPage = 0; totalPage = 0; // 显示消息 IMEvent imEvent = new IMEvent(IMEventType.MSG_HISTORY_FIND, namedObject.getEntity()); imEvent.putData("limit", limit); IMEventService events = getContext().getSerivce(IMService.Type.EVENT); events.broadcast(imEvent); win.addComponentListener( new ComponentAdapter() { @Override public void componentMoved(ComponentEvent e) { int x = e.getComponent().getX() + e.getComponent().getWidth() - 50; int y = e.getComponent().getY(); if (isPtInRect(getBounds(), new Point(x, y))) { setLocation(x, y); setSize(getWidth(), e.getComponent().getHeight()); } } }); }
private void reloadMembers() { GroupMemberListModel model = (GroupMemberListModel) listModels.get(namedObject.getEntity()); List<? extends QQStranger> members = getMembers(); if (model == null) { model = new GroupMemberListModel(new UserListComparator()); for (QQStranger m : members) { model.addElement(new UserListElement(new UIUser(m))); // 下载头像, 只下载一次,后面是手动更新 if (isLoadFace) { IMEventService events = getContext().getSerivce(IMService.Type.EVENT); events.broadcast(new IMEvent(IMEventType.USER_FACE_REQUEST, m)); } } listModels.put(namedObject.getEntity(), model); } model.sort(); // 根据状态排序 membersCount.setText("Members (" + getOnlineCount(members) + "/" + members.size() + ")"); if (model != memberList.getModel()) { memberList.setModel(model); } model.updateAll(); // 停止进度条 progressOverlay.setShowLoad(false); }
private void updateFaces(UINamedObject namedObject) { List<? extends QQStranger> members = getMembers(); for (QQStranger m : members) { IMEventService events = getContext().getSerivce(IMService.Type.EVENT); events.broadcast(new IMEvent(IMEventType.USER_FACE_REQUEST, m)); } }
public void checkSendSessionMsg(QQStranger member) { if (StringUtils.isEmpty(member.getGroupSig())) { IMEvent imEvent = new IMEvent(IMEventType.GET_SESSION_MSG_REQUEST, member); IMEventService events = getContext().getSerivce(IMService.Type.EVENT); events.broadcast(imEvent); } else { sendSessionMsg(member); } }
/** @param named */ private void updateMembers(UINamedObject named) { IMEventService events = getContext().getSerivce(IMService.Type.EVENT); if (named instanceof UIGroup) { events.broadcast(new IMEvent(IMEventType.GROUP_INFO_REQUEST, named.getEntity())); } else if (named instanceof UIDiscuz) { events.broadcast(new IMEvent(IMEventType.DISCUZ_INFO_REQUEST, named.getEntity())); } else { LOG.info("Unkown UINamedObject type:" + named); } }
public void sendSessionMsg(QQStranger member) { IMEvent imEvent = new IMEvent(IMEventType.SHOW_CHAT, member); IMEventService events = getContext().getSerivce(IMService.Type.EVENT); events.broadcast(imEvent); }