[seam-commits] Seam SVN: r13171 - in modules/faces/trunk/impl/src: test/java/org/jboss/seam/faces/status and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Jun 15 18:31:49 EDT 2010
Author: lincolnthree
Date: 2010-06-15 18:31:49 -0400 (Tue, 15 Jun 2010)
New Revision: 13171
Modified:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java
Log:
Messages Adapter now takes no action if there are no messages to be saved.
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java 2010-06-15 22:31:25 UTC (rev 13170)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/status/MessagesAdapter.java 2010-06-15 22:31:49 UTC (rev 13171)
@@ -37,7 +37,8 @@
import org.jboss.seam.faces.event.qualifier.RenderResponse;
import org.jboss.seam.international.status.Level;
import org.jboss.seam.international.status.Message;
-import org.jboss.seam.international.status.Messages;
+import org.jboss.seam.international.status.MessagesImpl;
+import org.slf4j.Logger;
/**
* Convert Seam Messages into FacesMessages before RenderResponse phase.<br>
@@ -53,15 +54,22 @@
private static final String FLASH_MESSAGES_KEY = MessagesAdapter.class.getName() + ".FLASH_KEY";
@Inject
- Messages messages;
+ MessagesImpl messages;
@Inject
FlashContext context;
+ @Inject
+ Logger log;
+
void flushBeforeNavigate(@Observes final PreNavigateEvent event)
{
- context.put(FLASH_MESSAGES_KEY, messages.getAll());
- messages.clear();
+ if (!messages.isEmpty())
+ {
+ log.debug("Saving status Messages to Flash Scope");
+ context.put(FLASH_MESSAGES_KEY, messages.getAll());
+ messages.clear();
+ }
}
@SuppressWarnings("unchecked")
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java 2010-06-15 22:31:25 UTC (rev 13170)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/status/MessagesAdapterTest.java 2010-06-15 22:31:49 UTC (rev 13171)
@@ -36,7 +36,7 @@
import org.jboss.seam.faces.event.PhaseEventBridge;
import org.jboss.seam.international.status.Bundles;
import org.jboss.seam.international.status.MessageFactory;
-import org.jboss.seam.international.status.Messages;
+import org.jboss.seam.international.status.MessagesImpl;
import org.jboss.seam.international.status.builder.BundleTemplateMessageImpl;
import org.jboss.seam.international.status.builder.TemplateMessageImpl;
import org.jboss.shrinkwrap.api.ArchivePaths;
@@ -58,11 +58,11 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessagesAdapter.class, Messages.class, MockFlashContext.class, MessageFactory.class, TemplateMessageImpl.class, BundleTemplateMessageImpl.class, Bundles.class, PhaseEventBridge.class, MockLogger.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(MessagesAdapter.class, MessagesImpl.class, MockFlashContext.class, MessageFactory.class, TemplateMessageImpl.class, BundleTemplateMessageImpl.class, Bundles.class, PhaseEventBridge.class, MockLogger.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
- Messages messages;
+ MessagesImpl messages;
String text = "Hey! This is a message";
More information about the seam-commits
mailing list