1 | |
package org.kuali.rice.core.api.uif.control; |
2 | |
|
3 | |
import javax.xml.bind.annotation.XmlElement; |
4 | |
|
5 | 0 | public class RadioButtonGroup extends AbstractControl implements RadioButtonGroupContract { |
6 | |
|
7 | |
@XmlElement(name = Elements.DEFAULT_VALUE, required = false) |
8 | |
private final String defaultValue; |
9 | |
|
10 | |
@Override |
11 | |
public String getDefaultValue() { |
12 | 0 | return defaultValue; |
13 | |
} |
14 | |
|
15 | 0 | private RadioButtonGroup() { |
16 | 0 | defaultValue = null; |
17 | 0 | } |
18 | |
|
19 | |
private RadioButtonGroup(Builder b) { |
20 | 0 | super(b); |
21 | 0 | defaultValue = b.defaultValue; |
22 | 0 | } |
23 | |
|
24 | 0 | public static final class Builder extends AbstractControl.Builder implements RadioButtonGroupContract { |
25 | |
private String defaultValue; |
26 | |
|
27 | |
private Builder(String name) { |
28 | 0 | super(name); |
29 | 0 | } |
30 | |
|
31 | |
public static Builder create(String name) { |
32 | 0 | return new Builder(name); |
33 | |
} |
34 | |
|
35 | |
public static Builder create(TextInputContract contract) { |
36 | 0 | Builder b = create(contract.getName()); |
37 | |
|
38 | 0 | partialCreate(contract, b); |
39 | |
|
40 | 0 | b.setDefaultValue(contract.getDefaultValue()); |
41 | 0 | return b; |
42 | |
} |
43 | |
|
44 | |
@Override |
45 | |
public String getDefaultValue() { |
46 | 0 | return defaultValue; |
47 | |
} |
48 | |
|
49 | |
public void setDefaultValue(String defaultValue) { |
50 | 0 | this.defaultValue = defaultValue; |
51 | 0 | } |
52 | |
|
53 | |
@Override |
54 | |
public RadioButtonGroup build() { |
55 | 0 | return new RadioButtonGroup(this); |
56 | |
} |
57 | |
} |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | 0 | static final class Constants { |
63 | |
static final String TYPE_NAME = "RadioButtonGroupType"; |
64 | |
} |
65 | |
|
66 | 0 | static final class Elements { |
67 | |
static final String DEFAULT_VALUE = "defaultValue"; |
68 | |
} |
69 | |
} |