org.jboss.seam.faces
Class FacesMessages

java.lang.Object
  extended by org.jboss.seam.faces.FacesMessages
All Implemented Interfaces:
Serializable

@Scope(value=CONVERSATION)
@Name(value="org.jboss.seam.faces.facesMessages")
@Install(precedence=0,
         classDependencies="javax.faces.context.FacesContext")
@BypassInterceptors
public class FacesMessages
extends Object
implements Serializable

A Seam component that propagates FacesMessages across redirects and interpolates EL expressions in the message string.

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
FacesMessages()
           
 
Method Summary
 void add(javax.faces.application.FacesMessage.Severity severity, String messageTemplate, Object... params)
          Add a templated FacesMessage that will be used the next time a page is rendered.
 void add(javax.faces.application.FacesMessage facesMessage)
          Add a FacesMessage that will be used the next time a page is rendered.
 void add(org.hibernate.validator.InvalidValue iv)
           
 void add(org.hibernate.validator.InvalidValue[] ivs)
           
 void add(String messageTemplate, Object... params)
          Add a templated FacesMessage that will be used the next time a page is rendered.
 void addFromResourceBundle(javax.faces.application.FacesMessage.Severity severity, String key, Object... params)
          Add a templated FacesMessage by looking for the message template in the resource bundle.
 void addFromResourceBundle(String key, Object... params)
          Add a templated FacesMessage by looking for the message template in the resource bundle.
 void addFromResourceBundleOrDefault(javax.faces.application.FacesMessage.Severity severity, String key, String defaultMessageTemplate, Object... params)
          Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.
 void addFromResourceBundleOrDefault(String key, String defaultMessageTemplate, Object... params)
          Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.
 void addToControl(org.hibernate.validator.InvalidValue iv)
           
 void addToControl(String id, javax.faces.application.FacesMessage.Severity severity, String messageTemplate, Object... params)
          Add a templated FacesMessage to a particular JSF control
 void addToControl(String id, javax.faces.application.FacesMessage facesMessage)
          Add a FacesMessage instance to a particular component id
 void addToControl(String id, org.hibernate.validator.InvalidValue iv)
           
 void addToControl(String id, String messageTemplate, Object... params)
          Add a templated FacesMessage to a particular JSF control
 void addToControlFromResourceBundle(String id, javax.faces.application.FacesMessage.Severity severity, String key, Object... params)
          Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.
 void addToControlFromResourceBundle(String id, String key, Object... params)
          Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.
 void addToControlFromResourceBundleOrDefault(String id, javax.faces.application.FacesMessage.Severity severity, String key, String defaultMessageTemplate, Object... params)
          Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.
 void addToControlFromResourceBundleOrDefault(String id, String key, String defaultMessageTemplate, Object... params)
          Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.
 void addToControls(org.hibernate.validator.InvalidValue[] ivs)
           
static void afterPhase()
           
 void beforeRenderResponse()
           
 void clear()
           
static javax.faces.application.FacesMessage createFacesMessage(javax.faces.application.FacesMessage.Severity severity, String messageTemplate, Object... params)
           
static javax.faces.application.FacesMessage createFacesMessage(javax.faces.application.FacesMessage.Severity severity, String key, String defaultMessageTemplate, Object... params)
           
 List<javax.faces.application.FacesMessage> getCurrentGlobalMessages()
          Get all faces global messages that have already been added to the context.
 List<javax.faces.application.FacesMessage> getCurrentMessages()
          Get all faces messages that have already been added to the context.
 List<javax.faces.application.FacesMessage> getCurrentMessagesForControl(String id)
          Get all faces messages that have already been added to the control.
static FacesMessages instance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FacesMessages

public FacesMessages()
Method Detail

beforeRenderResponse

public void beforeRenderResponse()

getCurrentMessages

public List<javax.faces.application.FacesMessage> getCurrentMessages()
Get all faces messages that have already been added to the context.

Returns:
a list of messages

getCurrentGlobalMessages

