net.sf.jzeno.echo.databinding
Class DynaTextField

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by net.sf.jzeno.echo.components.CustomComponent
          extended by net.sf.jzeno.echo.databinding.DynaTextField
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, BindingTarget, PropertyComponent, RebindableComponent, EventSink, EventSource, Precreation, Component, ActionListener, FastComponent, FastComponentContainer

public class DynaTextField
extends CustomComponent
implements java.beans.PropertyChangeListener, FastComponent, Precreation, ActionListener

Shows a single line text field on the screen. Bind this component to a string property.

See Also:
Serialized Form

Nested Class Summary
 class DynaTextField.DefaultValidator
           
 
Field Summary
static int CHARACTER_UNITS
           
static int LEFT
           
static int PERCENT_UNITS
           
static int PIXEL_UNITS
           
static int RIGHT
           
static long serialVersionUID
           
 
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
DynaTextField()
           Creates an unbound component.
DynaTextField(java.lang.Class beanClass, java.lang.String propertyName, java.lang.String constructionHints)
           Creates a bound component.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Invoked when an action occurs.
 void applyContext()
           
 Color getBackground()
           Gets the background color.
 int getBorderSize()
           
 int getColumns()
           
 java.lang.String getCssClass()
           
 int getExactLength()
           Gets the exact length the user input should be.
 Font getFont()
          Returns the font.
 Color getForeground()
           Gets the foreground (text) color.
 java.lang.String getInvalidMessage()
           Gets the message key that is added to the screen, when the component is marked as invalid.
 java.lang.String getInvalidMessageKey()
          Deprecated.  
 int getMaximumLength()
           Gets the maximum number of characters the user may enter.
 java.lang.String getNullValue()
           Gets the input value that corresponds to a data binding property value null.
 java.lang.String getText()
           Sets the current value inside the input box.
 java.lang.String getToolTipText()
           Gets the tooltip that is shown when the user hoovers over this component.
 int getWidth()
           Gets the width of the text field.
 int getWidthUnits()
           Gets the units in which width is specified.
 boolean isAsync()
           
 boolean isAutoTrim()
           Gets whether or not this component trims the input from the user.
 boolean isConvertToLowerCase()
           
 boolean isConvertToUpperCase()
           
 boolean isEditable()
           
 boolean isReadOnly()
           
 boolean isRequired()
           Query if the editor is required to be filled in.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           Used internally.
 void rebind()
           This operation causes the component to reset it's content to that of the domain model.
 void setActionCommand(java.lang.String command)
           
 void setAsync(boolean async)
           
 void setAutoTrim(boolean autoTrim)
           Sets whether or not this component trims the input from the user.
 void setBackground(Color background)
           Sets the background color.
 void setBorderSize(int size)
           
 void setColumns(int columns)
          Deprecated. use setWidth & setWidthUnits.
 void setConvertToLowerCase(boolean convertToLowerCase)
           
 void setConvertToUpperCase(boolean convertToUpperCase)
           
 void setCssClass(java.lang.String newValue)
           
 void setEditable(boolean b)
           
 void setExactLength(int exactLength)
           Sets the exact length the user input should be.
 void setFocused(boolean newValue)
           Sets the input focus to this component.
 void setFont(Font font)
          Sets the font of the component.
 void setForeground(Color foreground)
           Sets the foreground (text) color.
 void setHorizontalAlignment(int newValue)
          Sets the horizontal text alignment of the input field.
 void setInvalidMessage(java.lang.String invalidMessageKey)
           Sets the message key that is shown when the component is marked as invalid.
 void setInvalidMessageKey(java.lang.String s)
          Deprecated.  
 void setKeyActionCommand(java.lang.String command)
          Deprecated. Please use KeyActionCommand component
 void setMaximumLength(int maxLength)
           Sets the maximum number of characters the user may enter.
 void setNullValue(java.lang.String nullValue)
           Sets the input value that corresponds to a data binding property value null
 void setReadOnly(boolean readOnly)
           Mark this component as read-only.
 void setRequired(boolean required)
           Determine if the editor is required to be filled in.
 void setReturnActionCommand(java.lang.String command)
          Deprecated. Please use KeyActionCommand component
 void setText(java.lang.String text)
           Sets the text in the component.
 void setToolTipText(java.lang.String toolTipText)
           Sets the tooltip that is shown when the user hoovers over this component.
 void setWidth(int width)
           Sets the width of the text field.
 void setWidthUnits(int units)
           Sets the units in which width is specified.
 
