From 125dcdb0cc0a10cf735f04493fef194a72f49dcb Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 04 Jan 2010 06:46:50 +0000
Subject: [PATCH] Complete fix for issue 4412 (creating bogus entry from ldif in control panel, the error warning winodw shows hidden behind) Rewrite the code used to calculate the preferred size of the error pane.

---
 opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
index c64bd4d..8242c43 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008-2009 Sun Microsystems, Inc.
+ *      Copyright 2008-2010 Sun Microsystems, Inc.
  */
 
 package org.opends.guitools.controlpanel.ui;
@@ -1280,30 +1280,27 @@
     }
     if (!text.equals(lastDisplayedError))
     {
-      JEditorPane pane1 = Utilities.makeHtmlPane(null, pane.getFont());
-      String text1;
+      Message wrappedTitle = Utilities.wrapHTML(title, 80);
+      Message wrappedDetails = Utilities.wrapHTML(details, 90);
+
+      JEditorPane wrappedPane = Utilities.makeHtmlPane(null, pane.getFont());
+      String wrappedText;
       switch (type)
       {
       case ERROR:
-        text1 = Utilities.getFormattedError(title, titleFont,
-            null, detailsFont);
+        wrappedText = Utilities.getFormattedError(wrappedTitle, titleFont,
+            wrappedDetails, detailsFont);
         break;
       default:
-        text1 = Utilities.getFormattedSuccess(title, titleFont,
-            null, detailsFont);
+        wrappedText = Utilities.getFormattedSuccess(wrappedTitle, titleFont,
+            wrappedDetails, detailsFont);
         break;
       }
-      pane1.setText(text1);
-      Dimension d1 = pane1.getPreferredSize();
-      JEditorPane pane2 = Utilities.makeHtmlPane(null, pane.getFont());
-      pane2.setText(details.toString());
-      String plainText = details.toString().replaceAll("<br>",
-          ServerConstants.EOL);
-      Utilities.updatePreferredSize(pane2, 100, plainText, detailsFont, true);
-      Dimension d2 = pane2.getPreferredSize();
+      wrappedPane.setText(wrappedText);
+      Dimension d = wrappedPane.getPreferredSize();
+
       pane.setText(text);
-      pane.setPreferredSize(new Dimension(Math.max(d1.width, d2.width),
-          d1.height + d2.height));
+      pane.setPreferredSize(d);
 
       lastDisplayedError = text;
     }

--
Gitblit v1.10.0