1 /**
2 * Copyright 2005-2013 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.control;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
21 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26 /**
27 * Represents a group of HTML checkbox controls. Provides preset options for the
28 * user to choose by a series of checkbox controls. Only or more options can be
29 * select
30 *
31 * @author Kuali Rice Team (rice.collab@kuali.org)
32 */
33 @BeanTags({@BeanTag(name = "verticalCheckboxesControl-bean", parent = "Uif-VerticalCheckboxesControl"),
34 @BeanTag(name = "horizontalCheckboxesControl-bean", parent = "Uif-HorizontalCheckboxesControl")})
35 public class CheckboxGroupControl extends MultiValueControlBase {
36 private static final long serialVersionUID = 8800478332086081970L;
37
38 private String delimiter;
39
40 private List<String> fieldsetClasses;
41
42 public CheckboxGroupControl() {
43 super();
44 fieldsetClasses = new ArrayList<String>();
45 }
46
47 /**
48 * Delimiter string to be rendered between the checkbox group options
49 *
50 * <p>
51 * defaults to none.
52 * </p>
53 *
54 * @return String delimiter string
55 */
56 @BeanTagAttribute(name = "delimiter")
57 public String getDelimiter() {
58 return this.delimiter;
59 }
60
61 /**
62 * Setter for the string delimiter for each checkbox option
63 *
64 * @param delimiter
65 */
66 public void setDelimiter(String delimiter) {
67 this.delimiter = delimiter;
68 }
69
70 /**
71 * Get fieldsetClasses which are the classes that will be applied to this component's fieldset when generated
72 *
73 * @return fieldset css classes
74 */
75 @BeanTagAttribute(name = "fieldsetClasses", type = BeanTagAttribute.AttributeType.LISTVALUE)
76 public List<String> getFieldsetClasses() {
77 return fieldsetClasses;
78 }
79
80 /**
81 * Set fieldsetClasses - css classes for the element
82 *
83 * @param fieldsetClasses fieldset css classes list
84 */
85 public void setFieldsetClasses(List<String> fieldsetClasses) {
86 this.fieldsetClasses = fieldsetClasses;
87 }
88
89 /**
90 * Builds the HTML class attribute string by combining the fieldsetClasses list
91 * with a space delimiter
92 *
93 * @return String class attribute string
94 */
95 public String getFieldsetClassesAsString() {
96 if (fieldsetClasses != null) {
97 return StringUtils.join(fieldsetClasses, " ");
98 }
99
100 return "";
101 }
102
103 }