1 | |
package org.kuali.rice.core.api.uif; |
2 | |
|
3 | |
import javax.xml.bind.annotation.XmlAccessType; |
4 | |
import javax.xml.bind.annotation.XmlAccessorType; |
5 | |
import javax.xml.bind.annotation.XmlElement; |
6 | |
import javax.xml.bind.annotation.XmlType; |
7 | |
|
8 | |
@XmlAccessorType(XmlAccessType.NONE) |
9 | |
@XmlType(name = TextInput.Constants.TYPE_NAME) |
10 | 0 | public class TextInput extends AbstractControl implements Sized, Watermarked { |
11 | |
|
12 | |
@XmlElement(name = Elements.SIZE, required = false) |
13 | |
private final Integer size; |
14 | |
|
15 | |
@XmlElement(name = Elements.WATERMARK, required = false) |
16 | |
private final String watermark; |
17 | |
|
18 | |
@Override |
19 | |
public Integer getSize() { |
20 | 0 | return size; |
21 | |
} |
22 | |
|
23 | |
@Override |
24 | |
public String getWatermark() { |
25 | 0 | return watermark; |
26 | |
} |
27 | |
|
28 | 0 | private TextInput() { |
29 | 0 | size = null; |
30 | 0 | watermark = null; |
31 | 0 | } |
32 | |
|
33 | 0 | private TextInput(Builder b) { |
34 | 0 | size = b.size; |
35 | 0 | watermark = b.watermark; |
36 | 0 | } |
37 | |
|
38 | 0 | public static final class Builder extends AbstractControl.Builder implements Sized, Watermarked { |
39 | |
private Integer size; |
40 | |
private String watermark; |
41 | |
|
42 | |
private Builder() { |
43 | 0 | super(); |
44 | 0 | } |
45 | |
|
46 | |
public static Builder create() { |
47 | 0 | return new Builder(); |
48 | |
} |
49 | |
|
50 | |
@Override |
51 | |
public Integer getSize() { |
52 | 0 | return size; |
53 | |
} |
54 | |
|
55 | |
public void setSize(Integer size) { |
56 | 0 | if (size != null && size < 1) { |
57 | 0 | throw new IllegalArgumentException("size was < 1"); |
58 | |
} |
59 | |
|
60 | 0 | this.size = size; |
61 | 0 | } |
62 | |
|
63 | |
@Override |
64 | |
public String getWatermark() { |
65 | 0 | return watermark; |
66 | |
} |
67 | |
|
68 | |
public void setWatermark(String watermark) { |
69 | 0 | this.watermark = watermark; |
70 | 0 | } |
71 | |
|
72 | |
@Override |
73 | |
public TextInput build() { |
74 | 0 | return new TextInput(this); |
75 | |
} |
76 | |
} |
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | 0 | static final class Constants { |
82 | |
static final String TYPE_NAME = "TextInputType"; |
83 | |
} |
84 | |
|
85 | 0 | static final class Elements { |
86 | |
static final String SIZE = "size"; |
87 | |
static final String WATERMARK = "watermark"; |
88 | |
} |
89 | |
} |