[richfaces-issues] [JBoss JIRA] (RF-13161) rich:notifyMessages CSS incorrect on MyFaces 2.x
John Yeary (JIRA)
jira-events at lists.jboss.org
Fri Aug 30 09:08:03 EDT 2013
[ https://issues.jboss.org/browse/RF-13161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12800579#comment-12800579 ]
John Yeary commented on RF-13161:
---------------------------------
The issue seems to be focused around the NotifyMessageRendererBase which sets the severity level based on the ordinal value.
{noformat}
private void addMessageSpecificAttributes(MessageForRender message, FacesContext facesContext, UIComponent component,
Map<String, Object> options) {
Boolean showSummary = (Boolean) component.getAttributes().get("showSummary");
Boolean showDetail = (Boolean) component.getAttributes().get("showDetail");
String stackId = NotifyRendererUtils.getStackId(facesContext, component);
boolean escape = true;
if (component instanceof AbstractNotifyMessage) {
escape = ((AbstractNotifyMessage) component).isEscape();
}
if (component instanceof AbstractNotifyMessages) {
escape = ((AbstractNotifyMessages) component).isEscape();
}
//////////////////////////////////////////////////////////////////////
options.put("severity", message.getSeverity().getOrdinal());
//////////////////////////////////////////////////////////////////////
if (showSummary != null && showSummary) {
options.put("summary", escapeValue(message.getSummary(), escape));
}
if (showSummary != null && showDetail) {
options.put("detail", escapeValue(message.getDetail(), escape));
}
if (stackId != null && !stackId.isEmpty()) {
options.put("stackId", stackId);
}
}
{noformat}
which later is misinterpreted by the JS and sets it to the next higher severity level since MyFaces is not zero based.
> rich:notifyMessages CSS incorrect on MyFaces 2.x
> ------------------------------------------------
>
> Key: RF-13161
> URL: https://issues.jboss.org/browse/RF-13161
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-output
> Affects Versions: 4.2.3.Final, 4.2.4, 4.3.0.Final, 4.3.1, 4.3.2, 4.3.3
> Reporter: John Yeary
> Attachments: myfaces-rf-example.zip, RichfacesNotifyMessagesMyFaces.png
>
>
> The FacesMessage Severity levels do not match between Mojarra and MyFaces. As a result, the CSS styling for INFO messages are one level higher than they should be, and FATAL messages are unstyled.
> *Mojarra* - These represent values 0-3
> {noformat}
> /**
> * <p>Array of all defined values, ascending order of ordinal value.
> * Be sure you include any new instances created above, in the
> * same order.</p>
> */
> private static final Severity[] values =
> { SEVERITY_INFO, SEVERITY_WARN, SEVERITY_ERROR, SEVERITY_FATAL };
> {noformat}
> *MyFaces* - These represent values 1-4
> {noformat}
> /**
> * Message severity level indicating an informational message rather than an error.
> */
> public static final FacesMessage.Severity SEVERITY_INFO = new Severity("Info", 1);
> /**
> * Message severity level indicating that an error might have occurred.
> */
> public static final FacesMessage.Severity SEVERITY_WARN = new Severity("Warn", 2);
> /**
> * Message severity level indicating that an error has occurred.
> */
> public static final FacesMessage.Severity SEVERITY_ERROR = new Severity("Error", 3);
> /**
> * Message severity level indicating that a serious error has occurred.
> */
> public static final FacesMessage.Severity SEVERITY_FATAL = new Severity("Fatal", 4);
> {noformat}
> The *<rich:messages/>* component behaves correctly, and may be used as an alternative.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list