View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.internal.component.Properties;
4   import org.rcfaces.core.component.capability.IClosableCapability;
5   import org.apache.commons.logging.LogFactory;
6   import org.rcfaces.core.component.capability.ICloseEventCapability;
7   import org.rcfaces.core.internal.tools.TabbedPaneTools;
8   import org.rcfaces.core.component.capability.IPreSelectionEventCapability;
9   import org.rcfaces.core.component.capability.IShowValueCapability;
10  import javax.faces.context.FacesContext;
11  import org.rcfaces.core.component.TabComponent;
12  import javax.el.ValueExpression;
13  import java.util.HashSet;
14  import org.apache.commons.logging.Log;
15  import org.rcfaces.core.component.iterator.ITabIterator;
16  import org.rcfaces.core.component.CardBoxComponent;
17  import java.util.Set;
18  import java.util.Arrays;
19  
20  /**
21   * <p>The tabbedPane Component provides a way to show more information on a single page. It can download the data asynchronously via AJAX.</p>
22   * <p>The tabbedPane Component has the following capabilities :
23   * <ul>
24   * <li>ICloseEventCapability</li>
25   * <li>IClosableCapability</li>
26   * <li>IPreSelectionEventCapability</li>
27   * <li>IShowValueCapability</li>
28   * </ul>
29   * </p>
30   * 
31   * <p>The default <a href="/apidocs/index.html?org/rcfaces/core/component/TabbedPaneComponent.html">tabbedPane</a> renderer is linked to the <a href="/jsdocs/index.html?f_tabbedPane.html" target="_blank">f_tabbedPane</a> javascript class. f_tabbedPane extends f_cardBox</p>
32   * 
33   * <p> Table of component style classes: </p>
34   * <table border="1" cellpadding="3" cellspacing="0" width="100%">
35   * <tbody>
36   * 
37   * <tr style="text-align:left">
38   * <th  width="33%">Style Name</th>
39   * <th width="50%">Description</th>
40   * </tr>
41   * 
42   * <tr  style="text-align:left">
43   * <td width="33%">f_tabbedPane</td>
44   * <td width="50%">Defines styles for the wrapper element</td>
45   * </tr>
46   * <tr  style="text-align:left">
47   * <td width="33%">f_tabbedPane_title</td>
48   * <td width="50%">Defines styles for the TABLE element </td>
49   * </tr>
50   * <tr  style="text-align:left">
51   * <td width="33%">f_tabbedPane_content</td>
52   * <td width="50%">Defines styles for the DIV element</td>
53   * </tr>
54   * <tr  style="text-align:left">
55   * <td width="33%">f_tabbedPane_tab</td>
56   * <td width="50%">Defines styles for the DIV element</td>
57   * </tr>
58   * 
59   * </tbody>
60   * </table>
61   */
62  public class TabbedPaneComponent extends CardBoxComponent implements 
63  	ICloseEventCapability,
64  	IClosableCapability,
65  	IPreSelectionEventCapability,
66  	IShowValueCapability {
67  
68  	private static final Log LOG = LogFactory.getLog(TabbedPaneComponent.class);
69  
70  	public static final String COMPONENT_TYPE="org.rcfaces.core.tabbedPane";
71  
72  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CardBoxComponent.CAMELIA_ATTRIBUTES);
73  	static {
74  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"closeListener","showValue","closable","preSelectionListener"}));
75  	}
76  
77  	public TabbedPaneComponent() {
78  		setRendererType(COMPONENT_TYPE);
79  	}
80  
81  	public TabbedPaneComponent(String componentId) {
82  		this();
83  		setId(componentId);
84  	}
85  
86  	public ITabIterator listTabs() {
87  
88  
89  				return TabbedPaneTools.listTabs(this);				
90  			
91  	}
92  
93  	public TabComponent getSelectedTab() {
94  
95  
96  				return (TabComponent)getSelectedCard();
97  			
98  	}
99  
100 	public TabComponent getSelectedTab(FacesContext facesContext) {
101 
102 
103 				return (TabComponent)getSelectedCard(facesContext);
104 			
105 	}
106 
107 	public void select(TabComponent tab) {
108 
109 
110 				super.select(tab);
111 			
112 	}
113 
114 	public final void addCloseListener(org.rcfaces.core.event.ICloseListener listener) {
115 		addFacesListener(listener);
116 	}
117 
118 	public final void removeCloseListener(org.rcfaces.core.event.ICloseListener listener) {
119 		removeFacesListener(listener);
120 	}
121 
122 	public final javax.faces.event.FacesListener [] listCloseListeners() {
123 		return getFacesListeners(org.rcfaces.core.event.ICloseListener.class);
124 	}
125 
126 	public boolean isClosable() {
127 		return isClosable(null);
128 	}
129 
130 	/**
131 	 * See {@link #isClosable() isClosable()} for more details
132 	 */
133 	public boolean isClosable(javax.faces.context.FacesContext facesContext) {
134 		return engine.getBoolProperty(Properties.CLOSABLE, false, facesContext);
135 	}
136 
137 	/**
138 	 * Returns <code>true</code> if the attribute "closable" is set.
139 	 * @return <code>true</code> if the attribute is set.
140 	 */
141 	public final boolean isClosableSetted() {
142 		return engine.isPropertySetted(Properties.CLOSABLE);
143 	}
144 
145 	public void setClosable(boolean closable) {
146 		engine.setProperty(Properties.CLOSABLE, closable);
147 	}
148 
149 	public final void addPreSelectionListener(org.rcfaces.core.event.IPreSelectionListener listener) {
150 		addFacesListener(listener);
151 	}
152 
153 	public final void removePreSelectionListener(org.rcfaces.core.event.IPreSelectionListener listener) {
154 		removeFacesListener(listener);
155 	}
156 
157 	public final javax.faces.event.FacesListener [] listPreSelectionListeners() {
158 		return getFacesListeners(org.rcfaces.core.event.IPreSelectionListener.class);
159 	}
160 
161 	public java.lang.Object getShowValue() {
162 		return getShowValue(null);
163 	}
164 
165 	/**
166 	 * See {@link #getShowValue() getShowValue()} for more details
167 	 */
168 	public java.lang.Object getShowValue(javax.faces.context.FacesContext facesContext) {
169 		return engine.getProperty(Properties.SHOW_VALUE, facesContext);
170 	}
171 
172 	/**
173 	 * Returns <code>true</code> if the attribute "showValue" is set.
174 	 * @return <code>true</code> if the attribute is set.
175 	 */
176 	public final boolean isShowValueSetted() {
177 		return engine.isPropertySetted(Properties.SHOW_VALUE);
178 	}
179 
180 	public void setShowValue(java.lang.Object showValue) {
181 		engine.setProperty(Properties.SHOW_VALUE, showValue);
182 	}
183 
184 	protected Set getCameliaFields() {
185 		return CAMELIA_ATTRIBUTES;
186 	}
187 }