airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1327231 - /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorWindow.java
Date Tue, 17 Apr 2012 19:19:35 GMT
Author: lahiru
Date: Tue Apr 17 19:19:35 2012
New Revision: 1327231

URL: http://svn.apache.org/viewvc?rev=1327231&view=rev
Log:
Fixing https://issues.apache.org/jira/browse/AIRAVATA-369.

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorWindow.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorWindow.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorWindow.java?rev=1327231&r1=1327230&r2=1327231&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorWindow.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorWindow.java
Tue Apr 17 19:19:35 2012
@@ -127,7 +127,7 @@ public class ErrorWindow {
         // and set it to the default if it is still null.
         if (message == null) {
             if (e != null) {
-                message = e.getMessage();
+                message = messageSplitter(e.getMessage());
             }
         }
         if (message == null) {
@@ -207,7 +207,7 @@ public class ErrorWindow {
             printWriter.close();
             String stackTrace = stringWriter.toString();
 
-            JLabel messageLabel = new JLabel(message);
+            JLabel messageLabel = new JLabel(messageSplitter(message));
 
             XBayaTextArea textArea = new XBayaTextArea();
             textArea.setEditable(false);
@@ -248,4 +248,29 @@ public class ErrorWindow {
         JOptionPane.showMessageDialog(parent, message, title, JOptionPane.INFORMATION_MESSAGE);
     }
 
+    private String messageSplitter(String message){
+        int interval = 150;
+        char[] sAr = message.toCharArray();
+        int i = 0;
+        StringBuffer buffer = new StringBuffer("");
+        if(sAr.length > interval){
+        do{
+            String subString = "";
+            if(i + interval > message.length()){
+             subString = message.substring(i,message.length());
+            }else{
+             subString = message.substring(i, i + interval);
+            }
+            buffer.append(subString);
+            if(!subString.contains("\n")){
+               buffer.append("\n");
+            }
+            i = i + interval;
+        }while(i < sAr.length);
+            return buffer.toString();
+        }else{
+            return message;
+        }
+    }
+
 }
\ No newline at end of file



Mime
View raw message