View Javadoc

1   /**
2    * Copyright 2005-2012 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.widget;
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.uif.component.ClientSideState;
21  
22  /**
23   * Decorates a group with collapse/expand functionality
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  @BeanTag(name = "disclosure", parent = "Uif-Disclosure")
28  public class Disclosure extends WidgetBase {
29      private static final long serialVersionUID = 1238789480161901850L;
30  
31      private String collapseImageSrc;
32      private String expandImageSrc;
33  
34      private int animationSpeed;
35  
36      @ClientSideState
37      private boolean defaultOpen;
38  
39      private boolean renderImage;
40  
41      public Disclosure() {
42          super();
43  
44          defaultOpen = true;
45          renderImage = true;
46      }
47  
48      /**
49       * Path to the images that should be displayed to collapse the group
50       *
51       * @return String image path
52       */
53      @BeanTagAttribute(name="CollapseImageSrc")
54      public String getCollapseImageSrc() {
55          return this.collapseImageSrc;
56      }
57  
58      /**
59       * Setter for the collapse image path
60       *
61       * @param collapseImageSrc
62       */
63      public void setCollapseImageSrc(String collapseImageSrc) {
64          this.collapseImageSrc = collapseImageSrc;
65      }
66  
67      /**
68       * Path to the images that should be displayed to expand the group
69       *
70       * @return String image path
71       */
72      @BeanTagAttribute(name="expandImageSrc")
73      public String getExpandImageSrc() {
74          return this.expandImageSrc;
75      }
76  
77      /**
78       * Setter for the expand image path
79       *
80       * @param collapseImageSrc
81       */
82      public void setExpandImageSrc(String expandImageSrc) {
83          this.expandImageSrc = expandImageSrc;
84      }
85  
86      /**
87       * Gives the speed for the open/close animation, a smaller int will result
88       * in a faster animation
89       *
90       * @return int animation speed
91       */
92      @BeanTagAttribute(name="animationSpeed")
93      public int getAnimationSpeed() {
94          return this.animationSpeed;
95      }
96  
97      /**
98       * Setter for the open/close animation speed
99       *
100      * @param animationSpeed
101      */
102     public void setAnimationSpeed(int animationSpeed) {
103         this.animationSpeed = animationSpeed;
104     }
105 
106     /**
107      * Indicates whether the group should be initially open
108      *
109      * @return boolean true if group should be initially open, false if it
110      *         should be closed
111      */
112     @BeanTagAttribute(name="defaultOpen")
113     public boolean isDefaultOpen() {
114         return this.defaultOpen;
115     }
116 
117     /**
118      * Setter for the default open indicator
119      *
120      * @param defaultOpen
121      */
122     public void setDefaultOpen(boolean defaultOpen) {
123         this.defaultOpen = defaultOpen;
124     }
125 
126     /**
127      * Indicates whether the expand/collapse image should be rendered for the closure, if set to false only
128      * the group title will be clickable
129      *
130      * @return boolean true to render the expand/colapse image false to not
131      */
132     @BeanTagAttribute(name="renderImage")
133     public boolean isRenderImage() {
134         return renderImage;
135     }
136 
137     /**
138      * Setter for the render expand/collapse image indicator
139      *
140      * @param renderImage
141      */
142     public void setRenderImage(boolean renderImage) {
143         this.renderImage = renderImage;
144     }
145 }