1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.component.capability.IVisibilityCapability;
4 import org.rcfaces.core.internal.component.Properties;
5 import org.rcfaces.core.component.familly.IContentAccessors;
6 import org.rcfaces.core.component.capability.IStatesImageCapability;
7 import org.apache.commons.logging.LogFactory;
8 import org.rcfaces.core.component.SelectItemComponent;
9 import javax.faces.context.FacesContext;
10 import org.rcfaces.core.component.capability.IAlternateTextCapability;
11 import org.rcfaces.core.internal.tools.ImageAccessorTools;
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
19
20
21
22 public class UIImageItemComponent extends SelectItemComponent implements
23 IVisibilityCapability,
24 IStatesImageCapability,
25 IAlternateTextCapability,
26 IImageAccessorsCapability {
27
28 private static final Log LOG = LogFactory.getLog(UIImageItemComponent.class);
29
30 public static final String COMPONENT_TYPE="org.rcfaces.core.UIImageItem";
31
32 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(SelectItemComponent.CAMELIA_ATTRIBUTES);
33 static {
34 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"selectedImageURL","disabledImageURL","alternateText","visible","hoverImageURL","rendered","imageURL"}));
35 }
36
37 public UIImageItemComponent() {
38 setRendererType(null);
39 }
40
41 public UIImageItemComponent(String componentId) {
42 this();
43 setId(componentId);
44 }
45
46 public IContentAccessors getImageAccessors(FacesContext facesContext) {
47
48
49 return ImageAccessorTools.createImageAccessors(facesContext, this, engine);
50
51 }
52
53 public Boolean getVisibleState(FacesContext facesContext) {
54
55
56 if (engine.isPropertySetted(Properties.VISIBLE)==false) {
57 return null;
58 }
59
60 return Boolean.valueOf(isVisible(facesContext));
61
62 }
63
64 public boolean isVisible() {
65 return isVisible(null);
66 }
67
68
69
70
71 public boolean isVisible(javax.faces.context.FacesContext facesContext) {
72 return engine.getBoolProperty(Properties.VISIBLE, true, facesContext);
73 }
74
75
76
77
78
79 public final boolean isVisibleSetted() {
80 return engine.isPropertySetted(Properties.VISIBLE);
81 }
82
83 public void setVisible(boolean visible) {
84 engine.setProperty(Properties.VISIBLE, visible);
85 }
86
87 public Boolean getVisibleState() {
88
89
90 return getVisibleState(null);
91
92 }
93
94 public java.lang.String getDisabledImageURL() {
95 return getDisabledImageURL(null);
96 }
97
98
99
100
101 public java.lang.String getDisabledImageURL(javax.faces.context.FacesContext facesContext) {
102 return engine.getStringProperty(Properties.DISABLED_IMAGE_URL, facesContext);
103 }
104
105
106
107
108
109 public final boolean isDisabledImageURLSetted() {
110 return engine.isPropertySetted(Properties.DISABLED_IMAGE_URL);
111 }
112
113 public void setDisabledImageURL(java.lang.String disabledImageURL) {
114 engine.setProperty(Properties.DISABLED_IMAGE_URL, disabledImageURL);
115 }
116
117 public java.lang.String getHoverImageURL() {
118 return getHoverImageURL(null);
119 }
120
121
122
123
124 public java.lang.String getHoverImageURL(javax.faces.context.FacesContext facesContext) {
125 return engine.getStringProperty(Properties.HOVER_IMAGE_URL, facesContext);
126 }
127
128
129
130
131
132 public final boolean isHoverImageURLSetted() {
133 return engine.isPropertySetted(Properties.HOVER_IMAGE_URL);
134 }
135
136 public void setHoverImageURL(java.lang.String hoverImageURL) {
137 engine.setProperty(Properties.HOVER_IMAGE_URL, hoverImageURL);
138 }
139
140 public java.lang.String getSelectedImageURL() {
141 return getSelectedImageURL(null);
142 }
143
144
145
146
147 public java.lang.String getSelectedImageURL(javax.faces.context.FacesContext facesContext) {
148 return engine.getStringProperty(Properties.SELECTED_IMAGE_URL, facesContext);
149 }
150
151
152
153
154
155 public final boolean isSelectedImageURLSetted() {
156 return engine.isPropertySetted(Properties.SELECTED_IMAGE_URL);
157 }
158
159 public void setSelectedImageURL(java.lang.String selectedImageURL) {
160 engine.setProperty(Properties.SELECTED_IMAGE_URL, selectedImageURL);
161 }
162
163 public java.lang.String getImageURL() {
164 return getImageURL(null);
165 }
166
167
168
169
170 public java.lang.String getImageURL(javax.faces.context.FacesContext facesContext) {
171 return engine.getStringProperty(Properties.IMAGE_URL, facesContext);
172 }
173
174
175
176
177
178 public final boolean isImageURLSetted() {
179 return engine.isPropertySetted(Properties.IMAGE_URL);
180 }
181
182 public void setImageURL(java.lang.String imageURL) {
183 engine.setProperty(Properties.IMAGE_URL, imageURL);
184 }
185
186 public IContentAccessors getImageAccessors() {
187
188
189 return getImageAccessors(null);
190
191 }
192
193 public java.lang.String getAlternateText() {
194 return getAlternateText(null);
195 }
196
197
198
199
200 public java.lang.String getAlternateText(javax.faces.context.FacesContext facesContext) {
201 return engine.getStringProperty(Properties.ALTERNATE_TEXT, facesContext);
202 }
203
204
205
206
207
208 public final boolean isAlternateTextSetted() {
209 return engine.isPropertySetted(Properties.ALTERNATE_TEXT);
210 }
211
212 public void setAlternateText(java.lang.String alternateText) {
213 engine.setProperty(Properties.ALTERNATE_TEXT, alternateText);
214 }
215
216 protected Set getCameliaFields() {
217 return CAMELIA_ATTRIBUTES;
218 }
219 }