nextapp.echo
Class TextField

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by nextapp.echo.text.TextComponent
          extended by nextapp.echo.TextField
All Implemented Interfaces:
java.io.Serializable, Component, ToolTipSupport
Direct Known Subclasses:
PasswordField, TextField

public class TextField
extends TextComponent

A single line text-entry field.

See Also:
Serialized Form

Field Summary
static java.lang.String ACTION_COMMAND_CHANGED_PROPERTY
           
static java.lang.String COLUMN_UNITS_CHANGED_PROPERTY
           
static java.lang.String COLUMNS_CHANGED_PROPERTY
           
static java.lang.String KEY_ACTION_COMMAND_CHANGED_PROPERTY
           
static java.lang.String MAXIMUM_LENGTH_CHANGED_PROPERTY
           
static java.lang.String RETURN_KEY_ACTION_COMMAND_CHANGED_PROPERTY
           
static java.lang.String STYLE_MAXIMUM_LENGTH
          A style constant for the Maximum Length property.
 
Fields inherited from class nextapp.echo.text.TextComponent
BORDER_COLOR_CHANGED_PROPERTY, BORDER_DEFAULT, BORDER_INSET, BORDER_NONE, BORDER_OUTSET, BORDER_SIZE_CHANGED_PROPERTY, BORDER_SOLID, BORDER_STYLE_CHANGED_PROPERTY, CHARACTER_UNITS, CSS_CLASS_CHANGED_PROPERTY, DOCUMENT_CHANGED_PROPERTY, EDITABLE_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, PERCENT_UNITS, PIXEL_UNITS, STYLE_BORDER_COLOR, STYLE_BORDER_SIZE, STYLE_BORDER_STYLE, STYLE_COLUMNS, STYLE_HORIZONTAL_ALIGNMENT, STYLE_LINE_WRAP, STYLE_ROWS, TEXT_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.ToolTipSupport
TOOL_TIP_TEXT_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
TextField()
          Creates a new text field.
TextField(Document document)
          Creates a new text field with the given document model, text and number of columns.
TextField(Document document, java.lang.String text, int columns)
          Creates a new text field with the given document model, text and number of columns.
TextField(int columns)
          Creates a new text field with the given number of columns.
TextField(java.lang.String text)
          Creates a new text field with the given text.
TextField(java.lang.String text, int columns)
          Creates a new text field with the given text and number of columns.
 
Method Summary
 void addActionListener(ActionListener l)
          Adds an ActionListener to the text field.
 void addKeyActionListener(ActionListener l)
          Adds an ActionListener to the text field.
 void addReturnActionListener(ActionListener l)
          Adds an ActionListener to the text field.
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
 void fireActionEvent()
          Fires an action event to all listeners.
 void fireKeyActionEvent()
          Deprecated.  
 void fireReturnActionEvent()
          Deprecated.  
 java.lang.String getActionCommand()
          Returns the action command for this textField.
 int getColumns()
          Returns the columns of the text field.
 int getColumnUnits()
          Returns the units of the columns property.
 java.lang.String getKeyActionCommand()
          Deprecated. Returns the action command for this textField.
 int getMaximumLength()
          Returns the maximum number of characters that may be entered into the text field.
 java.lang.String getReturnActionCommand()
          Deprecated.  
 boolean hasActionListeners()
          Returns true if the text field has one or more action listeners.
 boolean hasKeyActionListeners()
          Returns true if the text field has one or more action listeners.
 boolean hasReturnActionListeners()
          Returns true if the text field has one or more action listeners.
 boolean isAsync()
           
 boolean isConvertToLowerCase()
           
 boolean isConvertToUpperCase()
           
 void removeActionListener(ActionListener l)
          Removes an ActionListener from the text field.
 void removeKeyActionListener(ActionListener l)
          Removes an ActionListener from the text field.
 void removeReturnActionListener(ActionListener l)
          Removes an ActionListener from the text field.
 void setActionCommand(java.lang.String newValue)
          Sets the text field's action command.
 void setAsync(boolean async)
           
 void setColumns(int newValue)
          Sets the columns of the text field.
 void setColumnUnits(int newValue)
          Sets the units for the columns property.
 void setConvertToLowerCase(boolean convertToLowerCase)
           
 void setConvertToUpperCase(boolean convertToUpperCase)
           
 void setKeyActionCommand(java.lang.String newValue)
          Deprecated.  
 void setMaximumLength(int newValue)
          Sets the maximum number of characters that may be entered into the text field.
 void setReturnActionCommand(java.lang.String newValue)
          Deprecated.  
 
