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);
   }
 }
Ejemplo n.º 3
0
  @Override
  public void mouseClicked(MouseEvent e) {

    if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
      if (!(e.getSource() instanceof WebList)) {
        return;
      }

      list = (WebList) e.getSource();

      if (list.getModel().getSize() <= 0) {
        return;
      }

      int index = list.locationToIndex(e.getPoint());
      if (index >= 0) {
        list.setSelectedIndex(index);
        iimage = (IImage) list.getSelectedValue();
        menu.show(e.getComponent(), e.getX(), e.getY());
      }
    }
  }
Ejemplo n.º 4
0
  private void updateHints() {
    String text = classSearchField.getText().trim();

    // Ignore empty text
    if (text.trim().length() == 0) {
      hideHints();
      return;
    }

    // Updating hints window if needed
    if (!CompareUtils.equals(lastSearchedText, text)) {
      // Saving old selection
      Object oldSelection = classSearchHintsList.getSelectedValue();

      // Clearing list
      DefaultListModel model = (DefaultListModel) classSearchHintsList.getModel();
      model.clear();

      // Look for classes
      List<JarEntry> found =
          jarStructure.findSimilarEntries(
              text,
              new Filter<JarEntry>() {
                @Override
                public boolean accept(JarEntry object) {
                  return object.getType().equals(JarEntryType.javaEntry);
                }
              });
      if (found.size() > 0) {
        classSearchField.setForeground(Color.BLACK);

        // Filling list with results
        for (JarEntry entry : found) {
          model.addElement(entry);
        }

        // Updating visible rows
        classSearchHintsList.setVisibleRowCount(Math.min(model.size(), 10));

        // Restoring selection if possible
        int index = oldSelection != null ? model.indexOf(oldSelection) : 0;
        classSearchHintsList.setSelectedIndex(index != -1 ? index : 0);

        // Packing popup
        classSearchHintsPopup.pack();

        // Displaying hints window
        if (!classSearchHintsPopup.isVisible()) {
          classSearchHintsPopup.setVisible(true);
        }
      } else {
        classSearchField.setForeground(Color.RED);

        // Hiding hints window
        if (classSearchHintsPopup.isVisible()) {
          classSearchHintsPopup.setVisible(false);
        }
      }

      lastSearchedText = text;
    }
  }