From b1f811ca4e019e8c84fab5e8c3bdb82b5022b973 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Mon, 26 Oct 2009 10:38:39 +0000 Subject: [PATCH] Part of previous commit on status messages revision 6184: Show the status message in the contact tooltip. --- .../main/contactlist/DefaultContactList.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java index 2cf526409..fb7ea7a22 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java @@ -23,12 +23,16 @@ * DeafultContactlist used to display JLists with contacts. * * @author Damian Minkov + * @author Yana Stamcheva */ public class DefaultContactList extends JList { private static final long serialVersionUID = 0L; + /** + * Creates an instance of DefaultContactList. + */ public DefaultContactList() { this.setOpaque(false); @@ -123,9 +127,11 @@ public JToolTip createToolTip() Iterator i = metaContact.getContacts(); + String statusMessage = null; + Contact protocolContact; while (i.hasNext()) { - Contact protocolContact = i.next(); + protocolContact = i.next(); ImageIcon protocolStatusIcon = new ImageIcon( @@ -135,7 +141,16 @@ public JToolTip createToolTip() //String statusMessage = protocolContact.getStatusMessage(); tip.addLine(protocolStatusIcon, contactAddress); + + // Set the first found status message. + if (statusMessage == null + && protocolContact.getStatusMessage() != null + && protocolContact.getStatusMessage().length() > 0) + statusMessage = protocolContact.getStatusMessage(); } + + if (statusMessage != null) + tip.setBottomText(statusMessage); } else if (element instanceof MetaContactGroup) { @@ -166,6 +181,7 @@ else if (element instanceof ChatContact) * in order to make the TooltipManager change the tooltip over the different * cells in the JList. * + * @param event the MouseEvent that notified us * @return the string to be used as the tooltip for event. */ public String getToolTipText(MouseEvent event)