You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2010/02/18 23:16:27 UTC

[jira] Commented: (TOMAHAWK-1472) Add Support for new Resource API in tomahawk 2.0 module

    [ https://issues.apache.org/jira/browse/TOMAHAWK-1472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12835438#action_12835438 ] 

Leonardo Uribe commented on TOMAHAWK-1472:
------------------------------------------

Trying to do this issue I found the following use case (all this snippets happens on renderers)

        if( tabbedPane.isClientSide() ){
                addResource.addJavaScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, HtmlTabbedPaneRenderer.class, "dynamicTabs.js");

This one is similar:

        if (schedule.isTooltip())
        {
            addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN,
                    HtmlSchedule.class, "javascript/alphaAPI.js");

Or this one:

        if (DEFAULT_THEME.equals(theme) || OUTLOOK_THEME.equals(theme)
                || EVOLUTION_THEME.equals(theme))
        {
            addResource.addStyleSheet(context, AddResource.HEADER_BEGIN,
                    HtmlSchedule.class, CSS_RESOURCE);
        }


The new JSF 2.0 Resource Api does not support conditional rendering for resources out of the box. To solve this one, we need the resource has a reference or a way to find the owner resource and check this condition when it is rendered. That means we need a custom resource renderer that check the condition.

Note the condition originally is evaluated each time on render response time, but the new JSF 2.0 Resource Api requires all resources were added before that. We don't have an event that gives the chance to register it before render response.

Other option is copy the value or ValueExpression required in the condition on the resource component, but this does not look good.

We have to try another alternative (a custom component event?), but it is not still clear how to do that.

> Add Support for new Resource API in tomahawk 2.0 module
> -------------------------------------------------------
>
>                 Key: TOMAHAWK-1472
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1472
>             Project: MyFaces Tomahawk
>          Issue Type: Task
>            Reporter: Leonardo Uribe
>


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