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