1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package javax.faces.model; |
20 | |
|
21 | |
import java.io.Serializable; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
public class SelectItem implements Serializable |
27 | |
{ |
28 | |
private static final long serialVersionUID = 8841094741464512226L; |
29 | |
|
30 | |
private Object _value; |
31 | |
private String _label; |
32 | |
private String _description; |
33 | |
private boolean _disabled; |
34 | |
private boolean _escape; |
35 | |
private boolean _noSelectionOption; |
36 | |
|
37 | |
|
38 | |
public SelectItem() |
39 | |
{ |
40 | 0 | this(null); |
41 | 0 | } |
42 | |
|
43 | |
public SelectItem(Object value) |
44 | |
{ |
45 | 0 | this(value, value == null ? null : value.toString()); |
46 | 0 | } |
47 | |
|
48 | |
public SelectItem(Object value, String label) |
49 | |
{ |
50 | 0 | this(value, label, null); |
51 | 0 | } |
52 | |
|
53 | |
public SelectItem(Object value, String label, String description) |
54 | |
{ |
55 | 0 | this(value, label, description, false); |
56 | 0 | } |
57 | |
|
58 | |
public SelectItem(Object value, String label, String description, boolean disabled) |
59 | |
{ |
60 | 0 | this(value, label, description, disabled, true); |
61 | 0 | } |
62 | |
|
63 | |
public SelectItem(Object value, String label, String description, boolean disabled, boolean escape) |
64 | |
{ |
65 | 0 | this(value, label, description, disabled, escape, false); |
66 | 0 | } |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, |
80 | |
boolean noSelectionOption) |
81 | 84 | { |
82 | 84 | _value = value; |
83 | 84 | _label = label; |
84 | 84 | _description = description; |
85 | 84 | _disabled = disabled; |
86 | 84 | _escape = escape; |
87 | 84 | _noSelectionOption = noSelectionOption; |
88 | 84 | } |
89 | |
|
90 | |
|
91 | |
public String getDescription() |
92 | |
{ |
93 | 0 | return _description; |
94 | |
} |
95 | |
|
96 | |
public String getLabel() |
97 | |
{ |
98 | 0 | return _label; |
99 | |
} |
100 | |
|
101 | |
public Object getValue() |
102 | |
{ |
103 | 88 | return _value; |
104 | |
} |
105 | |
|
106 | |
public boolean isDisabled() |
107 | |
{ |
108 | 0 | return _disabled; |
109 | |
} |
110 | |
|
111 | |
public boolean isEscape() |
112 | |
{ |
113 | 0 | return _escape; |
114 | |
} |
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | |
public boolean isNoSelectionOption() |
123 | |
{ |
124 | 14 | return _noSelectionOption; |
125 | |
} |
126 | |
|
127 | |
public void setDescription(String description) |
128 | |
{ |
129 | 0 | _description = description; |
130 | 0 | } |
131 | |
|
132 | |
public void setDisabled(boolean disabled) |
133 | |
{ |
134 | 0 | _disabled = disabled; |
135 | 0 | } |
136 | |
|
137 | |
public void setEscape(boolean escape) |
138 | |
{ |
139 | 0 | _escape = escape; |
140 | 0 | } |
141 | |
|
142 | |
public void setLabel(String label) |
143 | |
{ |
144 | 0 | if (label == null) |
145 | |
{ |
146 | 0 | throw new NullPointerException("label"); |
147 | |
} |
148 | 0 | _label = label; |
149 | 0 | } |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
public void setNoSelectionOption(boolean noSelectionOption) |
158 | |
{ |
159 | 0 | _noSelectionOption = noSelectionOption; |
160 | 0 | } |
161 | |
|
162 | |
public void setValue(Object value) |
163 | |
{ |
164 | 0 | _value = value; |
165 | 0 | } |
166 | |
|
167 | |
} |