View Javadoc

1   /*
2    * $Id: BasicInitializationState.java,v 1.2 2007/04/30 08:28:57 oeuillot Exp $
3    */
4   package org.rcfaces.core.internal.component;
5   
6   import javax.faces.context.FacesContext;
7   
8   import org.rcfaces.core.internal.listener.CameliaPhaseListener;
9   
10  /**
11   * 
12   * @author Olivier Oeuillot (latest modification by $Author: oeuillot $)
13   * @version $Revision: 1.2 $ $Date: 2007/04/30 08:28:57 $
14   */
15  public class BasicInitializationState implements IInitializationState {
16  
17      private FacesContext facesContext;
18  
19      private Boolean isConstructionState;
20  
21      public boolean isConstructionState() {
22          if (isConstructionState != null) {
23              return isConstructionState.booleanValue();
24          }
25  
26          FacesContext facesContext = getFacesContext();
27  
28          boolean ret = (CameliaPhaseListener.isRestoreViewPhase(facesContext) == false);
29  
30          isConstructionState = Boolean.valueOf(ret);
31  
32          return ret;
33      }
34  
35      public FacesContext getFacesContext() {
36          if (facesContext != null) {
37              return facesContext;
38          }
39  
40          facesContext = FacesContext.getCurrentInstance();
41          return facesContext;
42      }
43  
44  }