KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > renderkit > html > util > AutoScrollPhaseListener


1 package org.apache.myfaces.renderkit.html.util;
2
3 /**
4  * @author Manfred Geiler (latest modification by $Author: matze $)
5  * @version $Revision: 1.2 $ $Date: 2004/10/13 11:51:01 $
6  */

7
8 import javax.faces.context.FacesContext;
9 import javax.faces.event.PhaseEvent;
10 import javax.faces.event.PhaseId;
11 import javax.faces.event.PhaseListener;
12
13 /**
14  * This Phase listener is necessary for the autoscroll feature.
15  * Its only purpose is to determine the former viewId and store it in request scope
16  * so that we can later determine if a navigation has happened during rendering.
17  */

18 public class AutoScrollPhaseListener
19         implements PhaseListener
20 {
21     //private static final Log log = LogFactory.getLog(AutoScrollPhaseListener.class);
22

23     public PhaseId getPhaseId()
24     {
25         return PhaseId.RESTORE_VIEW;
26     }
27
28     public void beforePhase(PhaseEvent event)
29     {
30     }
31
32     public void afterPhase(PhaseEvent event)
33     {
34         FacesContext facesContext = event.getFacesContext();
35         String JavaDoc viewId = facesContext.getViewRoot().getViewId();
36         if (viewId != null)
37         {
38             JavascriptUtils.setOldViewId(facesContext.getExternalContext(), viewId);
39         }
40     }
41
42 }
43
Popular Tags