Methods inherited from class net.sf.jzeno.echo.components.CustomComponent
addValidator, fireActionEvent, fireActionEvent, fireActionEvent, getActionCommand, getBean, getBeanClass, getDecorator, getNullObject, getProperty, getValidationErrors, getValidators, getValue, isBound, isMarkedInvalid, isValid, markInvalid, markValid, preRender, removeValidator, setBean, setBeanClass, setDecorator, setNullObject, setProperty, setValue, traceValue, validate
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, applyStyle, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setClientId, setEnabled, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

CHARACTER_UNITS

public static final int CHARACTER_UNITS
See Also:
Constant Field Values

PIXEL_UNITS

public static final int PIXEL_UNITS
See Also:
Constant Field Values

PERCENT_UNITS

public static final int PERCENT_UNITS
See Also:
Constant Field Values
Constructor Detail

DynaTextField

public DynaTextField()

Creates an unbound component.


DynaTextField

public DynaTextField(java.lang.Class beanClass,
                     java.lang.String propertyName,
                     java.lang.String constructionHints)

Creates a bound component. Bind it to a String property.

Method Detail

rebind

public void rebind()
Description copied from interface: RebindableComponent

This operation causes the component to reset it's content to that of the domain model.

Specified by:
rebind in interface RebindableComponent
Overrides:
rebind in class CustomComponent

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)

Used internally.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

getNullValue

public java.lang.String getNullValue()

Gets the input value that corresponds to a data binding property value null.


setNullValue

public void setNullValue(java.lang.String nullValue)

Sets the input value that corresponds to a data binding property value null


getToolTipText

public java.lang.String getToolTipText()

Gets the tooltip that is shown when the user hoovers over this component.


setToolTipText

public void setToolTipText(java.lang.String toolTipText)

Sets the tooltip that is shown when the user hoovers over this component.


getInvalidMessage

public java.lang.String getInvalidMessage()

Gets the message key that is added to the screen, when the component is marked as invalid. Also see setInvalidMessage(String).


getInvalidMessageKey

public java.lang.String getInvalidMessageKey()
Deprecated. 


setInvalidMessage

public void setInvalidMessage(java.lang.String invalidMessageKey)

Sets the message key that is shown when the component is marked as invalid. Typically the component is marked invalid when you call EchoSupport.doValidationRecursively(Component) in your code. The value specified for this property is translated through the i18n support in jZeno (i18n.properties).


setInvalidMessageKey

public void setInvalidMessageKey(java.lang.String s)
Deprecated. 


getExactLength

public int getExactLength()

Gets the exact length the user input should be.


setExactLength

public void setExactLength(int exactLength)

Sets the exact length the user input should be.


isAutoTrim

public boolean isAutoTrim()

Gets whether or not this component trims the input from the user. This means that any leading and/or trailing spaces are removed from the input.


setAutoTrim

public void setAutoTrim(boolean autoTrim)

Sets whether or not this component trims the input from the user. This means that any leading and/or trailing spaces are removed from the input.


isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface PropertyComponent
Overrides:
isReadOnly in class CustomComponent

setReadOnly

public void setReadOnly(boolean readOnly)
Description copied from interface: PropertyComponent

Mark this component as read-only.

Specified by:
setReadOnly in interface PropertyComponent
Overrides:
setReadOnly in class CustomComponent

isRequired

public boolean isRequired()
Description copied from interface: PropertyComponent

Query if the editor is required to be filled in.

Specified by:
isRequired in interface PropertyComponent
Overrides:
isRequired in class CustomComponent

setRequired

