com.alkacon.geranium.client.ui.input
public class TextBox extends com.google.gwt.user.client.ui.Composite implements I_FormWidget, I_HasInit, com.google.gwt.event.dom.client.HasFocusHandlers, com.google.gwt.event.dom.client.HasBlurHandlers, com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.String>, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.dom.client.HasClickHandlers, I_HasBlur, I_HasGhostValue
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabledI_FormWidget.FieldType| Modifier and Type | Field and Description |
|---|---|
static I_InputCss |
CSS
The CSS bundle used for this widget.
|
protected boolean |
m_ghostMode
Flag for ghost mode.
|
protected java.lang.String |
m_ghostValue
The ghost value.
|
protected com.google.gwt.user.client.ui.TextBox |
m_textbox
The text box used internally by this widget.
|
protected static int[] |
NAVIGATION_CODES
Key codes for functional keys.
|
static java.lang.String |
WIDGET_TYPE
The widget type identifier for this widget.
|
| Constructor and Description |
|---|
TextBox()
Constructs a new instance of this widget.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.lang.String> handler) |
void |
blur()
Makes the widget lose focus.
|
protected void |
fireValueChangedEvent()
Helper method for firing a 'value changed' event.
|
java.lang.String |
getApparentValue()
Returns the "apparent value", i.e. either the real value if available, or else the ghost value if available, or null otherwise.
|
I_FormWidget.FieldType |
getFieldType()
Returns the type of data this widget produces.
|
java.lang.Object |
getFormValue()
Gets the selected/entered value from the widget.
|
java.lang.String |
getFormValueAsString()
Gets the current value of the widget as a string.
|
java.lang.String |
getId()
Returns the HTML id of the internal textbox used by this widget.
|
java.lang.String |
getText()
Returns the text in the text box.
|
boolean |
hasError()
Returns
true if this textbox has an error set. |
protected void |
hideError()
Hides the error for this textbox.
|
boolean |
isEnabled()
Gets whether this widget is enabled.
|
protected boolean |
isNavigationKey(int keyCode)
Checks if the given key code represents a functional key.
|
boolean |
isPreventShowError()
Returns the preventShowError.
|
boolean |
isReadOnly()
Returns the read only flag.
|
boolean |
isTriggerChangeOnKeyPress()
Returns if the text box is set to trigger the value changed event on key press and not on blur only.
|
void |
onBrowserEvent(com.google.gwt.user.client.Event event) |
void |
reset()
Resets the widget to its default state.
|
void |
setAutoHideParent(I_AutoHider autoHideParent)
Call this when auto hiding parents are shown.
|
void |
setChangedStyle()
Sets the changed style on the text box.
|
void |
setEnabled(boolean enabled)
Enables or disables the widget.
|
void |
setErrorMessage(java.lang.String errorMessage)
Sets the error message for this widget.
|
void |
setErrorMessageWidth(java.lang.String width)
Sets the width of the error message for this textbox.
|
void |
setFocus(boolean focused)
Sets the focus on the text box.
|
void |
setFormValue(java.lang.Object value)
Sets the value of the widget.
|
void |
setFormValueAsString(java.lang.String newValue)
Sets the current value of the widget as a string.
|
void |
setGhostMode(boolean ghostMode)
Enables or disables ghost mode.
|
void |
setGhostModeClear(boolean clearOnChangeMode)
Sets if the input field should be cleared when leaving the ghost mode.
|
void |
setGhostStyleEnabled(boolean enabled)
Enables or disables the "ghost mode" style.
|
void |
setGhostValue(java.lang.String value,
boolean ghostMode)
Sets the "ghost value" of the widget and optionally sets it to "ghost mode".
|
void |
setPreventShowError(boolean preventShowError)
Sets the preventShowError.
|
void |
setReadOnly(boolean readOnly)
Enables or disables read-only mode.
|
void |
setTriggerChangeOnKeyPress(boolean triggerOnKeyPress)
Sets if the value changed event should be triggered on key press and not on blur only.
|
protected void |
showError()
Shows the error for this textbox.
|
void |
updateLayout()
Updates the layout of the text box.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringpublic static final I_InputCss CSS
public static final java.lang.String WIDGET_TYPE
protected static final int[] NAVIGATION_CODES
protected boolean m_ghostMode
protected java.lang.String m_ghostValue
protected com.google.gwt.user.client.ui.TextBox m_textbox
public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler)
addBlurHandler in interface com.google.gwt.event.dom.client.HasBlurHandlersHasBlurHandlers.addBlurHandler(com.google.gwt.event.dom.client.BlurHandler)public com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
addClickHandler in interface com.google.gwt.event.dom.client.HasClickHandlersHasClickHandlers.addClickHandler(com.google.gwt.event.dom.client.ClickHandler)public com.google.gwt.event.shared.HandlerRegistration addFocusHandler(com.google.gwt.event.dom.client.FocusHandler handler)
addFocusHandler in interface com.google.gwt.event.dom.client.HasFocusHandlersHasFocusHandlers.addFocusHandler(com.google.gwt.event.dom.client.FocusHandler)public com.google.gwt.event.shared.HandlerRegistration addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler handler)
addKeyPressHandler in interface com.google.gwt.event.dom.client.HasKeyPressHandlersHasKeyPressHandlers.addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler)public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<java.lang.String> handler)
addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.String>HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)public void blur()
I_HasBlurblur in interface I_HasBlurI_HasBlur.blur()public java.lang.String getApparentValue()
I_FormWidgetgetApparentValue in interface I_FormWidgetI_FormWidget.getApparentValue()public I_FormWidget.FieldType getFieldType()
I_FormWidgetgetFieldType in interface I_FormWidgetI_FormWidget.getFieldType()public java.lang.Object getFormValue()
I_FormWidgetgetFormValue in interface I_FormWidgetI_FormWidget.getFormValue()public java.lang.String getFormValueAsString()
I_FormWidgetgetFormValueAsString in interface I_FormWidgetI_FormWidget.getFormValueAsString()public java.lang.String getId()
public java.lang.String getText()
public boolean hasError()
true if this textbox has an error set.true if this textbox has an error setpublic boolean isEnabled()
isEnabled in interface I_FormWidgettrue if the widget is enabledpublic boolean isPreventShowError()
public boolean isReadOnly()
true if this text box is only readablepublic boolean isTriggerChangeOnKeyPress()
true if the text box is set to trigger the value changed event on key presspublic void onBrowserEvent(com.google.gwt.user.client.Event event)
onBrowserEvent in interface com.google.gwt.user.client.EventListeneronBrowserEvent in class com.google.gwt.user.client.ui.CompositeComposite.onBrowserEvent(com.google.gwt.user.client.Event)public void reset()
I_FormWidgetreset in interface I_FormWidgetI_FormWidget.reset()public void setAutoHideParent(I_AutoHider autoHideParent)
I_FormWidgetsetAutoHideParent in interface I_FormWidgetautoHideParent - the auto hide parentI_FormWidget.setAutoHideParent(com.alkacon.geranium.client.ui.I_AutoHider)public void setChangedStyle()
public void setEnabled(boolean enabled)
I_FormWidgetsetEnabled in interface I_FormWidgetenabled - if true, the widget will be enabled, else disabledI_FormWidget.setEnabled(boolean)public void setErrorMessage(java.lang.String errorMessage)
I_FormWidgetIf the error message is null, no error message will be displayed.
setErrorMessage in interface I_FormWidgeterrorMessage - an error message or nullI_FormWidget.setErrorMessage(java.lang.String)public void setErrorMessageWidth(java.lang.String width)
width - the object's new width, in CSS units (e.g. "10px", "1em")public void setFocus(boolean focused)
focused - signals if the focus should be setpublic void setFormValue(java.lang.Object value)
value - the new valuepublic void setFormValueAsString(java.lang.String newValue)
I_FormWidgetsetFormValueAsString in interface I_FormWidgetnewValue - the new value of the widgetI_FormWidget.setFormValueAsString(java.lang.String)public void setGhostMode(boolean ghostMode)
setGhostMode in interface I_HasGhostValueghostMode - if true, enables ghost mode, else disables itpublic void setGhostModeClear(boolean clearOnChangeMode)
clearOnChangeMode - true to clear on leaving the ghost modepublic void setGhostStyleEnabled(boolean enabled)
This *only* changes the style, not the actual mode.
enabled - true if the ghost mode style should be enabled, false if it should be disabledpublic void setGhostValue(java.lang.String value,
boolean ghostMode)
I_HasGhostValue"Ghost mode" can be used to show the user the value (called "ghost value") which will be used if he either doesn't choose an option in the widget, or explicitly chooses an "empty" or "default" option.
setGhostValue in interface I_HasGhostValuevalue - the ghost valueghostMode - if true, sets the widget to ghost modeI_HasGhostValue.setGhostValue(java.lang.String, boolean)public void setPreventShowError(boolean preventShowError)
preventShowError - the preventShowError to setpublic void setReadOnly(boolean readOnly)
readOnly - if true, enables read-only mode, else disables itpublic void setTriggerChangeOnKeyPress(boolean triggerOnKeyPress)
triggerOnKeyPress - true if the value changed event should be triggered on key presspublic void updateLayout()
protected void fireValueChangedEvent()
protected void hideError()
protected boolean isNavigationKey(int keyCode)
keyCode - the key code to checktrue if the given key code represents a functional keyprotected void showError()