1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\r
5 import com.smartdevicelink.proxy.RPCStruct;
\r
6 import com.smartdevicelink.proxy.constants.Names;
\r
7 import com.smartdevicelink.proxy.rpc.enums.CharacterSet;
\r
8 import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
\r
9 import com.smartdevicelink.util.DebugTool;
\r
12 * Struct defining the characteristics of a displayed field on the HMI.
\r
13 * <p><b> Parameter List
\r
14 * <table border="1" rules="all">
\r
18 * <th>Description</th>
\r
19 * <th>SmartDeviceLink Ver. Available</th>
\r
23 * <td>TextFieldName</td>
\r
24 * <td>Enumeration identifying the field. </td>
\r
25 * <td>SmartDeviceLink 1.0</td>
\r
28 * <td>characterSet</td>
\r
29 * <td>CharacterSet</td>
\r
30 * <td>The character set that is supported in this field. </td>
\r
31 * <td>SmartDeviceLink 1.0</td>
\r
36 * <td>The number of characters in one row of this field.
\r
38 * <li>Minvalue="1"</li>
\r
39 * <li>maxvalue="500"</li>
\r
42 * <td>SmartDeviceLink 1.0</td>
\r
47 * <td>The number of rows for this text field.
\r
49 * <li>Minvalue="1"</li>
\r
50 * <li>maxvalue="3"</li>
\r
53 * <td>SmartDeviceLink 1.0</td>
\r
56 * @since SmartDeviceLink 1.0
\r
58 public class TextField extends RPCStruct {
\r
60 * Constructs a newly allocated TextField object
\r
62 public TextField() { }
\r
64 * Constructs a newly allocated TextField object indicated by the Hashtable parameter
\r
65 * @param hash The Hashtable to use
\r
67 public TextField(Hashtable hash) {
\r
71 * Get the enumeration identifying the field.
\r
72 * @return the name of TextField
\r
74 public TextFieldName getName() {
\r
75 Object obj = store.get(Names.name);
\r
76 if (obj instanceof TextFieldName) {
\r
77 return (TextFieldName) obj;
\r
78 } else if (obj instanceof String) {
\r
79 TextFieldName theCode = null;
\r
81 theCode = TextFieldName.valueForString((String) obj);
\r
82 } catch (Exception e) {
\r
83 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.name, e);
\r
90 * Set the enumeration identifying the field.
\r
91 * @param name the name of TextField
\r
93 public void setName( TextFieldName name ) {
\r
95 store.put(Names.name, name );
\r
99 * Get the character set that is supported in this field.
\r
100 * @return the character set
\r
102 public CharacterSet getCharacterSet() {
\r
103 Object obj = store.get(Names.characterSet);
\r
104 if (obj instanceof CharacterSet) {
\r
105 return (CharacterSet) obj;
\r
106 } else if (obj instanceof String) {
\r
107 CharacterSet theCode = null;
\r
109 theCode = CharacterSet.valueForString((String) obj);
\r
110 } catch (Exception e) {
\r
111 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.characterSet, e);
\r
118 * Set the character set that is supported in this field.
\r
119 * @param characterSet - the character set
\r
121 public void setCharacterSet( CharacterSet characterSet ) {
\r
122 if (characterSet != null) {
\r
123 store.put(Names.characterSet, characterSet );
\r
127 * Get the number of characters in one row of this field.
\r
129 * <li>Minvalue="1"</li>
\r
130 * <li>maxvalue="500"</li>
\r
132 * @return the number of characters in one row of this field
\r
134 public Integer getWidth() {
\r
135 return (Integer) store.get( Names.width );
\r
138 * Set the number of characters in one row of this field.
\r
140 * <li>Minvalue="1"</li>
\r
141 * <li>maxvalue="500"</li>
\r
143 * @param width the number of characters in one row of this field
\r
145 public void setWidth( Integer width ) {
\r
146 if (width != null) {
\r
147 store.put(Names.width, width );
\r
151 *Get the number of rows for this text field.
\r
153 * <li>Minvalue="1"</li>
\r
154 * <li>maxvalue="3"</li>
\r
156 * @return the number of rows for this text field
\r
158 public Integer getRows() {
\r
159 return (Integer) store.get( Names.rows );
\r
161 public void setRows( Integer rows ) {
\r
162 if (rows != null) {
\r
163 store.put(Names.rows, rows );
\r