Methods inherited from class nextapp.echo.text.TextComponent
getBorderColor, getBorderSize, getBorderStyle, getCssClass, getDocument, getHorizontalAlignment, getText, getToolTipText, isEditable, setBorderColor, setBorderSize, setBorderStyle, setCssClass, setDocument, setEditable, setHorizontalAlignment, setText, setToolTipText
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setClientId, setEnabled, setFocused, setFont, setForeground, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_MAXIMUM_LENGTH

public static final java.lang.String STYLE_MAXIMUM_LENGTH
A style constant for the Maximum Length property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

ACTION_COMMAND_CHANGED_PROPERTY

public static final java.lang.String ACTION_COMMAND_CHANGED_PROPERTY
See Also:
Constant Field Values

KEY_ACTION_COMMAND_CHANGED_PROPERTY

public static final java.lang.String KEY_ACTION_COMMAND_CHANGED_PROPERTY
See Also:
Constant Field Values

RETURN_KEY_ACTION_COMMAND_CHANGED_PROPERTY

public static final java.lang.String RETURN_KEY_ACTION_COMMAND_CHANGED_PROPERTY
See Also:
Constant Field Values

COLUMNS_CHANGED_PROPERTY

public static final java.lang.String COLUMNS_CHANGED_PROPERTY
See Also:
Constant Field Values

COLUMN_UNITS_CHANGED_PROPERTY

public static final java.lang.String COLUMN_UNITS_CHANGED_PROPERTY
See Also:
Constant Field Values

MAXIMUM_LENGTH_CHANGED_PROPERTY

public static final java.lang.String MAXIMUM_LENGTH_CHANGED_PROPERTY
See Also:
Constant Field Values
Constructor Detail

TextField

public TextField()
Creates a new text field.


TextField

public TextField(java.lang.String text)
Creates a new text field with the given text.

Parameters:
text - The initial text in the text field.

TextField

public TextField(int columns)
Creates a new text field with the given number of columns.

Parameters:
columns - The number of columns that will be displayed in the text field.

TextField

public TextField(java.lang.String text,
                 int columns)
Creates a new text field with the given text and number of columns.

Parameters:
text - The initial text in the text field.
columns - The number of columns that will be displayed in the text field.

TextField

public TextField(Document document)
Creates a new text field with the given document model, text and number of columns.

Parameters:
document - The model for this text field.

TextField

public TextField(Document document,
                 java.lang.String text,
                 int columns)
Creates a new text field with the given document model, text and number of columns.

Parameters:
document - The model for this text field.
text - The initial text in the text field.
columns - The number of columns that will be displayed in the text field.
Method Detail

applyStyle

public void applyStyle(Style style)
Description copied from interface: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Specified by:
applyStyle in interface Component
Overrides:
applyStyle in class TextComponent
Parameters:
style - The style object from which to retrieve properties for this Component.
See Also:
Component.applyStyle(Style)

fireActionEvent

public void fireActionEvent()
Fires an action event to all listeners.


fireKeyActionEvent

public void fireKeyActionEvent()
Deprecated. 

Fires a key action event to all listeners.


fireReturnActionEvent

public void fireReturnActionEvent()
Deprecated. 

Fires a return action event to all listeners.


getKeyActionCommand

public java.lang.String getKeyActionCommand()
Deprecated. Returns the action command for this textField.

