[
https://issues.apache.org/jira/browse/TOMAHAWK-1472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12836026#action_12836026
]
Leonardo Uribe commented on TOMAHAWK-1472:
------------------------------------------
After try a lot of alternatives, a custom component event named
PreRenderViewAddResourceEvent, called by a ViewHandlerWrapper instance at start
of renderView and it works without problem. The renderer looks like this:
@ListenerFor(systemEventClass=PreRenderViewAddResourceEvent.class)
public class HtmlTabbedPaneRenderer
extends HtmlRenderer implements ComponentSystemEventListener
{
public void processEvent(ComponentSystemEvent event)
{
HtmlPanelTabbedPane tabbedPane =
(HtmlPanelTabbedPane)event.getComponent();
if( tabbedPane.isClientSide() )
{
FacesContext facesContext = FacesContext.getCurrentInstance();
UIComponent outputScript = facesContext.getApplication().
createComponent(facesContext, "javax.faces.Output",
"javax.faces.resource.Script");
outputScript.getAttributes().put("name", "dynamicTabs.js");
outputScript.getAttributes().put("library",
"org.apache.myfaces.custom.tabbedpane");
outputScript.setTransient(true);
outputScript.setId(facesContext.getViewRoot().createUniqueId());
facesContext.getViewRoot().addComponentResource(facesContext,
outputScript);
.............
It is the easiest solution I can find. Now the next problem is component that
has javascriptLocation, imageLocation and styleLocation. This includes:
t:inputCalendar
t:jscookMenu
t:tree2
One option is create new attributes javascriptLibrary, imageLibrary and
styleLibrary and remove the previous ones (because if AddResource api will not
be used by tomahawk components and we will use the new JSF 2.0 api, there is no
point to have this one on the component class). If a user wants to upgrade, it
just put all resources on folder on a jar
(META-INF/resource/myImagesForThatComponent) or on
"resources/myImagesForThatComponent", configure the new attributes and that's
all.
Anyway I'll look a way to preserve the old attributes to prevent break existing
applications.
> 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.