001 /** 002 * Copyright 2005-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.krad.uif.container; 017 018 import org.kuali.rice.krad.datadictionary.parse.BeanTag; 019 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute; 020 import org.kuali.rice.krad.datadictionary.parse.BeanTags; 021 import org.kuali.rice.krad.uif.UifConstants; 022 import org.kuali.rice.krad.uif.component.Component; 023 import org.kuali.rice.krad.uif.view.View; 024 import org.kuali.rice.krad.uif.widget.Tabs; 025 026 import java.util.HashSet; 027 import java.util.List; 028 import java.util.Set; 029 030 /** 031 * A group that presents its child Groups as tabs. Items in this group's item list must be Groups 032 * themselves. 033 * 034 * @author Kuali Rice Team (rice.collab@kuali.org) 035 * @see Group 036 */ 037 @BeanTags( 038 {@BeanTag(name = "tabGroup-bean", parent = "Uif-TabGroup"), @BeanTag(name = "tabSection-bean", parent = "Uif-TabSection"), 039 @BeanTag(name = "tabSubSection-bean", parent = "Uif-TabSubSection")}) 040 public class TabGroup extends Group { 041 private static final long serialVersionUID = 3L; 042 043 private Tabs tabsWidget; 044 045 public TabGroup() { 046 super(); 047 } 048 049 /** 050 * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentsForLifecycle() 051 */ 052 @Override 053 public List<Component> getComponentsForLifecycle() { 054 List<Component> components = super.getComponentsForLifecycle(); 055 056 components.add(tabsWidget); 057 058 return components; 059 } 060 061 @Override 062 public void performFinalize(View view, Object model, Component parent) { 063 super.performFinalize(view, model, parent); 064 this.addDataAttribute(UifConstants.DataAttributes.TYPE, "Uif-TabGroup"); 065 } 066 067 /** 068 * Only groups are supported for this group. 069 * 070 * @see org.kuali.rice.krad.web.view.container.ContainerBase#getSupportedComponents() 071 */ 072 @Override 073 public Set<Class<? extends Component>> getSupportedComponents() { 074 Set<Class<? extends Component>> supportedComponents = new HashSet<Class<? extends Component>>(); 075 supportedComponents.add(Group.class); 076 077 return supportedComponents; 078 } 079 080 /** 081 * Gets the widget which contains any configuration for the tab widget component used to render 082 * this TabGroup 083 * 084 * @return the tabsWidget 085 */ 086 @BeanTagAttribute(name = "tabsWidget", type = BeanTagAttribute.AttributeType.SINGLEBEAN) 087 public Tabs getTabsWidget() { 088 return this.tabsWidget; 089 } 090 091 /** 092 * @param tabsWidget the tabsWidget to set 093 */ 094 public void setTabsWidget(Tabs tabsWidget) { 095 this.tabsWidget = tabsWidget; 096 } 097 098 /** 099 * @see org.kuali.rice.krad.uif.component.ComponentBase#copy() 100 */ 101 @Override 102 protected <T> void copyProperties(T component) { 103 super.copyProperties(component); 104 TabGroup tabGroupCopy = (TabGroup) component; 105 106 if(tabsWidget != null) { 107 tabGroupCopy.setTabsWidget((Tabs)this.getTabsWidget().copy()); 108 } 109 } 110 111 }