From 4edcd4c0a84b20055ecf848b2f8e78137d9c1702 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 05 May 2008 14:08:53 +0000
Subject: [PATCH] Move the method wrapText form Utils to StatusCli since makes an unsafe reference to StaticUtils that could break the webstart installer.

---
 opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java |   39 ++++++++++++++++++++++++++++-----------
 1 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java b/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
index 7e33122..d8a8faf 100644
--- a/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
+++ b/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
@@ -65,6 +65,7 @@
 import org.opends.server.tools.ToolConstants;
 import org.opends.server.tools.dsconfig.LDAPManagementContextFactory;
 import org.opends.server.types.NullOutputStream;
+import org.opends.server.util.StaticUtils;
 import org.opends.server.util.args.ArgumentException;
 import org.opends.server.util.cli.ConsoleApplication;
 import org.opends.server.util.cli.LDAPConnectionConsoleInteraction;
@@ -619,13 +620,14 @@
       {
         getOutputStream().println();
         getOutputStream().println(
-            wrap(INFO_NOT_AVAILABLE_SERVER_DOWN_CLI_LEGEND.get()));
+            wrapText(INFO_NOT_AVAILABLE_SERVER_DOWN_CLI_LEGEND.get()));
       }
       else if (displayMustAuthenticateLegend)
       {
         getOutputStream().println();
         getOutputStream().println(
-            wrap(INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_CLI_LEGEND.get()));
+            wrapText(
+                INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_CLI_LEGEND.get()));
       }
     }
     getOutputStream().println();
@@ -866,16 +868,17 @@
         if (!desc.isAuthenticated())
         {
           getOutputStream().println(
-              wrap(INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_CLI_LABEL.get()));
+              wrapText(
+                  INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_CLI_LABEL.get()));
         }
         else
         {
-          getOutputStream().println(wrap(INFO_NO_LISTENERS_FOUND.get()));
+          getOutputStream().println(wrapText(INFO_NO_LISTENERS_FOUND.get()));
         }
       }
       else
       {
-        getOutputStream().println(wrap(INFO_NO_LISTENERS_FOUND.get()));
+        getOutputStream().println(wrapText(INFO_NO_LISTENERS_FOUND.get()));
       }
     }
     else
@@ -908,16 +911,17 @@
         if (!desc.isAuthenticated())
         {
           getOutputStream().println(
-              wrap(INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_CLI_LABEL.get()));
+              wrapText(
+                  INFO_NOT_AVAILABLE_AUTHENTICATION_REQUIRED_CLI_LABEL.get()));
         }
         else
         {
-          getOutputStream().println(wrap(INFO_NO_DBS_FOUND.get()));
+          getOutputStream().println(wrapText(INFO_NO_DBS_FOUND.get()));
         }
       }
       else
       {
-        getOutputStream().println(wrap(INFO_NO_DBS_FOUND.get()));
+        getOutputStream().println(wrapText(INFO_NO_DBS_FOUND.get()));
       }
     }
     else
@@ -946,7 +950,7 @@
     if (errorMsg != null)
     {
       getOutputStream().println();
-      getOutputStream().println(wrap(errorMsg));
+      getOutputStream().println(wrapText(errorMsg));
     }
   }
 
@@ -1002,7 +1006,7 @@
 
           line.append(getCellValue(tableModel.getValueAt(i, j), desc));
 
-          getOutputStream().println(wrap(line.toMessage()));
+          getOutputStream().println(wrapText(line.toMessage()));
         }
       }
     }
@@ -1202,7 +1206,7 @@
       buf.append(" ");
     }
     buf.append(" ").append(String.valueOf(value));
-    getOutputStream().println(wrap(buf.toMessage()));
+    getOutputStream().println(wrapText(buf.toMessage()));
   }
 
   private Message centerTitle(Message text)
@@ -1295,4 +1299,17 @@
   public boolean isVerbose() {
     return true;
   }
+
+
+
+  /**
+   * Wraps a message accoring to client tool console width.
+   * @param text to wrap
+   * @return raw message representing wrapped string
+   */
+  private Message wrapText(Message text)
+  {
+    return Message.raw(
+        StaticUtils.wrapText(text, getCommandLineMaxLineWidth()));
+  }
 }

--
Gitblit v1.10.0