View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.component.iterator.IToolFolderIterator;
4   import org.rcfaces.core.internal.component.Properties;
5   import org.rcfaces.core.component.familly.IContentAccessors;
6   import org.apache.commons.logging.LogFactory;
7   import org.rcfaces.core.component.AbstractBasicComponent;
8   import javax.faces.context.FacesContext;
9   import org.rcfaces.core.internal.tools.ImageAccessorTools;
10  import org.rcfaces.core.component.capability.IBorderTypeCapability;
11  import javax.el.ValueExpression;
12  import java.util.HashSet;
13  import org.apache.commons.logging.Log;
14  import org.rcfaces.core.internal.tools.ToolBarTools;
15  import java.util.Set;
16  import java.util.Arrays;
17  import org.rcfaces.core.internal.capability.IImageAccessorsCapability;
18  import org.rcfaces.core.component.capability.IInitEventCapability;
19  import org.rcfaces.core.component.capability.IVerticalAlignmentCapability;
20  
21  /**
22   * <p>The toolBar component allows developers to easily add toolbars containing diffenrent components </p>
23   * 
24   * <p>The toolBar Component has the following capabilities :
25   * <ul>
26   * <li>IInitEventCapability</li>
27   * <li>IVerticalAlignmentCapability</li>
28   * <li>IBorderTypeCapability</li>
29   * <li>IImageAccessorsCapability </li>
30   * </ul>
31   * </p>
32   * 
33   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/ToolBarComponent.html">toolBar</a> renderer is linked to the <a href="/jsdocs/index.html?f_toolBar.html" target="_blank">f_toolBar</a> javascript class. f_toolBar extends f_component</p>
34   * <p> Table of component style classes: </p>
35   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
36   * <tbody>
37   * 
38   * <tr style="text-align:left">
39   * <th  width="33%">Style Name</th>
40   * <th width="50%">Description</th>
41   * </tr>
42   * 
43   * <tr  style="text-align:left">
44   * <td width="33%">f_toolBar</td>
45   * <td width="50%">Defines styles for the wrapper DIV element</td>
46   * </tr>
47   * </tbody>
48   * </table>
49   */
50  public class ToolBarComponent extends AbstractBasicComponent implements 
51  	IInitEventCapability,
52  	IVerticalAlignmentCapability,
53  	IBorderTypeCapability,
54  	IImageAccessorsCapability {
55  
56  	private static final Log LOG = LogFactory.getLog(ToolBarComponent.class);
57  
58  	public static final String COMPONENT_TYPE="org.rcfaces.core.toolBar";
59  
60  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractBasicComponent.CAMELIA_ATTRIBUTES);
61  	static {
62  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"controlImageWidth","borderType","separatorImageHeight","separatorImageWidth","initListener","verticalAlignment","separatorAlternateText","separatorImageURL","locked","controlImageHeight","itemPadding","controlImageURL","controlAlternateText"}));
63  	}
64  
65  	public ToolBarComponent() {
66  		setRendererType(COMPONENT_TYPE);
67  	}
68  
69  	public ToolBarComponent(String componentId) {
70  		this();
71  		setId(componentId);
72  	}
73  
74  	public IContentAccessors getImageAccessors(FacesContext facesContext) {
75  
76  
77  			return ImageAccessorTools.createImageAccessors(facesContext, this, engine);
78  		
79  	}
80  
81  	public IToolFolderIterator listToolFolders() {
82  
83  
84  		return ToolBarTools.listToolFolders(this);
85  		
86  	}
87  
88  	public final void addInitListener(org.rcfaces.core.event.IInitListener listener) {
89  		addFacesListener(listener);
90  	}
91  
92  	public final void removeInitListener(org.rcfaces.core.event.IInitListener listener) {
93  		removeFacesListener(listener);
94  	}
95  
96  	public final javax.faces.event.FacesListener [] listInitListeners() {
97  		return getFacesListeners(org.rcfaces.core.event.IInitListener.class);
98  	}
99  
100 	public java.lang.String getVerticalAlignment() {
101 		return getVerticalAlignment(null);
102 	}
103 
104 	/**
105 	 * See {@link #getVerticalAlignment() getVerticalAlignment()} for more details
106 	 */
107 	public java.lang.String getVerticalAlignment(javax.faces.context.FacesContext facesContext) {
108 		return engine.getStringProperty(Properties.VERTICAL_ALIGNMENT, facesContext);
109 	}
110 
111 	/**
112 	 * Returns <code>true</code> if the attribute "verticalAlignment" is set.
113 	 * @return <code>true</code> if the attribute is set.
114 	 */
115 	public final boolean isVerticalAlignmentSetted() {
116 		return engine.isPropertySetted(Properties.VERTICAL_ALIGNMENT);
117 	}
118 
119 	public void setVerticalAlignment(java.lang.String verticalAlignment) {
120 		engine.setProperty(Properties.VERTICAL_ALIGNMENT, verticalAlignment);
121 	}
122 
123 	public java.lang.String getBorderType() {
124 		return getBorderType(null);
125 	}
126 
127 	/**
128 	 * See {@link #getBorderType() getBorderType()} for more details
129 	 */
130 	public java.lang.String getBorderType(javax.faces.context.FacesContext facesContext) {
131 		return engine.getStringProperty(Properties.BORDER_TYPE, facesContext);
132 	}
133 
134 	/**
135 	 * Returns <code>true</code> if the attribute "borderType" is set.
136 	 * @return <code>true</code> if the attribute is set.
137 	 */
138 	public final boolean isBorderTypeSetted() {
139 		return engine.isPropertySetted(Properties.BORDER_TYPE);
140 	}
141 
142 	public void setBorderType(java.lang.String borderType) {
143 		engine.setProperty(Properties.BORDER_TYPE, borderType);
144 	}
145 
146 	public String getSeparatorImageURL() {
147 		return getSeparatorImageURL(null);
148 	}
149 
150 	public String getSeparatorImageURL(javax.faces.context.FacesContext facesContext) {
151 		return engine.getStringProperty(Properties.SEPARATOR_IMAGE_URL, facesContext);
152 	}
153 
154 	public void setSeparatorImageURL(String separatorImageURL) {
155 		engine.setProperty(Properties.SEPARATOR_IMAGE_URL, separatorImageURL);
156 	}
157 
158 	/**
159 	 * Returns <code>true</code> if the attribute "separatorImageURL" is set.
160 	 * @return <code>true</code> if the attribute is set.
161 	 */
162 	public boolean isSeparatorImageURLSetted() {
163 		return engine.isPropertySetted(Properties.SEPARATOR_IMAGE_URL);
164 	}
165 
166 	public int getSeparatorImageWidth() {
167 		return getSeparatorImageWidth(null);
168 	}
169 
170 	public int getSeparatorImageWidth(javax.faces.context.FacesContext facesContext) {
171 		return engine.getIntProperty(Properties.SEPARATOR_IMAGE_WIDTH, 0, facesContext);
172 	}
173 
174 	public void setSeparatorImageWidth(int separatorImageWidth) {
175 		engine.setProperty(Properties.SEPARATOR_IMAGE_WIDTH, separatorImageWidth);
176 	}
177 
178 	/**
179 	 * Returns <code>true</code> if the attribute "separatorImageWidth" is set.
180 	 * @return <code>true</code> if the attribute is set.
181 	 */
182 	public boolean isSeparatorImageWidthSetted() {
183 		return engine.isPropertySetted(Properties.SEPARATOR_IMAGE_WIDTH);
184 	}
185 
186 	public int getSeparatorImageHeight() {
187 		return getSeparatorImageHeight(null);
188 	}
189 
190 	public int getSeparatorImageHeight(javax.faces.context.FacesContext facesContext) {
191 		return engine.getIntProperty(Properties.SEPARATOR_IMAGE_HEIGHT, 0, facesContext);
192 	}
193 
194 	public void setSeparatorImageHeight(int separatorImageHeight) {
195 		engine.setProperty(Properties.SEPARATOR_IMAGE_HEIGHT, separatorImageHeight);
196 	}
197 
198 	/**
199 	 * Returns <code>true</code> if the attribute "separatorImageHeight" is set.
200 	 * @return <code>true</code> if the attribute is set.
201 	 */
202 	public boolean isSeparatorImageHeightSetted() {
203 		return engine.isPropertySetted(Properties.SEPARATOR_IMAGE_HEIGHT);
204 	}
205 
206 	public String getSeparatorAlternateText() {
207 		return getSeparatorAlternateText(null);
208 	}
209 
210 	public String getSeparatorAlternateText(javax.faces.context.FacesContext facesContext) {
211 		return engine.getStringProperty(Properties.SEPARATOR_ALTERNATE_TEXT, facesContext);
212 	}
213 
214 	public void setSeparatorAlternateText(String separatorAlternateText) {
215 		engine.setProperty(Properties.SEPARATOR_ALTERNATE_TEXT, separatorAlternateText);
216 	}
217 
218 	/**
219 	 * Returns <code>true</code> if the attribute "separatorAlternateText" is set.
220 	 * @return <code>true</code> if the attribute is set.
221 	 */
222 	public boolean isSeparatorAlternateTextSetted() {
223 		return engine.isPropertySetted(Properties.SEPARATOR_ALTERNATE_TEXT);
224 	}
225 
226 	public String getControlImageURL() {
227 		return getControlImageURL(null);
228 	}
229 
230 	public String getControlImageURL(javax.faces.context.FacesContext facesContext) {
231 		return engine.getStringProperty(Properties.CONTROL_IMAGE_URL, facesContext);
232 	}
233 
234 	public void setControlImageURL(String controlImageURL) {
235 		engine.setProperty(Properties.CONTROL_IMAGE_URL, controlImageURL);
236 	}
237 
238 	/**
239 	 * Returns <code>true</code> if the attribute "controlImageURL" is set.
240 	 * @return <code>true</code> if the attribute is set.
241 	 */
242 	public boolean isControlImageURLSetted() {
243 		return engine.isPropertySetted(Properties.CONTROL_IMAGE_URL);
244 	}
245 
246 	public int getControlImageWidth() {
247 		return getControlImageWidth(null);
248 	}
249 
250 	public int getControlImageWidth(javax.faces.context.FacesContext facesContext) {
251 		return engine.getIntProperty(Properties.CONTROL_IMAGE_WIDTH, 0, facesContext);
252 	}
253 
254 	public void setControlImageWidth(int controlImageWidth) {
255 		engine.setProperty(Properties.CONTROL_IMAGE_WIDTH, controlImageWidth);
256 	}
257 
258 	/**
259 	 * Returns <code>true</code> if the attribute "controlImageWidth" is set.
260 	 * @return <code>true</code> if the attribute is set.
261 	 */
262 	public boolean isControlImageWidthSetted() {
263 		return engine.isPropertySetted(Properties.CONTROL_IMAGE_WIDTH);
264 	}
265 
266 	public int getControlImageHeight() {
267 		return getControlImageHeight(null);
268 	}
269 
270 	public int getControlImageHeight(javax.faces.context.FacesContext facesContext) {
271 		return engine.getIntProperty(Properties.CONTROL_IMAGE_HEIGHT, 0, facesContext);
272 	}
273 
274 	public void setControlImageHeight(int controlImageHeight) {
275 		engine.setProperty(Properties.CONTROL_IMAGE_HEIGHT, controlImageHeight);
276 	}
277 
278 	/**
279 	 * Returns <code>true</code> if the attribute "controlImageHeight" is set.
280 	 * @return <code>true</code> if the attribute is set.
281 	 */
282 	public boolean isControlImageHeightSetted() {
283 		return engine.isPropertySetted(Properties.CONTROL_IMAGE_HEIGHT);
284 	}
285 
286 	public String getControlAlternateText() {
287 		return getControlAlternateText(null);
288 	}
289 
290 	public String getControlAlternateText(javax.faces.context.FacesContext facesContext) {
291 		return engine.getStringProperty(Properties.CONTROL_ALTERNATE_TEXT, facesContext);
292 	}
293 
294 	public void setControlAlternateText(String controlAlternateText) {
295 		engine.setProperty(Properties.CONTROL_ALTERNATE_TEXT, controlAlternateText);
296 	}
297 
298 	/**
299 	 * Returns <code>true</code> if the attribute "controlAlternateText" is set.
300 	 * @return <code>true</code> if the attribute is set.
301 	 */
302 	public boolean isControlAlternateTextSetted() {
303 		return engine.isPropertySetted(Properties.CONTROL_ALTERNATE_TEXT);
304 	}
305 
306 	public int getItemPadding() {
307 		return getItemPadding(null);
308 	}
309 
310 	public int getItemPadding(javax.faces.context.FacesContext facesContext) {
311 		return engine.getIntProperty(Properties.ITEM_PADDING, 0, facesContext);
312 	}
313 
314 	public void setItemPadding(int itemPadding) {
315 		engine.setProperty(Properties.ITEM_PADDING, itemPadding);
316 	}
317 
318 	/**
319 	 * Returns <code>true</code> if the attribute "itemPadding" is set.
320 	 * @return <code>true</code> if the attribute is set.
321 	 */
322 	public boolean isItemPaddingSetted() {
323 		return engine.isPropertySetted(Properties.ITEM_PADDING);
324 	}
325 
326 	public boolean isLocked() {
327 		return isLocked(null);
328 	}
329 
330 	public boolean isLocked(javax.faces.context.FacesContext facesContext) {
331 		return engine.getBoolProperty(Properties.LOCKED, false, facesContext);
332 	}
333 
334 	public void setLocked(boolean locked) {
335 		engine.setProperty(Properties.LOCKED, locked);
336 	}
337 
338 	/**
339 	 * Returns <code>true</code> if the attribute "locked" is set.
340 	 * @return <code>true</code> if the attribute is set.
341 	 */
342 	public boolean isLockedSetted() {
343 		return engine.isPropertySetted(Properties.LOCKED);
344 	}
345 
346 	protected Set getCameliaFields() {
347 		return CAMELIA_ATTRIBUTES;
348 	}
349 }