1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package javax.faces.component; |
20 | |
|
21 | |
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent; |
22 | |
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
@JSFComponent |
29 | |
public class UIOutcomeTarget extends UIOutput |
30 | |
{ |
31 | |
public static final String COMPONENT_TYPE = "javax.faces.OutcomeTarget"; |
32 | |
public static final String COMPONENT_FAMILY = "javax.faces.OutcomeTarget"; |
33 | |
|
34 | |
private static final boolean DEFAULT_INCLUDEVIEWPARAMS = false; |
35 | |
|
36 | |
public UIOutcomeTarget() |
37 | |
{ |
38 | 0 | super(); |
39 | 0 | setRendererType("javax.faces.Link"); |
40 | 0 | } |
41 | |
|
42 | |
public String getFamily() |
43 | |
{ |
44 | 0 | return COMPONENT_FAMILY; |
45 | |
} |
46 | |
|
47 | |
@JSFProperty |
48 | |
public String getOutcome() |
49 | |
{ |
50 | 0 | String outcome = (String) getStateHelper().eval(PropertyKeys.outcome); |
51 | |
|
52 | 0 | if(outcome == null && isInView()) |
53 | |
{ |
54 | 0 | return getFacesContext().getViewRoot().getViewId(); |
55 | |
} |
56 | |
|
57 | 0 | return outcome; |
58 | |
} |
59 | |
|
60 | |
public void setOutcome(String outcome) |
61 | |
{ |
62 | 0 | getStateHelper().put(PropertyKeys.outcome, outcome); |
63 | 0 | } |
64 | |
|
65 | |
@JSFProperty(defaultValue="false") |
66 | |
public boolean isIncludeViewParams() |
67 | |
{ |
68 | 0 | return (Boolean) getStateHelper().eval(PropertyKeys.includeViewParams, DEFAULT_INCLUDEVIEWPARAMS); |
69 | |
} |
70 | |
|
71 | |
public void setIncludeViewParams(boolean includeViewParams) |
72 | |
{ |
73 | 0 | getStateHelper().put(PropertyKeys.includeViewParams, includeViewParams); |
74 | 0 | } |
75 | |
|
76 | 0 | enum PropertyKeys { |
77 | 0 | includeViewParams, |
78 | 0 | outcome |
79 | |
} |
80 | |
} |