[JAVASERVERFACES_SPEC_PUBLIC-1135] Add PostRenderViewEvent Created: 04/Oct/12  Updated: 25/Feb/15  Resolved: 25/Feb/15

Status: Resolved
Project: javaserverfaces-spec-public
Component/s: Lifecycle
Affects Version/s: None
Fix Version/s: 2.3

Type: New Feature Priority: Major
Reporter: arjan tijms Assignee: Manfred Riem
Resolution: Fixed Votes: 5
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File changebundle.txt     Text File i_spec_1135-draft.patch     Zip Archive newfiles.zip    
Issue Links:
Blocks
is blocked by JAVASERVERFACES-3747 Implement JAVASERVERFACES_SPEC_PUBLIC... Closed

 Description   

In JSF 2.0 a PreRenderViewEvent was added that is published just before a view is rendered, but there's no corresponding event published just after rendering a view.

There are several alternatives for this, but none of them is really perfect. A per-view PhaseListener can be used, but it fires relatively early and sticks around after a post-back which may be undesirable. A global PhaseListener that picks up a delegating listener in request scope is another option that does work, but is not as intuitively clear (we use this approach in OmniFaces' CallbackPhaseListener).

I therefor propose to add a PostRenderViewEvent that is published right after a view is rendered.

Among the use cases for such an event is doing per request clean-ups; for instance a view scoped backing bean where a value is set such that for one particular request an item is rendered with some emphasis and then after the first post-back rendered normally again.



 Comments   
Comment by arjan tijms [ 04/Oct/12 ]

Draft of PostRenderViewEvent implementation including rudimentary test.

Comment by kithouna [ 07/Mar/13 ]

Would be great if this can still be put in JSF 2.2. Seems to be a very trivial thing.

Comment by kithouna [ 14/Mar/13 ]

On second thoughs, don't add this to JSF 2.2 for the mere reason that the team should focus 100% on polishing and finishing work that has already started and should not do anything new for 2.2.

For 2.3 this would be really great though

Comment by Ed Burns [ 01/Aug/14 ]

Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

Comment by Manfred Riem [ 01/Aug/14 ]

Setting priority to Major

Comment by Manfred Riem [ 02/Feb/15 ]

Implementation changes have been applied. See the associated implementation issue.

Arjan, please review the specification PDF to see if there is additional information to be added from a specification perspective.

Thanks!

Comment by arjan tijms [ 24/Feb/15 ]

Section 2.2.6 now contains the following:

Upon completion of rendering, the completed state of the view must have been saved using the methods of the class StateManager. This state information must be made accessible on a subsequent request, so that the Restore View can access it.[P1-end]

I propose to change this to:

Upon completion of rendering, the completed state of the view must have been saved using the methods of the class StateManager. This state information must be made accessible on a subsequent request, so that the Restore View can access it.

Publish the javax.faces.event.PostRenderViewEvent. (generally this is directly after the call to ViewHandler.renderView())
[P1-end]

Section 3.4.3.1 now contains the following:

PreRenderComponentEvent indicates that the source component is about to be rendered. Please see Section 3.1.7 “Component Tree Manipulation” for a reference to the normative specification.

PreRenderViewEvent indicates that the UIViewRoot source component is about to be rendered. Please see Section 2.2.6 “Render Response” for the normative specification.

PreValidateEvent indicates that an individual component instance is about to be validated. Please see the EditableValueHolder Section 3.2.7.3 “Events” for the normative specification.

I propose to change this to:

PreRenderComponentEvent indicates that the source component is about to be rendered. Please see Section 3.1.7 “Component Tree Manipulation” for a reference to the normative specification.

PreRenderViewEvent indicates that the UIViewRoot source component is about to be rendered. Please see Section 2.2.6 “Render Response” for the normative specification.

PostRenderViewEvent indicates that the UIViewRoot source component has just been rendered. Please see Section 2.2.6 “Render Response” for the normative specification.

PreValidateEvent indicates that an individual component instance is about to be validated. Please see the EditableValueHolder Section 3.2.7.3 “Events” for the normative specification.

Comment by Manfred Riem [ 25/Feb/15 ]

Applied to 2.3 trunk,

svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1135, Add PostRenderViewEvent"
Sending spec/frame/requestProcessingLifecycle.fm
Sending spec/frame/userInterfaceComponentModel.fm
Transmitting file data ..
Committed revision 1160.

Generated at Tue Mar 28 15:00:58 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.