The problem comes in the fact that there are defined constants in FacesMessage. Consider this:

A renderkit looks to see if the Faces Severity is FacesMessage.SEVERITY_INFO. If you changed the ordinal value in CustomFacesMessage, your CustomFacesMessage's SEVERITY_INFO will not be the same as the FacesMessage where the constant is defined.

It's fine is everything uses your own CustomFacesMessage class to determine your severity level. But generally a renderkit is going to assume that you're NOT overriding this. So in short, you could create a CustomFacesMessage if your application handles the displaying of messages from end to end. But if you are relying on renderkits like Trinidad, they will be generally confused.

Scott

Garner, Shawn wrote:
I used the warn level since I'm already using the error and info level.

I just don't like using warn instead of my own custom one.

I saw the ordinal and ordering in the source code. I don't see any reason why you couldn't override the order or create a
new severity.
I could make them display in any order I wanted by reordering the
ordinals and shouldn't affect the renderkit.
The renderkit would always render them according to ordinal.



Shawn
-----Original Message-----
From: Scott O'Bryan [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 09, 2007 10:44 AM
To: MyFaces Discussion
Subject: Re: FacesMessage Serverity

Shawn,

Oracle did something similar.  Our solution was that we created a custom

FacesMessage which also took an enumeration of our allowed severity types. These severity types could be mapped to the standard JSF severity types (Confirmation was mapped to Severity.INFO for instance) if a renderkit or something needed it in order to display the message. We then added get and set methods for the message type.

Unfortunately JSF gives the illusion of being able to change the severities easily, but the "ordinal" system that's in place in JSF does not lend itself to this. Plus, many renderkits (like trinidad) use the Severity in order to render messages on their components, so changing them will break these renderkits.

Scott

Simon Kitching wrote:
Garner, Shawn wrote:
I need to create a custom message severity.

I wanted to create a confirmation message severity but Severity has a

private constructor?

Shouldn't this be public so you can add your own?
I guess the API doesn't intend people to create custom severities.

The official javadocs are part of the JSF specification, and this page

doesn't indicate any public or protected constructor so MyFaces is probably *required* not to provide one in order to be "JSF compliant":


http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/a
pplication/FacesMessage.Severity.html
Regards,

Simon


**************************************************************************** This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. ****************************************************************************


Reply via email to