com.extjs.gxt.ui.client.widget.form
クラス Field<D>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
                  extended by com.extjs.gxt.ui.client.widget.form.Field<D>
Type Parameters:
D - the data type of the field
すべての実装インターフェース:
Observable, com.google.gwt.user.client.EventListener
Direct Known Subclasses:
AdapterField, CheckBox, LabelField, MultiField, TextField

public abstract class Field<D>
extends BoxComponent

Base class for form fields that provides default event handling, value handling and other functionality.

Events:
Focus : FieldEvent(field)
Fires when this field receives input focus.
Blur : FieldEvent(field)
Fires when this field loses input focus.
Change : FieldEvent(field, value, oldValue)
Fires just before the field blurs if the field value has changed.
Invalid : FieldEvent(field, message)
Fires after the field has been marked as invalid.
Valid : FieldEvent(field)
Fires after the field has been validated with no errors.
KeyPress : FieldEvent(field)
Fires after a key is pressed.


入れ子クラス 概要
 class Field.FieldMessages
          The field messages.
 
クラス com.google.gwt.user.client.ui.UIObject から継承された 入れ子クラス/インターフェース
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field 概要
 
クラス com.google.gwt.user.client.ui.UIObject から継承されたフィールド(Fields)
DEBUG_ID_PREFIX
 
メソッド 概要
 void addKeyListener(KeyListener listener)
          Adds a key listener.
 void clearInvalid()
          Clear any invalid styles / messages for this field.
 void focus()
          Try to focus this component.
 boolean getAutoValidate()
          Returns true if the field value is validated on each key press.
 java.lang.String getEmptyText()
          Returns the field's empty text.
 java.lang.String getFieldLabel()
          Returns the field's label.
 java.lang.String getLabelSeparator()
          Returns the field's label separator.
 java.lang.String getLabelStyle()
          Returns the field's label style.
 Field.FieldMessages getMessages()
          Returns the field's messages.
 java.lang.String getMessageTarget()
          Returns the field's message target.
 java.lang.String getName()
          Returns the name attribute of the field if available.
 PropertyEditor<D> getPropertyEditor()
          Retuns the field's property editor.
 java.lang.String getRawValue()
          Returns the raw data value which may or may not be a valid, defined value.
 boolean getValidateOnBlur()
          Returns true if the value is validate on blur.
 int getValidationDelay()
          Returns the field's validation delay in milliseconds.
 D getValue()
          Returns the typed value of the field.
 boolean isDirty()
          Returns true if this field is dirty.
 boolean isReadOnly()
          Returns the read only state.
 boolean isValid()
          Returns whether or not the field value is currently valid.
 void markInvalid(java.lang.String msg)
          Mark this field as invalid.
 void onComponentEvent(ComponentEvent ce)
          Any events a component receives will be forwarded to this method.
 void removeKeyListener(KeyListener listener)
          Removes the key listener.
 void reset()
          Resets the current field value to the originally loaded value and clears any validation messages.
 void setAutoValidate(boolean autoValidate)
          Sets whether the value is validated on each key press (defaults to false).
 void setEmptyText(java.lang.String emptyText)
          Sets the default text to display in an empty field.
 void setFieldLabel(java.lang.String fieldLabel)
          Sets the field's label.
 void setLabelSeparator(java.lang.String labelSeparator)
          The standard separator to display after the text of each form label (defaults to the value of FormLayout.setLabelSeperator(String), which is a colon ':' by default).
 void setLabelStyle(java.lang.String labelStyle)
          A CSS style specification to apply directly to this field's label.
 void setMessages(Field.FieldMessages messages)
          Sets the field's messages.
 void setMessageTarget(java.lang.String messageTarget)
          The location where error text should display.
 void setName(java.lang.String name)
          Sets the field's HTML name attribute.
 void setPropertyEditor(PropertyEditor<D> propertyEditor)
          Sets the field's property editor which is used to translate typed values to string, and string values back to typed values.
 void setRawValue(java.lang.String value)
          Sets the underlying DOM field's value directly, bypassing validation.
 void setReadOnly(boolean readOnly)
          Sets the field's read only state.
 void setTabIndex(int index)
          Sets the tab index.
 void setValidateOnBlur(boolean validateOnBlur)
          Sets whether the field should validate when it loses focus (defaults to true).
 void setValidationDelay(int validationDelay)
          Sets length of time in milliseconds after user input begins until validation is initiated (defaults to 250).
 void setValue(D value)
          Sets a data value into the field and validates it.
 boolean validate()
          Validates the field value.
 
