myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garner, Shawn" <shawn.gar...@vangent.com>
Subject RE: FacesMessage Serverity
Date Wed, 09 May 2007 20:57:03 GMT
I don't want to file problems with the RI.
I want them to fix/change the spec.  
I found this page:

http://jcp.org/en/jsr/detail?id=127

Shawn
-----Original Message-----
From: Scott O'Bryan [mailto:darkarena@gmail.com] 
Sent: Wednesday, May 09, 2007 3:47 PM
To: MyFaces Discussion
Subject: Re: FacesMessage Serverity

You can file bugs and stuff against the ri and you can always comment on

public drafts of the spec.  To become a spec EG member though you have 
to be a member of the JCP and get accepted by the spec lead.

JSF-RI is here:  https://javaserverfaces.dev.java.net/

Scott

Garner, Shawn wrote:
> Where do I go to comment on the spec?
>
> I've sent the email feedback before but I can't find the page on Sun's
> website.
> Also is there any way to sign up to contribute to future specs without
> paying a fee?
>
> Shawn
>
> -----Original Message-----
> From: Scott O'Bryan [mailto:darkarena@gmail.com] 
> Sent: Wednesday, May 09, 2007 3:35 PM
> To: MyFaces Discussion
> Subject: Re: FacesMessage Serverity
>
> Shawn,
>
> The FacesMessage class is inside of Faces.  You can't change that.  
> Anything you add needs to be added on TOP of FacesMessage.  I mean if 
> you can figure it out without violating JSF spec, more power to you.  
> MyFaces is doing the correct thing.
>
> Scott
>
> Garner, Shawn wrote:
>   
>> The problem comes in the fact that there are defined constants in
>> FacesMessage.
>>
>> Redeclare the constants that are declared in FacesMessage.
>> If these weren't final then you could re-declare them and initialize
>>     
> the
>   
>> map and list values including my new Serverity:
>>
>> public static final FacesMessage.Severity SEVERITY_INFO = new
>> Severity("Info", 1);
>>     public static final FacesMessage.Severity SEVERITY_WARN = new
>> Severity("Warn", 2);
>>     public static final FacesMessage.Severity SEVERITY_ERROR = new
>> Severity("Error", 3);
>>     public static final FacesMessage.Severity SEVERITY_FATAL = new
>> Severity("Fatal", 4);
>>     public static final List VALUES;
>>     public static final Map VALUES_MAP;
>>     static
>>     {
>>         Map map = new HashMap(7);
>>         map.put(SEVERITY_INFO.toString(), SEVERITY_INFO);
>>         map.put(SEVERITY_WARN.toString(), SEVERITY_WARN);
>>         map.put(SEVERITY_ERROR.toString(), SEVERITY_ERROR);
>>         map.put(SEVERITY_FATAL.toString(), SEVERITY_FATAL);
>>         VALUES = Collections.unmodifiableList(new
>> ArrayList(map.values()));
>>         VALUES_MAP = Collections.unmodifiableMap(map);
>>     }
>>
>>
>> Then you could still do this in the Trinidad:
>> FacesMessage.SEVERITY_INFO.equals(msg.getSeverity()).
>>
>>
>>
>> Shawn
>>
>> -----Original Message-----
>> From: Scott O'Bryan [mailto:darkarena@gmail.com] 
>> Sent: Wednesday, May 09, 2007 2:01 PM
>> To: MyFaces Discussion
>> Subject: Re: FacesMessage Serverity
>>
>> 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:darkarena@gmail.com] 
>>> 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. 
>>>
>>>     
>>>       
>
************************************************************************
>   
>> ****
>>   
>>     
>>>   
>>>     
>>>       
>>     
>
************************************************************************
> **** 
>   
>> 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. 
>>
>>     
>
************************************************************************
> ****
>   
>>   
>>     
>
>
************************************************************************
**** 
> 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. 
>
************************************************************************
****
>
>   

**************************************************************************** 
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. 
****************************************************************************

Mime
View raw message