| 92 | /// |
| 93 | /// @author Chen Fishbein |
| 94 | public class TextArea extends Component implements ActionSource, TextHolder { |
| 95 | /// Allows any type of input into a text field, if a constraint is not supported |
| 96 | /// by an underlying implementation this will be the default. |
| 97 | public static final int ANY = 0; |
| 98 | /// The user is allowed to enter an e-mail address. |
| 99 | public static final int EMAILADDR = 1; |
| 100 | /// The user is allowed to enter only an integer value. |
| 101 | public static final int NUMERIC = 2; |
| 102 | /// The user is allowed to enter a phone number. |
| 103 | public static final int PHONENUMBER = 3; |
| 104 | /// The user is allowed to enter a URL. |
| 105 | public static final int URL = 4; |
| 106 | /// The user is allowed to enter numeric values with optional decimal |
| 107 | /// fractions, for example "-123", "0.123", or ".5". |
| 108 | public static final int DECIMAL = 5; |
| 109 | /// Indicates that the text entered is confidential data that should be |
| 110 | /// obscured whenever possible. |
| 111 | public static final int PASSWORD = 0x10000; |
| 112 | /// Indicates that editing is currently disallowed. |
| 113 | public static final int UNEDITABLE = 0x20000; |
| 114 | /// Indicates that the text entered is sensitive data that the |
| 115 | /// implementation must never store into a dictionary or table for use |
| 116 | /// in predictive, auto-completing, or other accelerated input schemes. |
| 117 | public static final int SENSITIVE = 0x40000; |
| 118 | /// Indicates that the text entered does not consist of words that are |
| 119 | /// likely to be found in dictionaries typically used by predictive input |
| 120 | /// schemes. |
| 121 | public static final int NON_PREDICTIVE = 0x80000; |
| 122 | /// This flag is a hint to the implementation that during text editing, |
| 123 | /// the initial letter of each word should be capitalized. |
| 124 | public static final int INITIAL_CAPS_WORD = 0x100000; |
| 125 | /// This flag is a hint to the implementation that during text editing, |
| 126 | /// the initial letter of each sentence should be capitalized. |
| 127 | public static final int INITIAL_CAPS_SENTENCE = 0x200000; |
| 128 | /// This flag is a hint to the implementation that this field contains |
| 129 | /// a username. |
| 130 | public static final int USERNAME = 0x400000; |
| 131 | /// This flag is a hint to the implementation that the text in this |
| 132 | /// field should be upper case |
| 133 | public static final int UPPERCASE = 0x800000; |
| 134 | /// Indicates the enter key to be used for editing the text area and by the |
| 135 | /// text field |
| 136 | private static final char ENTER_KEY = '\n'; |
| 137 | private static final boolean hadSuccessfulEdit = false; |
| 138 | private static int defaultValign = TOP; |
| 139 | private static int defaultMaxSize = 124; |
| 140 | private static boolean autoDegradeMaxSize = false; |
| 141 | /// By default text area uses charWidth since its much faster on some devices |
| 142 | /// than string width. However, with some fonts and especially some languages (such |
| 143 | /// as Arabic, Korean etc.) the width of the string drawn might not equal the summary |
| 144 | /// of the width of the chars. Hence for portability to those languages/fonts this |
| 145 | /// flag must be set to true. |
| 146 | private static boolean useStringWidth; |
| 147 | /// Indicates the widest character in the alphabet, this is useful for detecting |
| 148 | /// linebreaks internally. In CJK languages the widest char is different than W |
| 149 | /// hence this functionality is exposed to developers. |
| 150 | private static char widestChar = 'W'; |
| 151 | private final EventDispatcher listeners = new EventDispatcher(); |