クラス com.extjs.gxt.ui.client.widget.BoxComponent から継承されたメソッド
getBounds, getHeight, getHeight, getPosition, getShadow, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShim, setSize, setSize, setWidth, setWidth
 
クラス com.extjs.gxt.ui.client.widget.Component から継承されたメソッド
addListener, addStyleName, addWidgetListener, disable, disableEvents, disableTextSelection, el, enable, enableEvents, fireEvent, fireEvent, fireEvent, fly, getBaseStyle, getBorders, getData, getData, getElement, getId, getItemId, getModel, getState, getToolTip, hide, hideToolTip, isEnabled, isRendered, isVisible, onBrowserEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeWidgetListener, render, render, saveState, setBorders, setData, setData, setElement, setEnabled, setEnableState, setId, setIntStyleAttribute, setItemId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, show, toString
 
クラス com.google.gwt.user.client.ui.Widget から継承されたメソッド
getParent, isAttached
 
クラス com.google.gwt.user.client.ui.UIObject から継承されたメソッド
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

メソッド 詳細

addKeyListener

public void addKeyListener(KeyListener listener)
Adds a key listener.

パラメータ:
listener - the key listener

clearInvalid

public void clearInvalid()
Clear any invalid styles / messages for this field.


focus

public void focus()
Description copied from class: Component
Try to focus this component. Fires the Focus event.

オーバーライド:
focus in class Component

getAutoValidate

public boolean getAutoValidate()
Returns true if the field value is validated on each key press.

戻り値:
the auto validate state

getEmptyText

public java.lang.String getEmptyText()
Returns the field's empty text.

戻り値:
the empty text

getFieldLabel

public java.lang.String getFieldLabel()
Returns the field's label.

戻り値:
the label

getLabelSeparator

public java.lang.String getLabelSeparator()
Returns the field's label separator.

戻り値:
the label separator

getLabelStyle

public java.lang.String getLabelStyle()
Returns the field's label style.

戻り値:
the label style

getMessages

public Field.FieldMessages getMessages()
Returns the field's messages.

戻り値:
the messages

getMessageTarget

public java.lang.String getMessageTarget()
Returns the field's message target.

戻り値:
the message target

getName

public java.lang.String getName()
Returns the name attribute of the field if available.

戻り値:
the field name

getPropertyEditor

public PropertyEditor<D> getPropertyEditor()
Retuns the field's property editor.

戻り値:
the property editor

getRawValue

public java.lang.String getRawValue()
Returns the raw data value which may or may not be a valid, defined value. To return a normalized value see getValue().

戻り値:
the raw value

getValidateOnBlur

public boolean getValidateOnBlur()
Returns true if the value is validate on blur.

戻り値:
the validate on blur state

getValidationDelay

public int getValidationDelay()
Returns the field's validation delay in milliseconds.

戻り値:
the delay in millseconds

getValue

public D getValue()
Returns the typed value of the field.

戻り値:
the fields value

isDirty

public boolean isDirty()
Returns true if this field is dirty. A field is dirty, if the current value is different than it's original value. The original value is the value of the field when the field is rendered. Disabled and pre-rendered fields are never dirty.

戻り値:
the dirty state

isReadOnly

public boolean isReadOnly()
Returns the read only state.