Returns:
The action command for this textField.

getActionCommand

public java.lang.String getActionCommand()
Returns the action command for this textField.

Returns:
The action command for this textField.

getColumns

public int getColumns()
Returns the columns of the text field.

Returns:
The number of columns that will be displayed in the text field.

getColumnUnits

public int getColumnUnits()
Returns the units of the columns property.

Returns:
The units of the columns property, one of the following values:
  • TextArea.UNITS_CHARACTER (the default)
  • TextArea.UNITS_PIXEL
  • TextArea.UNITS_PERCENT

getMaximumLength

public int getMaximumLength()
Returns the maximum number of characters that may be entered into the text field. A value of -1 imposes no limitation on maximum length. This value imposes no limitations on the document.

Returns:
The maximum number of characters that may be entered into the text field.

addActionListener

public void addActionListener(ActionListener l)
Adds an ActionListener to the text field.

Parameters:
l - The ActionListener to be added.

hasActionListeners

public boolean hasActionListeners()
Returns true if the text field has one or more action listeners.

Returns:
True if the text field has one or more action listeners.

removeActionListener

public void removeActionListener(ActionListener l)
Removes an ActionListener from the text field.

Parameters:
l - The ActionListener to be removed.

addKeyActionListener

public void addKeyActionListener(ActionListener l)
Adds an ActionListener to the text field.

Parameters:
l - The ActionListener to be added.

hasKeyActionListeners

public boolean hasKeyActionListeners()
Returns true if the text field has one or more action listeners.

Returns:
True if the text field has one or more action listeners.

removeKeyActionListener

public void removeKeyActionListener(ActionListener l)
Removes an ActionListener from the text field.

Parameters:
l - The ActionListener to be removed.

addReturnActionListener

public void addReturnActionListener(ActionListener l)
Adds an ActionListener to the text field.

Parameters:
l - The ActionListener to be added.

hasReturnActionListeners

public boolean hasReturnActionListeners()
Returns true if the text field has one or more action listeners.

Returns:
True if the text field has one or more action listeners.

removeReturnActionListener

public void removeReturnActionListener(ActionListener l)
Removes an ActionListener from the text field.

Parameters:
l - The ActionListener to be removed.

setActionCommand

public void setActionCommand(java.lang.String newValue)
Sets the text field's action command.

Parameters:
newValue - The new action command for this text field.

setKeyActionCommand

public void setKeyActionCommand(java.lang.String newValue)
Deprecated. 

Sets the text field's key action command.

Parameters:
newValue - The new action command for this text field.

setReturnActionCommand

public void setReturnActionCommand(java.lang.String newValue)
Deprecated. 

Sets the text field's return action command (when the user hits the return button).

Parameters:
newValue - The new action command for this text field.

setColumns

public void setColumns(int newValue)
Sets the columns of the text field.

Parameters:
newValue - The number of columns that will be displayed in the text field.

setColumnUnits

public void setColumnUnits(int newValue)
Sets the units for the columns property.

Parameters:
newValue - The new units for the columns property, one of the following values:
  • TextArea.UNITS_CHARACTER (the default)
  • TextArea.UNITS_PIXEL
  • TextArea.UNITS_PERCENT

setMaximumLength

public void setMaximumLength(int newValue)
Sets the maximum number of characters that may be entered into the text field. A value of -1 imposes no limitation on maximum length. This value will not impose any limitations on the document.

Parameters:
newValue - The maximum length.

isConvertToLowerCase

public boolean isConvertToLowerCase()

setConvertToLowerCase

public void setConvertToLowerCase(boolean convertToLowerCase)

isConvertToUpperCase

public boolean isConvertToUpperCase()

setConvertToUpperCase

public void setConvertToUpperCase(boolean convertToUpperCase)

isAsync

public boolean isAsync()

setAsync

public void setAsync(boolean async)

getReturnActionCommand

public java.lang.String getReturnActionCommand()
Deprecated.