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/upgrader/Upgrader.java | 5 ++
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 25 ++++++++----
opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java | 5 ++
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java | 39 +++++++++++++++++++
4 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
index e15a21f..d40c649 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -683,9 +683,12 @@
}
} else {
if (getUninstallUserData().getRemoveLibrariesAndTools()) {
+ String formattedPath =
+ addWordBreaks(
+ getStringFromCollection(paths, getLineBreak().toString()), 60, 5);
successMsg =
INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY_REMOVE_JARFILES
- .get(getStringFromCollection(paths, getLineBreak().toString()));
+ .get(formattedPath);
} else {
successMsg = INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY.get();
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 352afdf..cc420a8 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -2064,15 +2064,18 @@
getFormattedSummary(INFO_SUMMARY_CANCELING.get()));
Installation installation = getInstallation();
- String cmd = getPath(installation.getControlPanelCommandFile());
+ String cmd = Utils.addWordBreaks(
+ getPath(installation.getControlPanelCommandFile()), 60, 5);
cmd = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
+ String formattedPath = Utils.addWordBreaks(
+ formatter.getFormattedText(
+ Message.raw(getPath(new File(getInstancePath())))).toString(),
+ 60, 5);
Message successMessage = Utils.getCustomizedObject(
"INFO_SUMMARY_INSTALL_FINISHED_SUCCESSFULLY",
INFO_SUMMARY_INSTALL_FINISHED_SUCCESSFULLY.get(
- formatter.getFormattedText(
- Message.raw(getPath(new File(getInstancePath())))),
- INFO_GENERAL_SERVER_STOPPED.get(),
- cmd), Message.class);
+ formattedPath, INFO_GENERAL_SERVER_STOPPED.get(),
+ cmd), Message.class);
hmSummary.put(InstallProgressStep.FINISHED_SUCCESSFULLY,
getFormattedSuccess(successMessage));
hmSummary.put(InstallProgressStep.FINISHED_CANCELED,
@@ -2092,7 +2095,9 @@
{
Installation installation = getInstallation();
String cmd = getPath(installation.getControlPanelCommandFile());
- cmd = UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT);
+ cmd = Utils.addWordBreaks(
+ UIFactory.applyFontToHtml(cmd, UIFactory.INSTRUCTIONS_MONOSPACE_FONT),
+ 60, 5);
Message status;
if (installation.getStatus().isServerRunning())
{
@@ -2102,11 +2107,13 @@
{
status = INFO_GENERAL_SERVER_STOPPED.get();
}
+ String formattedPath = Utils.addWordBreaks(
+ formatter.getFormattedText(
+ Message.raw(getPath(new File(getInstancePath())))).toString(),
+ 60, 5);
Message successMessage = Utils.getCustomizedObject(
"INFO_SUMMARY_INSTALL_FINISHED_SUCCESSFULLY",
- INFO_SUMMARY_INSTALL_FINISHED_SUCCESSFULLY.get(
- formatter.getFormattedText(
- Message.raw(getPath(new File(getInstancePath())))),
+ INFO_SUMMARY_INSTALL_FINISHED_SUCCESSFULLY.get(formattedPath,
status,
cmd), Message.class);
hmSummary.put(InstallProgressStep.FINISHED_SUCCESSFULLY,
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 5a22bec..4370d35 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -2024,9 +2024,12 @@
formatter.getFormattedText(Message.raw(installPath)),
newVersion);
} else {
+ String formattedPath = Utils.addWordBreaks(
+ formatter.getFormattedText(Message.raw(installPath)).toString(),
+ 60, 5);
txt = getFormattedSuccess(
INFO_SUMMARY_UPGRADE_FINISHED_SUCCESSFULLY.get(
- formatter.getFormattedText(Message.raw(installPath)),
+ formattedPath,
newVersion));
}
return txt;
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