QeelwaEtech / omnifaces

Automatically exported from code.google.com/p/omnifaces
0 stars 1 forks source link

Adapt org.omnifaces.util.Message to allow a separation between messages Detail and Messages Summary String #141

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I think that could be nice if the omnifaces message class allow to use a 
different Strings to render a Message detail and Message summary.

For exmple, in a pure JSF I can use this code:

 new FacesMessage(FacesMessage.SEVERITY_ERROR, "This is a summary String: ", "This is the detail String")

With the omnifaces component, I cannot use a diffrent String for Detail and for 
Summary, all Strings are passed as summary String.

Original issue reported on code.google.com by fressqui...@gmail.com on 19 Feb 2013 at 12:02

GoogleCodeExporter commented 9 years ago
From the javadoc: 
http://wiki.omnifaces.googlecode.com/hg/javadoc/1.3/org/omnifaces/util/Messages.
html

> Note that all of those shortcut methods by design only sets the message 
summary and ignores the message detail (it is not possible to offer varargs to 
parameterize both the summary and the detail). The message summary is exactly 
the information which is by default displayed in the <h:message(s)>, while the 
detail is by default only displayed when you explicitly set the 
showDetail="true" attribute.

> To create a FacesMessage with a message detail as well, use the 
Messages.Message builder as you can obtain by create(String, Object...).

The showcase has also one example: 
https://showcase-omnifaces.rhcloud.com/showcase/utils/Messages.xhtml

In your particular case, you can use e.g.

new ValidatorException(Messages.create("This is a summary String: 
").error().detail("This is the detail String").get());

Original comment by balusc on 19 Feb 2013 at 10:48