-
1. Re: Tuning validation for information
christian.bauer Feb 13, 2008 9:36 AM (in response to nickarls)I don't think this is really necessary. For example, on this site we do not use a different template for each message severity, but one for
informational
and one foranything worse than info that needs more attention
. So this check works just fine:<h:panelGrid styleClass="messageBoxTable" columns="2" cellpadding="0" cellspacing="0" border="0" rendered="#{message.severity.ordinal == 0}"> <h:graphicImage value="#{themePath}/img/info.gif" width="18" height="18" styleClass="infoImage"/> <h:outputText styleClass="infoMessage" value="#{message.summary}"/> </h:panelGrid> <h:panelGrid styleClass="messageBoxTable" columns="2" cellpadding="0" cellspacing="0" border="0" rendered="#{message.severity.ordinal > 0}"> <h:graphicImage value="#{themePath}/img/attention.gif" rendered="#{message.severity.ordinal > 0}" width="18" height="18" styleClass="attentionImage"/> <h:outputText styleClass="attentionMessage" value="#{message.summary}"/> </h:panelGrid>
-
2. Re: Tuning validation for information
gavin.king Feb 13, 2008 9:42 AM (in response to nickarls)I don't really like the idea of having multiple templates, since I think the only thing that would vary between them would be one css class. Also it gets verbose at the point of use.
Christian, why did you not write your template like this:
<h:panelGrid styleClass="messageBoxTable" columns="2" cellpadding="0" cellspacing="0" border="0" rendered="#{invalid}> <h:graphicImage value="#{themePath}/img/info.gif" width="18" height="18" styleClass="#{message.severity.ordinal == 0 ? 'info':'attention'}Image"/> <h:outputText styleClass="#{message.severity.ordinal == 0 ? 'info':'attention'}Message" value="#{message.summary}"/> </h:panelGrid>
That's much less verbose...
-
3. Re: Tuning validation for information
gavin.king Feb 13, 2008 9:51 AM (in response to nickarls)I mean one css class and one image :-)
-
4. Re: Tuning validation for information
christian.bauer Feb 13, 2008 9:59 AM (in response to nickarls)I guess I had very different HTML for different levels, at some point. We could probably clean it up now, but that's true for many other things :)
-
5. Re: Tuning validation for information
nickarls Feb 13, 2008 11:41 AM (in response to nickarls)Thanks for the replies.
is s:decorate supposed to expose the message as #message.severity.ordinal}? The original question was regarding component level messages, are the suggestions still applicable?
Should I be able to place a s:decorate around my field with the applied template containing an afterInvalidField facet containing your code?
BTW Chris, do you also have a baseball cap with <HEAD>? ;-) ref: avatar
-
6. Re: Tuning validation for information
nickarls Feb 13, 2008 10:59 PM (in response to nickarls)Shameless bump. Yeah, yeah, I know, I'm spoiled...
-
7. Re: Tuning validation for information
christian.bauer Feb 13, 2008 11:12 PM (in response to nickarls)That's a good way to never get a response again from any of us, too :)
-
8. Re: Tuning validation for information
nickarls Feb 14, 2008 7:28 AM (in response to nickarls)
Christian Bauer wrote on Feb 13, 2008 11:12 PM:
That's a good way to never get a response again from any of us, too :)
Hey, give me some credit, at least I'm honest! ;-)
-
9. Re: Tuning validation for information
nickarls Feb 14, 2008 10:53 AM (in response to nickarls)looking at the wiki code I now see that the #{message} in your example was bound to #{facesMessages.currentGlobalMessages} but is there any way to hook into the messages for a component (for use in the invalid-facets)?
s:message seems to be able to do it. or is it force-fed by the s:decorate?
-
10. Re: Tuning validation for information
nickarls Feb 15, 2008 7:23 AM (in response to nickarls)If I get a nice solution to this I'll document it in the knowledge base and write the Web Beans RI for you. Well, at least the first one...
-
11. Re: Tuning validation for information
pmuir Feb 18, 2008 5:49 PM (in response to nickarls)Thats something Christian did using the alias you found - not something <s:decorate /> gives you - you could file a feature request for <s:decorate /> to give you this, it's not a bad idea.
-
12. Re: Tuning validation for information
nickarls Feb 25, 2008 10:13 AM (in response to nickarls)So the interpretation is "there is currently no way to access the list of messages for a specific component from an e.g. aroundInvalidField facet in EL"?
-
13. Re: Tuning validation for information
pmuir Feb 26, 2008 1:23 PM (in response to nickarls)No AFAICS.