protected void updateStatus() {
    final CollabManager manager = CollabManager.getDefault();

    if (manager != null) {
      int sharedStatus = CollabPrincipal.STATUS_OFFLINE;
      boolean unilateral = true;

      CollabSession[] sessions = manager.getSessions();

      for (int i = 0; i < sessions.length; i++) {
        int status = sessions[i].getUserPrincipal().getStatus();

        if (sharedStatus == CollabPrincipal.STATUS_OFFLINE) {
          sharedStatus = status;
        }

        if (status != sharedStatus) {
          unilateral = false;
        }
      }

      if (unilateral) {
        // This will occur if either:
        // 1) No sessions were found
        // 2) All available sessions had the same status
        setStatus(sharedStatus);
      } else {
        // Assume at least one session is online
        setStatus(CollabPrincipal.STATUS_ONLINE);
      }
    }
  }
  protected static String getStatusToolTip() {
    StringBuffer result = new StringBuffer("<html>"); // NOI18N
    result.append("<table cellspacing=\"0\" border=\"0\">"); // NOI18N

    final CollabManager manager = CollabManager.getDefault();

    if (manager != null) {
      Set sessions =
          new TreeSet(
              new Comparator() {
                public int compare(Object o1, Object o2) {
                  String s1 = ((CollabSession) o1).getUserPrincipal().getDisplayName();
                  String s2 = ((CollabSession) o2).getUserPrincipal().getDisplayName();

                  return s1.compareTo(s2);
                }
              });

      sessions.addAll(Arrays.asList(manager.getSessions()));

      if (sessions.size() == 0) {
        result.append("<tr><td>"); // NOI18N
        result.append(getStatusDescription(CollabPrincipal.STATUS_OFFLINE));
        result.append("</td></tr>"); // NOI18N
      } else {
        for (Iterator i = sessions.iterator(); i.hasNext(); ) {
          CollabPrincipal principal = ((CollabSession) i.next()).getUserPrincipal();

          result.append("<tr>"); // NOI18N
          result.append("<td>"); // NOI18N
          result.append("<b>"); // NOI18N
          result.append(principal.getDisplayName());
          result.append(": "); // NOI18N
          result.append("</b>"); // NOI18N
          result.append("</td>"); // NOI18N
          result.append("<td>"); // NOI18N
          result.append(getStatusDescription(principal.getStatus()));
          result.append("</td>"); // NOI18N
          result.append("</tr>"); // NOI18N
        }
      }
    }

    result.append("</table>"); // NOI18N

    return result.toString();
  }
  private void attachListeners() {
    // Add the listener from each collab session principal
    CollabSession[] sessions = CollabManager.getDefault().getSessions();

    for (int i = 0; i < sessions.length; i++) {
      sessions[i].getUserPrincipal().removePropertyChangeListener(helper);
      sessions[i].getUserPrincipal().addPropertyChangeListener(helper);
    }
  }
  private void initListening(final int level) {
    CollabManager man = CollabManager.getDefault();
    if (man == null) {
      // manager not yet registered. This is a transient condition during
      // module enablement because of manager registration mechanism.
      // Retry 5s later
      assert level < 10;

      RequestProcessor.getDefault()
          .post(
              new Runnable() {
                public void run() {
                  initListening(level + 1);
                }
              },
              level * 5000);
    } else {
      man.addPropertyChangeListener(helper);
      attachListeners();
      updateStatus();
    }
  }