Beispiel #1
0
  /**
   * Returns a list of all <tt>UIContactDetail</tt>s within this <tt>UIContact</tt>.
   *
   * @return a list of all <tt>UIContactDetail</tt>s within this <tt>UIContact</tt>
   */
  public List<UIContactDetail> getContactDetails() {
    List<UIContactDetail> resultList = new LinkedList<UIContactDetail>();

    Iterator<Contact> contacts = metaContact.getContacts();

    while (contacts.hasNext()) {
      resultList.add(new MetaContactDetail(contacts.next()));
    }
    return resultList;
  }
Beispiel #2
0
  /** Initializes all search strings for this <tt>MetaUIGroup</tt>. */
  private void initSearchStrings() {
    searchStrings.add(metaContact.getDisplayName());

    Iterator<Contact> contacts = metaContact.getContacts();
    while (contacts.hasNext()) {
      Contact contact = contacts.next();

      searchStrings.add(contact.getDisplayName());
      searchStrings.add(contact.getAddress());
    }
  }
Beispiel #3
0
  /**
   * Returns a list of <tt>UIContactDetail</tt>s supporting the given <tt>OperationSet</tt> class.
   *
   * @param opSetClass the <tt>OperationSet</tt> class we're interested in
   * @return a list of <tt>UIContactDetail</tt>s supporting the given <tt>OperationSet</tt> class
   */
  public List<UIContactDetail> getContactDetailsForOperationSet(
      Class<? extends OperationSet> opSetClass) {
    List<UIContactDetail> resultList = new LinkedList<UIContactDetail>();

    Iterator<Contact> contacts = metaContact.getContactsForOperationSet(opSetClass).iterator();

    while (contacts.hasNext()) {
      resultList.add(new MetaContactDetail(contacts.next()));
    }
    return resultList;
  }
Beispiel #4
0
  /**
   * Determines whether a specific format is supported by the <tt>Recorder</tt> represented by this
   * <tt>RecordButton</tt>.
   *
   * @param format the format which is to be checked whether it is supported by the
   *     <tt>Recorder</tt> represented by this <tt>RecordButton</tt>
   * @return <tt>true</tt> if the specified <tt>format</tt> is supported by the <tt>Recorder</tt>
   *     represented by this <tt>RecordButton</tt>; otherwise, <tt>false</tt>
   */
  private boolean isSupportedFormat(String format) {
    Recorder recorder;

    try {
      recorder = getRecorder();
    } catch (OperationFailedException ofex) {
      logger.error("Failed to get Recorder", ofex);
      return false;
    }

    List<String> supportedFormats = recorder.getSupportedFormats();

    return (supportedFormats != null) && supportedFormats.contains(format);
  }
Beispiel #5
0
 /**
  * Gets and formats the names of the peers in the call.
  *
  * @param maxLength maximum length of the filename
  * @return the name of the peer in the call formated
  */
 private String getCallPeerName(int maxLength) {
   List<CallPeer> callPeers = call.getConference().getCallPeers();
   CallPeer callPeer = null;
   String peerName = "";
   if (!callPeers.isEmpty()) {
     callPeer = callPeers.get(0);
     if (callPeer != null) {
       peerName = callPeer.getDisplayName();
       peerName = peerName.replaceAll("[^\\da-zA-Z\\_\\-@\\.]", "");
       if (peerName.length() > maxLength) {
         peerName = peerName.substring(0, maxLength);
       }
     }
   }
   return peerName;
 }
Beispiel #6
0
  /**
   * Loads the tooltip with the data for current metacontact.
   *
   * @param tip the tooltip to fill.
   */
  private void loadTooltip(final ExtendedTooltip tip) {
    Iterator<Contact> i = metaContact.getContacts();

    ContactPhoneUtil contactPhoneUtil = ContactPhoneUtil.getPhoneUtil(metaContact);

    String statusMessage = null;
    Contact protocolContact;
    boolean isLoading = false;
    while (i.hasNext()) {
      protocolContact = i.next();

      // Set the first found status message.
      if (statusMessage == null
          && protocolContact.getStatusMessage() != null
          && protocolContact.getStatusMessage().length() > 0)
        statusMessage = protocolContact.getStatusMessage();

      if (ConfigurationUtils.isHideAccountStatusSelectorsEnabled()) break;

      ImageIcon protocolStatusIcon =
          ImageLoader.getIndexedProtocolIcon(
              ImageUtils.getBytesInImage(protocolContact.getPresenceStatus().getStatusIcon()),
              protocolContact.getProtocolProvider());

      String contactAddress = protocolContact.getAddress();
      // String statusMessage = protocolContact.getStatusMessage();

      tip.addLine(protocolStatusIcon, contactAddress);

      addContactResourceTooltipLines(tip, protocolContact);

      if (!protocolContact.getProtocolProvider().isRegistered()) continue;

      contactPhoneUtil.addDetailsResponseListener(
          protocolContact,
          new OperationSetServerStoredContactInfo.DetailsResponseListener() {
            public void detailsRetrieved(final Iterator<GenericDetail> details) {
              if (!SwingUtilities.isEventDispatchThread()) {
                SwingUtilities.invokeLater(
                    new Runnable() {
                      public void run() {
                        detailsRetrieved(details);
                      }
                    });
                return;
              }

              // remove previously shown information
              // as it contains "Loading..." text
              tip.removeAllLines();

              // load it again
              loadTooltip(tip);
            }
          });

      List<String> phones = contactPhoneUtil.getPhones(protocolContact);

      if (phones != null) {
        addPhoneTooltipLines(tip, phones.iterator());
      } else isLoading = true;
    }

    if (isLoading)
      tip.addLine(null, GuiActivator.getResources().getI18NString("service.gui.LOADING"));

    if (statusMessage != null) tip.setBottomText(statusMessage);
  }
Beispiel #7
0
  /**
   * Returns the default <tt>ContactDetail</tt> to use for any operations depending to the given
   * <tt>OperationSet</tt> class.
   *
   * @param opSetClass the <tt>OperationSet</tt> class we're interested in
   * @return the default <tt>ContactDetail</tt> to use for any operations depending to the given
   *     <tt>OperationSet</tt> class
   */
  public UIContactDetail getDefaultContactDetail(Class<? extends OperationSet> opSetClass) {
    List<UIContactDetail> details = getContactDetailsForOperationSet(opSetClass);

    return (details != null && !details.isEmpty()) ? details.get(0) : null;
  }
Beispiel #8
0
 /**
  * Returns an <tt>Iterator</tt> over a list of strings, which can be used to find this contact.
  *
  * @return an <tt>Iterator</tt> over a list of search strings
  */
 public Iterator<String> getSearchStrings() {
   return searchStrings.iterator();
 }