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