| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Accordion |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2011 The Kuali Foundation Licensed under the Educational Community | |
| 3 | * License, Version 1.0 (the "License"); you may not use this file except in | |
| 4 | * compliance with the License. You may obtain a copy of the License at | |
| 5 | * http://www.opensource.org/licenses/ecl1.php Unless required by applicable law | |
| 6 | * or agreed to in writing, software distributed under the License is | |
| 7 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| 8 | * KIND, either express or implied. See the License for the specific language | |
| 9 | * governing permissions and limitations under the License. | |
| 10 | */ | |
| 11 | package org.kuali.rice.krad.uif.widget; | |
| 12 | ||
| 13 | import org.kuali.rice.krad.uif.component.ClientSideState; | |
| 14 | ||
| 15 | /** | |
| 16 | * Decorates a group with collapse/expand functionality | |
| 17 | * | |
| 18 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 19 | */ | |
| 20 | public class Accordion extends WidgetBase { | |
| 21 | private static final long serialVersionUID = 1238789480161901850L; | |
| 22 | ||
| 23 | private String collapseImageSrc; | |
| 24 | private String expandImageSrc; | |
| 25 | ||
| 26 | private int animationSpeed; | |
| 27 | ||
| 28 | @ClientSideState | |
| 29 | private boolean defaultOpen; | |
| 30 | ||
| 31 | private boolean renderImage; | |
| 32 | ||
| 33 | public Accordion() { | |
| 34 | 0 | super(); |
| 35 | ||
| 36 | 0 | defaultOpen = true; |
| 37 | 0 | renderImage = true; |
| 38 | 0 | } |
| 39 | ||
| 40 | /** | |
| 41 | * Path to the images that should be displayed to collapse the group | |
| 42 | * | |
| 43 | * @return String image path | |
| 44 | */ | |
| 45 | public String getCollapseImageSrc() { | |
| 46 | 0 | return this.collapseImageSrc; |
| 47 | } | |
| 48 | ||
| 49 | /** | |
| 50 | * Setter for the collapse image path | |
| 51 | * | |
| 52 | * @param collapseImageSrc | |
| 53 | */ | |
| 54 | public void setCollapseImageSrc(String collapseImageSrc) { | |
| 55 | 0 | this.collapseImageSrc = collapseImageSrc; |
| 56 | 0 | } |
| 57 | ||
| 58 | /** | |
| 59 | * Path to the images that should be displayed to expand the group | |
| 60 | * | |
| 61 | * @return String image path | |
| 62 | */ | |
| 63 | public String getExpandImageSrc() { | |
| 64 | 0 | return this.expandImageSrc; |
| 65 | } | |
| 66 | ||
| 67 | /** | |
| 68 | * Setter for the expand image path | |
| 69 | * | |
| 70 | * @param collapseImageSrc | |
| 71 | */ | |
| 72 | public void setExpandImageSrc(String expandImageSrc) { | |
| 73 | 0 | this.expandImageSrc = expandImageSrc; |
| 74 | 0 | } |
| 75 | ||
| 76 | /** | |
| 77 | * Gives the speed for the open/close animation, a smaller int will result | |
| 78 | * in a faster animation | |
| 79 | * | |
| 80 | * @return int animation speed | |
| 81 | */ | |
| 82 | public int getAnimationSpeed() { | |
| 83 | 0 | return this.animationSpeed; |
| 84 | } | |
| 85 | ||
| 86 | /** | |
| 87 | * Setter for the open/close animation speed | |
| 88 | * | |
| 89 | * @param animationSpeed | |
| 90 | */ | |
| 91 | public void setAnimationSpeed(int animationSpeed) { | |
| 92 | 0 | this.animationSpeed = animationSpeed; |
| 93 | 0 | } |
| 94 | ||
| 95 | /** | |
| 96 | * Indicates whether the group should be initially open | |
| 97 | * | |
| 98 | * @return boolean true if group should be initially open, false if it | |
| 99 | * should be closed | |
| 100 | */ | |
| 101 | public boolean isDefaultOpen() { | |
| 102 | 0 | return this.defaultOpen; |
| 103 | } | |
| 104 | ||
| 105 | /** | |
| 106 | * Setter for the default open indicator | |
| 107 | * | |
| 108 | * @param defaultOpen | |
| 109 | */ | |
| 110 | public void setDefaultOpen(boolean defaultOpen) { | |
| 111 | 0 | this.defaultOpen = defaultOpen; |
| 112 | 0 | } |
| 113 | ||
| 114 | /** | |
| 115 | * Indicates whether the expand/collapse image should be rendered for the closure, if set to false only | |
| 116 | * the group title will be clickable | |
| 117 | * | |
| 118 | * @return boolean true to render the expand/colapse image false to not | |
| 119 | */ | |
| 120 | public boolean isRenderImage() { | |
| 121 | 0 | return renderImage; |
| 122 | } | |
| 123 | ||
| 124 | /** | |
| 125 | * Setter for the render expand/collapse image indicator | |
| 126 | * | |
| 127 | * @param renderImage | |
| 128 | */ | |
| 129 | public void setRenderImage(boolean renderImage) { | |
| 130 | 0 | this.renderImage = renderImage; |
| 131 | 0 | } |
| 132 | } |