org.tentackle.ui
Interface FormFieldComponent

All Superinterfaces:
FormComponent
All Known Implementing Classes:
AppDbObjectFieldPanel, AppDbObjectLinkPanel, BMoneyFormField, ByteFormField, DateFormField, DoubleFormField, FloatFormField, FormCalendarField, FormField, FormFieldComboBox, FormFieldComponentPanel, FormFileChooser, FormMailField, FormTelnoField, FormTextArea, FormTextAreaTableCellRenderer, FormUrlField, IntegerFormField, LongFormField, NumberFormField, ShortFormField, StringFormField, TimeZoneComboBox, WeekdayComboBox

public interface FormFieldComponent
extends FormComponent

Extended FormComponent for editable text fields.

Adds features like max columns, autoselect, autotext, conversion, etc...

Author:
harald

Method Summary
 void clearText()
          Clears the contents of this component.
 void doActionPerformed()
          Invokes the action performed handler.
 String doFormat(Object object)
          Does the formatting of the given object.
Renders the object and returns the string.
 void downRight()
          Move the caret to the right side of field and if already there move to next field.
 char getAdjust()
          Gets the current adjustment.
 int getBaseline(int width, int height)
          Returns the baseline of this component.
 int getCaretPosition()
          Gets the caret position.
 int getColumns()
          Gets the columns.
 char getConvert()
          Gets the current convesion
 StringConverter getConverter()
          Gets the current converter.
 int getErrorOffset()
          Gets the offset in this components text for the first error.
 char getFiller()
          Gets the current fill char.
 String getFormat()
          Gets the format string.
 int getHorizontalAlignment()
          Gets the horizontal alignment.
 String getInvalidChars()
          Gets invalid characters.
 int getMaxColumns()
          Gets the maximum number of columns.
 String getText()
          Gets the text from the view of this component.
 String getToolTipText()
          Gets the tooltip text for this component.
 String getValidChars()
          Gets allowed characters.
 int getVerticalAlignment()
          Gets the vertical alignment.
 boolean isAutoNext()
          Returns whether the auto-next feature is enabled.
 boolean isAutoSelect()
          Returns whether the auto-select feature is enabled.
 boolean isAutoUpdate()
          Returns whether the auto-update feature is enabled.
 boolean isCaretLeft()
          Returns whether carat is at leftmost position.
 boolean isCaretRight()
          Returns whether caret is at rightmost position.
 boolean isEmpty()
          Determines whether this component is empty.
 boolean isEraseFirst()
          Returns whether to erase the field after first setText().
 boolean isInhibitAutoSelect()
          Returns whether auto-select is inhibited (once).
 boolean isOverwrite()
          Gets the current override mode.
 boolean isStartEditLeftmost()
          Returns whether to start edit leftmost in this component (once).
 void setAdjust(char adjust)
          Sets character adjustment.
By default the text input data is trimmed, i.e.
 void setAutoNext(boolean autoNext)
          Sets the auto-next feature.
If autonext is enabled the next component will automatically receive the focus if the maximum number of characters is reached.
 void setAutoSelect(boolean autoSelect)
          Sets the auto-select feature.
A component with autoselect enabled will automatically select all characters if the component gets the keyboard focus.
 void setAutoUpdate(boolean autoUpdate)
          Sets the auto-update feature.
By default, all components update the data model if the view changes (due to certain events, for example focus lost).
 void setCaretLeft()
          Sets the caret to leftmost position.
 void setCaretPosition(int pos)
          Sets the caret position.
 void setCaretRight()
          Sets the caret to rightmost position.
 void setColumns(int columns)
          Sets the number of columns in this component.
The visible width is adjusted according to the current font.
 void setConvert(char convert)
          Sets character upper/lowercase conversion.
Notice that changing the character conversion will immediately convert.
 void setConverter(StringConverter converter)
          Sets the string converter.
Besides the lower/uppercase conversion an optional StringConverter may be set to translate characters.
 void setEraseFirst(boolean eraseFirst)
          Sets whether to erase the field after first setText().
 void setFiller(char filler)
          Sets the fill char.
The fill char determines the adjustment of the text data.
 void setFormat(String pattern)
          Sets the format string.
