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