View Javadoc

1   /**
2    * Copyright 2005-2013 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.Accordion;
24  
25  import java.util.HashSet;
26  import java.util.List;
27  import java.util.Set;
28  
29  /**
30   * Accordion group class used to stack groups by there header titles in an accordion layout
31   */
32  @BeanTags({@BeanTag(name = "accordionGroup-bean", parent = "Uif-AccordionGroup"),
33          @BeanTag(name = "accordionSection-bean", parent = "Uif-AccordionSection"),
34          @BeanTag(name = "accordionSubSection-bean", parent = "Uif-AccordionSubSection"),
35          @BeanTag(name = "disclosure-accordionSection-bean", parent = "Uif-Disclosure-AccordionSection"),
36          @BeanTag(name = "disclosure-accordionSubSection-bean", parent = "Uif-Disclosure-AccordionSubSection")})
37  public class AccordionGroup extends Group {
38  
39      private static final long serialVersionUID = 7230145606607506418L;
40  
41      private Accordion accordionWidget;
42  
43      /**
44       * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentsForLifecycle()
45       */
46      @Override
47      public List<Component> getComponentsForLifecycle() {
48          List<Component> components = super.getComponentsForLifecycle();
49  
50          components.add(accordionWidget);
51  
52          return components;
53      }
54  
55      /**
56       * @see org.kuali.rice.krad.uif.component.ComponentBase#performFinalize(org.kuali.rice.krad.uif.view.View, Object,
57       *      org.kuali.rice.krad.uif.component.Component)
58       */
59      @Override
60      public void performFinalize(View view, Object model, Component parent) {
61          super.performFinalize(view, model, parent);
62          this.addDataAttribute("type", "Uif-AccordionGroup");
63      }
64  
65      /**
66       * Only groups are supported for this group.
67       *
68       * @see org.kuali.rice.krad.web.view.container.ContainerBase#getSupportedComponents()
69       */
70      @Override
71      public Set<Class<? extends Component>> getSupportedComponents() {
72          Set<Class<? extends Component>> supportedComponents = new HashSet<Class<? extends Component>>();
73          supportedComponents.add(Group.class);
74  
75          return supportedComponents;
76      }
77  
78      /**
79       * Gets the widget which contains any configuration for the accordion widget component used to render
80       * this AccordionGroup
81       *
82       * @return the accordionWidget
83       */
84      @BeanTagAttribute(name = "accordionWidget", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
85      public Accordion getAccordionWidget() {
86          return this.accordionWidget;
87      }
88  
89      /**
90       * Set the accordionWidget
91       *
92       * @param accordionWidget the accordionWidget to set
93       */
94      public void setAccordionWidget(Accordion accordionWidget) {
95          this.accordionWidget = accordionWidget;
96      }
97  }