Coverage Report - org.seasar.teeda.core.util.FacesContextUtil
 
Classes in this File Line Coverage Branch Coverage Complexity
FacesContextUtil
40%
4/10
N/A
1
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.teeda.core.util;
 17  
 
 18  
 import java.util.Locale;
 19  
 
 20  
 import javax.faces.application.StateManager;
 21  
 import javax.faces.application.ViewHandler;
 22  
 import javax.faces.context.FacesContext;
 23  
 
 24  
 import org.seasar.framework.util.AssertionUtil;
 25  
 
 26  
 /**
 27  
  * @author shot
 28  
  * 
 29  
  */
 30  
 public class FacesContextUtil {
 31  
 
 32  0
     private FacesContextUtil() {
 33  0
     }
 34  
 
 35  
     public static Locale getLocale() {
 36  0
         return getLocale(FacesContext.getCurrentInstance());
 37  
     }
 38  
 
 39  
     public static Locale getLocale(FacesContext context) {
 40  0
         return context.getViewRoot().getLocale();
 41  
     }
 42  
 
 43  
     public static ViewHandler getViewHandler() {
 44  0
         return getViewHandler(FacesContext.getCurrentInstance());
 45  
     }
 46  
 
 47  
     public static ViewHandler getViewHandler(FacesContext context) {
 48  31
         AssertionUtil.assertNotNull("FacesContext", context);
 49  31
         return context.getApplication().getViewHandler();
 50  
     }
 51  
 
 52  
     public static StateManager getStateManager() {
 53  0
         return getStateManager(FacesContext.getCurrentInstance());
 54  
     }
 55  
 
 56  
     public static StateManager getStateManager(FacesContext context) {
 57  9
         AssertionUtil.assertNotNull("FacesContext", context);
 58  9
         return context.getApplication().getStateManager();
 59  
     }
 60  
 }