public void setRequired(boolean required)
Description copied from interface: PropertyComponent

Determine if the editor is required to be filled in.

Specified by:
setRequired in interface PropertyComponent
Overrides:
setRequired in class CustomComponent

setColumns

public void setColumns(int columns)
Deprecated. use setWidth & setWidthUnits.

Sets how wide the component is on the screen. Specifies the number of character columns.


getColumns

public int getColumns()

setWidth

public void setWidth(int width)

Sets the width of the text field.


getWidth

public int getWidth()

Gets the width of the text field.


setWidthUnits

public void setWidthUnits(int units)

Sets the units in which width is specified.


getWidthUnits

public int getWidthUnits()

Gets the units in which width is specified.


setMaximumLength

public void setMaximumLength(int maxLength)

Sets the maximum number of characters the user may enter.


getMaximumLength

public int getMaximumLength()

Gets the maximum number of characters the user may enter.


getBackground

public Color getBackground()

Gets the background color.

Specified by:
getBackground in interface Component
Overrides:
getBackground in class AbstractComponent
Returns:
The background color of the component.

setBackground

public void setBackground(Color background)

Sets the background color.

Specified by:
setBackground in interface Component
Overrides:
setBackground in class AbstractComponent
Parameters:
background - The new background color of the component.

getForeground

public Color getForeground()

Gets the foreground (text) color.

Specified by:
getForeground in interface Component
Overrides:
getForeground in class AbstractComponent
Returns:
The foreground of the component.

setForeground

public void setForeground(Color foreground)

Sets the foreground (text) color.

Specified by:
setForeground in interface Component
Overrides:
setForeground in class AbstractComponent
Parameters:
foreground - The new foreground color of the component.

getCssClass

public java.lang.String getCssClass()

setCssClass

public void setCssClass(java.lang.String newValue)

getText

public java.lang.String getText()

Sets the current value inside the input box. Handy if you are using this component unbound.


setText

public void setText(java.lang.String text)

Sets the text in the component.


setFocused

public void setFocused(boolean newValue)

Sets the input focus to this component.

Specified by:
setFocused in interface Component
Overrides:
setFocused in class AbstractComponent
Parameters:
newValue - True if the component is to be focused.

isConvertToLowerCase

public boolean isConvertToLowerCase()

setConvertToLowerCase

public void setConvertToLowerCase(boolean convertToLowerCase)

isConvertToUpperCase

public boolean isConvertToUpperCase()

setConvertToUpperCase

public void setConvertToUpperCase(boolean convertToUpperCase)

setBorderSize

public void setBorderSize(int size)

getBorderSize

public int getBorderSize()

setEditable

public void setEditable(boolean b)

isEditable

public boolean isEditable()

applyContext

public void applyContext()
Specified by:
applyContext in interface Precreation

setActionCommand

public void setActionCommand(java.lang.String command)
Specified by:
setActionCommand in interface EventSource
Overrides:
setActionCommand in class CustomComponent

setKeyActionCommand

public void setKeyActionCommand(java.lang.String command)
Deprecated. Please use KeyActionCommand component


setReturnActionCommand

public void setReturnActionCommand(java.lang.String command)
Deprecated. Please use KeyActionCommand component


actionPerformed

public void actionPerformed(ActionEvent e)
Description copied from interface: ActionListener
Invoked when an action occurs.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - The event describing the action.

setAsync

public void setAsync(boolean async)

isAsync

public boolean isAsync()

setFont

public void setFont(Font font)
Description copied from interface: Component
Sets the font of the component.

Specified by:
setFont in interface Component
Overrides:
setFont in class AbstractComponent
Parameters:
font - The new font of the component.

getFont

public Font getFont()
Description copied from interface: Component
Returns the font.

Specified by:
getFont in interface Component
Overrides:
getFont in class AbstractComponent
Returns:
The font of the component.

setHorizontalAlignment

public void setHorizontalAlignment(int newValue)
Sets the horizontal text alignment of the input field.

Parameters:
newValue - LEFT or RIGHT