com.sencha.gxt.widget.core.client.form
Class AdapterField<T>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.sencha.gxt.widget.core.client.Component
              extended by com.sencha.gxt.widget.core.client.container.Container
                  extended by com.sencha.gxt.widget.core.client.container.ResizeContainer
                      extended by com.sencha.gxt.widget.core.client.container.SimpleContainer
                          extended by com.sencha.gxt.widget.core.client.form.AdapterField<T>
All Implemented Interfaces:
Editor<T>, HasEditorDelegate<T>, HasEditorErrors<T>, LeafValueEditor<T>, HasAttachHandlers, HasResizeHandlers, HasHandlers, EventListener, TakesValue<T>, AcceptsOneWidget, HasOneWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, ProvidesResize, RequiresResize, HasLayout, AddEvent.HasAddHandlers, BeforeAddEvent.HasBeforeAddHandlers, BeforeHideEvent.HasBeforeHideHandlers, BeforeRemoveEvent.HasBeforeRemoveHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, ContainerHandler.HasContainerHandlers, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, InvalidEvent.HasInvalidHandlers, MoveEvent.HasMoveHandlers, RemoveEvent.HasRemoveHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, ValidEvent.HasValidHandlers, IsField<T>, HasFocusSupport, HasItemId, Iterable<Widget>
Direct Known Subclasses:
DualListField, HtmlEditor, ListField

public abstract class AdapterField<T>
extends SimpleContainer
implements IsField<T>, InvalidEvent.HasInvalidHandlers, ValidEvent.HasValidHandlers, HasEditorErrors<T>, HasEditorDelegate<T>


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.editor.client.Editor
Editor.Ignore, Editor.Path
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
AdapterField(Widget widget)
           
 
Method Summary
 HandlerRegistration addInvalidHandler(InvalidEvent.InvalidHandler handler)
          Adds a InvalidEvent.InvalidHandler handler for InvalidEvent events.
 void addValidator(Validator<T> validator)
           
 HandlerRegistration addValidHandler(ValidEvent.ValidHandler handler)
          Adds a ValidEvent handler for ValidEvent events.
 void clear()
          Clears the value from the field.
 void clearInvalid()
          Clear any invalid styles / messages for this field.
 void disable()
          Disable this widget.
 void enable()
          Enable this widget.
 void forceInvalid(String msg)
          Forces the field to be invalid using the given error message.
 ErrorHandler getErrorSupport()
          Returns the field's error support instance.
 List<Validator<T>> getValidators()
          Returns the field's validators.
 boolean isValid()
          Returns whether or not the field value is currently valid.
 boolean isValid(boolean preventMark)
          Returns whether or not the field value is currently valid.
 void markInvalid(String msg)
          Marks this field as invalid.
 void removeValidator(Validator<T> validator)
           
 void reset()
          Resets the current field value to the originally loaded value and clears any validation messages.
 void setDelegate(EditorDelegate<T> delegate)
           
 void setErrorSupport(ErrorHandler error)
           
 void showErrors(List<EditorError> errors)
           
 boolean validate()
          Validates the field value.
 boolean validate(boolean preventMark)
          Validates the field value.
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.SimpleContainer
add, add, getWidget, isResize, setResize, setWidget, setWidget
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.ResizeContainer
forceLayout, isLayoutRunning, isOrWasLayoutRunning, onResize
 
Methods inherited from class com.sencha.gxt.widget.core.client.container.Container
add, addAddHandler, addBeforeAddHandler, addBeforeRemoveHandler, addContainerHandler, addRemoveHandler, findWidget, getItemByItemId, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, iterator, remove, remove, remove
 
Methods inherited from class com.sencha.gxt.widget.core.client.Component
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disableEvents, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, onBrowserEvent, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.user.client.ui.IsWidget
asWidget
 
Methods inherited from interface com.google.gwt.user.client.TakesValue
getValue, setValue
 

Constructor Detail

AdapterField

public AdapterField(Widget widget)
Method Detail

addInvalidHandler

public HandlerRegistration addInvalidHandler(InvalidEvent.InvalidHandler handler)
Description copied from interface: InvalidEvent.HasInvalidHandlers
Adds a InvalidEvent.InvalidHandler handler for InvalidEvent events.

Specified by:
addInvalidHandler in interface InvalidEvent.HasInvalidHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addValidator

public void addValidator(Validator<T> validator)

addValidHandler

public HandlerRegistration addValidHandler(ValidEvent.ValidHandler handler)
Description copied from interface: ValidEvent.HasValidHandlers
Adds a ValidEvent handler for ValidEvent events.

Specified by:
addValidHandler in interface ValidEvent.HasValidHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

clear

public void clear()
Clears the value from the field.

Specified by:
clear in interface HasWidgets
Specified by:
clear in interface IsField<T>
Overrides:
clear in class Container

clearInvalid

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

Specified by:
clearInvalid in interface IsField<T>

disable

public void disable()
Description copied from class: Component
Disable this widget.

Overrides:
disable in class Container

enable

public void enable()
Description copied from class: Component
Enable this widget.

Overrides:
enable in class Container

forceInvalid

public void forceInvalid(String msg)
Forces the field to be invalid using the given error message. When using this feature, clearInvalid() must be called to clear the error. Also, no other validation logic will execute.

Parameters:
msg - the error text

getErrorSupport

public ErrorHandler getErrorSupport()
Returns the field's error support instance.

Returns:
the error support

getValidators

public List<Validator<T>> getValidators()
Returns the field's validators.

Returns:
the validators

isValid

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

Returns:
true if valid

isValid

public boolean isValid(boolean preventMark)
Description copied from interface: IsField
Returns whether or not the field value is currently valid.

Specified by:
isValid in interface IsField<T>
Parameters:
preventMark - true for silent validation (no invalid event and field is not marked invalid)
Returns:
true if the value is valid, otherwise false

markInvalid

public void markInvalid(String msg)
Marks this field as invalid. Validation will still run if called again, and the error message will be changed or cleared based on validation. To set a error message that will not be cleared until manually cleared see forceInvalid(String) Calling this will also register an error in the editor, if any.

Parameters:
msg - the validation message

removeValidator

public void removeValidator(Validator<T> validator)

reset

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

Specified by:
reset in interface IsField<T>

setDelegate

public void setDelegate(EditorDelegate<T> delegate)
Specified by:
setDelegate in interface HasEditorDelegate<T>

setErrorSupport

public void setErrorSupport(ErrorHandler error)

showErrors

public void showErrors(List<EditorError> errors)
Specified by:
showErrors in interface HasEditorErrors<T>

validate

public boolean validate()
Validates the field value.

Returns:
true if valid, otherwise false

validate

public boolean validate(boolean preventMark)
Validates the field value.

Specified by:
validate in interface IsField<T>
Parameters:
preventMark - true to not mark the field valid and fire invalid event when invalid
Returns:
true if valid, otherwise false


Copyright © 2012. All Rights Reserved.