[ 
https://issues.apache.org/jira/browse/MYFACES-1790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559686#action_12559686
 ] 

Leonardo Uribe commented on MYFACES-1790:
-----------------------------------------

Hi

Checking one test for h:column headerClass and footerClass (a test for see if  
issue 4 of JSR 252), after MYFACES-1790 previous fixes
does not work.

The change from javax.faces.HtmlColumn to javax.faces.Column let this code on 
shared without effect:

org.apache.myfaces.shared.renderkit.html.HtmlTableRendererBase

    protected void renderColumnChildHeaderOrFooterRow(FacesContext facesContext,
        ResponseWriter writer, UIComponent uiComponent, String styleClass, 
boolean isHeader) throws IOException
    {
        if (uiComponent instanceof UIColumn)
        {
            // allow column to override style class, new in JSF 1.2
            if (uiComponent instanceof HtmlColumn) {
                HtmlColumn column = (HtmlColumn)uiComponent;
                if (isHeader && column.getHeaderClass()!=null)
                    styleClass = column.getHeaderClass();
                else if (!isHeader && column.getFooterClass()!=null)
                    styleClass = column.getFooterClass();
            }

            .........


I don't like what spec says (it's just my opinion), because in runtime 
HtmlColumn is never used!.

Testing this against facelets, this library creates UIColumn instances.

Anyway the solution is to make this:

    protected void renderColumnChildHeaderOrFooterRow(FacesContext facesContext,
        ResponseWriter writer, UIComponent uiComponent, String styleClass, 
boolean isHeader) throws IOException
    {
        if (uiComponent instanceof UIColumn)
        {
            // allow column to override style class, new in JSF 1.2
            if (uiComponent instanceof HtmlColumn) {
                HtmlColumn column = (HtmlColumn)uiComponent;
                if (isHeader && column.getHeaderClass()!=null)
                    styleClass = column.getHeaderClass();
                else if (!isHeader && column.getFooterClass()!=null)
                    styleClass = column.getFooterClass();
            }else{
                //This code corrects MYFACES-1790, because HtmlColumnTag
                //has as component type javax.faces.Column, so as side
                //effect it not create HtmlColumn, it create UIColumn
                //classes.
                UIColumn column = (UIColumn) uiComponent;                
                if (isHeader){
                    String headerClass = (String) 
column.getAttributes().get("headerClass");
                    if (headerClass != null){
                        styleClass = (String) headerClass;
                    }
                }else{
                    String footerClass = (String) 
column.getAttributes().get("footerClass");
                    if (footerClass != null){
                        styleClass = (String) footerClass;
                    }
                }
            }

           ......................

I have tested this in both environments (pure myfaces and facelets) and works 
well.


> HtmlColumnTag.getComponentType returns the wrong value
> ------------------------------------------------------
>
>                 Key: MYFACES-1790
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1790
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>            Reporter: Cameron Bateman
>            Assignee: Matthias Weßendorf
>             Fix For: 1.2.1
>
>
> According to the spec, the component type of the default h:column tag is 
> supposed to be "javax.faces.Column", however HtmlColumnTag returns 
> "javax.faces.HtmlColumn".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to