myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Punz <werner.p...@gmail.com>
Subject Re: JSF2 facelet question (Simon Lessard?)
Date Wed, 02 Sep 2009 08:29:52 GMT
Ok never mind I think I found the info in 3.6.2.1 Composite Component 
Metadata of the spec

I will work my way in from there.
Btw. one thing I am noticed for now is that there is no direct way to 
push in behaviors in child tag handlers. Especially since you do not 
know the nesting depth of the next behavior aware component.
And since the meta data api is only available for composite components 
for now we cannot work with it on that case.

We probably have to extend either our ComponentTagHandler class or our 
ComponentTagHandlerDelegate class to look for possible behaviors 
integrated into the components newly generated.

Here is a small case

<f:ajax event="onclick" render="bla">
	<h:commandButton id="button1" action="#{bean.action1}" />
	<h:commandButton id="button1" action="#{bean.action1}" />
</f:ajax>
Should attach the behavior to both components

now public void apply(FaceletContext faceletContext, UIComponent parent)
is responsible for creating the component.
As it is done only the current component is created which means
at the time the f:ajax tag is hit none of the two command buttons are 
created.

all you can do is to store a list of behaviors and then find a way to 
attach the behaviors via some outside functionality.

As I could see the extension point of all this probably would be
the ComponentTagHandlerFactory, but since we are in our own system
would it be possible maybe to extend our componenttaghandler impl class 
with some functionality? I am not so eager to program this into an 
extension point which might be overwritten by a user setting.

The idea would be to add a thread local to an impl class of the 
ComponentTagHandler which would get the additional behavior data.
Which then the component tag handler, in case of being a behavior holder
could attach to the component.

(Probably the onComponentCreated callback from the ComponentTagHandler 
would be the ideal place to place the code)


This also would mean whatever generates the ComponentTagHandler probably 
has to generate an impl class.

(Probably one of the core Facelet classes)
The other way would be the extension point over the delegate factory as 
I said, there we could work in a similar way.




Werner





Werner Punz schrieb:
> as it seems I have now the tag handler for the jsf:ajax tag on my back, 
> my main gripe are some details regarding the tag handler.
> 
> I mostly figured out most steps except one thing.
> 
> What I need is following
> 
> I have my tag handler being embedded in a composite component
> 
> <c:composite>
>     <f:ajax ... />
> </c:composite>
> 
> The main issue here is that if I use the ajax tag I have to attach it to 
> an event in most cases it is onclick
> which means if the composite has onClick defined I have to get a way
> to get references to the embedded components which reference onClick 
> event handler defined in the composite interface.
> Once I have references to the component or their respective tag handlers 
> I am set, then I can work my way in and attach the behavior as expected.
> 
> 
> Can anyone point me towards a way to get there?
> 
> 
> Werner
> 
> 


Mime
View raw message