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

    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

getEnable

    public boolean getEnable()

Determines whether this textfield is enabled or not.

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

getExpectedFormat

    public String getExpectedFormat()

Get the expected format (Regular Expression)

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

getHeight

    public int getHeight()

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

Return:
The textfield height (in lines).

getMaxLength

    public int getMaxLength()

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

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

getPassword

    public boolean getPassword()

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


getText

    public String getText()

Returns the text content.

Return:
The text presented by this textfield.

getTooltip

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

Return:
This button tooltip.

getWidth

    public int getWidth()

Returns the textfield width (in characters).

Return:
The textfield width (in characters).

setEnable

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

setExpectedFormat

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

setHeight

    public void setHeight(int iHeight)

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

Parameters:
iHeight
The textfield height (in lines).

setMaxLength

    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.

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

setPassword

    public void setPassword(boolean iPassword)

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

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


setText

    public void setText(String iText)

Sets the text content.

Parameters:
iText
The new text presented by this textfield.

setTooltip

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

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

setWidth

    public void setWidth(int iWidth)

Sets the textfield width (in characters).

Parameters:
iWidth
The textfield width (in characters).


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