[ 
http://issues.apache.org/jira/browse/MYFACES-444?page=comments#action_12320031 
] 

Ken Weiner commented on MYFACES-444:
------------------------------------

You're right, the spec is contradictory.  I posted this issue based on the 
tooltip description and failed to see the section that you pointed out.

This is what they do in the RI's MessageRenderer:

        Object tooltip = component.getAttributes().get("tooltip");
        boolean isTooltip = false;
        if (tooltip instanceof Boolean) {
            //if it's not a boolean can ignore it
            isTooltip = ((Boolean) tooltip).booleanValue();
        }

        boolean wroteTooltip = false;
        if (showSummary && showDetail && isTooltip) {

            if (!wroteSpan) {
                writer.startElement("span", component);
            }
            writer.writeAttribute("title", summary, "title");
            writer.flush();
            writer.writeText("\t", null);
            wroteTooltip = true;
        } else if (wroteSpan) {
            writer.flush();
        }

        if (!wroteTooltip && showSummary) {
            writer.writeText("\t", null);
            writer.writeText(summary, null);
            writer.writeText(" ", null);
        }
        if (showDetail) {
            writer.writeText(detail, null);
        }

        if (wroteSpan || wroteTooltip) {
            writer.endElement("span");
        }

So it seems like the tooltip should be the summary if showSummary is true, 
otherwise the detail if showDetail is true (if we follow the RI code and the 
rendering paragraph from the javadoc.  In this case, the description of what 
tooltip does in the javadoc needs to change.

Why doesn't the actual JSF spec address this?  Is the wording in the javadoc 
considered part of the spec?

I'm still confused about what should happen if the title attribute is set. Does 
it take presidence over both the summary and detail?

> HtmlMessageRendererBase renders tooltip as message summary rather than detail
> -----------------------------------------------------------------------------
>
>          Key: MYFACES-444
>          URL: http://issues.apache.org/jira/browse/MYFACES-444
>      Project: MyFaces
>         Type: Bug
>   Components: JSF 1.1
>     Versions: 1.0.9 beta
>     Reporter: Ken Weiner
>     Assignee: Martin Marinschek

>
> The tooltip attribute description on 
> http://java.sun.com/j2ee/javaserverfaces/1.1/docs/tlddocs/h/message.html says 
> that the tooltip content should be composed of the message detail text.  
> However, the tooltip content in MyFaces is getting set to the message summary 
> text.  This happens in HtmlMessageRendererBase in the 
> renderSingleFacesMessage() method.  The code sets the title to the summary if 
> the tooltip is enabled.  Otherwise it uses the title attribute:
>         String summary = getSummary(facesContext, message, facesMessage, 
> messageClientId);
>         String detail = getDetail(facesContext, message, facesMessage, 
> messageClientId);
>         String title = getTitle(message);
>         boolean tooltip = isTooltip(message);
>         if (title == null && tooltip)
>         {
>             title = summary;
>         }
> Instead it should use the detail as follows:
>         String summary = getSummary(facesContext, message, facesMessage, 
> messageClientId);
>         String detail = getDetail(facesContext, message, facesMessage, 
> messageClientId);
>         String title = getTitle(message);
>         boolean tooltip = isTooltip(message);
>         if (title == null && tooltip)
>         {
>             title = detail;
>         }
> It might be argued that the tooltip should be set to the detail regardless of 
> whether the title attribute is set at all since the description of the title 
> attribute is "Advisory title information about markup elements generated for 
> this component."  If that is the case then the code should look like this:
>         String summary = getSummary(facesContext, message, facesMessage, 
> messageClientId);
>         String detail = getDetail(facesContext, message, facesMessage, 
> messageClientId);
>         String title = getTitle(message);
>         boolean tooltip = isTooltip(message);
>         if (tooltip)
>         {
>             title = detail;
>         }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to