From b2ec35e3fea287b5ebbaab145651f44c2a27b2e1 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 27 Nov 2009 16:55:08 +0000
Subject: [PATCH] Complete fix for issue 4372 (control-panel output is on one line on copy).

---
 opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java        |   21 ++++++---------------
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java |    2 +-
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java
index 2fc8844..fe9f3c6 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/ProgressDialog.java
@@ -271,23 +271,14 @@
 
     /**
      * Appends a line to the logs (Details are) section of the panel.  The text
-     * will be preceded by a new line (is similar to println()).
+     * will have a new-line char at the end (is similar to println()).
      * @param msg the HTML formatted text to be appended.
      */
     public void appendErrorLine(String msg)
     {
-      HTMLDocument doc = (HTMLDocument)logs.getDocument();
-      msg = Utilities.applyFont(msg+"<br>", ColorAndFontConstants.progressFont);
-      try
-      {
-        msg = filterForBugID4988885(msg);
-        doc.insertBeforeStart(doc.getElement(LASTID), msg);
-      }
-      catch (Throwable t)
-      {
-        // Bug
-        t.printStackTrace();
-      }
+      msg = filterForBugID4988885(msg+"<br>");
+      msg = Utilities.applyFont(msg, ColorAndFontConstants.progressFont);
+      appendHtml(msg);
     }
 
     /**
@@ -581,7 +572,7 @@
     }
 
     /**
-     * Checks if the 'Close when over' checkbox is selected and if it is the
+     * Checks if the 'Close when over' check box is selected and if it is the
      * case, closes the dialog after waiting for 2 seconds (so that the user
      * can see the result, or cancel the automatic closing of the dialog).
      *
@@ -630,6 +621,6 @@
    */
   private static String filterForBugID4988885(String msg)
   {
-    return msg.replaceAll("<br>", "<br>&#10;");
+    return msg.replaceAll("<br>", "&#10;<br>");
   }
 }
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java
index dae39c4..bd2cf1a 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java
@@ -70,7 +70,7 @@
    * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4988885
    */
    private static final Message LINE_BREAK=
-     Message.raw(Constants.HTML_LINE_BREAK+"&#10;");
+     Message.raw("&#10;"+Constants.HTML_LINE_BREAK);
 
   /**
    * Returns the HTML representation of the text without providing any style.

--
Gitblit v1.10.0