001/** 002 * Copyright 2005-2018 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.control; 017 018import org.apache.commons.lang.StringUtils; 019import org.kuali.rice.krad.datadictionary.parse.BeanTag; 020import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute; 021import org.kuali.rice.krad.datadictionary.parse.BeanTags; 022 023import java.util.ArrayList; 024import java.util.List; 025 026/** 027 * Represents a group of HTML checkbox controls. Provides preset options for the 028 * user to choose by a series of checkbox controls. Only or more options can be 029 * select. 030 * 031 * @author Kuali Rice Team (rice.collab@kuali.org) 032 */ 033@BeanTags({@BeanTag(name = "verticalCheckboxesControl", parent = "Uif-VerticalCheckboxesControl"), 034 @BeanTag(name = "horizontalCheckboxesControl", parent = "Uif-HorizontalCheckboxesControl")}) 035public class CheckboxGroupControl extends MultiValueControlBase { 036 private static final long serialVersionUID = 8800478332086081970L; 037 038 private String delimiter; 039 040 private List<String> fieldsetClasses; 041 042 public CheckboxGroupControl() { 043 super(); 044 045 fieldsetClasses = new ArrayList<String>(); 046 } 047 048 /** 049 * Delimiter string to be rendered between the checkbox group options 050 * 051 * <p> 052 * defaults to none. 053 * </p> 054 * 055 * @return delimiter string 056 */ 057 @BeanTagAttribute 058 public String getDelimiter() { 059 return this.delimiter; 060 } 061 062 /** 063 * Setter for the string delimiter for each checkbox option 064 * 065 * @param delimiter 066 */ 067 public void setDelimiter(String delimiter) { 068 this.delimiter = delimiter; 069 } 070 071 /** 072 * Get fieldsetClasses which are the classes that will be applied to this component's fieldset when generated 073 * 074 * @return fieldset css classes 075 */ 076 @BeanTagAttribute 077 public List<String> getFieldsetClasses() { 078 return fieldsetClasses; 079 } 080 081 /** 082 * Set fieldsetClasses - css classes for the element 083 * 084 * @param fieldsetClasses fieldset css classes list 085 */ 086 public void setFieldsetClasses(List<String> fieldsetClasses) { 087 this.fieldsetClasses = fieldsetClasses; 088 } 089 090 /** 091 * Builds the HTML class attribute string by combining the fieldsetClasses list 092 * with a space delimiter 093 * 094 * @return class attribute string 095 */ 096 public String getFieldsetClassesAsString() { 097 if (fieldsetClasses != null) { 098 return StringUtils.join(fieldsetClasses, " "); 099 } 100 101 return ""; 102 } 103}