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.context.FacesContext;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.internal.component.AbstractUITabGroup;
26  import org.apache.myfaces.tobago.model.SwitchType;
27  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
28  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
29  import org.apache.myfaces.tobago.internal.util.StringUtils;
30  import org.apache.myfaces.tobago.internal.util.Deprecation;
31  import org.apache.myfaces.tobago.component.Tags;
32  import javax.annotation.Generated;
33  import javax.el.ELException;
34  import javax.faces.FacesException;
35  import java.util.Arrays;
36  import java.util.ArrayList;
37  import java.util.Collection;
38  import java.util.List;
39  import javax.el.MethodExpression;
40  import javax.el.ValueExpression;
41  
42  /**
43   Renders a tab group which contains tab panels.
44    * UIComponent class, generated from template {@code component.stg} with class
45    * {@link org.apache.myfaces.tobago.internal.taglib.component.TabGroupTagDeclaration}.
46   */
47  @Generated("component.stg")
48  public class UITabGroup
49      extends AbstractUITabGroup  {
50  
51    public static final String COMPONENT_TYPE = Tags.tabGroup.componentType();
52  
53    public static final String COMPONENT_FAMILY = "javax.faces.Panel";
54  
55    private static final Collection<String> EVENT_NAMES = Arrays.asList("click");
56  
57    @Override
58    public Collection<String> getEventNames() {
59      return EVENT_NAMES;
60    }
61  
62    @Override
63    public String getDefaultEventName() {
64      return "click";
65    }
66  
67  
68    enum PropertyKeys {
69      renderedIndex,
70      actionListener,
71      switchType,
72      tabChangeListener,
73      markup,
74      immediate,
75      action,
76      customClass,
77      showNavigationBar,
78      tip,
79      selectedIndex,
80    }
81  
82    public String getFamily() {
83      return COMPONENT_FAMILY;
84    }
85  
86  
87    /**
88    For internal use. TBD: Check if this is needed any longer.
89    <br>Default: <code>0</code>
90    */
91    public java.lang.Integer getRenderedIndex() {
92      Number value  = (Number) getStateHelper().eval(PropertyKeys.renderedIndex);
93      if (value != null) {
94        return value.intValue();
95      }
96      return 0;
97    }
98  
99    public void setRenderedIndex(java.lang.Integer renderedIndex) {
100     getStateHelper().put(PropertyKeys.renderedIndex, renderedIndex);
101   }
102 
103   public javax.el.MethodExpression getActionListenerExpression() {
104     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.actionListener);
105   }
106 
107   public void setActionListenerExpression(javax.el.MethodExpression actionListener) {
108     getStateHelper().put(PropertyKeys.actionListener, actionListener);
109   }
110 
111 
112   /**
113   <p>
114    Indicating how tab switching should be done.
115    </p>
116    <p>
117    Possible values are:
118    </p>
119    <dl>
120      <dt>client</dt>
121      <dd>Tab switching is done on client, no server Request.</dd>
122      <dt>reloadPage</dt>
123      <dd>Tab switching is done by server request. Full page is reloaded.</dd>
124      <dt>reloadTab</dt>
125      <dd>Tab switching is done by server request. Only the Tab is reloaded.</dd>
126    </dl>
127   <br>Default: <code>client</code><br>Allowed Values: <code>client,reloadPage,reloadTab</code>
128   */
129   public org.apache.myfaces.tobago.model.SwitchType getSwitchType() {
130     org.apache.myfaces.tobago.model.SwitchType switchType = (org.apache.myfaces.tobago.model.SwitchType) getStateHelper().eval(PropertyKeys.switchType);
131     if (switchType != null) {
132       return switchType;
133     }
134     return org.apache.myfaces.tobago.model.SwitchType.client;
135   }
136 
137   public void setSwitchType(org.apache.myfaces.tobago.model.SwitchType switchType) {
138     getStateHelper().put(PropertyKeys.switchType, switchType);
139   }
140 
141   public javax.el.MethodExpression getTabChangeListenerExpression() {
142     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.tabChangeListener);
143   }
144 
145   public void setTabChangeListenerExpression(javax.el.MethodExpression tabChangeListener) {
146     getStateHelper().put(PropertyKeys.tabChangeListener, tabChangeListener);
147   }
148 
149 
150   public org.apache.myfaces.tobago.context.Markup getMarkup() {
151     Object object = getStateHelper().eval(PropertyKeys.markup);
152     if (object != null) {
153       return Markup.valueOf(object);
154     }
155     return null;
156   }
157 
158   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
159     getStateHelper().put(PropertyKeys.markup, markup);
160   }
161 
162   /**
163   Flag indicating that, if this component is activated by the user,
164    notifications should be delivered to interested listeners and actions
165    immediately (that is, during Apply Request Values phase) rather than
166    waiting until Invoke Application phase.
167   <br>Default: <code>false</code>
168   */
169   public boolean isImmediate() {
170     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.immediate);
171     if (bool != null) {
172       return bool;
173     }
174     return false;
175   }
176 
177   public void setImmediate(boolean immediate) {
178     getStateHelper().put(PropertyKeys.immediate, immediate);
179   }
180 
181   public javax.el.MethodExpression getActionExpression() {
182     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.action);
183   }
184 
185   public void setActionExpression(javax.el.MethodExpression action) {
186     getStateHelper().put(PropertyKeys.action, action);
187   }
188 
189 
190   /**
191   Sets a CSS class in its parent, if the parent supports it.
192 
193    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
194 
195    <pre>
196    &lt;tc:in&gt;
197      &lt;tc:style customClass="my-emphasized"/&gt;
198    &lt;/tc:in&gt;
199    </pre>
200 
201    One capability is, to used external CSS libs.
202    <br>
203    This feature should not be used imprudent.
204    Because it might be unstable against changes in the renderered HTML code.
205 
206   */
207   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
208     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
209   }
210 
211   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
212     getStateHelper().put(PropertyKeys.customClass, customClass);
213   }
214 
215   /**
216   Flag indicating that the tab navigation bar is rendered.
217   <br>Default: <code>true</code>
218   */
219   public boolean isShowNavigationBar() {
220     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showNavigationBar);
221     if (bool != null) {
222       return bool;
223     }
224     return true;
225   }
226 
227   public void setShowNavigationBar(boolean showNavigationBar) {
228     getStateHelper().put(PropertyKeys.showNavigationBar, showNavigationBar);
229   }
230 
231   /**
232   Text value to display as tooltip.
233 
234   */
235   public java.lang.String getTip() {
236     return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
237   }
238 
239   public void setTip(java.lang.String tip) {
240     getStateHelper().put(PropertyKeys.tip, tip);
241   }
242 
243   /**
244   <strong>ValueBindingExpression</strong> pointing to a Integer to save the
245    component's selected Tab.
246   <br>Default: <code>0</code>
247   */
248   public java.lang.Integer getSelectedIndex() {
249     Number value  = (Number) getStateHelper().eval(PropertyKeys.selectedIndex);
250     if (value != null) {
251       return value.intValue();
252     }
253     return 0;
254   }
255 
256   public void setSelectedIndex(java.lang.Integer selectedIndex) {
257     getStateHelper().put(PropertyKeys.selectedIndex, selectedIndex);
258   }
259 
260 
261   @Override
262   public void restoreState(FacesContext context, Object state) {
263     // FIXME HACK for mojarra SystemEventListener state restoring bug
264     pushComponentToEL(context, this);
265     super.restoreState(context, state);
266     popComponentFromEL(context);
267   }
268 
269 }