[seam-commits] Seam SVN: r8810 - tags/JBoss_Seam_2_1_0_BETA1/src/main/org/jboss/seam/international.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Aug 26 09:51:33 EDT 2008


Author: jbalunas at redhat.com
Date: 2008-08-26 09:51:33 -0400 (Tue, 26 Aug 2008)
New Revision: 8810

Modified:
   tags/JBoss_Seam_2_1_0_BETA1/src/main/org/jboss/seam/international/StatusMessages.java
Log:
port of JBSEAM-3318 in 2.1.0.BETA1 tag

Modified: tags/JBoss_Seam_2_1_0_BETA1/src/main/org/jboss/seam/international/StatusMessages.java
===================================================================
--- tags/JBoss_Seam_2_1_0_BETA1/src/main/org/jboss/seam/international/StatusMessages.java	2008-08-26 12:36:12 UTC (rev 8809)
+++ tags/JBoss_Seam_2_1_0_BETA1/src/main/org/jboss/seam/international/StatusMessages.java	2008-08-26 13:51:33 UTC (rev 8810)
@@ -14,6 +14,7 @@
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.international.StatusMessage.Severity;
+import org.jboss.seam.util.Strings;
 
 /**
  * Abstract base class for providing status messages. View layers should provide
@@ -71,17 +72,23 @@
     */
    public void add(Severity severity, String key, String detailKey, String messageTemplate, String messageDetailTemplate, final Object... params)
    {
-      final StatusMessage message = new StatusMessage(severity, key, detailKey, messageTemplate, messageDetailTemplate);
-      messages.add(message);
-      getTasks().add(
-            new Runnable() 
-            {
-               public void run() 
-               {
-                   message.interpolate(params);
-               }
-            }
-      );
+      if (!Strings.isEmpty(key))
+      {
+         final StatusMessage message = new StatusMessage(severity, key, detailKey, messageTemplate, messageDetailTemplate);
+         if (!Strings.isEmpty(message.getSummary()))
+         {
+            messages.add(message);
+            getTasks().add(
+                  new Runnable() 
+                  {
+                     public void run() 
+                     {
+                         message.interpolate(params);
+                     }
+                  }
+            );
+         }
+      }
    }
    
    /**
@@ -98,29 +105,34 @@
     */
    public void addToControl(String id, Severity severity, String key, String messageTemplate, final Object... params)
    {
-      final StatusMessage message = new StatusMessage(severity, key, null, messageTemplate, null);
-      if (keyedMessages.containsKey(id))
-      {
-         keyedMessages.get(id).add(message);
-      }
-      else
-      {
-         List<StatusMessage> list = new ArrayList<StatusMessage>();
-         list.add(message);
-         keyedMessages.put(id, list);
-      }
-      getTasks().add(
-            new Runnable() 
+      if (!Strings.isEmpty(key))
+      {            
+         final StatusMessage message = new StatusMessage(severity, key, null, messageTemplate, null);
+         if (!Strings.isEmpty(message.getSummary()))
+         {         
+            if (keyedMessages.containsKey(id))
             {
-               
-               public void run() 
-               {
-                  message.interpolate(params);
-               }
-               
+               keyedMessages.get(id).add(message);
             }
-      );
-      
+            else
+            {
+               List<StatusMessage> list = new ArrayList<StatusMessage>();
+               list.add(message);
+               keyedMessages.put(id, list);
+            }
+            getTasks().add(
+                  new Runnable() 
+                  {
+                     
+                     public void run() 
+                     {
+                        message.interpolate(params);
+                     }
+                     
+                  }
+            );
+         }
+      }      
    }
 
    /**




More information about the seam-commits mailing list