View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.internal.taglib.component;
21  
22  import org.apache.myfaces.tobago.apt.annotation.Behavior;
23  import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
24  import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
25  import org.apache.myfaces.tobago.apt.annotation.Tag;
26  import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
27  import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
28  import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
29  import org.apache.myfaces.tobago.component.ClientBehaviors;
30  import org.apache.myfaces.tobago.component.RendererTypes;
31  import org.apache.myfaces.tobago.internal.taglib.declaration.HasAction;
32  import org.apache.myfaces.tobago.internal.taglib.declaration.HasActionListener;
33  import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
34  import org.apache.myfaces.tobago.internal.taglib.declaration.HasTip;
35  import org.apache.myfaces.tobago.internal.taglib.declaration.IsImmediateCommand;
36  import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
37  import org.apache.myfaces.tobago.model.SwitchType;
38  
39  import javax.faces.component.UIPanel;
40  
41  /**
42   * Renders a tab group which contains tab panels.
43   */
44  @Tag(name = "tabGroup")
45  @BodyContentDescription(anyTagOf = "(<tc:tab>* ")
46  @UIComponentTag(
47      uiComponent = "org.apache.myfaces.tobago.component.UITabGroup",
48      uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUITabGroup",
49      uiComponentFacesClass = "javax.faces.component.UIPanel",
50      componentFamily = UIPanel.COMPONENT_FAMILY,
51      rendererType = RendererTypes.TAB_GROUP,
52      interfaces = "javax.faces.component.ActionSource2",
53      allowedChildComponenents = "org.apache.myfaces.tobago.Tab",
54      behaviors = {
55          @Behavior(
56              name = ClientBehaviors.CLICK,
57              isDefault = true)
58      })
59  public interface TabGroupTagDeclaration
60      extends HasIdBindingAndRendered, IsImmediateCommand, HasAction, HasActionListener, IsVisual, HasTip {
61  
62    /**
63     * Flag indicating that the tab navigation bar is rendered.
64     */
65    @TagAttribute
66    @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
67    void setShowNavigationBar(String showNavigationBar);
68  
69    /**
70     * <p>
71     * Indicating how tab switching should be done.
72     * </p>
73     * <p>
74     * Possible values are:
75     * </p>
76     * <dl>
77     *   <dt>client</dt>
78     *   <dd>Tab switching is done on client, no server Request.</dd>
79     *   <dt>reloadPage</dt>
80     *   <dd>Tab switching is done by server request. Full page is reloaded.</dd>
81     *   <dt>reloadTab</dt>
82     *   <dd>Tab switching is done by server request. Only the Tab is reloaded.</dd>
83     * </dl>
84     * @param switchType Sets the switching type.
85     */
86    @TagAttribute
87    @UIComponentTagAttribute(type = "org.apache.myfaces.tobago.model.SwitchType",
88        allowedValues = {SwitchType.CLIENT, SwitchType.RELOAD_PAGE, SwitchType.RELOAD_TAB},
89        defaultValue = SwitchType.CLIENT,
90        defaultCode = "org.apache.myfaces.tobago.model.SwitchType.client")
91    void setSwitchType(String switchType);
92  
93    /**
94     *
95     * <strong>ValueBindingExpression</strong> pointing to a Integer to save the
96     * component's selected Tab.
97     *
98     */
99    @TagAttribute
100   @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "0")
101   void setSelectedIndex(String selectedIndex);
102 
103   /**
104    * For internal use. TBD: Check if this is needed any longer.
105    */
106   @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "0")
107   void setRenderedIndex(String renderedIndex);
108 
109   @TagAttribute  
110   @UIComponentTagAttribute(
111       type = {},
112       expression = DynamicExpression.METHOD_EXPRESSION_REQUIRED,
113       methodSignature = "org.apache.myfaces.tobago.event.TabChangeEvent")
114   void setTabChangeListener(String listener);
115 }