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