2010/3/29 Martin Marinschek <mmarinsc...@apache.org>

> >
> > Now, the instants of time where PostAddToViewEvent is published are:
> >
> > - With Partial State Saving enabled
> >
> >    * When the view is build at first time.
> >    * In a postback when the view is build but before the state of the
> > component is restored.
> >
> > - With Partial State Saving disabled
> >
> >    * When the view is build at first time.
> >    * In a postback when the view is "refreshed", because all component
> nodes
> > are detached and attached to the tree. In other words, on render response
> > phase, vdl.buildView is called and in this case facelets algorithm add
> all
> > transient components (usually all html markup not saved), and to do that,
> it
> > detach and attach all components to be in right order. This also has some
> > other implications, like c:if tag depends on this to work correctly.
> >
> This sounds ugly. You are sure that this is the behaviour in both
> MyFaces and Mojarra. Here my 2cents:
>
>
I'm 100% sure this is the current behavior. If the issue with c:if and
partial
state saving was solved on mojarra, PSS = true should trigger
PostAddToViewEvent like PSS = false


> - Partial state saving should not make any difference at all (also in
> partial state saving, the template should be reapplied before
> rendering, see my other mail)
> - PostAddToViewEvent should be called always after a component has
> been added to the view fully, and all its state has been restored
>
>
I totally agree. Really it is necessary to add an event for relocate
components
on the tree when the view is build. In myfaces, when we started to integrate
facelets it was detected, so right now there exists a class called
PostBuildComponentTreeOnRestoreViewEvent. The problem to use this one
is it is inside myfaces impl jar, so if anyone wants to create a component
that requires relocation it will not be compatible with myfaces, so right
now
we are using the "standard" PostAddToView for this case.

I'll be more detailed about the conclusion I proposed on the first email.
What I want to be added on the spec is this:

- Create a new event (let's call it PostBuildViewEvent for the moment), that
is
propagated every time the view is build (when it is created, restored or
refreshed before render response). h:outputScript, h:outputStylesheet,
cc:insertChildren and cc:insertFacet should add a listener for this
event and handle all relocation code at response of this event.

- Fix PostAddToViewEvent/PreRemoveFromViewEvent publishing conditions.
In my opinion this ones should not be called when the view is "refreshed".
Martin suggestion about the publishing conditions are reasonable.

I have to remember this topic here:

 [jsr-314-open] add component resources depending on the owner component
state

If exists an event like PostBuildViewEvent, that event could solve this one
too
(we could have PostRefreshViewEvent extends PostBuildViewEvent).

with best regards,

Leonardo Uribe

Reply via email to