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