View Javadoc

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.apache.commons.logging.LogFactory;
6   import java.lang.String;
7   import org.rcfaces.core.component.capability.IHiddenModeCapability;
8   import javax.faces.context.FacesContext;
9   import org.rcfaces.core.internal.component.CameliaBaseComponent;
10  import javax.el.ValueExpression;
11  import java.util.HashSet;
12  import org.apache.commons.logging.Log;
13  import org.rcfaces.core.component.capability.IStyleClassCapability;
14  import java.util.Set;
15  import java.util.Arrays;
16  import org.rcfaces.core.internal.converter.HiddenModeConverter;
17  
18  /**
19   * <p>The lineBreak Component is the &lt;BR&gt; HTML equivalent.</p>
20   * <p>It is used often when simple HTML is not desirable : for example if a part of a page is loaded via AJAX it might be easier to have only a jsf tree memory represantation.</p>
21   * <p>The lineBreak Component has the following capability :
22   * <ul>
23   * <li>IStyleClassCapability</li>
24   * <li>IVisibilityCapability</li>
25   * <li>IHiddenModeCapability</li>
26   * </ul>
27   * </p>
28   * 
29   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/LineBreakComponent.html">lineBreak</a> renderer is linked to the <a href="/jsdocs/index.html?f_lineBreak.html" target="_blank">f_lineBreak</a> javascript class. f_lineBreak extends f_component</p>
30   * 
31   * <p> Table of component style classes: </p>
32   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
33   * <tbody>
34   * 
35   * <tr style="text-align:left">
36   * <th  width="33%">Style Name</th>
37   * <th width="50%">Description</th>
38   * </tr>
39   * 
40   * <tr  style="text-align:left">
41   * <td width="33%">f_lineBreak</td>
42   * <td width="50%">Defines styles for the wrapper element</td>
43   * </tr>
44   * 
45   * </tbody>
46   * </table>
47   */
48  public class LineBreakComponent extends CameliaBaseComponent implements 
49  	IStyleClassCapability,
50  	IVisibilityCapability,
51  	IHiddenModeCapability {
52  
53  	private static final Log LOG = LogFactory.getLog(LineBreakComponent.class);
54  
55  	public static final String COMPONENT_TYPE="org.rcfaces.core.lineBreak";
56  
57  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaBaseComponent.CAMELIA_ATTRIBUTES);
58  	static {
59  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"visible","hiddenMode","styleClass","rendered"}));
60  	}
61  
62  	public LineBreakComponent() {
63  		setRendererType(COMPONENT_TYPE);
64  	}
65  
66  	public LineBreakComponent(String componentId) {
67  		this();
68  		setId(componentId);
69  	}
70  
71  	public void setHiddenMode(String hiddenMode) {
72  
73  
74  			setHiddenMode(((Integer)HiddenModeConverter.SINGLETON.getAsObject(null, this, hiddenMode)).intValue());
75  		
76  	}
77  
78  	public Boolean getVisibleState(FacesContext facesContext) {
79  
80  
81  			if (engine.isPropertySetted(Properties.VISIBLE)==false) {
82  				return null;
83  			}
84  			
85  			return Boolean.valueOf(isVisible(facesContext));
86  		
87  	}
88  
89  	public java.lang.String getStyleClass() {
90  		return getStyleClass(null);
91  	}
92  
93  	/**
94  	 * See {@link #getStyleClass() getStyleClass()} for more details
95  	 */
96  	public java.lang.String getStyleClass(javax.faces.context.FacesContext facesContext) {
97  		return engine.getStringProperty(Properties.STYLE_CLASS, facesContext);
98  	}
99  
100 	/**
101 	 * Returns <code>true</code> if the attribute "styleClass" is set.
102 	 * @return <code>true</code> if the attribute is set.
103 	 */
104 	public final boolean isStyleClassSetted() {
105 		return engine.isPropertySetted(Properties.STYLE_CLASS);
106 	}
107 
108 	public void setStyleClass(java.lang.String styleClass) {
109 		engine.setProperty(Properties.STYLE_CLASS, styleClass);
110 	}
111 
112 	public boolean isVisible() {
113 		return isVisible(null);
114 	}
115 
116 	/**
117 	 * See {@link #isVisible() isVisible()} for more details
118 	 */
119 	public boolean isVisible(javax.faces.context.FacesContext facesContext) {
120 		return engine.getBoolProperty(Properties.VISIBLE, true, facesContext);
121 	}
122 
123 	/**
124 	 * Returns <code>true</code> if the attribute "visible" is set.
125 	 * @return <code>true</code> if the attribute is set.
126 	 */
127 	public final boolean isVisibleSetted() {
128 		return engine.isPropertySetted(Properties.VISIBLE);
129 	}
130 
131 	public void setVisible(boolean visible) {
132 		engine.setProperty(Properties.VISIBLE, visible);
133 	}
134 
135 	public Boolean getVisibleState() {
136 
137 
138 			return getVisibleState(null);
139 		
140 	}
141 
142 	public int getHiddenMode() {
143 		return getHiddenMode(null);
144 	}
145 
146 	/**
147 	 * See {@link #getHiddenMode() getHiddenMode()} for more details
148 	 */
149 	public int getHiddenMode(javax.faces.context.FacesContext facesContext) {
150 		return engine.getIntProperty(Properties.HIDDEN_MODE,IHiddenModeCapability.DEFAULT_HIDDEN_MODE, facesContext);
151 	}
152 
153 	/**
154 	 * Returns <code>true</code> if the attribute "hiddenMode" is set.
155 	 * @return <code>true</code> if the attribute is set.
156 	 */
157 	public final boolean isHiddenModeSetted() {
158 		return engine.isPropertySetted(Properties.HIDDEN_MODE);
159 	}
160 
161 	public void setHiddenMode(int hiddenMode) {
162 		engine.setProperty(Properties.HIDDEN_MODE, hiddenMode);
163 	}
164 
165 	protected Set getCameliaFields() {
166 		return CAMELIA_ATTRIBUTES;
167 	}
168 }