dev@javaserverfaces.java.net

Facelets VDL.buildView drops programmatic component change

From: Martin Kočí <Martin.Koci_at_aura.cz>
Date: Mon, 16 Nov 2009 15:43:31 +0100

Hi,

i have a problem with Facelets2 (mojarra trunk) and component tree
manipulation:
in invoke application phase I switch two UIColumn in UIData (first
columns goes last atd.) and I expect that this change will survive save
state/restore state but it is not true. With some help of debugger it
seems that
com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FacesContext, UIViewRoot) reverts my component change back.

The process is: first request -> RenderResponse calls VDL.buildView (ok)
-> postback request > Restore View -> Invoke Application (listener
performs component tree manipulation) -> RenderResponse calls
VDL.buildView -> FaceletViewHandlingStrategy.buildView(FacesContext,
UIViewRoot) rebuilds UIData from .xhtml and drops UIColumn's order
change.

FaceletViewHandlingStrategy.buildView contain a intresting if as first
statement:

if (Util.isViewPopulated(ctx, view)) {
            return;
}

Isn't for this case view already populated from Restore State phase?
Probably it is and if I add Util.setViewPopulated in
ViewHandlingStrategy.restoreView it fixes my problem.

This problem is not present with JSP; with facelets only with partial
state saving=false.


Is it a bug?


Regards,

Martin Kočí