/** * Adds resources for contact. * * @param tip the tool tip * @param protocolContact the protocol contact, which resources we're looking for */ private void addContactResourceTooltipLines(ExtendedTooltip tip, Contact protocolContact) { Collection<ContactResource> contactResources = protocolContact.getResources(); if (contactResources == null) return; Iterator<ContactResource> resourcesIter = contactResources.iterator(); while (resourcesIter.hasNext()) { ContactResource contactResource = resourcesIter.next(); // We only add the status icon if we have more than one resources, // otherwise it will always be identical to the contact status icon. ImageIcon protocolStatusIcon = null; if (contactResources.size() > 1) { protocolStatusIcon = ImageLoader.getIndexedProtocolIcon( ImageUtils.getBytesInImage(contactResource.getPresenceStatus().getStatusIcon()), protocolContact.getProtocolProvider()); } String resourceName = (contactResource.getPriority() >= 0) ? contactResource.getResourceName() + " (" + contactResource.getPriority() + ")" : contactResource.getResourceName(); if (protocolStatusIcon == null) tip.addSubLine(protocolStatusIcon, resourceName, 27); else tip.addSubLine(protocolStatusIcon, resourceName, 20); } tip.revalidate(); tip.repaint(); }
/** * Returns the presence status of this transport. * * @return the presence status of this transport. */ public PresenceStatus getStatus() { if (contactResource != null) return contactResource.getPresenceStatus(); else return contact.getPresenceStatus(); }