001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.uif.widget; 017 018import org.kuali.rice.krad.uif.component.ClientSideState; 019 020/** 021 * Decorates a group with collapse/expand functionality 022 * 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025public class Disclosure extends WidgetBase { 026 private static final long serialVersionUID = 1238789480161901850L; 027 028 private String collapseImageSrc; 029 private String expandImageSrc; 030 031 private int animationSpeed; 032 033 @ClientSideState 034 private boolean defaultOpen; 035 036 private boolean renderImage; 037 038 public Disclosure() { 039 super(); 040 041 defaultOpen = true; 042 renderImage = true; 043 } 044 045 /** 046 * Path to the images that should be displayed to collapse the group 047 * 048 * @return String image path 049 */ 050 public String getCollapseImageSrc() { 051 return this.collapseImageSrc; 052 } 053 054 /** 055 * Setter for the collapse image path 056 * 057 * @param collapseImageSrc 058 */ 059 public void setCollapseImageSrc(String collapseImageSrc) { 060 this.collapseImageSrc = collapseImageSrc; 061 } 062 063 /** 064 * Path to the images that should be displayed to expand the group 065 * 066 * @return String image path 067 */ 068 public String getExpandImageSrc() { 069 return this.expandImageSrc; 070 } 071 072 /** 073 * Setter for the expand image path 074 * 075 * @param collapseImageSrc 076 */ 077 public void setExpandImageSrc(String expandImageSrc) { 078 this.expandImageSrc = expandImageSrc; 079 } 080 081 /** 082 * Gives the speed for the open/close animation, a smaller int will result 083 * in a faster animation 084 * 085 * @return int animation speed 086 */ 087 public int getAnimationSpeed() { 088 return this.animationSpeed; 089 } 090 091 /** 092 * Setter for the open/close animation speed 093 * 094 * @param animationSpeed 095 */ 096 public void setAnimationSpeed(int animationSpeed) { 097 this.animationSpeed = animationSpeed; 098 } 099 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}