1 | |
package org.kuali.rice.core.api.uif; |
2 | |
|
3 | |
import javax.xml.bind.annotation.XmlElement; |
4 | |
import java.util.Collections; |
5 | |
import java.util.HashMap; |
6 | |
import java.util.Map; |
7 | |
|
8 | 0 | public class CheckboxGroup extends AbstractControl implements KeyLabeled { |
9 | |
|
10 | |
@XmlElement(name = Elements.KEY_LABELS, required = false) |
11 | |
private final Map<String, String> keyLabels; |
12 | |
|
13 | |
@Override |
14 | |
public Map<String, String> getKeyLabels() { |
15 | 0 | return keyLabels; |
16 | |
} |
17 | |
|
18 | 0 | private CheckboxGroup() { |
19 | 0 | keyLabels = null; |
20 | 0 | } |
21 | |
|
22 | 0 | private CheckboxGroup(Builder b) { |
23 | 0 | keyLabels = b.keyLabels; |
24 | 0 | } |
25 | |
|
26 | 0 | public static final class Builder extends AbstractControl.Builder implements KeyLabeled { |
27 | |
private Map<String, String> keyLabels; |
28 | |
|
29 | 0 | private Builder(Map<String, String> keyLabels) { |
30 | 0 | setKeyLabels(keyLabels); |
31 | 0 | } |
32 | |
|
33 | |
public static Builder create(Map<String, String> keyLabels) { |
34 | 0 | return new Builder(keyLabels); |
35 | |
} |
36 | |
|
37 | |
@Override |
38 | |
public Map<String, String> getKeyLabels() { |
39 | 0 | return keyLabels; |
40 | |
} |
41 | |
|
42 | |
public void setKeyLabels(Map<String, String> keyLabels) { |
43 | 0 | if (keyLabels == null || keyLabels.isEmpty()) { |
44 | 0 | throw new IllegalArgumentException("keyLabels must be non-null & non-empty"); |
45 | |
} |
46 | |
|
47 | 0 | this.keyLabels = Collections.unmodifiableMap(new HashMap<String, String>(keyLabels)); |
48 | 0 | } |
49 | |
|
50 | |
@Override |
51 | |
public CheckboxGroup build() { |
52 | 0 | return new CheckboxGroup(this); |
53 | |
} |
54 | |
} |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | 0 | static final class Constants { |
60 | |
static final String TYPE_NAME = "CheckboxGroupType"; |
61 | |
} |
62 | |
|
63 | 0 | static final class Elements { |
64 | |
static final String KEY_LABELS = "keyLabels"; |
65 | |
} |
66 | |
} |