org.ploin.web.faces
Class BaseMessages

java.lang.Object
  extended by org.ploin.web.faces.Base
      extended by org.ploin.web.faces.BaseMessages
Direct Known Subclasses:
BaseBean

public class BaseMessages
extends Base

$LastChangedBy: r.reiz $
$Revision: 113 $
$Date: 2010-03-18 12:53:04 +0100 (Thu, 18 Mar 2010) $

Created by: robert Created date: Nov 11, 2009 - 10:37:34 PM

Description:


Constructor Summary
BaseMessages()
           
 
Method Summary
 void addErrorMessage(String key)
           
 void addErrorMessage(String componentId, String key, String[] params)
           
 void addErrorMessageText(String text)
           
 void addErrorMessageText(String summary, String detail)
           
 void addFatalMessage(String key)
           
 void addFatalMessage(String componentId, String key, String[] params)
           
 void addFatalMessageText(String text)
           
 void addFatalMessageText(String summary, String detail)
           
 void addHTMLMessage(javax.faces.application.FacesMessage.Severity severity, String summary, String detail)
           
 void addHTMLMessageFromBundle(javax.faces.application.FacesMessage.Severity severity, String key)
          This method adds a message to the application context.
 void addHTMLMessageFromBundle(javax.faces.application.FacesMessage.Severity severity, String key, String[] params)
          With this method you can parametrize your message-values.
 void addHTMLMessageFromBundle(String componentId, javax.faces.application.FacesMessage.Severity severity, String key)
          This method adds a message to the application context.
 void addHTMLMessageFromBundle(String componentId, javax.faces.application.FacesMessage.Severity severity, String key, String[] params)
          With this method you can parametrize your message-values.
 void addInfoMessage(String key)
           
 void addInfoMessage(String componentId, String key, String[] params)
           
 void addInfoMessageText(String text)
           
 void addInfoMessageText(String summary, String detail)
           
 void addWarnMessage(String key)
           
 void addWarnMessage(String componentId, String key, String[] params)
           
 void addWarnMessageText(String text)
           
 void addWarnMessageText(String summary, String detail)
           
 String getDetailSuffix()
           
 String getStringFromResourceBundle(String key)
          This method returns a value from the default resource bundle.
 String getStringFromResourceBundle(String key, String[] params)
          With this method you can parametrize your message-values.
 String getStringFromResourceBundleDetail(String key)
          This methode cocatinate the given key with "Detail".
 String getStringFromResourceBundleDetail(String key, String[] params)
          With this method you can parametrize your message-values.
 String getStringFromResourceBundleSummary(String key)
          This methode cocatinate the given key with "Summary".
 String getStringFromResourceBundleSummary(String key, String[] params)
          This methode cocatinate the given key with "Summary".
 String getSummarySuffix()
           
 void setDetailSuffix(String detailSuffix)
           
 void setSummarySuffix(String summarySuffix)
           
 
Methods inherited from class org.ploin.web.faces.Base
getApplication, getFacesContext, getLocale, getResourceBundle, getViewRoot, getViewRootId, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseMessages

public BaseMessages()
Method Detail

getStringFromResourceBundle

public String getStringFromResourceBundle(String key)
This method returns a value from the default resource bundle. If there is no value for the given key, returning "???key???".

String firstName = getStringFromResourceBundle("firstName");

Parameters:
key - - the messageKey
Returns:
value - value for key

getStringFromResourceBundle

public String getStringFromResourceBundle(String key,
                                          String[] params)
With this method you can parametrize your message-values. If you have a messageBundle like this:

user.info=Hallo {0}, yo are {1}


you can call this code to parametrize you message.

String[] params = {"Wilbur Ton", "welcome"} ;
STring value = getStringFromResourceBundle("user.info", params)


Parameters:
key - - the messageKey
params - - a String array for the message-values
Returns:
value

getStringFromResourceBundleDetail

public String getStringFromResourceBundleDetail(String key)
This methode cocatinate the given key with "Detail". If you call the methode with "user", it will look in the resourceBundle for a key "userDetail".

String userDetail = getStringFromResourceBundleDetail("user");

Parameters:
key - - the messageKey
Returns:
value - value for key

getStringFromResourceBundleDetail

public String getStringFromResourceBundleDetail(String key,
                                                String[] params)
With this method you can parametrize your message-values. If you have a messageBundle like this:

user.infoDetail=Hallo {0}, yo are {1}


you can call this code to parametrize you message.

String[] params = {"Wilbur Ton", "welcome"} ;
STring value = getStringFromResourceBundleDetail("user.info", params)


Parameters:
key - - the message key
params - - a String array for the message-values
Returns:
value

getStringFromResourceBundleSummary

public String getStringFromResourceBundleSummary(String key)
This methode cocatinate the given key with "Summary". If you call the methode with "user", it will look in the resourceBundle for a key "userSummary".

String userSummary = getStringFromResourceBundleDetail("user");

