com.smartgwt.client.widgets.form.fields
Class TextItem

java.lang.Object
  extended by com.smartgwt.client.core.JsObject
      extended by com.smartgwt.client.core.DataClass
          extended by com.smartgwt.client.core.RefDataClass
              extended by com.smartgwt.client.widgets.form.fields.FormItem
                  extended by com.smartgwt.client.widgets.form.fields.TextItem
All Implemented Interfaces:
HasHandlers, HasBlurHandlers, HasChangedHandlers, HasChangeHandlers, HasClickHandlers, HasDoubleClickHandlers, HasFocusHandlers, HasIconClickHandlers, HasIconKeyPressHandlers, HasItemHoverHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasTitleHoverHandlers
Direct Known Subclasses:
PasswordItem, SpinnerItem, TimeItem, UploadItem

public class TextItem
extends FormItem

FormItem for managing a text field.


Field Summary
 
Fields inherited from class com.smartgwt.client.core.JsObject
jsObj
 
Constructor Summary
TextItem()
           
TextItem(JavaScriptObject jsObj)
           
TextItem(String name)
           
TextItem(String name, String title)
           
 
Method Summary
 void deselectValue()
          If this item currently has focus, clear the current selection.
 void deselectValue(boolean start)
          If this item currently has focus, clear the current selection.
 CharacterCasing getCharacterCasing()
          Should entered characters be converted to upper or lowercase? Also applies to values applied with FormItem.setValue(int).
 int getHeight()
          Default height for text items.
 String getHint()
          Returns the hint text for this item.
 String getKeyPressFilter()
          Sets a keypress filter regular expression to limit valid characters that can be entered by the user.
 Integer getLength()
          if set, maximum number of characters for this field
 String getMask()
          Input mask used to filter text entry.
 Boolean getMaskOverwriteMode()
          During entry into masked field, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.
 String getMaskPadChar()
          Character that is used to fill required empty mask positions to display text while control has no focus.
 String getMaskPromptChar()
          Character that is used to fill required empty mask positions to display text while control has focus.
 Boolean getMaskSaveLiterals()
          Should entered mask value be saved with embedded literals?
static TextItem getOrCreateRef(JavaScriptObject jsObj)
           
 int[] getSelectionRange()
          For text-based items, this method returns the indices of the start/end of the current selection.
 Boolean getSelectOnFocus()
          Allows the 'selectOnFocus' behavior to be configured on a per-FormItem basis.
 Boolean getShowHintInField()
          If showing hint for this form item, should it be shown within the field?
 String getTextBoxStyle()
          Base CSS class name for this item's input element.
 int getWidth()
          Default width for fields.
 void selectValue()
          Put focus in this item and select the entire value.
 void setCharacterCasing(CharacterCasing characterCasing)
          Should entered characters be converted to upper or lowercase? Also applies to values applied with FormItem.setValue(int).
 void setHeight(int height)
          Default height for text items.
 void setKeyPressFilter(String keyPressFilter)
          Sets a keypress filter regular expression to limit valid characters that can be entered by the user.
 void setLength(Integer length)
          if set, maximum number of characters for this field
 void setMask(String mask)
          Input mask used to filter text entry.
 void setMaskOverwriteMode(Boolean maskOverwriteMode)
          During entry into masked field, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.
 void setMaskPadChar(String maskPadChar)
          Character that is used to fill required empty mask positions to display text while control has no focus.
 void setMaskPromptChar(String maskPromptChar)
          Character that is used to fill required empty mask positions to display text while control has focus.
 void setMaskSaveLiterals(Boolean maskSaveLiterals)
          Should entered mask value be saved with embedded literals?
 void setSelectionRange(int start, int end)
          Puts focus into this form item and selects characters between the given indices.
 void setSelectOnFocus(Boolean selectOnFocus)
          Allows the 'selectOnFocus' behavior to be configured on a per-FormItem basis.
 void setShowHintInField(Boolean showHintInField)
          If showing hint for this form item, should it be shown within the field?
 void setTextBoxStyle(String textBoxStyle)
          Base CSS class name for this item's input element.
 void setWidth(int width)
          Default width for fields.
 
