org.millstone.base.ui
Class TextField

java.lang.Object
  |
  +--org.millstone.base.ui.AbstractComponent
        |
        +--org.millstone.base.ui.AbstractField
              |
              +--org.millstone.base.ui.TextField
All Implemented Interfaces:
Buffered, BufferedValidatable, Component, java.util.EventListener, MethodEventSource, Paintable, Property, Property.Editor, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, VariableOwner

public class TextField
extends AbstractField

A text editor component that can be bound to any bindable Property. The text editor supports both multiline and single line modes, default is one-line mode.

Since TextField extends AbstractField it implements the Buffered interface. A TextField is in write-through mode by default, so AbstractField.setWriteThrough(boolean) must be called to enable buffering.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Nested Class Summary
 
Nested classes inherited from class org.millstone.base.ui.AbstractField
AbstractField.ReadOnlyStatusChangeEvent, AbstractField.ValueChangeEvent
 
Nested classes inherited from class org.millstone.base.data.Buffered
Buffered.SourceException
 
Nested classes inherited from class org.millstone.base.data.Property
Property.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeEvent, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeEvent, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
 
Nested classes inherited from class org.millstone.base.ui.Component
Component.Event, Component.Listener
 
Nested classes inherited from class org.millstone.base.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Constructor Summary
TextField()
          Constructs an empty TextField with no caption.
TextField(Property dataSource)
          Constructs a new TextField that's bound to the specified Property and has no caption.
TextField(java.lang.String caption)
          Constructs an empty TextField with given caption.
TextField(java.lang.String caption, Property dataSource)
          Constructs a new TextField that's bound to the specified Property and has the given caption String.
TextField(java.lang.String caption, java.lang.String value)
          Constructs a new TextField with the given caption and initial text contents.
 
Method Summary
 void changeVariables(java.lang.Object source, java.util.Map variables)
          Called when one or more variables handled by the implementing class are changed.
 int getColumns()
          Gets the number of columns in the editor.
 java.lang.String getNullRepresentation()
          Get the null-string representation.
 int getRows()
          Gets the number of rows in the editor.
 java.lang.String getTag()
          Gets the UIDL tag corresponding to the component.
 java.lang.Class getType()
          Returns the type of the Property.
 boolean isNullSettingAllowed()
          Is setting nulls with null-string representation allowed.
 boolean isSecret()
          Get the secret property on and off.
 boolean isWordwrap()
          Tests if the editor is in word-wrap mode.
 void paintContent(PaintTarget target)
          Paints any needed component-specific things to the given UIDL stream.
 void setColumns(int columns)
          Sets the number of columns in the editor.
 void setNullRepresentation(java.lang.String nullRepresentation)
          Sets the null-string representation.
 void setNullSettingAllowed(boolean nullSettingAllowed)
          Set the null conversion mode.
 void setRows(int rows)
          Sets the number of rows in the editor.
 void setSecret(boolean secret)
          Set the secret property on and off.
 void setWordwrap(boolean wordwrap)
          Sets the editor's word-wrap mode on or off.
 
Methods inherited from class org.millstone.base.ui.AbstractField
addListener, addListener, addValidator, commit, constructField, discard, fireReadOnlyStatusChange, fireValueChange, focus, getErrorMessage, getPropertyDataSource, getValidators, getValue, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isReadThrough, isValid, isWriteThrough, removeListener, removeListener, removeValidator, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setReadOnly, setReadThrough, setValue, setWriteThrough, toString, validate, valueChange
 
Methods inherited from class org.millstone.base.ui.AbstractComponent
addListener, addListener, addListener, addListener, attach, childRequestedRepaint, dependsOn, detach, fireComponentEvent, fireEvent, getApplication, getCaption, getComponentError, getDescription, getDirectDependencies, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isVisible, paint, removeDirectDependency, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setDescription, setEnabled, setIcon, setImmediate, setLocale, setParent, setStyle, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextField

public TextField()
Constructs an empty TextField with no caption.


TextField

public TextField(java.lang.String caption)
Constructs an empty TextField with given caption.


TextField

public TextField(Property dataSource)
Constructs a new TextField that's bound to the specified Property and has no caption.

Parameters:
dataSource - the Property to be edited with this editor

TextField

public TextField(java.lang.String caption,
                 Property dataSource)
Constructs a new TextField that's bound to the specified Property and has the given caption String.

Parameters:
caption - caption String for the editor
dataSource - the Property to be edited with this editor

TextField

public TextField(java.lang.String caption,
                 java.lang.String value)
