1 /**
2 * Copyright 2005-2012 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
20 import java.util.ArrayList;
21 import java.util.List;
22
23 /**
24 * Represents a group of HTML Radio controls. Provides preset options for the
25 * user to choose by a series of radio controls. Only one option can be selected
26 *
27 * @author Kuali Rice Team (rice.collab@kuali.org)
28 */
29 public class RadioGroupControl extends MultiValueControlBase {
30 private static final long serialVersionUID = 8800478332086081970L;
31 private List<String> fieldsetClasses;
32
33
34 private String delimiter;
35
36 public RadioGroupControl() {
37 super();
38 fieldsetClasses = new ArrayList<String>();
39 }
40
41 /**
42 * Delimiter string to be rendered between the radio group options, defaults
43 * to none
44 *
45 * @return String delimiter string
46 */
47 public String getDelimiter() {
48 return this.delimiter;
49 }
50
51 /**
52 * Setter for the string delimiter for each radio option
53 *
54 * @param delimiter delimeter to render between options
55 */
56 public void setDelimiter(String delimiter) {
57 this.delimiter = delimiter;
58 }
59
60 /**
61 * Get fieldsetClasses which are the classes that will be applied to this component's fieldset when generated
62 *
63 * @return css classes for the fieldset
64 */
65 public List<String> getFieldsetClasses() {
66 return fieldsetClasses;
67 }
68
69 /**
70 * Set fieldsetClasses
71 *
72 * @param fieldsetClasses css classes for the fieldset
73 */
74 public void setFieldsetClasses(List<String> fieldsetClasses) {
75 this.fieldsetClasses = fieldsetClasses;
76 }
77
78 /**
79 * Builds the HTML class attribute string by combining the fieldsetClasses list
80 * with a space delimiter
81 *
82 * @return String class attribute string
83 */
84 public String getFieldsetClassesAsString() {
85 if (fieldsetClasses != null) {
86 return StringUtils.join(fieldsetClasses, " ");
87 }
88
89 return "";
90 }
91 }