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.widget.Reorderer;
23  
24  import java.util.List;
25  
26  /**
27   * Group implementation that supports reordering of the group items
28   *
29   * <p>
30   * Uses a {@link org.kuali.rice.krad.uif.widget.Reorderer} widget to perform the reordering client side
31   * </p>
32   *
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  @BeanTags({@BeanTag(name = "reorderGroup", parent = "Uif-ReorderGroup"),
36          @BeanTag(name = "reorderSection", parent = "Uif-ReorderSection")})
37  public class ReorderingGroup extends Group {
38      private static final long serialVersionUID = -9069458348367183223L;
39  
40      private Reorderer reorderer;
41  
42      public ReorderingGroup() {
43          super();
44      }
45  
46      /**
47       * @see org.kuali.rice.krad.uif.component.ComponentBase#getComponentsForLifecycle()
48       */
49      @Override
50      public List<Component> getComponentsForLifecycle() {
51          List<Component> components = super.getComponentsForLifecycle();
52  
53          components.add(reorderer);
54  
55          return components;
56      }
57  
58      /**
59       * Widget that will perform the reordering of the group's items client side
60       *
61       * @return Reorderer widget instance
62       */
63      @BeanTagAttribute(name = "reorderer", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
64      public Reorderer getReorderer() {
65          return reorderer;
66      }
67  
68      /**
69       * Setter for the groups reorderer widget
70       *
71       * @param reorderer
72       */
73      public void setReorderer(Reorderer reorderer) {
74          this.reorderer = reorderer;
75      }
76  }