Methods inherited from class com.smartgwt.client.widgets.form.fields.FormItem
addBlurHandler, addChangedHandler, addChangeHandler, addClickHandler, addDoubleClickHandler, addFocusHandler, addIconClickHandler, addIconKeyPressHandler, addItemHoverHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addTitleHoverHandler, blurItem, clearValue, disable, enable, focusInItem, getAccessKey, getAlign, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsString, getCellStyle, getConfig, getCriteriaField, getCriterion, getDataPath, getDateFormatter, getDefaultIconSrc, getDisabled, getDisplayField, getDisplayFieldName, getDisplayValue, getDisplayValue, getEmptyDisplayValue, getEmptyValueIcon, getEndRow, getErrorIconHeight, getErrorIconSrc, getErrorIconWidth, getErrorMessageWidth, getFetchMissingValues, getFieldName, getFilterLocally, getForm, getGlobalTabIndex, getHintStyle, getHoverAlign, getHoverDelay, getHoverHeight, getHoverOpacity, getHoverStyle, getHoverVAlign, getHoverWidth, getIconHeight, getIconPageRect, getIconPrompt, getIconRect, getIconVAlign, getIconWidth, getImageURLPrefix, getImageURLSuffix, getLeft, getName, getOperator, getOptionCriteria, getOptionFilterContext, getOptionOperationId, getPickerIconHeight, getPickerIconSrc, getPickerIconWidth, getPrompt, getRejectInvalidValueOnChange, getRequired, getRowSpan, getShouldSaveValue, getShowDisabled, getShowErrorIcon, getShowErrorStyle, getShowErrorText, getShowFocused, getShowFocusedIcons, getShowFocusedPickerIcon, getShowHint, getShowIcons, getShowOverIcons, getShowPickerIcon, getShowTitle, getShowValueIconOnly, getStartRow, getSuppressValueIcon, getTabIndex, getTextAlign, getTimeFormatter, getTitle, getTitleAlign, getTitleOrientation, getTitleStyle, getTooltip, getTop, getType, getValidateOnChange, getValue, getValueField, getValueFieldName, getValueIconHeight, getValueIconLeftPadding, getValueIconRightPadding, getValueIconSize, getValueIconWidth, getVisible, getWrapTitle, hide, isCreated, isDisabled, isDrawn, redraw, setAccessKey, setAlign, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setCellStyle, setColSpan, setColSpan, setCriteriaField, setDataPath, setDateFormatter, setDefaultIconSrc, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDefaultValue, setDisabled, setDisplayField, setEditorType, setEditorValueFormatter, setEditorValueParser, setEmptyDisplayValue, setEmptyValueIcon, setEndRow, setErrorFormatter, setErrorIconHeight, setErrorIconSrc, setErrorIconWidth, setErrorMessageWidth, setErrorOrientation, setFetchMissingValues, setFilterLocally, setGlobalTabIndex, setHeight, setHint, setHintStyle, setHoverAlign, setHoverDelay, setHoverHeight, setHoverOpacity, setHoverStyle, setHoverVAlign, setHoverWidth, setIconHeight, setIconPrompt, setIcons, setIconVAlign, setIconWidth, setImageURLPrefix, setImageURLSuffix, setInputTransformer, setItemHoverFormatter, setItemTitleHoverFormatter, setLeft, setName, setOperator, setOptionCriteria, setOptionDataSource, setOptionFilterContext, setOptionOperationId, setPickerIconHeight, setPickerIconSrc, setPickerIconWidth, setPrompt, setProperty, setProperty, setProperty, setProperty, setRedrawOnChange, setRejectInvalidValueOnChange, setRequired, setRowSpan, setShouldSaveValue, setShowDisabled, setShowErrorIcon, setShowErrorStyle, setShowErrorText, setShowFocused, setShowFocusedIcons, setShowFocusedPickerIcon, setShowHint, setShowIcons, setShowIfCondition, setShowOverIcons, setShowPickerIcon, setShowTitle, setShowValueIconOnly, setStartRow, setSuppressValueIcon, setTabIndex, setTextAlign, setTimeFormatter, setTitle, setTitleAlign, setTitleOrientation, setTitleStyle, setTooltip, setTop, setType, setValidateOnChange, setValidators, setValue, setValue, setValue, setValue, setValue, setValue, setValueField, setValueFormatter, setValueIconHeight, setValueIconLeftPadding, setValueIconRightPadding, setValueIcons, setValueIconSize, setValueIconWidth, setValueMap, setValueMap, setVisible, setWidth, setWrapTitle, show, stopHover, updateState
 
Methods inherited from class com.smartgwt.client.core.RefDataClass
getRef, getRef
 
