|
|
Package com.dassault_systemes.catjdialog |
Class CATTextField
|
Class Hierarchy |
java.lang.Object | +-com.dassault_systemes.catjdialog.CATCallbackSource | +-com.dassault_systemes.catjdialog.CATDialog | +-com.dassault_systemes.catjdialog.CATTextField
Class Location |
Class Description |
public class CATTextField
The textfield graphical component.
<textfield_path>.Tooltip
entry.
You may also set it programmatically using setTooltip()
.
Field Summary |
Constructor Summary |
CATTextField(CATDialog iDialog, String iName) |
Method Summary |
String | getText() |
void | setText(String iText) |
boolean | getPassword() |
void | setPassword(boolean iPassword) |
int | getWidth() |
void | setWidth(int iWidth) |
int | getHeight() |
void | setHeight(int iHeight) |
int | getMaxLength() |
void | setMaxLength(int iMaxLength) |
boolean | getEnable() |
void | setEnable(boolean iEnable) |
String | getTooltip() |
void | setTooltip(String iTooltip) |
String | getExpectedFormat() |
void | setExpectedFormat(String iRegExp) |
Field Detail |
Constructor Detail |
CATTextField(CATDialog iDialog, String iName)Creates a textfield with the specified parent and name.
iParent
iName
Method Detail |
String getText()Returns the text content.
void setText(String iText)Sets the text content.
iText
boolean getPassword()Determines whether this component is a 'password-editor' or not.
void setPassword(boolean iPassword)Sets/unsets this component a 'password-editor'.
A password editor shows star (*) characters in place or input chars.
int getWidth()Returns the textfield width (in characters).
void setWidth(int iWidth)Sets the textfield width (in characters).
iWidth
int getHeight()Returns the textfield height (in lines). Default height is 1.
void setHeight(int iHeight)Sets the textfield height (in lines). Default height is 1.
iHeight
int getMaxLength()Returns the maximum length (in characters) of the input text.
void setMaxLength(int iMaxLength)Sets the maximum length (in characters) of the input text.
The textfield will prevent the user from typing more than what's authorized.
iMaxLength
boolean getEnable()Determines whether this textfield is enabled or not.
true
if this textfield is enabled; false
otherwise.void setEnable(boolean iEnable)Enables or disables this textfield.
A disabled textfield doesn't allow the user to change its content text.
iEnable
true
, this textfield is enabled; otherwise it is disabled.String getTooltip()Returns the textfield's tooltip.
Returns the programmatic value if setTooltip() has been called,
or tries to retrieve its value from the associated message catalog file
(<textfield_path>.Tooltip
entry).
void setTooltip(String iTooltip)Sets the textfield's tooltip.
Calling this method sets programmatically the tooltip. This should
be reserved for cases where the tooltip can only be determined by dynamic
means.
The standard way of defining components messages is using CATNls catalog
files (supports NLS).
iTooltip
String getExpectedFormat()Get the expected format (Regular Expression)
null
value means "no expected format".void setExpectedFormat(String iRegExp)Sets the expected format (Regular Expression).
Note: if you want the user to be informed of the expected format, you should define a 'Tooltip' attribute on the widget in the NLS message catalog.
Examples:
To get a string that can be parsed into an integer:
myTextField.setExpectedFormat("[0-9]+");
To get a non-empty string:
myTextField.setExpectedFormat(".");
To get a string composed of exactly 10 characters:
myTextField.setExpectedFormat(".{10}");
Special characters that may be used with the RegExp Object:
Character | Matches |
---|---|
\ | Used to find literal or special characters. |
^ | The match must occur at the beginning of the string. |
$ | The match must occur at the end of the string. |
* | Matches zero or more times. |
+ | Matches one or more times. |
? | Matches zero or one time. |
. | Matches any character except new lines. |
\b | Defines the boundary for the word. |
\B | Ensures the match is not on the boundary of a word. |
\d | Used to match any single digit between 0 and 9. |
\D | Used to match any non-digit. |
\f \n \r \t \v | Used to match any of the escape sequences, \f (form feed), \n (new line), \r (carriage return), \t (tab), \v (vertical tab). |
\s | Used to match any single white-space character which includes a space, and any other escape sequences outlined above. |
\S | Used to match any single non white-space character. |
\w | Used to match any character, digit or underscore. |
\W | Used to match anything other than a character, digit or underscore. |
\xnn | Used to match the ASCII character represented by the hexadecimal number nn. The ASCII character for 'A' is 65. The hexadecimal value is 41. |
[] | Used to match any of the enclosed characters. |
[^] | The first match that is not in the enclosed characters. |
[c-c] | Used to match a range of characters. |
{n} | Used to match n occurences of the previous character. |
{n,} | Used to match at least n occurences of the previous character.If there were four w's |
{m,n} | Used to match between m and n occurences of the previous character. |
| | Matches either of the character to the side of the operator. |
iRegExp
null
value unsets the expected format.