From fec60e4ae07d72c5a1fe780ecb0cdb428a28d382 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 25 Jun 2009 05:15:17 +0000
Subject: [PATCH] Fix for issue 3464 (Install summary screen cut-off) Add some word break tags (<wbr>) to the install paths that are displayed in the summary to force some wrapping.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 5dcca22..4399381 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -1785,6 +1785,45 @@
     }
     return value;
   }
+
+  /**
+   * Adds word break tags to the provided html string.
+   * @param htmlString the string.
+   * @param from the first index to start the spacing from.
+   * @param spacing the minimal spacing between word breaks.
+   * @return a string containing word breaks.
+   */
+  public static String addWordBreaks(String htmlString, int from, int spacing)
+  {
+    StringBuffer sb = new StringBuffer();
+    boolean insideTag = false;
+    int totalAddedChars = 0;
+    int addedChars = 0;
+    for (int i = 0 ; i<htmlString.length(); i++)
+    {
+      char c = htmlString.charAt(i);
+      sb.append(c);
+      if (c == '<')
+      {
+        insideTag = true;
+      }
+      else if ((c == '>') && insideTag)
+      {
+        insideTag = false;
+      }
+      if (!insideTag && (c != '>'))
+      {
+        addedChars ++;
+        totalAddedChars ++;
+      }
+      if ((addedChars > spacing) && (totalAddedChars > from) && !insideTag)
+      {
+        sb.append("<wbr>");
+        addedChars = 0;
+      }
+    }
+    return sb.toString();
+  }
 }
 
 /**

--
Gitblit v1.10.0