[sip-comm-dev] Re: svn commit: r5233 - trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java


#1

My report may very well not be related to this particular commit, I'm
just replying here because it's about the visibility of tooltip of the
chat conversation panel. I just noticed on Debian GNU/Linux + GNOME
that whenever the mouse pointer is over the chat conversation panel,
an empty tooltip will appear after a tiny delay regardless of whether
there's any text underneath it i.e. it will appear even if there's no
text, no hyperlink.

Regards,
Lubo

···

On Wed, Apr 8, 2009 at 11:48 AM, <damencho@dev.java.net> wrote:

Author: damencho
Date: 2009-04-08 08:48:06+0000
New Revision: 5233

Modified:
trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java

Log:
Fix for issue #634. When chat window is closed if any tooltip was visible it will disappear.

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java?view=diff&rev=5233&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java&r1=5232&r2=5233

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java 2009-04-08 08:48:06+0000
@@ -43,7 +43,7 @@
private static final Logger logger =
Logger.getLogger(ChatConversationPanel.class);

- private final JEditorPane chatEditorPane = new JEditorPane();
+ private final JEditorPane chatEditorPane = new MyEditorPane();

private final HTMLEditorKit editorKit = new SIPCommHTMLEditorKit\(\);

@@ -61,16 +61,6 @@

private final JSeparator copyLinkSeparator = new JSeparator\(\);

- private final JPopupMenu urlPopup = new JPopupMenu();
-
- private final JTextArea urlItem = new JTextArea();
-
- private final static int urlPopupMaxWidth = 300;
-
- private final static int urlPopupInitialHeight = 20;
-
- private final static int urlPopupBorderSize = 3;
-
private long lastIncomingMsgTimestamp;

private final boolean isHistory;

@@ -78,10 +68,10 @@
public static final String HTML_CONTENT_TYPE = "text/html";

public static final String TEXT\_CONTENT\_TYPE = &quot;text/plain&quot;;

-
+
/**
* Creates an instance of <tt>ChatConversationPanel</tt>.
- *
+ *
* @param chatContainer The parent <tt>ChatConversationContainer</tt>.
*/
public ChatConversationPanel(ChatConversationContainer chatContainer)
@@ -166,19 +156,6 @@
copyLinkItem.setMnemonic(
GuiActivator.getResources().getI18nMnemonic(
"service.gui.COPY_LINK"));
-
- // Initialize URL popup component.
- this.urlItem.setLineWrap(true);
- this.urlPopup.setLayout(new BorderLayout());
- this.urlPopup.add(urlItem);
- this.urlItem.setBorder(
- BorderFactory.createEmptyBorder(urlPopupBorderSize,
- urlPopupBorderSize,
- urlPopupBorderSize,
- urlPopupBorderSize));
-
- this.urlItem.setSize(new Dimension(urlPopupMaxWidth,
- urlPopupInitialHeight));
}

/\*\*

@@ -208,7 +185,7 @@

/\*\*
 \* Processes the message given by the parameters\.

- *
+ *
* @param contactName The name of the contact sending the message.
* @param date The time at which the message is sent or received.
* @param messageType The type of the message. One of OUTGOING_MESSAGE or
@@ -255,7 +232,7 @@
}

    if \(messageType\.equals\(Constants\.INCOMING\_MESSAGE\)\)

