[jsr-314-open-mirror] [jsr-314-open] Cannot call UIComponent.getCurrentComponent() from UIComponent.restoreState() or UIComponent.saveState()

Andy Schwartz andy.schwartz at oracle.com
Tue May 11 07:08:33 EDT 2010


Hey Leonardo -

> To restore the "component" reference required, both implementations 
> call UIComponent.getCurrentComponent() and both call processEvent but 
> for the parent!.

Interesting...  I recently spent some time reading through your earlier 
"PostAddToViewEvent publishing conditions" thread and as a result 
playing around with PostAddToViewEvents.   I noticed that if I implement 
a custom component with a PostAddToViewEvent listener, eg:

> @ListenerFor(systemEventClass=PostAddToViewEvent.class)
> @FacesComponent("foo.PostAddTester")
> public class PostAddTester extends UIComponentBase implements 
> ComponentSystemEventListener {
>

During the initial request, the event is delivered to my custom 
component.  However, after a postback, the event is instead delivered to 
the custom component's parent.

I was hoping to find some time to try to track this down and log it 
(didn't realize it was a spec issue - figured implementation bug), but 
you beat me to it!

I agree with you that the current component should be in context when 
saveState()/restoreState() are called.  It is interesting that 
processSaveState()/processRestoreState() behave differently from the 
other process* methods.  Makes me wonder whether this was done 
intentionally.  Anyone know?

Do you want to log a spec issue?  If so, let me know the issue # - I can 
also upload my little test case that demonstrates the problem.

Andy






More information about the jsr-314-open-mirror mailing list