View Javadoc
1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import javax.el.MethodExpression;
23  import javax.faces.component.ActionSource2;
24  import javax.faces.context.FacesContext;
25  import org.apache.myfaces.tobago.context.Markup;
26  import org.apache.myfaces.tobago.internal.component.AbstractUITabGroup;
27  import org.apache.myfaces.tobago.model.SwitchType;
28  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
29  import org.apache.myfaces.tobago.renderkit.css.Style;
30  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
31  import org.apache.myfaces.tobago.internal.util.StringUtils;
32  import org.apache.myfaces.tobago.internal.util.Deprecation;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.ArrayList;
36  import java.util.List;
37  import javax.el.MethodExpression;
38  import javax.el.ValueExpression;
39  
40  /** 
41   Renders a tab group which contains tab panels.
42    * UIComponent class, generated from template {@code component.stg} with class
43    * {@link org.apache.myfaces.tobago.internal.taglib.component.TabGroupTagDeclaration}.
44   */
45  public class UITabGroup
46      extends AbstractUITabGroup implements ActionSource2, Visual {
47  
48    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TabGroup";
49  
50    public static final String COMPONENT_FAMILY = "javax.faces.Panel";
51  
52  
53    enum PropertyKeys {
54      renderedIndex,
55      actionListener,
56      switchType,
57      tabChangeListener,
58      markup,
59      immediate,
60      action,
61      customClass,
62      showNavigationBar,
63      style,
64      tip,
65      selectedIndex,
66    }
67  
68    public String getFamily() {
69      return COMPONENT_FAMILY;
70    }
71  
72  
73    /**
74    For internal use. TBD: Check if this is needed any longer.
75    <br>Default: <code>0</code>
76    */
77    public java.lang.Integer getRenderedIndex() {
78      Number value  = (Number) getStateHelper().eval(PropertyKeys.renderedIndex);
79      if (value != null) {
80        return value.intValue();
81      }
82      return 0;
83    }
84  
85    public void setRenderedIndex(java.lang.Integer renderedIndex) {
86      getStateHelper().put(PropertyKeys.renderedIndex, renderedIndex);
87    }
88  
89    /**
90     * @deprecated since 2.0.0
91     */
92    @Deprecated
93    public javax.faces.el.MethodBinding getActionListener() {
94      javax.el.MethodExpression expression = getActionListenerExpression();
95      if (expression instanceof MethodBindingToMethodExpression) {
96        return ((MethodBindingToMethodExpression)expression).getMethodBinding();
97      }
98      if (expression != null) {
99         return new MethodExpressionToMethodBinding(expression);
100     }
101     return null;
102   }
103 
104   /**
105    * @deprecated since 2.0.0
106    */
107   @Deprecated
108   public void setActionListener(javax.faces.el.MethodBinding actionListener) {
109     if (actionListener != null) {
110       setActionListenerExpression(new MethodBindingToMethodExpression(actionListener));
111     } else {
112       setActionListenerExpression(null);
113     }
114   }
115 
116   public javax.el.MethodExpression getActionListenerExpression() {
117     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.actionListener);
118   }
119 
120   public void setActionListenerExpression(javax.el.MethodExpression actionListener) {
121     getStateHelper().put(PropertyKeys.actionListener, actionListener);
122   }
123 
124 
125   /**
126   <p>
127    Indicating how tab switching should be done.
128    </p>
129    <p>
130    Possible values are:
131    </p>
132    <dl>
133      <dt>client</dt>
134      <dd>Tab switching is done on client, no server Request.</dd>
135      <dt>reloadPage</dt>
136      <dd>Tab switching is done by server request. Full page is reloaded.</dd>
137      <dt>reloadTab</dt>
138      <dd>Tab switching is done by server request. Only the Tab is reloaded.</dd>
139    </dl>
140   <br>Default: <code>client</code><br>Allowed Values: <code>client,reloadPage,reloadTab</code>
141   */
142   public org.apache.myfaces.tobago.model.SwitchType getSwitchType() {
143     org.apache.myfaces.tobago.model.SwitchType switchType = (org.apache.myfaces.tobago.model.SwitchType) getStateHelper().eval(PropertyKeys.switchType);
144     if (switchType != null) {
145       return switchType;
146     }
147     return org.apache.myfaces.tobago.model.SwitchType.client;
148   }
149 
150   public void setSwitchType(org.apache.myfaces.tobago.model.SwitchType switchType) {
151     getStateHelper().put(PropertyKeys.switchType, switchType);
152   }
153 
154   /**
155    * @deprecated since 2.0.0
156    */
157   @Deprecated
158   public javax.faces.el.MethodBinding getTabChangeListener() {
159     javax.el.MethodExpression expression = getTabChangeListenerExpression();
160     if (expression instanceof MethodBindingToMethodExpression) {
161       return ((MethodBindingToMethodExpression)expression).getMethodBinding();
162     }
163     if (expression != null) {
164        return new MethodExpressionToMethodBinding(expression);
165     }
166     return null;
167   }
168 
169   /**
170    * @deprecated since 2.0.0
171    */
172   @Deprecated
173   public void setTabChangeListener(javax.faces.el.MethodBinding tabChangeListener) {
174     if (tabChangeListener != null) {
175       setTabChangeListenerExpression(new MethodBindingToMethodExpression(tabChangeListener));
176     } else {
177       setTabChangeListenerExpression(null);
178     }
179   }
180 
181   public javax.el.MethodExpression getTabChangeListenerExpression() {
182     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.tabChangeListener);
183   }
184 
185   public void setTabChangeListenerExpression(javax.el.MethodExpression tabChangeListener) {
186     getStateHelper().put(PropertyKeys.tabChangeListener, tabChangeListener);
187   }
188 
189 
190   public org.apache.myfaces.tobago.context.Markup getMarkup() {
191     Object object = getStateHelper().eval(PropertyKeys.markup);
192     if (object != null) {
193       return Markup.valueOf(object);
194     }
195     return null;
196   }
197 
198   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
199     getStateHelper().put(PropertyKeys.markup, markup);
200   }
201 
202   /**
203   Flag indicating that, if this component is activated by the user,
204    notifications should be delivered to interested listeners and actions
205    immediately (that is, during Apply Request Values phase) rather than
206    waiting until Invoke Application phase.
207   <br>Default: <code>false</code>
208   */
209   public boolean isImmediate() {
210     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.immediate);
211     if (bool != null) {
212       return bool;
213     }
214     return false;
215   }
216 
217   public void setImmediate(boolean immediate) {
218     getStateHelper().put(PropertyKeys.immediate, immediate);
219   }
220 
221   /**
222    * @deprecated since 2.0.0
223    */
224   @Deprecated
225   public javax.faces.el.MethodBinding getAction() {
226     javax.el.MethodExpression expression = getActionExpression();
227     if (expression instanceof MethodBindingToMethodExpression) {
228       return ((MethodBindingToMethodExpression)expression).getMethodBinding();
229     }
230     if (expression != null) {
231        return new MethodExpressionToMethodBinding(expression);
232     }
233     return null;
234   }
235 
236   /**
237    * @deprecated since 2.0.0
238    */
239   @Deprecated
240   public void setAction(javax.faces.el.MethodBinding action) {
241     if (action != null) {
242       setActionExpression(new MethodBindingToMethodExpression(action));
243     } else {
244       setActionExpression(null);
245     }
246   }
247 
248   public javax.el.MethodExpression getActionExpression() {
249     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.action);
250   }
251 
252   public void setActionExpression(javax.el.MethodExpression action) {
253     getStateHelper().put(PropertyKeys.action, action);
254   }
255 
256 
257   /**
258   Sets a CSS class in its parent, if the parent supports it.
259 
260    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
261 
262    <pre>
263    &lt;tc:in&gt;
264      &lt;tc:style customClass="my-emphasized"/&gt;
265    &lt;/tc:in&gt;
266    </pre>
267 
268    One capability is, to used external CSS libs.
269    <br>
270    This feature should not be used imprudent.
271    Because it might be unstable against changes in the renderered HTML code.
272 
273   */
274   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
275     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
276   }
277 
278   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
279     getStateHelper().put(PropertyKeys.customClass, customClass);
280   }
281 
282   /**
283   Flag indicating that the tab navigation bar is rendered.
284   <br>Default: <code>true</code>
285   */
286   public boolean isShowNavigationBar() {
287     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showNavigationBar);
288     if (bool != null) {
289       return bool;
290     }
291     return true;
292   }
293 
294   public void setShowNavigationBar(boolean showNavigationBar) {
295     getStateHelper().put(PropertyKeys.showNavigationBar, showNavigationBar);
296   }
297 
298   /**
299   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
300 
301   */
302   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
303     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
304   }
305 
306   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
307     getStateHelper().put(PropertyKeys.style, style);
308   }
309 
310   /**
311   Text value to display as tooltip.
312 
313   */
314   public java.lang.String getTip() {
315     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
316   }
317 
318   public void setTip(java.lang.String tip) {
319     getStateHelper().put(PropertyKeys.tip, tip);
320   }
321 
322   /**
323   <strong>ValueBindingExpression</strong> pointing to a Integer to save the
324    component's selected Tab.
325   <br>Default: <code>0</code>
326   */
327   public java.lang.Integer getSelectedIndex() {
328     Number value  = (Number) getStateHelper().eval(PropertyKeys.selectedIndex);
329     if (value != null) {
330       return value.intValue();
331     }
332     return 0;
333   }
334 
335   public void setSelectedIndex(java.lang.Integer selectedIndex) {
336     getStateHelper().put(PropertyKeys.selectedIndex, selectedIndex);
337   }
338 
339 
340 }