Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
 /*
  * 有点效率问题,下载头像时更新太频繁
  */
 @IMEventHandler(IMEventType.USER_FACE_UPDATE)
 protected void processIMUpdateUserFace(IMEvent event) {
   ListModel m = memberList.getModel();
   QQUser user = (QQUser) event.getTarget();
   if (m instanceof GroupMemberListModel && user instanceof QQStranger) {
     GroupMemberListModel model = (GroupMemberListModel) m;
     model.update(user);
   }
 }