View Javadoc

1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.uif.container;
17  
18  import org.kuali.rice.krad.datadictionary.parse.BeanTag;
19  import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20  import org.kuali.rice.krad.datadictionary.parse.BeanTags;
21  import org.kuali.rice.krad.uif.component.Component;
22  import org.kuali.rice.krad.uif.view.View;
23  import org.kuali.rice.krad.uif.widget.Tabs;
24  
25  import java.util.HashSet;
26  import java.util.List;
27  import java.util.Set;
28  
29  /**
30   * A group that presents its child Groups as tabs.  Items in this group's item list must be Groups
31   * themselves.
32   *
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   * @see Group
35   */
36  @BeanTags(
37          {@BeanTag(name = "tabGroup-bean", parent = "Uif-TabGroup"), @BeanTag(name = "tabSection-bean", parent = "Uif-TabSection"),
38                  @BeanTag(name = "tabSubSection-bean", parent = "Uif-TabSubSection")})
39  public class TabGroup extends Group {
40      private static final long serialVersionUID = 3L;
41  
42      private Tabs tabsWidget;
43  
44      public TabGroup() {
45          super();
46      }
47  
48      /**
49       * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentsForLifecycle()
50       */
51      @Override
52      public List<Component> getComponentsForLifecycle() {
53          List<Component> components = super.getComponentsForLifecycle();
54  
55          components.add(tabsWidget);
56  
57          return components;
58      }
59  
60      @Override
61      public void performFinalize(View view, Object model, Component parent) {
62          super.performFinalize(view, model, parent);
63          this.addDataAttribute("type", "Uif-TabGroup");
64      }
65  
66      /**
67       * Only groups are supported for this group.
68       *
69       * @see org.kuali.rice.krad.web.view.container.ContainerBase#getSupportedComponents()
70       */
71      @Override
72      public Set<Class<? extends Component>> getSupportedComponents() {
73          Set<Class<? extends Component>> supportedComponents = new HashSet<Class<? extends Component>>();
74          supportedComponents.add(Group.class);
75  
76          return supportedComponents;
77      }
78  
79      /**
80       * Gets the widget which contains any configuration for the tab widget component used to render
81       * this TabGroup
82       *
83       * @return the tabsWidget
84       */
85      @BeanTagAttribute(name = "tabsWidget", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
86      public Tabs getTabsWidget() {
87          return this.tabsWidget;
88      }
89  
90      /**
91       * @param tabsWidget the tabsWidget to set
92       */
93      public void setTabsWidget(Tabs tabsWidget) {
94          this.tabsWidget = tabsWidget;
95      }
96  
97  }