Constructs a new TextField with the given caption and initial text contents. The editor constructed this way will not be bound to a Property unless Property.Viewer.setPropertyDataSource(Property) is called to bind it.

Parameters:
caption - caption String for the editor
Method Detail

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Description copied from class: AbstractComponent
Paints any needed component-specific things to the given UIDL stream. The more general AbstractComponent.paint(PaintTarget) method handles all general attributes common to all components, and it calls this method to paint any component-specific attributes to the UIDL stream.

Overrides:
paintContent in class AbstractField
Parameters:
target - target UIDL stream where the component should paint itself to
Throws:
PaintException - if the operation failed

getTag

public java.lang.String getTag()
Description copied from class: AbstractComponent
Gets the UIDL tag corresponding to the component.

Specified by:
getTag in class AbstractComponent
Returns:
component's UIDL tag as String

changeVariables

public void changeVariables(java.lang.Object source,
                            java.util.Map variables)
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.

Specified by:
changeVariables in interface VariableOwner
Overrides:
changeVariables in class AbstractComponent
Parameters:
source - Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
variables - Mapping from variable names to new variable values

getColumns

public int getColumns()
Gets the number of columns in the editor. If the number of columns is set 0, the actual number of displayed columns is determined implicitly by the adapter.


setColumns

public void setColumns(int columns)
Sets the number of columns in the editor. If the number of columns is set 0, the actual number of displayed columns is determined implicitly by the adapter.

Returns:
number of explicitly set columns

getRows

public int getRows()
Gets the number of rows in the editor. If the number of rows is set to 0, the actual number of displayed rows is determined implicitly by the adapter.

Returns:
number of explicitly set rows

setRows

public void setRows(int rows)
Sets the number of rows in the editor. If the number of rows is set to 0, the actual number of displayed rows is determined implicitly by the adapter.


isWordwrap

public boolean isWordwrap()
Tests if the editor is in word-wrap mode.

Returns:
true if the component is in the word-wrap mode, false if not

setWordwrap

public void setWordwrap(boolean wordwrap)
Sets the editor's word-wrap mode on or off.

Parameters:
wordwrap - boolean value specifying if the editor should be in word-wrap mode after the call or not.

getType

public java.lang.Class getType()
Description copied from interface: Property
Returns the type of the Property. The methods getValue and setValue must be compatible with this type: one must be able to safely cast the value returned from getValue to the given type and pass any variable assignable to this type as an argument to setValue.

Specified by:
getType in interface Property
Specified by:
getType in class AbstractField
Returns:
type of the Property

isSecret

public boolean isSecret()
Get the secret property on and off. If a field is used to enter secretinformation the information is not echoed to display.

Returns:
true if the field is used to enter secret information, false otherwise.

setSecret

public void setSecret(boolean secret)
Set the secret property on and off. If a field is used to enter secretinformation the information is not echoed to display.

Parameters:
secret - value specifying if the field is used to enter secret information.

getNullRepresentation

public java.lang.String getNullRepresentation()
Get the null-string representation.

The null-valued strings are represented on the user interface by replacing the null value with this string. If the null representation is set null (not 'null' string), painting null value throws exception.

The default value is string 'null'

Returns:
String Textual representation for null strings.
See Also:
isNullSettingAllowed()

isNullSettingAllowed

public boolean isNullSettingAllowed()
Is setting nulls with null-string representation allowed.

If this property is true, writing null-representation string to text field allways sets the field value to real null. If this property is false, null setting is not made, but the null values are maintained. Maintenance of null-values is made by only converting the textfield contents to real null, if the text field matches the null-string representation and the current value of the field is null.

By default this setting is false

Returns:
boolean Should the null-string represenation be allways converted to null-values.
See Also:
getNullRepresentation()

setNullRepresentation

public void setNullRepresentation(java.lang.String nullRepresentation)
Sets the null-string representation.

The null-valued strings are represented on the user interface by replacing the null value with this string. If the null representation is set null (not 'null' string), painting null value throws exception.

The default value is string 'null'

Parameters:
nullRepresentation - Textual representation for null strings.
See Also:
setNullSettingAllowed(boolean)

setNullSettingAllowed

public void setNullSettingAllowed(boolean nullSettingAllowed)
Set the null conversion mode.

If this property is true, writing null-representation string to text field allways sets the field value to real null. If this property is false, null setting is not made, but the null values are maintained. Maintenance of null-values is made by only converting the textfield contents to real null, if the text field matches the null-string representation and the current value of the field is null.

By default this setting is false

Parameters:
nullSettingAllowed - Should the null-string represenation be allways converted to null-values.
See Also:
getNullRepresentation()


Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.