戻り値:
true if read only, otherwise false

isValid

public boolean isValid()
Returns whether or not the field value is currently valid.

戻り値:
true if the value is valid, otherwise false

markInvalid

public void markInvalid(java.lang.String msg)
Mark this field as invalid.

パラメータ:
msg - the validation message

onComponentEvent

public void onComponentEvent(ComponentEvent ce)
Description copied from class: Component
Any events a component receives will be forwarded to this method. Subclasses should override as needed. The Component.onBrowserEvent(com.google.gwt.user.client.Event) method should not be overridden or modified.

オーバーライド:
onComponentEvent in class Component
パラメータ:
ce - the base event

removeKeyListener

public void removeKeyListener(KeyListener listener)
Removes the key listener.

パラメータ:
listener - the key listener

reset

public void reset()
Resets the current field value to the originally loaded value and clears any validation messages.


setAutoValidate

public void setAutoValidate(boolean autoValidate)
Sets whether the value is validated on each key press (defaults to false).

パラメータ:
autoValidate - true to validate on each key press

setEmptyText

public void setEmptyText(java.lang.String emptyText)
Sets the default text to display in an empty field.

パラメータ:
emptyText - the empty text

setFieldLabel

public void setFieldLabel(java.lang.String fieldLabel)
Sets the field's label.

パラメータ:
fieldLabel - the label

setLabelSeparator

public void setLabelSeparator(java.lang.String labelSeparator)
The standard separator to display after the text of each form label (defaults to the value of FormLayout.setLabelSeperator(String), which is a colon ':' by default).

パラメータ:
labelSeparator - the label separator or "" for none

setLabelStyle

public void setLabelStyle(java.lang.String labelStyle)
A CSS style specification to apply directly to this field's label. For example, labelStyle: 'font-weight:bold;'

パラメータ:
labelStyle - the label style

setMessages

public void setMessages(Field.FieldMessages messages)
Sets the field's messages.

パラメータ:
messages - the messages

setMessageTarget

public void setMessageTarget(java.lang.String messageTarget)
The location where error text should display. Should be one of the following values (defaults to 'side'):
 Value         Description
 -----------   ----------------------------------------------------------------------
 tooltip       Display a tool tip when the user hovers over the field
 title         Display a default browser title attribute popup
 side          Add an error icon to the right of the field with a popup on hover
 [element id]  Add the error text directly to the innerHTML of the specified element
 

パラメータ:
messageTarget - the message target

setName

public void setName(java.lang.String name)
Sets the field's HTML name attribute.

パラメータ:
name - the name

setPropertyEditor

public void setPropertyEditor(PropertyEditor<D> propertyEditor)
Sets the field's property editor which is used to translate typed values to string, and string values back to typed values.

パラメータ:
propertyEditor - the property editor

setRawValue

public void setRawValue(java.lang.String value)
Sets the underlying DOM field's value directly, bypassing validation. To set the value with validation see setValue(D).

パラメータ:
value - the raw value

setReadOnly

public void setReadOnly(boolean readOnly)
Sets the field's read only state.

パラメータ:
readOnly - the read only state

setTabIndex

public void setTabIndex(int index)
Sets the tab index.

パラメータ:
index - the tab index value

setValidateOnBlur

public void setValidateOnBlur(boolean validateOnBlur)
Sets whether the field should validate when it loses focus (defaults to true).

パラメータ:
validateOnBlur - true to validate on blur, otherwise false

setValidationDelay

public void setValidationDelay(int validationDelay)
Sets length of time in milliseconds after user input begins until validation is initiated (defaults to 250).

パラメータ:
validationDelay - the delay in milliseconds

setValue

public void setValue(D value)
Sets a data value into the field and validates it. If the field is rendered, To set the value directly without validation see setRawValue(java.lang.String).

パラメータ:
value - the value to set

validate

public boolean validate()
Validates the field value.

戻り値:
true if valid, otherwise false