Methods inherited from class com.smartgwt.client.core.DataClass
doAddHandler, fireEvent, getAttributeAsIntArray, getAttributeAsMap, getAttributeAsObject, getAttributeAsStringArray, getAttributes, getHandlerCount, getJsObj, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute
 
Methods inherited from class com.smartgwt.client.core.JsObject
setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

TextItem

public TextItem()

TextItem

public TextItem(JavaScriptObject jsObj)

TextItem

public TextItem(String name)

TextItem

public TextItem(String name,
                String title)
Method Detail

getOrCreateRef

public static TextItem getOrCreateRef(JavaScriptObject jsObj)

setWidth

public void setWidth(int width)
Default width for fields.

Overrides:
setWidth in class FormItem
Parameters:
width - width Default value is 150

getWidth

public int getWidth()
Default width for fields.

Overrides:
getWidth in class FormItem
Returns:
int

setHeight

public void setHeight(int height)
Default height for text items.

Overrides:
setHeight in class FormItem
Parameters:
height - height Default value is 19

getHeight

public int getHeight()
Default height for text items.

Overrides:
getHeight in class FormItem
Returns:
int

setTextBoxStyle

public void setTextBoxStyle(String textBoxStyle)
Base CSS class name for this item's input element. NOTE: See the CompoundFormItem_skinning discussion for special skinning considerations.

Overrides:
setTextBoxStyle in class FormItem
Parameters:
textBoxStyle - textBoxStyle Default value is "textItem"

getTextBoxStyle

public String getTextBoxStyle()
Base CSS class name for this item's input element. NOTE: See the CompoundFormItem_skinning discussion for special skinning considerations.

Overrides:
getTextBoxStyle in class FormItem
Returns:
String

setLength

public void setLength(Integer length)
if set, maximum number of characters for this field

Parameters:
length - length Default value is null

getLength

public Integer getLength()
if set, maximum number of characters for this field

Returns:
Integer

setSelectOnFocus

public void setSelectOnFocus(Boolean selectOnFocus)
Allows the 'selectOnFocus' behavior to be configured on a per-FormItem basis. Normally all items in a form default to the value of selectOnFocus.

Overrides:
setSelectOnFocus in class FormItem
Parameters:
selectOnFocus - selectOnFocus Default value is null

getSelectOnFocus

public Boolean getSelectOnFocus()
Allows the 'selectOnFocus' behavior to be configured on a per-FormItem basis. Normally all items in a form default to the value of selectOnFocus.

Overrides:
getSelectOnFocus in class FormItem
Returns:
Boolean

setShowHintInField

public void setShowHintInField(Boolean showHintInField)
If showing hint for this form item, should it be shown within the field?

CSS style for the hint is textBoxStyle with the suffix "Hint" appended to it.

Note : This is an advanced setting

Parameters:
showHintInField - showHintInField Default value is null

getShowHintInField

public Boolean getShowHintInField()
If showing hint for this form item, should it be shown within the field?

CSS style for the hint is textBoxStyle with the suffix "Hint" appended to it.

Returns:
Boolean

setCharacterCasing

public void setCharacterCasing(CharacterCasing characterCasing)
Should entered characters be converted to upper or lowercase? Also applies to values applied with FormItem.setValue(int).

Note: character casing cannot be used at the same time as a mask.

Note : This is an advanced setting

Parameters:
characterCasing - characterCasing Default value is TextItem.DEFAULT

getCharacterCasing

public CharacterCasing getCharacterCasing()
Should entered characters be converted to upper or lowercase? Also applies to values applied with FormItem.setValue(int).

Note: character casing cannot be used at the same time as a mask.

Returns:
CharacterCasing

setKeyPressFilter

public void setKeyPressFilter(String keyPressFilter)
Sets a keypress filter regular expression to limit valid characters that can be entered by the user. If defined, keys that match the regular expression are allowed; all others are suppressed. The filter is applied after character casing, if defined.

Note: keypress filtering cannot be used at the same time as a mask. Set the keyPressFilter for this item

Note : This is an advanced setting

Parameters:
keyPressFilter - new keyPress filter for the item. Default value is null

getKeyPressFilter

public String getKeyPressFilter()
Sets a keypress filter regular expression to limit valid characters that can be entered by the user. If defined, keys that match the regular expression are allowed; all others are suppressed. The filter is applied after character casing, if defined.

Note: keypress filtering cannot be used at the same time as a mask.

Returns:
String

setMask

