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.ViewHandler; |
21 | |
import javax.faces.context.FacesContext; |
22 | |
|
23 | |
import org.seasar.framework.util.AssertionUtil; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
public class ViewHandlerUtil { |
29 | |
|
30 | 0 | private ViewHandlerUtil() { |
31 | 0 | } |
32 | |
|
33 | |
public static String getActionURL(FacesContext context) { |
34 | 0 | AssertionUtil.assertNotNull("FacesContext", context); |
35 | 0 | return getActionURL(context, context.getViewRoot().getViewId()); |
36 | |
} |
37 | |
|
38 | |
public static String getActionURL(FacesContext context, String viewId) { |
39 | 0 | AssertionUtil.assertNotNull("FacesContext", context); |
40 | 0 | ViewHandler handler = FacesContextUtil.getViewHandler(context); |
41 | 0 | return handler.getActionURL(context, viewId); |
42 | |
} |
43 | |
|
44 | |
public static Locale getLocale() { |
45 | 4 | return getLocale(FacesContext.getCurrentInstance()); |
46 | |
} |
47 | |
|
48 | |
public static Locale getLocale(FacesContext context) { |
49 | 4 | ViewHandler viewHandler = FacesContextUtil.getViewHandler(context); |
50 | 4 | return viewHandler.calculateLocale(context); |
51 | |
} |
52 | |
|
53 | |
} |