1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.internal.component.Properties;
4 import org.rcfaces.core.component.capability.IInputTypeCapability;
5 import org.rcfaces.core.component.capability.IRadioGroupCapability;
6 import java.lang.String;
7 import org.apache.commons.logging.LogFactory;
8 import org.rcfaces.core.component.capability.IImageSizeCapability;
9 import org.rcfaces.core.component.capability.ILookAndFeelCapability;
10 import org.rcfaces.core.component.capability.IWidthCapability;
11 import org.rcfaces.core.component.capability.IAccessKeyCapability;
12 import org.rcfaces.core.component.capability.IImmediateCapability;
13 import org.rcfaces.core.component.capability.IHorizontalTextPositionCapability;
14 import org.rcfaces.core.component.capability.IBorderTypeCapability;
15 import javax.faces.convert.Converter;
16 import org.rcfaces.core.component.capability.ITextPositionCapability;
17 import javax.el.ValueExpression;
18 import org.rcfaces.core.internal.converter.InputTypeConverter;
19 import java.util.HashSet;
20 import org.apache.commons.logging.Log;
21 import org.rcfaces.core.component.UIImageItemComponent;
22 import org.rcfaces.core.component.capability.IStyleClassCapability;
23 import java.util.Set;
24 import java.util.Arrays;
25 import org.rcfaces.core.component.ToolFolderComponent;
26 import org.rcfaces.core.internal.converter.TextPositionConverter;
27
28
29
30
31 public class ToolItemComponent extends UIImageItemComponent implements
32 IRadioGroupCapability,
33 IInputTypeCapability,
34 IImageSizeCapability,
35 ILookAndFeelCapability,
36 IBorderTypeCapability,
37 ITextPositionCapability,
38 IAccessKeyCapability,
39 IWidthCapability,
40 IStyleClassCapability,
41 IImmediateCapability {
42
43 private static final Log LOG = LogFactory.getLog(ToolItemComponent.class);
44
45 public static final String COMPONENT_TYPE="org.rcfaces.core.toolItem";
46
47 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(UIImageItemComponent.CAMELIA_ATTRIBUTES);
48 static {
49 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"immediate","lookId","imageHeight","accessKey","groupName","textPosition","borderType","styleClass","width","inputType","imageWidth"}));
50 }
51
52 public ToolItemComponent() {
53 setRendererType(null);
54 }
55
56 public ToolItemComponent(String componentId) {
57 this();
58 setId(componentId);
59 }
60
61 public void setInputType(String inputType) {
62
63
64 setInputType(((Integer)InputTypeConverter.SINGLETON.getAsObject(null, this, inputType)).intValue());
65
66 }
67
68 public ToolFolderComponent getToolFolder() {
69
70
71 return (ToolFolderComponent)getParent();
72
73 }
74
75 protected Converter getTextPositionConverter() {
76
77
78 return TextPositionConverter.SINGLETON;
79
80 }
81
82 public void setTextPosition(String textPosition) {
83
84
85 setTextPosition(((Integer)getTextPositionConverter().getAsObject(null, this, textPosition)).intValue());
86
87 }
88
89 public java.lang.String getGroupName() {
90 return getGroupName(null);
91 }
92
93
94
95
96 public java.lang.String getGroupName(javax.faces.context.FacesContext facesContext) {
97 return engine.getStringProperty(Properties.GROUP_NAME, facesContext);
98 }
99
100
101
102
103
104 public final boolean isGroupNameSetted() {
105 return engine.isPropertySetted(Properties.GROUP_NAME);
106 }
107
108 public void setGroupName(java.lang.String groupName) {
109 engine.setProperty(Properties.GROUP_NAME, groupName);
110 }
111
112 public int getInputType() {
113 return getInputType(null);
114 }
115
116
117
118
119 public int getInputType(javax.faces.context.FacesContext facesContext) {
120 return engine.getIntProperty(Properties.INPUT_TYPE,0, facesContext);
121 }
122
123
124
125
126
127 public final boolean isInputTypeSetted() {
128 return engine.isPropertySetted(Properties.INPUT_TYPE);
129 }
130
131 public void setInputType(int inputType) {
132 engine.setProperty(Properties.INPUT_TYPE, inputType);
133 }
134
135 public int getImageHeight() {
136 return getImageHeight(null);
137 }
138
139
140
141
142 public int getImageHeight(javax.faces.context.FacesContext facesContext) {
143 return engine.getIntProperty(Properties.IMAGE_HEIGHT,0, facesContext);
144 }
145
146
147
148
149
150 public final boolean isImageHeightSetted() {
151 return engine.isPropertySetted(Properties.IMAGE_HEIGHT);
152 }
153
154 public void setImageHeight(int imageHeight) {
155 engine.setProperty(Properties.IMAGE_HEIGHT, imageHeight);
156 }
157
158 public int getImageWidth() {
159 return getImageWidth(null);
160 }
161
162
163
164
165 public int getImageWidth(javax.faces.context.FacesContext facesContext) {
166 return engine.getIntProperty(Properties.IMAGE_WIDTH,0, facesContext);
167 }
168
169
170
171
172
173 public final boolean isImageWidthSetted() {
174 return engine.isPropertySetted(Properties.IMAGE_WIDTH);
175 }
176
177 public void setImageWidth(int imageWidth) {
178 engine.setProperty(Properties.IMAGE_WIDTH, imageWidth);
179 }
180
181 public java.lang.String getLookId() {
182 return getLookId(null);
183 }
184
185
186
187
188 public java.lang.String getLookId(javax.faces.context.FacesContext facesContext) {
189 return engine.getStringProperty(Properties.LOOK_ID, facesContext);
190 }
191
192
193
194
195
196 public final boolean isLookIdSetted() {
197 return engine.isPropertySetted(Properties.LOOK_ID);
198 }
199
200 public void setLookId(java.lang.String lookId) {
201 engine.setProperty(Properties.LOOK_ID, lookId);
202 }
203
204 public java.lang.String getBorderType() {
205 return getBorderType(null);
206 }
207
208
209
210
211 public java.lang.String getBorderType(javax.faces.context.FacesContext facesContext) {
212 return engine.getStringProperty(Properties.BORDER_TYPE, facesContext);
213 }
214
215
216
217
218
219 public final boolean isBorderTypeSetted() {
220 return engine.isPropertySetted(Properties.BORDER_TYPE);
221 }
222
223 public void setBorderType(java.lang.String borderType) {
224 engine.setProperty(Properties.BORDER_TYPE, borderType);
225 }
226
227 public int getTextPosition() {
228 return getTextPosition(null);
229 }
230
231
232
233
234 public int getTextPosition(javax.faces.context.FacesContext facesContext) {
235 return engine.getIntProperty(Properties.TEXT_POSITION,IHorizontalTextPositionCapability.DEFAULT_POSITION, facesContext);
236 }
237
238
239
240
241
242 public final boolean isTextPositionSetted() {
243 return engine.isPropertySetted(Properties.TEXT_POSITION);
244 }
245
246 public void setTextPosition(int textPosition) {
247 engine.setProperty(Properties.TEXT_POSITION, textPosition);
248 }
249
250 public java.lang.String getAccessKey() {
251 return getAccessKey(null);
252 }
253
254
255
256
257 public java.lang.String getAccessKey(javax.faces.context.FacesContext facesContext) {
258 return engine.getStringProperty(Properties.ACCESS_KEY, facesContext);
259 }
260
261
262
263
264
265 public final boolean isAccessKeySetted() {
266 return engine.isPropertySetted(Properties.ACCESS_KEY);
267 }
268
269 public void setAccessKey(java.lang.String accessKey) {
270 engine.setProperty(Properties.ACCESS_KEY, accessKey);
271 }
272
273 public java.lang.String getWidth() {
274 return getWidth(null);
275 }
276
277
278
279
280 public java.lang.String getWidth(javax.faces.context.FacesContext facesContext) {
281 return engine.getStringProperty(Properties.WIDTH, facesContext);
282 }
283
284
285
286
287
288 public final boolean isWidthSetted() {
289 return engine.isPropertySetted(Properties.WIDTH);
290 }
291
292 public void setWidth(java.lang.String width) {
293 engine.setProperty(Properties.WIDTH, width);
294 }
295
296 public java.lang.String getStyleClass() {
297 return getStyleClass(null);
298 }
299
300
301
302
303 public java.lang.String getStyleClass(javax.faces.context.FacesContext facesContext) {
304 return engine.getStringProperty(Properties.STYLE_CLASS, facesContext);
305 }
306
307
308
309
310
311 public final boolean isStyleClassSetted() {
312 return engine.isPropertySetted(Properties.STYLE_CLASS);
313 }
314
315 public void setStyleClass(java.lang.String styleClass) {
316 engine.setProperty(Properties.STYLE_CLASS, styleClass);
317 }
318
319 public boolean isImmediate() {
320 return isImmediate(null);
321 }
322
323
324
325
326 public boolean isImmediate(javax.faces.context.FacesContext facesContext) {
327 return engine.getBoolProperty(Properties.IMMEDIATE, false, facesContext);
328 }
329
330
331
332
333
334 public final boolean isImmediateSetted() {
335 return engine.isPropertySetted(Properties.IMMEDIATE);
336 }
337
338 public void setImmediate(boolean immediate) {
339 engine.setProperty(Properties.IMMEDIATE, immediate);
340 }
341
342 protected Set getCameliaFields() {
343 return CAMELIA_ATTRIBUTES;
344 }
345 }