You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org> on 2010/01/28 22:03:34 UTC

[jira] Created: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Allow any child for f:event in the case of a PreRenderViewEvent
---------------------------------------------------------------

                 Key: MYFACES-2516
                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
            Reporter: Bernd Bohmann
            Assignee: Bernd Bohmann


f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806253#action_12806253 ] 

Bernd Bohmann commented on MYFACES-2516:
----------------------------------------

My code looks like this:

 UIComponent metadataFacet = parent.getFacet(UIViewRoot.METADATA_FACET_NAME);
            if (metadataFacet == null)
            {
                metadataFacet = ctx.getFacesContext().getApplication().createComponent(UIPanel.COMPONENT_TYPE);
                metadataFacet.setId(UIViewRoot.METADATA_FACET_NAME);
                metadataFacet.getAttributes().put(ComponentSupport.FACET_CREATED_UIPANEL_MARKER, true);
                parent.getFacets().put(UIViewRoot.METADATA_FACET_NAME, metadataFacet);
            }
            parent.getAttributes().put(FacetHandler.KEY, UIViewRoot.METADATA_FACET_NAME);
            try
            {
                this.nextHandler.apply(ctx, parent);
            }
            finally
            {
                parent.getAttributes().remove(FacetHandler.KEY);
            }

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Resolved: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bernd Bohmann resolved MYFACES-2516.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-beta-2

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Bernd Bohmann
>             Fix For: 2.0.0-beta-2
>
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806258#action_12806258 ] 

Matthias Weßendorf commented on MYFACES-2516:
---------------------------------------------

+1 yes, please commit it

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Bernd Bohmann
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806223#action_12806223 ] 

Bernd Bohmann commented on MYFACES-2516:
----------------------------------------

I see it.
If f:event is inside f:metadata i get a NullpointerException. The metadata facet of UIViewRoot is set after nextHandler.apply because of  ComponentHandler.isNew() should return true.
Where is the metadata contract defined? Which kind of tags are allowed in the metadata tag?


> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806241#action_12806241 ] 

Leonardo Uribe commented on MYFACES-2516:
-----------------------------------------

Ouch, that's true. To solve this one we have to change the current ViewMetadataHandler implementation.

The implementation of FacetHandler looks like this:

    public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {
        if (parent == null)
        {
            throw new TagException(this.tag, "Parent UIComponent was null");
        }
        parent.getAttributes().put(KEY, this.name.getValue(ctx));
        try
        {
            this.nextHandler.apply(ctx, parent);
        }
        finally
        {
            parent.getAttributes().remove(KEY);
        }
    }

There is no creation of panel here (it is done indirectly from ComponentTagHandlerDelegate). Maybe we can set and remove FacetHandler.KEY like in FacetHandler, also create a panel like it is present, then change the call of call

this.nextHandler.apply(ctx, parent);

instead

this.nextHandler.apply(ctx, metadataFacet);

And in theory that should work.

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806380#action_12806380 ] 

Leonardo Uribe commented on MYFACES-2516:
-----------------------------------------

Thanks Bernd for check it and commit that one. I'm glad that solution works.

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-alpha, 2.0.0-beta
>            Reporter: Bernd Bohmann
>            Assignee: Bernd Bohmann
>             Fix For: 2.0.0-beta-2
>
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806231#action_12806231 ] 

Leonardo Uribe commented on MYFACES-2516:
-----------------------------------------

In theory it is expected f:metadata could contains f:viewParam and f:event tags. UIViewParameter extends from UIInput, so it also f:viewParam could contains converter and validator tags. f:metadata is a facet with multiple components, so in theory inside UIViewRoot.METADATA_FACET_NAME there should be only one UIPanel (optional) and one or many UIViewParameter instances.

With the latest code (using ComponentSupport.getViewRoot), use f:event inside f:metadata should work without problem.

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806236#action_12806236 ] 

Bernd Bohmann commented on MYFACES-2516:
----------------------------------------

Have you try it?

I get a
 java.lang.NullPointerException
	at org.apache.myfaces.view.facelets.tag.jsf.core.EventHandler.apply(EventHandler.java:114)
	at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:51)
	at org.apache.myfaces.view.facelets.tag.jsf.core.ViewMetadataHandler.apply(ViewMetadataHandler.java:69)
	at org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:57)
	at org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:45)
	at org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:103)
	at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage$FaceletViewMetadata.createMetadataView(FaceletViewDeclarationLanguage.java:1854)
	at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:148)
	at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:138)

Once again 

You can not get the UIViewRoot from the parent in ComponentSupport.
The metadata facet of UIViewRoot is set after nextHandler.apply in ViewMetadataHandler because ComponentHandler.isNew() should return true in EventHandler.
 


> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806255#action_12806255 ] 

Bernd Bohmann commented on MYFACES-2516:
----------------------------------------

Should I commit?

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Issue Comment Edited: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806206#action_12806206 ] 

Bernd Bohmann edited comment on MYFACES-2516 at 1/29/10 4:13 AM:
-----------------------------------------------------------------

That is the reason why i don't apply the patch.

If f:event is a direct child of f:metadata you don't get the UIViewRoot from the parent or from the FacesContext.  

How we can get the ViewRoot in this case?


      was (Author: bommel):
    That is the reason why i don't apply the patch.
If f:event is not a direct child of UIViewRoot you don't get the UIViewRoot from the parent or the FacesContext. 
Should we file an issue agains the spec?

Without setting the ViewRoot you get a NullpointerException.
  
> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806244#action_12806244 ] 

Leonardo Uribe commented on MYFACES-2516:
-----------------------------------------

The final code looks like this:

            UIComponent metadataFacet = parent.getFacet(UIViewRoot.METADATA_FACET_NAME);
            if (metadataFacet == null)
            {
                metadataFacet = ctx.getFacesContext().
                    getApplication().createComponent(UIPanel.COMPONENT_TYPE);
                metadataFacet.setId(UIViewRoot.METADATA_FACET_NAME);
                parent.getFacets().put(UIViewRoot.METADATA_FACET_NAME, metadataFacet);
            }
            parent.getAttributes().put(FacetHandler.KEY, UIViewRoot.METADATA_FACET_NAME);
            try
            {
                this.nextHandler.apply(ctx, parent);
            }
            finally
            {
                parent.getAttributes().remove(FacetHandler.KEY);
            }

Does that work?

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806185#action_12806185 ] 

Leonardo Uribe commented on MYFACES-2516:
-----------------------------------------

This patch changes the way it is setViewRoot is called. I don't think we can apply that part as is, because the algorithm to setViewRoot is clear (see RestoreViewExecutor and section 2.2 of jsf 2.0 spec)

Anyway, I think it is valid apply the remaining part of the patch so I'll commit that one.

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Bernd Bohmann
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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


[jira] Commented: (MYFACES-2516) Allow any child for f:event in the case of a PreRenderViewEvent

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806212#action_12806212 ] 

Leonardo Uribe commented on MYFACES-2516:
-----------------------------------------

Note the committed code uses ComponentSupport.getViewRoot instead facesContext.getViewRoot(). If f:event is inside f:metadata we don't have a NullpointerException, but if we have f:event inside a component inside f:metadata we have it. Does this apply for your use case?

> Allow any child for f:event in the case of a PreRenderViewEvent
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2516
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2516
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>            Reporter: Bernd Bohmann
>            Assignee: Leonardo Uribe
>         Attachments: MYFACES-2516.patch
>
>
> f:event currently only supports the UIViewRoot as a child for the PreRenderViewEvent

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