1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.api.uif; |
17 | |
|
18 | |
import org.kuali.rice.core.api.CoreConstants; |
19 | |
import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter; |
20 | |
import org.w3c.dom.Element; |
21 | |
|
22 | |
import javax.xml.bind.annotation.XmlAccessType; |
23 | |
import javax.xml.bind.annotation.XmlAccessorType; |
24 | |
import javax.xml.bind.annotation.XmlAnyElement; |
25 | |
import javax.xml.bind.annotation.XmlElement; |
26 | |
import javax.xml.bind.annotation.XmlRootElement; |
27 | |
import javax.xml.bind.annotation.XmlType; |
28 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
29 | |
import java.util.Collection; |
30 | |
import java.util.Collections; |
31 | |
import java.util.HashMap; |
32 | |
import java.util.Map; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
@XmlRootElement(name = RemotableCheckboxGroup.Constants.ROOT_ELEMENT_NAME) |
38 | |
@XmlAccessorType(XmlAccessType.NONE) |
39 | |
@XmlType(name = RemotableCheckboxGroup.Constants.TYPE_NAME, propOrder = { |
40 | |
RemotableCheckboxGroup.Elements.KEY_LABELS, |
41 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS }) |
42 | 0 | public final class RemotableCheckboxGroup extends RemotableAbstractControl implements KeyLabeled { |
43 | |
|
44 | |
@XmlElement(name = Elements.KEY_LABELS, required = true) |
45 | |
@XmlJavaTypeAdapter(value = MapStringStringAdapter.class) |
46 | |
private final Map<String, String> keyLabels; |
47 | |
|
48 | 0 | @SuppressWarnings("unused") |
49 | |
@XmlAnyElement |
50 | |
private final Collection<Element> _futureElements = null; |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
@SuppressWarnings("unused") |
56 | 0 | private RemotableCheckboxGroup() { |
57 | 0 | keyLabels = null; |
58 | 0 | } |
59 | |
|
60 | 0 | private RemotableCheckboxGroup(Builder b) { |
61 | 0 | keyLabels = b.keyLabels; |
62 | 0 | } |
63 | |
|
64 | |
@Override |
65 | |
public Map<String, String> getKeyLabels() { |
66 | 0 | return keyLabels; |
67 | |
} |
68 | |
|
69 | 0 | public static final class Builder extends RemotableAbstractControl.Builder implements KeyLabeled { |
70 | |
private Map<String, String> keyLabels; |
71 | |
|
72 | 0 | private Builder(Map<String, String> keyLabels) { |
73 | 0 | setKeyLabels(keyLabels); |
74 | 0 | } |
75 | |
|
76 | |
public static Builder create(Map<String, String> keyLabels) { |
77 | 0 | return new Builder(keyLabels); |
78 | |
} |
79 | |
|
80 | |
@Override |
81 | |
public Map<String, String> getKeyLabels() { |
82 | 0 | return keyLabels; |
83 | |
} |
84 | |
|
85 | |
public void setKeyLabels(Map<String, String> keyLabels) { |
86 | 0 | if (keyLabels == null || keyLabels.isEmpty()) { |
87 | 0 | throw new IllegalArgumentException("keyLabels must be non-null & non-empty"); |
88 | |
} |
89 | |
|
90 | 0 | this.keyLabels = Collections.unmodifiableMap(new HashMap<String, String>(keyLabels)); |
91 | 0 | } |
92 | |
|
93 | |
@Override |
94 | |
public RemotableCheckboxGroup build() { |
95 | 0 | return new RemotableCheckboxGroup(this); |
96 | |
} |
97 | |
} |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | 0 | static final class Constants { |
103 | |
static final String TYPE_NAME = "CheckboxGroupType"; |
104 | |
final static String ROOT_ELEMENT_NAME = "checkboxGroup"; |
105 | |
} |
106 | |
|
107 | 0 | static final class Elements { |
108 | |
static final String KEY_LABELS = "keyLabels"; |
109 | |
} |
110 | |
} |