1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.internal.component.Properties;
4 import org.rcfaces.core.component.CheckButtonComponent;
5 import org.rcfaces.core.component.familly.IContentAccessors;
6 import org.apache.commons.logging.LogFactory;
7 import javax.faces.context.FacesContext;
8 import org.rcfaces.core.internal.tools.ImageAccessorTools;
9 import org.rcfaces.core.component.capability.IHorizontalTextPositionCapability;
10 import javax.faces.convert.Converter;
11 import javax.el.ValueExpression;
12 import java.util.HashSet;
13 import org.apache.commons.logging.Log;
14 import java.util.Set;
15 import java.util.Arrays;
16 import org.rcfaces.core.component.familly.IImageButtonFamilly;
17 import org.rcfaces.core.internal.converter.TextPositionConverter;
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 public class ImageCheckButtonComponent extends CheckButtonComponent implements
53 IImageButtonFamilly {
54
55 private static final Log LOG = LogFactory.getLog(ImageCheckButtonComponent.class);
56
57 public static final String COMPONENT_TYPE="org.rcfaces.core.imageCheckButton";
58
59 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CheckButtonComponent.CAMELIA_ATTRIBUTES);
60 static {
61 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"disabledImageURL","imageHeight","text","borderType","textPosition","hoverImageURL","tabIndex","selectedImageURL","selectionListener","readOnly","border","imageURL","disabled","imageWidth"}));
62 }
63 protected static final String CAMELIA_VALUE_ALIAS="selected";
64
65 public ImageCheckButtonComponent() {
66 setRendererType(COMPONENT_TYPE);
67 }
68
69 public ImageCheckButtonComponent(String componentId) {
70 this();
71 setId(componentId);
72 }
73
74 protected Converter getTextPositionConverter() {
75
76
77 return TextPositionConverter.SINGLETON;
78
79 }
80
81 public java.lang.String getImageURL() {
82 return getImageURL(null);
83 }
84
85
86
87
88 public java.lang.String getImageURL(javax.faces.context.FacesContext facesContext) {
89 return engine.getStringProperty(Properties.IMAGE_URL, facesContext);
90 }
91
92
93
94
95
96 public final boolean isImageURLSetted() {
97 return engine.isPropertySetted(Properties.IMAGE_URL);
98 }
99
100 public void setImageURL(java.lang.String imageURL) {
101 engine.setProperty(Properties.IMAGE_URL, imageURL);
102 }
103
104 public java.lang.String getDisabledImageURL() {
105 return getDisabledImageURL(null);
106 }
107
108
109
110
111 public java.lang.String getDisabledImageURL(javax.faces.context.FacesContext facesContext) {
112 return engine.getStringProperty(Properties.DISABLED_IMAGE_URL, facesContext);
113 }
114
115
116
117
118
119 public final boolean isDisabledImageURLSetted() {
120 return engine.isPropertySetted(Properties.DISABLED_IMAGE_URL);
121 }
122
123 public void setDisabledImageURL(java.lang.String disabledImageURL) {
124 engine.setProperty(Properties.DISABLED_IMAGE_URL, disabledImageURL);
125 }
126
127 public java.lang.String getHoverImageURL() {
128 return getHoverImageURL(null);
129 }
130
131
132
133
134 public java.lang.String getHoverImageURL(javax.faces.context.FacesContext facesContext) {
135 return engine.getStringProperty(Properties.HOVER_IMAGE_URL, facesContext);
136 }
137
138
139
140
141
142 public final boolean isHoverImageURLSetted() {
143 return engine.isPropertySetted(Properties.HOVER_IMAGE_URL);
144 }
145
146 public void setHoverImageURL(java.lang.String hoverImageURL) {
147 engine.setProperty(Properties.HOVER_IMAGE_URL, hoverImageURL);
148 }
149
150 public java.lang.String getSelectedImageURL() {
151 return getSelectedImageURL(null);
152 }
153
154
155
156
157 public java.lang.String getSelectedImageURL(javax.faces.context.FacesContext facesContext) {
158 return engine.getStringProperty(Properties.SELECTED_IMAGE_URL, facesContext);
159 }
160
161
162
163
164
165 public final boolean isSelectedImageURLSetted() {
166 return engine.isPropertySetted(Properties.SELECTED_IMAGE_URL);
167 }
168
169 public void setSelectedImageURL(java.lang.String selectedImageURL) {
170 engine.setProperty(Properties.SELECTED_IMAGE_URL, selectedImageURL);
171 }
172
173 public boolean isBorder() {
174 return isBorder(null);
175 }
176
177
178
179
180 public boolean isBorder(javax.faces.context.FacesContext facesContext) {
181 return engine.getBoolProperty(Properties.BORDER, true, facesContext);
182 }
183
184
185
186
187
188 public final boolean isBorderSetted() {
189 return engine.isPropertySetted(Properties.BORDER);
190 }
191
192 public void setBorder(boolean border) {
193 engine.setProperty(Properties.BORDER, border);
194 }
195
196 public java.lang.String getBorderType() {
197 return getBorderType(null);
198 }
199
200
201
202
203 public java.lang.String getBorderType(javax.faces.context.FacesContext facesContext) {
204 return engine.getStringProperty(Properties.BORDER_TYPE, facesContext);
205 }
206
207
208
209
210
211 public final boolean isBorderTypeSetted() {
212 return engine.isPropertySetted(Properties.BORDER_TYPE);
213 }
214
215 public void setBorderType(java.lang.String borderType) {
216 engine.setProperty(Properties.BORDER_TYPE, borderType);
217 }
218
219 public int getImageHeight() {
220 return getImageHeight(null);
221 }
222
223
224
225
226 public int getImageHeight(javax.faces.context.FacesContext facesContext) {
227 return engine.getIntProperty(Properties.IMAGE_HEIGHT,0, facesContext);
228 }
229
230
231
232
233
234 public final boolean isImageHeightSetted() {
235 return engine.isPropertySetted(Properties.IMAGE_HEIGHT);
236 }
237
238 public void setImageHeight(int imageHeight) {
239 engine.setProperty(Properties.IMAGE_HEIGHT, imageHeight);
240 }
241
242 public int getImageWidth() {
243 return getImageWidth(null);
244 }
245
246
247
248
249 public int getImageWidth(javax.faces.context.FacesContext facesContext) {
250 return engine.getIntProperty(Properties.IMAGE_WIDTH,0, facesContext);
251 }
252
253
254
255
256
257 public final boolean isImageWidthSetted() {
258 return engine.isPropertySetted(Properties.IMAGE_WIDTH);
259 }
260
261 public void setImageWidth(int imageWidth) {
262 engine.setProperty(Properties.IMAGE_WIDTH, imageWidth);
263 }
264
265 public IContentAccessors getImageAccessors(FacesContext facesContext) {
266
267
268 return ImageAccessorTools.createImageAccessors(facesContext, this, engine);
269
270 }
271
272 public IContentAccessors getImageAccessors() {
273
274
275 return getImageAccessors(null);
276
277 }
278
279 protected Set getCameliaFields() {
280 return CAMELIA_ATTRIBUTES;
281 }
282
283 protected String getCameliaValueAlias() {
284 return CAMELIA_VALUE_ALIAS;
285 }
286 }