1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.container;
17
18 import java.util.HashSet;
19 import java.util.Set;
20
21 import org.apache.commons.collections.CollectionUtils;
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
24 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
25 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
26 import org.kuali.rice.krad.uif.UifConstants;
27 import org.kuali.rice.krad.uif.component.ClientSideState;
28 import org.kuali.rice.krad.uif.component.Component;
29 import org.kuali.rice.krad.uif.util.LifecycleElement;
30 import org.kuali.rice.krad.uif.widget.Tabs;
31
32
33
34
35
36
37
38
39 @BeanTags({@BeanTag(name = "tabGroup", parent = "Uif-TabGroup"),
40 @BeanTag(name = "tabSection", parent = "Uif-TabSection"),
41 @BeanTag(name = "tabSubSection", parent = "Uif-TabSubSection")})
42 public class TabGroup extends GroupBase {
43 private static final long serialVersionUID = 3L;
44
45 private Tabs tabsWidget;
46
47
48 @ClientSideState(variableName = "activeTab")
49 private String defaultActiveTabId;
50
51 public TabGroup() {
52 super();
53 }
54
55
56
57
58 @Override
59 public void performFinalize(Object model, LifecycleElement parent) {
60 super.performFinalize(model, parent);
61 this.addDataAttribute(UifConstants.DataAttributes.TYPE, "Uif-TabGroup");
62
63 if (StringUtils.isBlank(defaultActiveTabId) && CollectionUtils.isNotEmpty(this.getItems())) {
64 defaultActiveTabId = this.getItems().get(0).getId();
65 }
66 }
67
68
69
70
71
72
73 @Override
74 public Set<Class<? extends Component>> getSupportedComponents() {
75 Set<Class<? extends Component>> supportedComponents = new HashSet<Class<? extends Component>>();
76 supportedComponents.add(Group.class);
77
78 return supportedComponents;
79 }
80
81
82
83
84
85
86
87 @BeanTagAttribute
88 public Tabs getTabsWidget() {
89 return this.tabsWidget;
90 }
91
92
93
94
95 public void setTabsWidget(Tabs tabsWidget) {
96 this.tabsWidget = tabsWidget;
97 }
98
99
100
101
102
103
104 @BeanTagAttribute
105 public String getDefaultActiveTabId() {
106 return defaultActiveTabId;
107 }
108
109
110
111
112 public void setDefaultActiveTabId(String defaultActiveTabId) {
113 this.defaultActiveTabId = defaultActiveTabId;
114 }
115 }