View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.internal.component.Properties;
4   import org.rcfaces.core.internal.tools.CardBoxTools;
5   import org.rcfaces.core.internal.capability.IAsyncRenderComponent;
6   import java.lang.String;
7   import org.apache.commons.logging.LogFactory;
8   import org.rcfaces.core.component.capability.ILoadEventCapability;
9   import javax.faces.context.FacesContext;
10  import javax.el.ValueExpression;
11  import org.rcfaces.core.component.capability.ITextAlignmentCapability;
12  import org.rcfaces.core.internal.converter.AsyncDecodeModeConverter;
13  import java.util.HashSet;
14  import org.apache.commons.logging.Log;
15  import org.rcfaces.core.component.CardBoxComponent;
16  import org.rcfaces.core.component.AbstractOutputComponent;
17  import java.util.Set;
18  import java.util.Arrays;
19  import org.rcfaces.core.internal.capability.IVariableScopeCapability;
20  import org.rcfaces.core.component.capability.IAsyncDecodeModeCapability;
21  import org.rcfaces.core.component.capability.IVerticalAlignmentCapability;
22  
23  /**
24   * An element belonging to a <a href="/comps/cardBoxComponent.html">cardBox Component</a> and holding the components.
25   */
26  public class CardComponent extends AbstractOutputComponent implements 
27  	ITextAlignmentCapability,
28  	IVerticalAlignmentCapability,
29  	IVariableScopeCapability,
30  	IAsyncDecodeModeCapability,
31  	ILoadEventCapability,
32  	IAsyncRenderComponent {
33  
34  	private static final Log LOG = LogFactory.getLog(CardComponent.class);
35  
36  	public static final String COMPONENT_TYPE="org.rcfaces.core.card";
37  
38  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractOutputComponent.CAMELIA_ATTRIBUTES);
39  	static {
40  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"scopeSaveValue","verticalAlignment","scopeVar","textAlignment","scopeValue","asyncDecodeMode","loadListener"}));
41  	}
42  
43  	public CardComponent() {
44  		setRendererType(COMPONENT_TYPE);
45  	}
46  
47  	public CardComponent(String componentId) {
48  		this();
49  		setId(componentId);
50  	}
51  
52  	public CardBoxComponent getCardBox() {
53  
54  
55  				return CardBoxTools.getCardBox(this);
56  			
57  	}
58  
59  	public int getAsyncDecodeMode(FacesContext facesContext) {
60  
61  
62  				if (engine.isPropertySetted(Properties.ASYNC_DECODE_MODE)) {			
63  					return engine.getIntProperty(Properties.ASYNC_DECODE_MODE,0, facesContext);
64  				}
65  				
66  				CardBoxComponent cardBox=getCardBox();
67  				if (cardBox==null) {
68  					return IAsyncDecodeModeCapability.DEFAULT_ASYNC_DECODE_MODE;
69  				}
70  				
71  				return cardBox.getAsyncDecodeMode(facesContext);
72  			
73  	}
74  
75  	public void setAsyncDecodeMode(String asyncDecodeMode) {
76  
77  
78  			setAsyncDecodeMode(((Integer)AsyncDecodeModeConverter.SINGLETON.getAsObject(null, this, asyncDecodeMode)).intValue());
79  		
80  	}
81  
82  	public java.lang.String getTextAlignment() {
83  		return getTextAlignment(null);
84  	}
85  
86  	/**
87  	 * See {@link #getTextAlignment() getTextAlignment()} for more details
88  	 */
89  	public java.lang.String getTextAlignment(javax.faces.context.FacesContext facesContext) {
90  		return engine.getStringProperty(Properties.TEXT_ALIGNMENT, facesContext);
91  	}
92  
93  	/**
94  	 * Returns <code>true</code> if the attribute "textAlignment" is set.
95  	 * @return <code>true</code> if the attribute is set.
96  	 */
97  	public final boolean isTextAlignmentSetted() {
98  		return engine.isPropertySetted(Properties.TEXT_ALIGNMENT);
99  	}
100 
101 	public void setTextAlignment(java.lang.String textAlignment) {
102 		engine.setProperty(Properties.TEXT_ALIGNMENT, textAlignment);
103 	}
104 
105 	public java.lang.String getVerticalAlignment() {
106 		return getVerticalAlignment(null);
107 	}
108 
109 	/**
110 	 * See {@link #getVerticalAlignment() getVerticalAlignment()} for more details
111 	 */
112 	public java.lang.String getVerticalAlignment(javax.faces.context.FacesContext facesContext) {
113 		return engine.getStringProperty(Properties.VERTICAL_ALIGNMENT, facesContext);
114 	}
115 
116 	/**
117 	 * Returns <code>true</code> if the attribute "verticalAlignment" is set.
118 	 * @return <code>true</code> if the attribute is set.
119 	 */
120 	public final boolean isVerticalAlignmentSetted() {
121 		return engine.isPropertySetted(Properties.VERTICAL_ALIGNMENT);
122 	}
123 
124 	public void setVerticalAlignment(java.lang.String verticalAlignment) {
125 		engine.setProperty(Properties.VERTICAL_ALIGNMENT, verticalAlignment);
126 	}
127 
128 	public boolean isScopeSaveValue() {
129 		return isScopeSaveValue(null);
130 	}
131 
132 	/**
133 	 * See {@link #isScopeSaveValue() isScopeSaveValue()} for more details
134 	 */
135 	public boolean isScopeSaveValue(javax.faces.context.FacesContext facesContext) {
136 		return engine.getBoolProperty(Properties.SCOPE_SAVE_VALUE, false, facesContext);
137 	}
138 
139 	/**
140 	 * Returns <code>true</code> if the attribute "scopeSaveValue" is set.
141 	 * @return <code>true</code> if the attribute is set.
142 	 */
143 	public final boolean isScopeSaveValueSetted() {
144 		return engine.isPropertySetted(Properties.SCOPE_SAVE_VALUE);
145 	}
146 
147 	public void setScopeSaveValue(boolean scopeSaveValue) {
148 		engine.setProperty(Properties.SCOPE_SAVE_VALUE, scopeSaveValue);
149 	}
150 
151 	public java.lang.Object getScopeValue() {
152 		return getScopeValue(null);
153 	}
154 
155 	/**
156 	 * See {@link #getScopeValue() getScopeValue()} for more details
157 	 */
158 	public java.lang.Object getScopeValue(javax.faces.context.FacesContext facesContext) {
159 		return engine.getProperty(Properties.SCOPE_VALUE, facesContext);
160 	}
161 
162 	/**
163 	 * Returns <code>true</code> if the attribute "scopeValue" is set.
164 	 * @return <code>true</code> if the attribute is set.
165 	 */
166 	public final boolean isScopeValueSetted() {
167 		return engine.isPropertySetted(Properties.SCOPE_VALUE);
168 	}
169 
170 	public void setScopeValue(java.lang.Object scopeValue) {
171 		engine.setProperty(Properties.SCOPE_VALUE, scopeValue);
172 	}
173 
174 	public java.lang.String getScopeVar() {
175 		return getScopeVar(null);
176 	}
177 
178 	/**
179 	 * See {@link #getScopeVar() getScopeVar()} for more details
180 	 */
181 	public java.lang.String getScopeVar(javax.faces.context.FacesContext facesContext) {
182 		return engine.getStringProperty(Properties.SCOPE_VAR, facesContext);
183 	}
184 
185 	/**
186 	 * Returns <code>true</code> if the attribute "scopeVar" is set.
187 	 * @return <code>true</code> if the attribute is set.
188 	 */
189 	public final boolean isScopeVarSetted() {
190 		return engine.isPropertySetted(Properties.SCOPE_VAR);
191 	}
192 
193 	public void setScopeVar(java.lang.String scopeVar) {
194 		engine.setProperty(Properties.SCOPE_VAR, scopeVar);
195 	}
196 
197 	public int getAsyncDecodeMode() {
198 		return getAsyncDecodeMode(null);
199 	}
200 
201 	/**
202 	 * Returns <code>true</code> if the attribute "asyncDecodeMode" is set.
203 	 * @return <code>true</code> if the attribute is set.
204 	 */
205 	public final boolean isAsyncDecodeModeSetted() {
206 		return engine.isPropertySetted(Properties.ASYNC_DECODE_MODE);
207 	}
208 
209 	public void setAsyncDecodeMode(int asyncDecodeMode) {
210 		engine.setProperty(Properties.ASYNC_DECODE_MODE, asyncDecodeMode);
211 	}
212 
213 	public final void addLoadListener(org.rcfaces.core.event.ILoadListener listener) {
214 		addFacesListener(listener);
215 	}
216 
217 	public final void removeLoadListener(org.rcfaces.core.event.ILoadListener listener) {
218 		removeFacesListener(listener);
219 	}
220 
221 	public final javax.faces.event.FacesListener [] listLoadListeners() {
222 		return getFacesListeners(org.rcfaces.core.event.ILoadListener.class);
223 	}
224 
225 	protected Set getCameliaFields() {
226 		return CAMELIA_ATTRIBUTES;
227 	}
228 }