- {
+ {
this.lastIncomingMsgTimestamp = System.currentTimeMillis();

        chatString      = &quot;&lt;h2 identifier=\\&quot;&quot;

@@ -337,7 +314,7 @@
+ msgHeaderID
+ "\" date=\""
+ date + "\">";
-
+
endHeaderTag = "</h6>";

        String errorIcon = &quot;&lt;IMG SRC=&#39;&quot;

@@ -369,7 +346,7 @@
+ msgHeaderID
+ "\" date=\""
+ date + "\">";
-
+
endHeaderTag = "</h3>";

        chatString \+= timeString

@@ -386,7 +363,7 @@

/\*\*
 \* Processes the message given by the parameters\.

- *
+ *
* @param contactName The name of the contact sending the message.
* @param date The time at which the message is sent or received.
* @param messageType The type of the message. One of OUTGOING_MESSAGE or
@@ -409,7 +386,7 @@
/**
* Appends the given string at the end of the contained in this panel
* document.
- *
+ *
* @param chatString the string to append
*/
public void appendMessageToEnd(String chatString)
@@ -440,7 +417,7 @@
/**
* Inserts the given string at the beginning of the contained in this panel
* document.
- *
+ *
* @param chatString the string to insert
*/
public void insertMessageAfterStart(String chatString)
@@ -476,18 +453,18 @@
if (document.getLength() > Constants.CHAT_BUFFER_SIZE)
{
int msgElementCount = 0;
-
- Element firstMsgElement = null;
-
+
+ Element firstMsgElement = null;
+
int firstMsgIndex = 0;
-
+
Element rootElement = this.document.getDefaultRootElement();
// Count how many messages we have in the document.
for (int i = 0; i < rootElement.getElementCount(); i++)
- {
+ {
String idAttr = (String) rootElement.getElement(i)
.getAttributes().getAttribute("identifier");
-
+
if(idAttr != null
&& (idAttr.equals("message")
>> idAttr.equals("statusMessage")
@@ -498,28 +475,28 @@
firstMsgElement = rootElement.getElement(i);
firstMsgIndex = i;
}
-
+
msgElementCount++;
}
}
-
+
// If we doesn't have any known elements in the document or if we
- // have only one long message we don't want to remove it.
+ // have only one long message we don't want to remove it.
if(firstMsgElement == null || msgElementCount < 2)
return;
-
+
try
{
// Remove the header of the message if such exists.
if(firstMsgIndex > 0)
{
Element headerElement = rootElement.getElement(firstMsgIndex - 1);
-
+
String idAttr = (String) headerElement
.getAttributes().getAttribute("identifier");
-
+
if(idAttr != null && idAttr.equals("messageHeader"))
- {
+ {
this.document.remove(headerElement.getStartOffset(),
headerElement.getEndOffset()
- headerElement.getStartOffset());
@@ -540,7 +517,7 @@

/\*\*
 \* Highlights keywords searched in the history\.

- *
+ *
* @param message the source message
* @param keyword the searched keyword
* @return the formatted message
@@ -591,7 +568,7 @@
/**
* Formats the given message. Processes all smilies chars, new lines and all
* the links.
- *
+ *
* @return the formatted message
*/
private String formatMessage(String message, String contentType)
@@ -621,7 +598,7 @@

/\*\*
 \* Formats all links in the given message\.

- *
+ *
* @param message The source message string.
* @return The message string with properly formatted links.
*/
@@ -670,7 +647,7 @@

/\*\*
 \* Formats message new lines\.

- *
+ *
* @param message The source message string.
* @return The message string with properly formatted new lines.
*/
@@ -678,15 +655,15 @@
{
String startPlainTextTag = "<PLAINTEXT>";
String endPlainTextTag = "</PLAINTEXT>";
-
+
/*
* <br> tags are needed to visualize a new line in the html format, but
* when copied to the clipboard they are exported to the plain text
* format as ' ' and not as '\n'.
- *
+ *
* See bug N4988885:
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4988885
- *
+ *
* To fix this we need "&#10;" - the HTML-Code for ASCII-Character No.10
* (Line feed).
*/
@@ -696,7 +673,7 @@

/\*\*
 \* Formats message smilies\.

- *
+ *
* @param message The source message string.
* @return The message string with properly formated smilies.
*/
@@ -760,7 +737,7 @@
/**
* Opens a link in the default browser when clicked and shows link url in a
* popup on mouseover.
- *
+ *
* @param e The HyperlinkEvent.
*/
public void hyperlinkUpdate(HyperlinkEvent e)
@@ -770,24 +747,16 @@
String href = e.getDescription();

        this\.currentHref = href;

-
- urlItem.setText(href);
-
- urlPopup.setLocation(MouseInfo.getPointerInfo().getLocation());
- urlPopup.pack();
- urlPopup.setVisible(true);
}
else if (e.getEventType() == HyperlinkEvent.EventType.EXITED)
{
this.currentHref = "";
-
- urlPopup.setVisible(false);
}
}

/\*\*
 \* Returns the editor of this conversation panel\.

- *
+ *
* @return The editor of this conversation panel.
*/
public JEditorPane getChatEditorPane()
@@ -797,7 +766,7 @@

/\*\*
 \* Returns the time of the last received message\.

- *
+ *
* @return The time of the last received message.
*/
public long getLastIncomingMsgTimestamp()
@@ -820,7 +789,7 @@
/**
* When a right button click is performed in the editor pane, a popup menu
* is opened.
- *
+ *
* @param e The MouseEvent.
*/
public void mouseClicked(MouseEvent e)
@@ -842,7 +811,7 @@

/\*\*
 \* Opens this panel context menu at the given point\.

- *
+ *
* @param p the point where to position the left-top cornet of the context
* menu
*/
@@ -896,7 +865,7 @@

/\*\*
 \* Returns the chat container\.

- *
+ *
* @return the chat container
*/
public ChatConversationContainer getChatContainer()
@@ -925,7 +894,7 @@

/\*\*
 \* Sets the given document to the editor pane in this panel\.

- *
+ *
* @param doc the document to set
*/
public void setContent(HTMLDocument doc)
@@ -945,7 +914,7 @@

/\*\*
 \* Returns the document contained in this panel\.

- *
+ *
* @return the document contained in this panel
*/
public HTMLDocument getContent()
@@ -955,7 +924,7 @@

/\*\*
 \* Returns the right button popup menu\.

- *
+ *
* @return the right button popup menu
*/
public ChatRightButtonMenu getRightButtonMenu()
@@ -965,20 +934,20 @@

/\*\*
 \* Returns the date of the first message in the current page\.

- *
+ *
* @return the date of the first message in the current page
*/
public Date getPageFirstMsgTimestamp()
- {
+ {
Element rootElement = this.document.getDefaultRootElement();
-
+
Element firstMessageElement = null;
-
+
for(int i = 0; i < rootElement.getElementCount(); i ++)
- {
+ {
String idAttr = (String) rootElement.getElement(i)
.getAttributes().getAttribute("identifier");
-
+
if (idAttr != null && idAttr.equals("messageHeader"))
{
firstMessageElement = rootElement.getElement(i);
@@ -988,29 +957,29 @@

    if\(firstMessageElement == null\)
        return new Date\(Long\.MAX\_VALUE\);

-
+
String dateString = (String)firstMessageElement
.getAttributes().getAttribute("date");
-
- return new Date(Long.parseLong(dateString));
+
+ return new Date(Long.parseLong(dateString));
}

/\*\*
 \* Returns the date of the last message in the current page\.

- *
+ *
* @return the date of the last message in the current page
*/
public Date getPageLastMsgTimestamp()
- {
+ {
Element rootElement = this.document.getDefaultRootElement();
-
+
Element lastMessageElement = null;

    for\(int i = rootElement\.getElementCount\(\) \- 1; i &gt;= 0; i \-\-\)
    \{
        String idAttr = \(String\) rootElement\.getElement\(i\)
            \.getAttributes\(\)\.getAttribute\(&quot;identifier&quot;\);

-
+
if (idAttr != null && idAttr.equals("messageHeader"))
{
lastMessageElement = rootElement.getElement(i);
@@ -1020,13 +989,13 @@

    if\(lastMessageElement == null\)
        return new Date\(0\);

-
+
String dateString = (String) lastMessageElement
.getAttributes().getAttribute("date");
-
+
return new Date(Long.parseLong(dateString));
}
-
+
/**
* Formats HTML tags &lt;br/&gt; to &lt;br&gt; or &lt;BR/&gt; to &lt;BR&gt;.
* The reason of this function is that the ChatPanel does not support
@@ -1078,7 +1047,7 @@
}
return processedMessage.toString();
}
-
+
/**
* Formats HTML tags &lt;img ... /&gt; to &lt; img ... &gt;&lt;/img&gt; or
* &lt;IMG ... /&gt; to &lt;IMG&gt;&lt;/IMG&gt;.
@@ -1132,4 +1101,35 @@
}
return processedMessage.toString();
}
+
+ /**
+ * Extend Editor pane to add url tooltips.
+ */
+ private class MyEditorPane
+ extends JEditorPane
+ {
+ /**
+ * Create tooltip.
+ */
+ public JToolTip createToolTip()
+ {
+ JToolTip tip = new JToolTip();
+ tip.setComponent(this);
+
+ return tip;
+ }
+
+ /**
+ * Returns the string to be used as the tooltip for <i>event</i>.
+ *
+ * @return the string to be used as the tooltip for <i>event</i>.
+ */
+ public String getToolTipText(MouseEvent event)
+ {
+ if(currentHref != null && currentHref.length() != 0)
+ return currentHref;
+ else
+ return "";
+ }
+ }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hi Lubo,

I think its now fixed with r5235.

Thanks for the quick report :slight_smile:
damencho

Lubomir Marinov wrote:

···

My report may very well not be related to this particular commit, I'm
just replying here because it's about the visibility of tooltip of the
chat conversation panel. I just noticed on Debian GNU/Linux + GNOME
that whenever the mouse pointer is over the chat conversation panel,
an empty tooltip will appear after a tiny delay regardless of whether
there's any text underneath it i.e. it will appear even if there's no
text, no hyperlink.

Regards,
Lubo

On Wed, Apr 8, 2009 at 11:48 AM, <damencho@dev.java.net> wrote:
  

Author: damencho
Date: 2009-04-08 08:48:06+0000
New Revision: 5233

Modified:
  trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java

Log:
Fix for issue #634. When chat window is closed if any tooltip was visible it will disappear.

Modified: trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java?view=diff&rev=5233&p1=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java&p2=trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java&r1=5232&r2=5233

--- trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java (original)
+++ trunk/src/net/java/sip/communicator/impl/gui/main/chat/ChatConversationPanel.java 2009-04-08 08:48:06+0000
@@ -43,7 +43,7 @@
    private static final Logger logger =
        Logger.getLogger(ChatConversationPanel.class);

- private final JEditorPane chatEditorPane = new JEditorPane();
+ private final JEditorPane chatEditorPane = new MyEditorPane();

    private final HTMLEditorKit editorKit = new SIPCommHTMLEditorKit();

@@ -61,16 +61,6 @@

    private final JSeparator copyLinkSeparator = new JSeparator();

- private final JPopupMenu urlPopup = new JPopupMenu();
-
- private final JTextArea urlItem = new JTextArea();
-
- private final static int urlPopupMaxWidth = 300;
-
- private final static int urlPopupInitialHeight = 20;
-
- private final static int urlPopupBorderSize = 3;
-
    private long lastIncomingMsgTimestamp;

    private final boolean isHistory;
@@ -78,10 +68,10 @@
    public static final String HTML_CONTENT_TYPE = "text/html";

    public static final String TEXT_CONTENT_TYPE = "text/plain";
-
+
    /**
     * Creates an instance of <tt>ChatConversationPanel</tt>.
- *
+ *
     * @param chatContainer The parent <tt>ChatConversationContainer</tt>.
     */
    public ChatConversationPanel(ChatConversationContainer chatContainer)
@@ -166,19 +156,6 @@
        copyLinkItem.setMnemonic(
            GuiActivator.getResources().getI18nMnemonic(
                "service.gui.COPY_LINK"));
-
- // Initialize URL popup component.
- this.urlItem.setLineWrap(true);
- this.urlPopup.setLayout(new BorderLayout());
- this.urlPopup.add(urlItem);
- this.urlItem.setBorder(
- BorderFactory.createEmptyBorder(urlPopupBorderSize,
- urlPopupBorderSize,
- urlPopupBorderSize));
-
- this.urlItem.setSize(new Dimension(urlPopupMaxWidth,
- urlPopupInitialHeight));
    }

    /**
@@ -208,7 +185,7 @@

    /**
     * Processes the message given by the parameters.
- *
+ *
     * @param contactName The name of the contact sending the message.
     * @param date The time at which the message is sent or received.
     * @param messageType The type of the message. One of OUTGOING_MESSAGE or
@@ -255,7 +232,7 @@
        }

        if (messageType.equals(Constants.INCOMING_MESSAGE))
- {
+ {
            this.lastIncomingMsgTimestamp = System.currentTimeMillis();

            chatString = "<h2 identifier=\""
@@ -337,7 +314,7 @@
                            + msgHeaderID
                            + "\" date=\""
                            + date + "\">";
-
+
            endHeaderTag = "</h6>";

            String errorIcon = "<IMG SRC='"
@@ -369,7 +346,7 @@
                            + msgHeaderID
                            + "\" date=\""
                            + date + "\">";
-
+
            endHeaderTag = "</h3>";

            chatString += timeString
@@ -386,7 +363,7 @@

    /**
     * Processes the message given by the parameters.
- *
+ *
     * @param contactName The name of the contact sending the message.
     * @param date The time at which the message is sent or received.
     * @param messageType The type of the message. One of OUTGOING_MESSAGE or
@@ -409,7 +386,7 @@
    /**
     * Appends the given string at the end of the contained in this panel
     * document.
- *
+ *
     * @param chatString the string to append
     */
    public void appendMessageToEnd(String chatString)
@@ -440,7 +417,7 @@
    /**
     * Inserts the given string at the beginning of the contained in this panel
     * document.
- *
+ *
     * @param chatString the string to insert
     */
    public void insertMessageAfterStart(String chatString)
@@ -476,18 +453,18 @@
        if (document.getLength() > Constants.CHAT_BUFFER_SIZE)
        {
            int msgElementCount = 0;
-
- Element firstMsgElement = null;
-
+
+ Element firstMsgElement = null;
+
            int firstMsgIndex = 0;
-
+
            Element rootElement = this.document.getDefaultRootElement();
            // Count how many messages we have in the document.
            for (int i = 0; i < rootElement.getElementCount(); i++)
- {
+ {
                String idAttr = (String) rootElement.getElement(i)
                    .getAttributes().getAttribute("identifier");
-
+
                if(idAttr != null
                    && (idAttr.equals("message")
                        >> idAttr.equals("statusMessage")
@@ -498,28 +475,28 @@
                        firstMsgElement = rootElement.getElement(i);
                        firstMsgIndex = i;
                    }
-
+
                    msgElementCount++;
                }
            }
-
+
            // If we doesn't have any known elements in the document or if we
- // have only one long message we don't want to remove it.
+ // have only one long message we don't want to remove it.
            if(firstMsgElement == null || msgElementCount < 2)
                return;
-
+
            try
            {
                // Remove the header of the message if such exists.
                if(firstMsgIndex > 0)
                {
                    Element headerElement = rootElement.getElement(firstMsgIndex - 1);
-
+
                    String idAttr = (String) headerElement
                        .getAttributes().getAttribute("identifier");
-
+
                    if(idAttr != null && idAttr.equals("messageHeader"))
- {
+ {
                        this.document.remove(headerElement.getStartOffset(),
                            headerElement.getEndOffset()
                                - headerElement.getStartOffset());
@@ -540,7 +517,7 @@

    /**
     * Highlights keywords searched in the history.
- *
+ *
     * @param message the source message
     * @param keyword the searched keyword
     * @return the formatted message
@@ -591,7 +568,7 @@
    /**
     * Formats the given message. Processes all smilies chars, new lines and all
     * the links.
- *
+ *
     * @return the formatted message
     */
    private String formatMessage(String message, String contentType)
@@ -621,7 +598,7 @@

    /**
     * Formats all links in the given message.
- *
+ *
     * @param message The source message string.
     * @return The message string with properly formatted links.
     */
@@ -670,7 +647,7 @@

    /**
     * Formats message new lines.
- *
+ *
     * @param message The source message string.
     * @return The message string with properly formatted new lines.
     */
@@ -678,15 +655,15 @@
    {
        String startPlainTextTag = "<PLAINTEXT>";
        String endPlainTextTag = "</PLAINTEXT>";
-
+
        /*
         * <br> tags are needed to visualize a new line in the html format, but
         * when copied to the clipboard they are exported to the plain text
         * format as ' ' and not as '\n'.
- *
+ *
         * See bug N4988885:
         * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4988885
- *
+ *
         * To fix this we need "&#10;" - the HTML-Code for ASCII-Character No.10
         * (Line feed).
         */
@@ -696,7 +673,7 @@

    /**
     * Formats message smilies.
- *
+ *
     * @param message The source message string.
     * @return The message string with properly formated smilies.
     */
@@ -760,7 +737,7 @@
    /**
     * Opens a link in the default browser when clicked and shows link url in a
     * popup on mouseover.
- *
+ *
     * @param e The HyperlinkEvent.
     */
    public void hyperlinkUpdate(HyperlinkEvent e)
@@ -770,24 +747,16 @@
            String href = e.getDescription();

            this.currentHref = href;
-
- urlItem.setText(href);
-
- urlPopup.setLocation(MouseInfo.getPointerInfo().getLocation());
- urlPopup.pack();
- urlPopup.setVisible(true);
        }
        else if (e.getEventType() == HyperlinkEvent.EventType.EXITED)
        {
            this.currentHref = "";
-
- urlPopup.setVisible(false);
        }
    }

    /**
     * Returns the editor of this conversation panel.
- *
+ *
     * @return The editor of this conversation panel.
     */
    public JEditorPane getChatEditorPane()
@@ -797,7 +766,7 @@

    /**
     * Returns the time of the last received message.
- *
+ *
     * @return The time of the last received message.
     */
    public long getLastIncomingMsgTimestamp()
@@ -820,7 +789,7 @@
    /**
     * When a right button click is performed in the editor pane, a popup menu
     * is opened.
- *
+ *
     * @param e The MouseEvent.
     */
    public void mouseClicked(MouseEvent e)
@@ -842,7 +811,7 @@

    /**
     * Opens this panel context menu at the given point.
- *
+ *
     * @param p the point where to position the left-top cornet of the context
     * menu
     */
@@ -896,7 +865,7 @@

    /**
     * Returns the chat container.
- *
+ *
     * @return the chat container
     */
    public ChatConversationContainer getChatContainer()
@@ -925,7 +894,7 @@

    /**
     * Sets the given document to the editor pane in this panel.
- *
+ *
     * @param doc the document to set
     */
    public void setContent(HTMLDocument doc)
@@ -945,7 +914,7 @@

    /**
     * Returns the document contained in this panel.
- *
+ *
     * @return the document contained in this panel
     */
    public HTMLDocument getContent()
@@ -955,7 +924,7 @@

    /**
     * Returns the right button popup menu.
- *
+ *
     * @return the right button popup menu
     */
    public ChatRightButtonMenu getRightButtonMenu()
@@ -965,20 +934,20 @@

    /**
     * Returns the date of the first message in the current page.
- *
+ *
     * @return the date of the first message in the current page
     */
    public Date getPageFirstMsgTimestamp()
- {
+ {
        Element rootElement = this.document.getDefaultRootElement();
-
+
        Element firstMessageElement = null;
-
+
        for(int i = 0; i < rootElement.getElementCount(); i ++)
- {
+ {
            String idAttr = (String) rootElement.getElement(i)
                    .getAttributes().getAttribute("identifier");
-
+
            if (idAttr != null && idAttr.equals("messageHeader"))
            {
                firstMessageElement = rootElement.getElement(i);
@@ -988,29 +957,29 @@

        if(firstMessageElement == null)
            return new Date(Long.MAX_VALUE);
-
+
        String dateString = (String)firstMessageElement
            .getAttributes().getAttribute("date");
-
- return new Date(Long.parseLong(dateString));
+
+ return new Date(Long.parseLong(dateString));
    }

    /**
     * Returns the date of the last message in the current page.
- *
+ *
     * @return the date of the last message in the current page
     */
    public Date getPageLastMsgTimestamp()
- {
+ {
        Element rootElement = this.document.getDefaultRootElement();
-
+
        Element lastMessageElement = null;

        for(int i = rootElement.getElementCount() - 1; i >= 0; i --)
        {
            String idAttr = (String) rootElement.getElement(i)
                .getAttributes().getAttribute("identifier");
-
+
            if (idAttr != null && idAttr.equals("messageHeader"))
            {
                lastMessageElement = rootElement.getElement(i);
@@ -1020,13 +989,13 @@

        if(lastMessageElement == null)
            return new Date(0);
-
+
        String dateString = (String) lastMessageElement
            .getAttributes().getAttribute("date");
-
+
        return new Date(Long.parseLong(dateString));
    }
-
+
    /**
     * Formats HTML tags &lt;br/&gt; to &lt;br&gt; or &lt;BR/&gt; to &lt;BR&gt;.
     * The reason of this function is that the ChatPanel does not support
@@ -1078,7 +1047,7 @@
        }
        return processedMessage.toString();
    }
-
+
    /**
     * Formats HTML tags &lt;img ... /&gt; to &lt; img ... &gt;&lt;/img&gt; or
     * &lt;IMG ... /&gt; to &lt;IMG&gt;&lt;/IMG&gt;.
@@ -1132,4 +1101,35 @@
        }
        return processedMessage.toString();
    }
+
+ /**
+ * Extend Editor pane to add url tooltips.
+ */
+ private class MyEditorPane
+ extends JEditorPane
+ {
+ /**
+ * Create tooltip.
+ */
+ public JToolTip createToolTip()
+ {
+ JToolTip tip = new JToolTip();
+ tip.setComponent(this);
+
+ return tip;
+ }
+
+ /**
+ * Returns the string to be used as the tooltip for <i>event</i>.
+ *
+ * @return the string to be used as the tooltip for <i>event</i>.
+ */
+ public String getToolTipText(MouseEvent event)
+ {
+ if(currentHref != null && currentHref.length() != 0)
+ return currentHref;
+ else
+ return "";
+ }
+ }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net