public class CmsTextBox extends com.google.gwt.user.client.ui.Composite implements I_CmsFormWidget, I_CmsHasInit, 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_CmsHasBlur, I_CmsHasGhostValue
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
I_CmsFormWidget.FieldType
限定符和类型 | 字段和说明 |
---|---|
static I_CmsInputCss |
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.
|
构造器和说明 |
---|
CmsTextBox()
Constructs a new instance of this widget.
|
限定符和类型 | 方法和说明 |
---|---|
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()
Fires a value change event.
|
protected void |
fireValueChangedEvent(boolean inhibitValidation)
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_CmsFormWidget.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.
|
com.google.gwt.user.client.ui.TextBox |
getTextBox()
Returns the Textbox of this widget.
|
CmsPaddedPanel |
getTextBoxContainer()
Returns the Panel of this widget.
|
boolean |
hasError()
Returns
true if this textbox has an error set. |
protected void |
hideError()
Hides the error for this textbox.
|
static void |
initClass()
Initializes this class.
|
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_CmsAutoHider 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 |
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,
boolean mayClear)
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 |
setInhibitValidationForKeypresses(boolean inhibitValidationForKeypresses)
Sets the 'inhibitValidationForKeypresses' flag.
|
void |
setName(java.lang.String name)
Sets the name of the input box.
|
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.
|
void |
setValueInTextBoxDelayed(java.lang.String value)
Sets the value of the text box after a short delay.
|
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, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
addStyleDependentName, 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, toString, unsinkEvents
public static final I_CmsInputCss 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 static void initClass()
public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler)
addBlurHandler
在接口中 com.google.gwt.event.dom.client.HasBlurHandlers
HasBlurHandlers.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
在接口中 com.google.gwt.event.dom.client.HasClickHandlers
HasClickHandlers.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
在接口中 com.google.gwt.event.dom.client.HasFocusHandlers
HasFocusHandlers.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
在接口中 com.google.gwt.event.dom.client.HasKeyPressHandlers
HasKeyPressHandlers.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
在接口中 com.google.gwt.event.logical.shared.HasValueChangeHandlers<java.lang.String>
HasValueChangeHandlers.addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler)
public void blur()
I_CmsHasBlur
blur
在接口中 I_CmsHasBlur
I_CmsHasBlur.blur()
public java.lang.String getApparentValue()
I_CmsFormWidget
getApparentValue
在接口中 I_CmsFormWidget
I_CmsFormWidget.getApparentValue()
public I_CmsFormWidget.FieldType getFieldType()
I_CmsFormWidget
getFieldType
在接口中 I_CmsFormWidget
I_CmsFormWidget.getFieldType()
public java.lang.Object getFormValue()
I_CmsFormWidget
getFormValue
在接口中 I_CmsFormWidget
I_CmsFormWidget.getFormValue()
public java.lang.String getFormValueAsString()
I_CmsFormWidget
getFormValueAsString
在接口中 I_CmsFormWidget
I_CmsFormWidget.getFormValueAsString()
public java.lang.String getId()
public java.lang.String getText()
public com.google.gwt.user.client.ui.TextBox getTextBox()
public CmsPaddedPanel getTextBoxContainer()
public boolean hasError()
true
if this textbox has an error set.true
if this textbox has an error setpublic boolean isEnabled()
isEnabled
在接口中 I_CmsFormWidget
true
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
在接口中 com.google.gwt.user.client.EventListener
onBrowserEvent
在类中 com.google.gwt.user.client.ui.Composite
Composite.onBrowserEvent(com.google.gwt.user.client.Event)
public void reset()
I_CmsFormWidget
reset
在接口中 I_CmsFormWidget
I_CmsFormWidget.reset()
public void setAutoHideParent(I_CmsAutoHider autoHideParent)
I_CmsFormWidget
setAutoHideParent
在接口中 I_CmsFormWidget
autoHideParent
- the auto hide parentI_CmsFormWidget.setAutoHideParent(org.opencms.gwt.client.ui.I_CmsAutoHider)
public void setChangedStyle()
public void setEnabled(boolean enabled)
I_CmsFormWidget
setEnabled
在接口中 I_CmsFormWidget
enabled
- if true, the widget will be enabled, else disabledI_CmsFormWidget.setEnabled(boolean)
public void setErrorMessage(java.lang.String errorMessage)
I_CmsFormWidget
If the error message is null, no error message will be displayed.
setErrorMessage
在接口中 I_CmsFormWidget
errorMessage
- an error message or nullI_CmsFormWidget.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 setFormValueAsString(java.lang.String newValue)
I_CmsFormWidget
setFormValueAsString
在接口中 I_CmsFormWidget
newValue
- the new value of the widgetI_CmsFormWidget.setFormValueAsString(java.lang.String)
public void setGhostMode(boolean ghostMode)
setGhostMode
在接口中 I_CmsHasGhostValue
ghostMode
- 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, boolean mayClear)
This *only* changes the style, not the actual mode.
enabled
- true
if the ghost mode style should be enabled, false if it should be disabledmayClear
- true
if no value was previously setpublic void setGhostValue(java.lang.String value, boolean ghostMode)
I_CmsHasGhostValue
"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
在接口中 I_CmsHasGhostValue
value
- the ghost valueghostMode
- if true, sets the widget to ghost modeI_CmsHasGhostValue.setGhostValue(java.lang.String, boolean)
public void setInhibitValidationForKeypresses(boolean inhibitValidationForKeypresses)
inhibitValidationForKeypresses
- the new flag valuepublic void setName(java.lang.String name)
name
- of the input boxpublic 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 setValueInTextBoxDelayed(java.lang.String value)
value
- the value to setpublic void updateLayout()
protected void fireValueChangedEvent()
protected void fireValueChangedEvent(boolean inhibitValidation)
inhibitValidation
- if true, some additional information will be added to the event to ask event handlers to not perform any validation directlyprotected void hideError()
protected boolean isNavigationKey(int keyCode)
keyCode
- the key code to checktrue
if the given key code represents a functional keyprotected void showError()