Parameters:
key - - the messageKey
Returns:
value - value fro key

getStringFromResourceBundleSummary

public String getStringFromResourceBundleSummary(String key,
                                                 String[] params)
This methode cocatinate the given key with "Summary". If you call the methode with "user", it will look in the resourceBundle for a key "userSummary".

String userSummary = getStringFromResourceBundleDetail("user");

Parameters:
key - the messageKey
params - to replace in key
Returns:
value value fro key

addHTMLMessageFromBundle

public void addHTMLMessageFromBundle(javax.faces.application.FacesMessage.Severity severity,
                                     String key)
This method adds a message to the application context. The key will be concatinated onetimes with "Summary" and onetimes with "Detail". If you call this method with the key "user", you should have following entries in your resourceBundle:

userDetail=something
userSummary=something

addHTMLMessageFromBundle(FacesMessage.SEVERITY_INFO, "user");

Parameters:
severity - - the severity of the message defined in FacesMessage.Severity
key - - The messageKey

addHTMLMessageFromBundle

public void addHTMLMessageFromBundle(String componentId,
                                     javax.faces.application.FacesMessage.Severity severity,
                                     String key)
This method adds a message to the application context. The key will be concatinated onetimes with "Summary" and onetimes with "Detail". If you call this method with the key "user", you should have following entries in your resourceBundle:

userDetail=something
userSummary=something


With compId you can call the component, for example the id of a textfield.

addHTMLMessageFromBundle("form:testID", FacesMessage.SEVERITY_INFO, "user");

to find out your exact ID you should use fireBug in FireFox.

Parameters:
componentId - - the id of the component
severity - - the severity of the message defined in FacesMessage.Severity
key - - The messageKey

addHTMLMessageFromBundle

public void addHTMLMessageFromBundle(javax.faces.application.FacesMessage.Severity severity,
                                     String key,
                                     String[] params)
With this method you can parametrize your message-values. If you have a messageBundle like this:

user.infoSummary=Hallo {0},
user.infoDetail=welcome in {1}.


you can call this code to parametrize you message.

String[] params = {"Wilbur Ton", "Malibu"} ;
addHTMLMessageFromBundle(FacesMessage.SEVERITY_INFO, "user.info", params)


Parameters:
severity - - the severity of the message defined in FacesMessage.Severity
key - - the messageKey
params - - a String array for the message-values

addHTMLMessageFromBundle

public void addHTMLMessageFromBundle(String componentId,
                                     javax.faces.application.FacesMessage.Severity severity,
                                     String key,
                                     String[] params)
With this method you can parametrize your message-values. If you have a messageBundle like this:

user.infoSummary=Hallo {0},
user.infoDetail=welcome in {1}.


you can call this code to parametrize you message.

String[] params = {"Wilbur Ton", "Malibu"} ;
addHTMLMessageFromBundle(FacesMessage.SEVERITY_INFO, "user.info", params)


With compId you can call the component, for example the id of a textfield. The returned Message will be refered to the componentId.

Parameters:
componentId - - the id of the component
severity - - the severity of the message defined in FacesMessage.Severity
key - - the messageKey
params - - a String array for the message-values

addInfoMessage

public void addInfoMessage(String componentId,
                           String key,
                           String[] params)

addInfoMessage

public void addInfoMessage(String key)

addInfoMessageText

public void addInfoMessageText(String text)

addInfoMessageText

public void addInfoMessageText(String summary,
                               String detail)

addWarnMessage

public void addWarnMessage(String componentId,
                           String key,
                           String[] params)

addWarnMessage

public void addWarnMessage(String key)

addWarnMessageText

public void addWarnMessageText(String text)

addWarnMessageText

public void addWarnMessageText(String summary,
                               String detail)

addErrorMessage

public void addErrorMessage(String componentId,
                            String key,
                            String[] params)

addErrorMessage

public void addErrorMessage(String key)

addErrorMessageText

public void addErrorMessageText(String text)

addErrorMessageText

public void addErrorMessageText(String summary,
                                String detail)

addFatalMessage

public void addFatalMessage(String componentId,
                            String key,
                            String[] params)

addFatalMessage

public void addFatalMessage(String key)

addFatalMessageText

public void addFatalMessageText(String text)

addFatalMessageText

public void addFatalMessageText(String summary,
                                String detail)

addHTMLMessage

public void addHTMLMessage(javax.faces.application.FacesMessage.Severity severity,
                           String summary,
                           String detail)
Parameters:
severity - - the severity of the message defined in FacesMessage.Severity
summary - - the messageKey for the summary
detail - - the messageKey for the detail

getDetailSuffix

public String getDetailSuffix()

setDetailSuffix

public void setDetailSuffix(String detailSuffix)

getSummarySuffix

public String getSummarySuffix()

setSummarySuffix

public void setSummarySuffix(String summarySuffix)


Copyright © 2012 PLOIN GmbH. All Rights Reserved.