|
|
|||||
| 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)
Creates a textfield with the specified parent and name. |
| Method Summary |
| public boolean | getEnable()
Determines whether this textfield is enabled or not. |
| public String | getExpectedFormat()
Get the expected format (Regular Expression) |
| public int | getHeight()
Returns the textfield height (in lines). |
| public int | getMaxLength()
Returns the maximum length (in characters) of the input text. |
| public boolean | getPassword()
Determines whether this component is a 'password-editor' or not. |
| public String | getText()
Returns the text content. |
| public String | getTooltip()
Returns the textfield's tooltip. |
| public int | getWidth()
Returns the textfield width (in characters). |
| public void | setEnable(boolean iEnable)
Enables or disables this textfield. |
| public void | setExpectedFormat(String iRegExp)
Sets the expected format (Regular Expression). |
| public void | setHeight(int iHeight)
Sets the textfield height (in lines). |
| public void | setMaxLength(int iMaxLength)
Sets the maximum length (in characters) of the input text. |
| public void | setPassword(boolean iPassword)
Sets/unsets this component a 'password-editor'. |
| public void | setText(String iText)
Sets the text content. |
| public void | setTooltip(String iTooltip)
Sets the textfield's tooltip. |
| public void | setWidth(int iWidth)
Sets the textfield width (in characters). |
| Field Detail |
| Constructor Detail |
CATTextField(CATDialog iDialog, String iName)
Creates a textfield with the specified parent and name.
iParentiName| Method Detail |
public boolean getEnable()
Determines whether this textfield is enabled or not.
true if this textfield is enabled; false otherwise.
public String getExpectedFormat()
Get the expected format (Regular Expression)
null value means "no expected format".
public int getHeight()
Returns the textfield height (in lines). Default height is 1.
public int getMaxLength()
Returns the maximum length (in characters) of the input text.
public boolean getPassword()
Determines whether this component is a 'password-editor' or not.
public String getText()
Returns the text content.
public 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).
public int getWidth()
Returns the textfield width (in characters).
public void setEnable(boolean iEnable)
Enables or disables this textfield.
A disabled textfield doesn't allow the user to change its content text.
iEnabletrue, this textfield is enabled; otherwise it is disabled.
public 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. |
iRegExpnull value unsets the expected format.
public void setHeight(int iHeight)
Sets the textfield height (in lines). Default height is 1.
iHeight
public 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
public void setPassword(boolean iPassword)
Sets/unsets this component a 'password-editor'.
A password editor shows star (*) characters in place or input chars.
public void setText(String iText)
Sets the text content.
iText
public 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
public void setWidth(int iWidth)
Sets the textfield width (in characters).
iWidth