public void setMask(String mask)
Input mask used to filter text entry.

Sample masks:

Overview of available mask characters

CharacterDescription
0Digit (0 through 9) or plus [+] or minus [-] signs
9Digit or space
#Digit
LLetter (A through Z)
?Letter (A through Z) or space
ALetter or digit
aLetter or digit
CAny character or space
 
<Causes all characters that follow to be convered to lowercase
>Causes all characters that follow to be convered to uppercase

Any character not matching one of the above mask characters or that is escaped with a backslash (\) is considered to be a literal.

Custom mask characters can be defined by standard regular expression character set or range. For example, a hexadecimal color code mask could be:

Note: input mask cannot be used at the same time as a keyPressFilter. Set the mask for this item.

Note that the current value of the field is cleared when changing the mask.

Note : This is an advanced setting

Parameters:
mask - mask to apply to text item. Default value is null

getMask

public String getMask()
Input mask used to filter text entry.

Sample masks:

Overview of available mask characters

CharacterDescription
0Digit (0 through 9) or plus [+] or minus [-] signs
9Digit or space
#Digit
LLetter (A through Z)
?Letter (A through Z) or space
ALetter or digit
aLetter or digit
CAny character or space
 
<Causes all characters that follow to be convered to lowercase
>Causes all characters that follow to be convered to uppercase

Any character not matching one of the above mask characters or that is escaped with a backslash (\) is considered to be a literal.

Custom mask characters can be defined by standard regular expression character set or range. For example, a hexadecimal color code mask could be:

Note: input mask cannot be used at the same time as a keyPressFilter.

Returns:
String

setMaskOverwriteMode

public void setMaskOverwriteMode(Boolean maskOverwriteMode)
During entry into masked field, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.

Note : This is an advanced setting

Parameters:
maskOverwriteMode - maskOverwriteMode Default value is null

getMaskOverwriteMode

public Boolean getMaskOverwriteMode()
During entry into masked field, should keystrokes overwrite current position value? By default new keystrokes are inserted into the field.

Returns:
Boolean

setMaskSaveLiterals

public void setMaskSaveLiterals(Boolean maskSaveLiterals)
Should entered mask value be saved with embedded literals?

Note : This is an advanced setting

Parameters:
maskSaveLiterals - maskSaveLiterals Default value is null

getMaskSaveLiterals

public Boolean getMaskSaveLiterals()
Should entered mask value be saved with embedded literals?

Returns:
Boolean

setMaskPadChar

public void setMaskPadChar(String maskPadChar)
Character that is used to fill required empty mask positions to display text while control has no focus.

Note : This is an advanced setting

Parameters:
maskPadChar - maskPadChar Default value is " "

getMaskPadChar

public String getMaskPadChar()
Character that is used to fill required empty mask positions to display text while control has no focus.

Returns:
String

setMaskPromptChar

public void setMaskPromptChar(String maskPromptChar)
Character that is used to fill required empty mask positions to display text while control has focus.

Note : This is an advanced setting

Parameters:
maskPromptChar - maskPromptChar Default value is "_"

getMaskPromptChar

public String getMaskPromptChar()
Character that is used to fill required empty mask positions to display text while control has focus.

Returns:
String

getHint

public String getHint()
Returns the hint text for this item. Default implementation returns hint, or null if there is no hint to show.

Overrides:
getHint in class FormItem
Returns:
HTML to show as the hint for the item

setSelectionRange

public void setSelectionRange(int start,
                              int end)
Puts focus into this form item and selects characters between the given indices. Only applies to drawn text based items.

Parameters:
start - selection starting character index
end - end of selection character index

selectValue

public void selectValue()
Put focus in this item and select the entire value. Only applies to text based items


deselectValue

public void deselectValue()
If this item currently has focus, clear the current selection. leaving focus in the item. Has no effect if the item is undrawn or unfocussed. Only applies to text-based items.


deselectValue

public void deselectValue(boolean start)
If this item currently has focus, clear the current selection. leaving focus in the item. Has no effect if the item is undrawn or unfocussed. Only applies to text-based items.

Parameters:
start - By default the text insertion cursor will be moved to the end of the current value - pass in this parameter to move to the start instead

getSelectionRange

public int[] getSelectionRange()
For text-based items, this method returns the indices of the start/end of the current selection. Returns null if the item doesn't have focus.

Returns:
2 element array showing character index of the current selection's start and end point within this item's value. May be null if the item doesn't have focus.