public List<javax.faces.application.FacesMessage> getCurrentGlobalMessages()
Get all faces global messages that have already been added to the context.

Returns:
a list of global messages

getCurrentMessagesForControl

public List<javax.faces.application.FacesMessage> getCurrentMessagesForControl(String id)
Get all faces messages that have already been added to the control.

Returns:
a list of messages

afterPhase

public static void afterPhase()

clear

public void clear()

add

public void add(javax.faces.application.FacesMessage facesMessage)
Add a FacesMessage that will be used the next time a page is rendered.


addToControl

public void addToControl(String id,
                         javax.faces.application.FacesMessage facesMessage)
Add a FacesMessage instance to a particular component id

Parameters:
id - a JSF component id

add

public void add(String messageTemplate,
                Object... params)
Add a templated FacesMessage that will be used the next time a page is rendered.


add

public void add(javax.faces.application.FacesMessage.Severity severity,
                String messageTemplate,
                Object... params)
Add a templated FacesMessage that will be used the next time a page is rendered.


addToControl

public void addToControl(String id,
                         String messageTemplate,
                         Object... params)
Add a templated FacesMessage to a particular JSF control

Parameters:
id - a JSF component id

addToControl

public void addToControl(String id,
                         javax.faces.application.FacesMessage.Severity severity,
                         String messageTemplate,
                         Object... params)
Add a templated FacesMessage to a particular JSF control

Parameters:
id - a JSF component id

addFromResourceBundle

public void addFromResourceBundle(String key,
                                  Object... params)
Add a templated FacesMessage by looking for the message template in the resource bundle.


addFromResourceBundle

public void addFromResourceBundle(javax.faces.application.FacesMessage.Severity severity,
                                  String key,
                                  Object... params)
Add a templated FacesMessage by looking for the message template in the resource bundle.


addFromResourceBundleOrDefault

public void addFromResourceBundleOrDefault(String key,
                                           String defaultMessageTemplate,
                                           Object... params)
Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle. If it is missing, use the given message template.


addFromResourceBundleOrDefault

public void addFromResourceBundleOrDefault(javax.faces.application.FacesMessage.Severity severity,
                                           String key,
                                           String defaultMessageTemplate,
                                           Object... params)
Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle. If it is missing, use the given message template.


addToControlFromResourceBundle

public void addToControlFromResourceBundle(String id,
                                           String key,
                                           Object... params)
Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.


addToControlFromResourceBundle

public void addToControlFromResourceBundle(String id,
                                           javax.faces.application.FacesMessage.Severity severity,
                                           String key,
                                           Object... params)
Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle.


addToControlFromResourceBundleOrDefault

public void addToControlFromResourceBundleOrDefault(String id,
                                                    String key,
                                                    String defaultMessageTemplate,
                                                    Object... params)
Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle. If it is missing, use the given message template.


addToControlFromResourceBundleOrDefault

public void addToControlFromResourceBundleOrDefault(String id,
                                                    javax.faces.application.FacesMessage.Severity severity,
                                                    String key,
                                                    String defaultMessageTemplate,
                                                    Object... params)
Add a templated FacesMessage to a particular component id by looking for the message template in the resource bundle. If it is missing, use the given message template.


add

public void add(org.hibernate.validator.InvalidValue[] ivs)

addToControls

public void addToControls(org.hibernate.validator.InvalidValue[] ivs)

add

public void add(org.hibernate.validator.InvalidValue iv)

addToControl

public void addToControl(org.hibernate.validator.InvalidValue iv)

addToControl

public void addToControl(String id,
                         org.hibernate.validator.InvalidValue iv)

createFacesMessage

public static javax.faces.application.FacesMessage createFacesMessage(javax.faces.application.FacesMessage.Severity severity,
                                                                      String messageTemplate,
                                                                      Object... params)

createFacesMessage

public static javax.faces.application.FacesMessage createFacesMessage(javax.faces.application.FacesMessage.Severity severity,
                                                                      String key,
                                                                      String defaultMessageTemplate,
                                                                      Object... params)

instance

public static FacesMessages instance()