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