View Javadoc

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