The format string is used to format the view of the data.
 void setHorizontalAlignment(int alignment)
          Sets the horizontal alignment.
 void setInhibitAutoSelect(boolean inhibitAutoSelect)
          Sets auto-select to be inhibited inhibited (once).
 void setInvalidChars(String invalidChars)
          Sets invalid characters.
 void setMaxColumns(int maxColumns)
          Sets the maximum number of columns.
 void setOverwrite(boolean override)
          Sets the insert/override mode.
 void setStartEditLeftmost(boolean startEditLeftmost)
          Sets whether to start edit leftmost in this component (once).
 void setText(String str)
          Sets the given text in the view of this component.
 void setToolTipText(String text)
          Sets the tooltip text for this component.
 void setValidChars(String validChars)
          Sets allowed characters.
 void setVerticalAlignment(int alignment)
          Sets the vertical alignment.
Can only be used in Tentackle-LookAndFeels!
 void upLeft()
          Move caret to the left side of field and if already there move to previous field.
 
Methods inherited from interface org.tentackle.ui.FormComponent
addValueListener, fireValueChanged, fireValueEntered, getFormValue, getHelpURL, getParentWindow, hasFocus, invalidateParentInfo, isCellEditorUsage, isChangeable, isFireRunning, isFormTraversable, isHonourChangeable, isValueChanged, prepareFocusLost, removeValueListener, requestFocusLater, saveValue, setCellEditorUsage, setChangeable, setFireRunning, setFormTraversable, setFormValue, setFormWrapWindow, setHelpURL, setHonourChangeable, showHelp, transferFocus, transferFocusBackward, triggerValueChanged, wasFocusGainedFromTransfer, wasFocusGainedFromTransferBackward, wasTransferFocus, wasTransferFocusBackward, wasTransferFocusByEnter
 

Method Detail

setFormat

void setFormat(String pattern)
Sets the format string.
The format string is used to format the view of the data.

Parameters:
pattern - the format string

getFormat

String getFormat()
Gets the format string.

Returns:
the format string

setAutoSelect

void setAutoSelect(boolean autoSelect)
Sets the auto-select feature.
A component with autoselect enabled will automatically select all characters if the component gets the keyboard focus. Useful for numerical fields, for example.

Parameters:
autoSelect - true if autoselect enabled, false if disabled (default)

isAutoSelect

boolean isAutoSelect()
Returns whether the auto-select feature is enabled.

Returns:
true if autoselect enabled, false if disabled (default)

setAutoNext

void setAutoNext(boolean autoNext)
Sets the auto-next feature.
If autonext is enabled the next component will automatically receive the focus if the maximum number of characters is reached. Only meaningful if maxColumns > 0

Parameters:
autoNext - true if autonext enabled, false if disabled (default)

isAutoNext

boolean isAutoNext()
Returns whether the auto-next feature is enabled.

Returns:
true if autonext enabled, false if disabled (default)

setAutoUpdate

void setAutoUpdate(boolean autoUpdate)
Sets the auto-update feature.
By default, all components update the data model if the view changes (due to certain events, for example focus lost).

Parameters:
autoUpdate - true if auto update the data (default), false if not

isAutoUpdate

boolean isAutoUpdate()
Returns whether the auto-update feature is enabled.

Returns:
true if auto update the data (default), false if not

setConvert

void setConvert(char convert)
Sets character upper/lowercase conversion.
Notice that changing the character conversion will immediately convert.

Parameters:
convert - one of FormField.CONVERT_...

getConvert

char getConvert()
Gets the current convesion

Returns:
the conversion, default is CONVERT_NONE

setConverter

void setConverter(StringConverter converter)
Sets the string converter.
Besides the lower/uppercase conversion an optional StringConverter may be set to translate characters.

Parameters:
converter - the converter, null if none (default)

getConverter

StringConverter getConverter()
Gets the current converter. Default is null.

Returns:
the converter.

setAdjust

void setAdjust(char adjust)
Sets character adjustment.
By default the text input data is trimmed, i.e. fill characters (space by default) to the left and right are removed. This is not be mixed up with the horizontal orientation!

Parameters:
adjust - one of FormField.ADJUST_...
See Also:
setFiller(char)

getAdjust

char getAdjust()
Gets the current adjustment.

Returns:
the adjustment, default ADJUST_TRIM

setMaxColumns

void setMaxColumns(int maxColumns)
Sets the maximum number of columns.

Parameters:
maxColumns - the maximum number of columns, 0 if unlimited (default)

getMaxColumns

int getMaxColumns()
Gets the maximum number of columns.

Returns:
the maximum number of columns, 0 if unlimited (default)

setFiller

void setFiller(char filler)
Sets the fill char.
The fill char determines the adjustment of the text data.

Parameters:
filler - the fill character
See Also:
setAdjust(char)

getFiller

char getFiller()
Gets the current fill char.

Returns:
the filler, default is blank (space)

setOverwrite

