1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
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 | |
|
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 | |
} |