View Javadoc

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   * A textarea control type.
16   */
17  @XmlRootElement(name = RemotableTextarea.Constants.ROOT_ELEMENT_NAME)
18  @XmlAccessorType(XmlAccessType.NONE)
19  @XmlType(name = RemotableTextarea.Constants.TYPE_NAME, propOrder = {
20          RemotableTextarea.Elements.ROWS,
21          RemotableTextarea.Elements.COLS,
22          RemotableTextarea.Elements.WATERMARK,
23  		CoreConstants.CommonElements.FUTURE_ELEMENTS })
24  public final class RemotableTextarea extends RemotableAbstractControl implements Watermarked, RowsCols {
25  
26      @XmlElement(name = Elements.ROWS, required = false)
27      private final Integer rows;
28  
29      @XmlElement(name = Elements.COLS, required = false)
30      private final Integer cols;
31  
32      @XmlElement(name = Elements.WATERMARK, required = false)
33      private final String watermark;
34  
35      @SuppressWarnings("unused")
36      @XmlAnyElement
37      private final Collection<Element> _futureElements = null;
38  
39      /**
40       * Should only be invoked by JAXB.
41       */
42      @SuppressWarnings("unused")
43      private RemotableTextarea() {
44          rows = null;
45          cols = null;
46          watermark = null;
47      }
48  
49      private RemotableTextarea(Builder b) {
50          rows = b.rows;
51          cols = b.cols;
52          watermark = b.watermark;
53      }
54  
55      @Override
56      public Integer getRows() {
57          return rows;
58      }
59  
60      @Override
61      public Integer getCols() {
62          return cols;
63      }
64  
65      @Override
66      public String getWatermark() {
67          return watermark;
68      }
69  
70      public static final class Builder extends RemotableAbstractControl.Builder implements Watermarked, RowsCols {
71          private Integer rows;
72          private Integer cols;
73          private String watermark;
74  
75          private Builder() {
76              super();
77          }
78  
79          public static Builder create() {
80              return new Builder();
81          }
82  
83          @Override
84          public Integer getRows() {
85              return rows;
86          }
87  
88          public void setRows(Integer rows) {
89              if (rows != null && rows < 1) {
90                  throw new IllegalArgumentException("rows was < 1");
91              }
92  
93              this.rows = rows;
94          }
95  
96          @Override
97          public Integer getCols() {
98              return cols;
99          }
100 
101         public void setCols(Integer cols) {
102             if (cols != null && cols < 1) {
103                 throw new IllegalArgumentException("cols was < 1");
104             }
105 
106             this.cols = cols;
107         }
108 
109         @Override
110         public String getWatermark() {
111             return watermark;
112         }
113 
114         public void setWatermark(String watermark) {
115             this.watermark = watermark;
116         }
117 
118         @Override
119         public RemotableTextarea build() {
120             return new RemotableTextarea(this);
121         }
122     }
123 
124     /**
125      * Defines some internal constants used on this class.
126      */
127     static final class Constants {
128         static final String TYPE_NAME = "TextareaType";
129         final static String ROOT_ELEMENT_NAME = "textarea";
130     }
131 
132     static final class Elements {
133         static final String COLS = "cols";
134         static final String ROWS = "rows";
135         static final String WATERMARK = "watermark";
136     }
137 }