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

Framework : CATJDialog

Module : CATJDialog

Class Description

public class CATTextField

The textfield graphical component.

Description:

It is is a text input component that allows editing one or several lines of text.

CATTextField Properties:

CATTextField Notifications:

CATTextField Message Catalog Implicit Mappings:

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

    CATTextField(CATDialog iDialog, String iName)

Creates a textfield with the specified parent and name.

Parameters:
iParent
The parent component.
iName
This textfield name. Here are some rules for this name:
  • It is set in the constructor, and cannot be changed afterwards.
  • The name must be unique for the parent (2 children with the same name are not allowed).
  • The name may not contain any ot the following characters: '.' (dot), ' ' (blank), '_' (underscore)

Method Detail

getText

    String getText()

Returns the text content.

Returns:
The text presented by this textfield.

setText

    void setText(String iText)

Sets the text content.

Parameters:
iText
The new text presented by this textfield.

getPassword

    boolean getPassword()

Determines whether this component is a 'password-editor' or not.


setPassword

    void setPassword(boolean iPassword)

Sets/unsets this component a 'password-editor'.

A password editor shows star (*) characters in place or input chars.


getWidth

    int getWidth()

Returns the textfield width (in characters).

Returns:
The textfield width (in characters).

setWidth

    void setWidth(int iWidth)

Sets the textfield width (in characters).

Parameters:
iWidth
The textfield width (in characters).

getHeight

    int getHeight()

Returns the textfield height (in lines). Default height is 1.

Returns:
The textfield height (in lines).

setHeight

    void setHeight(int iHeight)

Sets the textfield height (in lines). Default height is 1.

Parameters:
iHeight
The textfield height (in lines).

getMaxLength

    int getMaxLength()

Returns the maximum length (in characters) of the input text.

Returns:
The maximum length (in characters) of the input text.

setMaxLength

    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.

Parameters:
iMaxLength
The maximum length (in characters) of the input text.

getEnable

    boolean getEnable()

Determines whether this textfield is enabled or not.

Returns:
true if this textfield is enabled; false otherwise.

setEnable

    void setEnable(boolean iEnable)

Enables or disables this textfield.

A disabled textfield doesn't allow the user to change its content text.

Parameters:
iEnable
If true, this textfield is enabled; otherwise it is disabled.

getTooltip

    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).

Returns:
This button tooltip.

setTooltip

    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).

Parameters:
iTooltip
The string that is to be this textfield's tooltip.

getExpectedFormat

    String getExpectedFormat()

Get the expected format (Regular Expression)

Returns:
A regular expression string defining the allowed format. A null value means "no expected format".
See Also:
CATTextField#setExpectedFormat(String)

setExpectedFormat

    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:
CharacterMatches
\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.
\bDefines the boundary for the word.
\BEnsures the match is not on the boundary of a word.
\dUsed to match any single digit between 0 and 9.
\DUsed 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).
\sUsed to match any single white-space character which includes a space, and any other escape sequences outlined above.
\SUsed to match any single non white-space character.
\wUsed to match any character, digit or underscore.
\WUsed to match anything other than a character, digit or underscore.
\xnnUsed 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.

Parameters:
iRegExp
The regular expression string. A null value unsets the expected format.


Copyright © 2000, Dassault Systèmes. All rights reserved