1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package javax.faces.component; |
17 | |
|
18 | |
import javax.faces.context.FacesContext; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
public class UIMessage extends UIComponentBase { |
25 | |
|
26 | |
public static final String COMPONENT_FAMILY = "javax.faces.Message"; |
27 | |
|
28 | |
public static final String COMPONENT_TYPE = "javax.faces.Message"; |
29 | |
|
30 | |
private static final String DEFAULT_RENDER_TYPE = "javax.faces.Message"; |
31 | |
|
32 | 231 | private String forTarget = null; |
33 | |
|
34 | 231 | private boolean showDetail = true; |
35 | |
|
36 | 231 | private boolean showDetailSet = false; |
37 | |
|
38 | 231 | private boolean showSummary = false; |
39 | |
|
40 | 231 | private boolean showSummarySet = false; |
41 | |
|
42 | 231 | public UIMessage() { |
43 | 231 | setRendererType(DEFAULT_RENDER_TYPE); |
44 | 231 | } |
45 | |
|
46 | |
public String getFamily() { |
47 | 24 | return COMPONENT_FAMILY; |
48 | |
} |
49 | |
|
50 | |
public String getFor() { |
51 | 30 | if (forTarget != null) { |
52 | 27 | return forTarget; |
53 | |
} |
54 | 3 | return (String) ComponentUtil_.getValueBindingValue(this, "for"); |
55 | |
} |
56 | |
|
57 | |
public void setFor(String newFor) { |
58 | 43 | forTarget = newFor; |
59 | 43 | } |
60 | |
|
61 | |
public boolean isShowDetail() { |
62 | 29 | if (showDetailSet) { |
63 | 6 | return showDetail; |
64 | |
} |
65 | 23 | Object value = ComponentUtil_.getValueBindingValue(this, "showDetail"); |
66 | 23 | return (value != null) ? Boolean.TRUE.equals(value) : showDetail; |
67 | |
} |
68 | |
|
69 | |
public void setShowDetail(boolean isShowDetail) { |
70 | 6 | showDetail = isShowDetail; |
71 | 6 | showDetailSet = true; |
72 | 6 | } |
73 | |
|
74 | |
public boolean isShowSummary() { |
75 | 29 | if (showSummarySet) { |
76 | 8 | return showSummary; |
77 | |
} |
78 | 21 | Object value = ComponentUtil_.getValueBindingValue(this, "showSummary"); |
79 | 21 | return (value != null) ? Boolean.TRUE.equals(value) : showSummary; |
80 | |
} |
81 | |
|
82 | |
public void setShowSummary(boolean showSummary) { |
83 | 8 | this.showSummary = showSummary; |
84 | 8 | showSummarySet = true; |
85 | 8 | } |
86 | |
|
87 | |
public void restoreState(FacesContext context, Object state) { |
88 | 4 | Object[] values = (Object[]) state; |
89 | 4 | super.restoreState(context, values[0]); |
90 | 4 | forTarget = (String) values[1]; |
91 | 4 | showDetail = ComponentUtil_.convertToPrimitiveBoolean(values[2]); |
92 | 4 | showDetailSet = ComponentUtil_.convertToPrimitiveBoolean(values[3]); |
93 | 4 | showSummary = ComponentUtil_.convertToPrimitiveBoolean(values[4]); |
94 | 4 | showSummarySet = ComponentUtil_.convertToPrimitiveBoolean(values[5]); |
95 | 4 | } |
96 | |
|
97 | |
public Object saveState(FacesContext context) { |
98 | 6 | Object[] values = new Object[6]; |
99 | 6 | values[0] = super.saveState(context); |
100 | 6 | values[1] = forTarget; |
101 | 6 | values[2] = ComponentUtil_.convertToBoolean(showDetail); |
102 | 6 | values[3] = ComponentUtil_.convertToBoolean(showDetailSet); |
103 | 6 | values[4] = ComponentUtil_.convertToBoolean(showSummary); |
104 | 6 | values[5] = ComponentUtil_.convertToBoolean(showSummarySet); |
105 | 6 | return values; |
106 | |
} |
107 | |
|
108 | |
} |