void setOverwrite(boolean override)
Sets the insert/override mode.

Parameters:
override - true if override, false if insert (default)

isOverwrite

boolean isOverwrite()
Gets the current override mode.

Returns:
true if override, false if insert (default)

setValidChars

void setValidChars(String validChars)
Sets allowed characters.

Parameters:
validChars - the valid characters, null = all (default)

getValidChars

String getValidChars()
Gets allowed characters.

Returns:
the valid characters, null = all (default)

setInvalidChars

void setInvalidChars(String invalidChars)
Sets invalid characters.

Parameters:
invalidChars - the invalid characters, null = none (default)

getInvalidChars

String getInvalidChars()
Gets invalid characters.

Returns:
the invalid characters, null = none (default)

isCaretLeft

boolean isCaretLeft()
Returns whether carat is at leftmost position.

Returns:
true if caret is at leftmost position

isCaretRight

boolean isCaretRight()
Returns whether caret is at rightmost position.

Returns:
true if caret is at rightmost position

setCaretLeft

void setCaretLeft()
Sets the caret to leftmost position.


setCaretRight

void setCaretRight()
Sets the caret to rightmost position.


upLeft

void upLeft()
Move caret to the left side of field and if already there move to previous field.


downRight

void downRight()
Move the caret to the right side of field and if already there move to next field.


setEraseFirst

void setEraseFirst(boolean eraseFirst)
Sets whether to erase the field after first setText().

Parameters:
eraseFirst - true to clear after first setText

isEraseFirst

boolean isEraseFirst()
Returns whether to erase the field after first setText().

Returns:
true to clear after first setText

setInhibitAutoSelect

void setInhibitAutoSelect(boolean inhibitAutoSelect)
Sets auto-select to be inhibited inhibited (once).

Parameters:
inhibitAutoSelect - true if inhibited

isInhibitAutoSelect

boolean isInhibitAutoSelect()
Returns whether auto-select is inhibited (once).

Returns:
true if inhibited

clearText

void clearText()
Clears the contents of this component.


doFormat

String doFormat(Object object)
Does the formatting of the given object.
Renders the object and returns the string.

Parameters:
object - the object
Returns:
the formatted object as a string

isEmpty

boolean isEmpty()
Determines whether this component is empty.

Returns:
true if empty

setStartEditLeftmost

void setStartEditLeftmost(boolean startEditLeftmost)
Sets whether to start edit leftmost in this component (once).

Parameters:
startEditLeftmost - true if start edit leftmost

isStartEditLeftmost

boolean isStartEditLeftmost()
Returns whether to start edit leftmost in this component (once).

Returns:
true if start edit leftmost

getErrorOffset

int getErrorOffset()
Gets the offset in this components text for the first error.

Returns:
the error offset, -1 if no error

doActionPerformed

void doActionPerformed()
Invokes the action performed handler.


setText

void setText(String str)
Sets the given text in the view of this component.

Parameters:
str - the text

getText

String getText()
Gets the text from the view of this component.

Returns:
the text

setColumns

void setColumns(int columns)
Sets the number of columns in this component.
The visible width is adjusted according to the current font.

Parameters:
columns - the number of columns ≥ 0

getColumns

int getColumns()
Gets the columns.

Returns:
the columns

setToolTipText

void setToolTipText(String text)
Sets the tooltip text for this component.

Parameters:
text - the tooltip text, null = none

getToolTipText

String getToolTipText()
Gets the tooltip text for this component.

Returns:
the tooltip text, null = none

setHorizontalAlignment

void setHorizontalAlignment(int alignment)
Sets the horizontal alignment.

Parameters:
alignment - the alignment
See Also:
Component

getHorizontalAlignment

int getHorizontalAlignment()
Gets the horizontal alignment.

Returns:
the horizontal alignment
See Also:
Component

setVerticalAlignment

void setVerticalAlignment(int alignment)
Sets the vertical alignment.
Can only be used in Tentackle-LookAndFeels!

Parameters:
alignment - the vertical alignment

getVerticalAlignment

int getVerticalAlignment()
Gets the vertical alignment.

Returns:
the vertical alignment

setCaretPosition

void setCaretPosition(int pos)
Sets the caret position.

Parameters:
pos - the caret position, 0 = start of field

getCaretPosition

int getCaretPosition()
Gets the caret position.

Returns:
the caret position, 0 = start of field

getBaseline

int getBaseline(int width,
                int height)
Returns the baseline of this component.

Parameters:
width - the width to get the baseline for
height - the height to get the baseline for
Returns:
the baseline
Since:
1.6


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de