|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gwt.user.client.ui.UIObject com.google.gwt.user.client.ui.Widget com.google.gwt.user.client.ui.FocusWidget com.google.gwt.user.client.ui.ValueBoxBase<T>
T
- the value typepublic class ValueBoxBase<T>
Abstract base class for all text entry widgets.
Nested Class Summary | |
---|---|
static class |
ValueBoxBase.TextAlignment
Alignment values for setAlignment(com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment) . |
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.i18n.client.HasDirection |
---|
HasDirection.Direction |
Field Summary |
---|
Fields inherited from class com.google.gwt.user.client.ui.Widget |
---|
eventsToSink |
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR |
Constructor Summary | |
---|---|
protected |
ValueBoxBase(Element elem,
Renderer<T> renderer,
Parser<T> parser)
Creates a value box that wraps the given browser element handle. |
Method Summary | |
---|---|
HandlerRegistration |
addChangeHandler(ChangeHandler handler)
Adds a ChangeEvent handler. |
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<T> handler)
Adds a ValueChangeEvent handler. |
ValueBoxEditor<T> |
asEditor()
Returns an Editor that is backed by the ValueBoxBase. |
void |
cancelKey()
If a keyboard event is currently being handled on this text box, calling this method will suppress it. |
int |
getCursorPos()
Gets the current position of the cursor (this also serves as the beginning of the text selection). |
HasDirection.Direction |
getDirection()
Gets the directionality of the widget. |
DirectionEstimator |
getDirectionEstimator()
Gets the direction estimation model of the auto-dir handler. |
protected com.google.gwt.user.client.ui.impl.TextBoxImpl |
getImpl()
|
java.lang.String |
getName()
Gets the widget's name. |
java.lang.String |
getSelectedText()
Gets the text currently selected within this text box. |
int |
getSelectionLength()
Gets the length of the current text selection. |
java.lang.String |
getText()
Gets this object's text. |
T |
getValue()
Return the parsed value, or null if the field is empty or parsing fails. |
T |
getValueOrThrow()
Return the parsed value, or null if the field is empty. |
boolean |
isReadOnly()
Determines whether or not the widget is read-only. |
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received. |
protected void |
onLoad()
This method is called immediately after a widget becomes attached to the browser's document. |
void |
removeChangeListener(ChangeListener listener)
Deprecated. Use the HandlerRegistration.removeHandler() method on the
object returned by addChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) instead |
void |
selectAll()
Selects all of the text in the box. |
void |
setAlignment(ValueBoxBase.TextAlignment align)
|
void |
setCursorPos(int pos)
Sets the cursor position. |
void |
setDirection(HasDirection.Direction direction)
Sets the directionality for a widget. |
void |
setDirectionEstimator(boolean enabled)
Toggles on / off direction estimation. |
void |
setDirectionEstimator(DirectionEstimator directionEstimator)
Sets the direction estimation model of the auto-dir handler. |
void |
setKey(char key)
Deprecated. this method only works in IE and should not have been added to the API |
void |
setName(java.lang.String name)
Sets the widget's name. |
void |
setReadOnly(boolean readOnly)
Turns read-only mode on or off. |
void |
setSelectionRange(int pos,
int length)
Sets the range of text to be selected. |
void |
setText(java.lang.String text)
Sets this object's text. |
void |
setValue(T value)
Sets this object's value without firing any events. |
void |
setValue(T value,
boolean fireEvents)
Sets this object's value. |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onDetach, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents |
Methods inherited from class com.google.gwt.user.client.ui.UIObject |
---|
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.gwt.event.dom.client.HasKeyUpHandlers |
---|
addKeyUpHandler |
Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
---|
fireEvent |
Constructor Detail |
---|
protected ValueBoxBase(Element elem, Renderer<T> renderer, Parser<T> parser)
elem
- the browser element to wrapMethod Detail |
---|
public HandlerRegistration addChangeHandler(ChangeHandler handler)
HasChangeHandlers
ChangeEvent
handler.
addChangeHandler
in interface HasChangeHandlers
handler
- the change handler
HandlerRegistration
used to remove this handlerpublic HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
HasValueChangeHandlers
ValueChangeEvent
handler.
addValueChangeHandler
in interface HasValueChangeHandlers<T>
handler
- the handler
public ValueBoxEditor<T> asEditor()
ValueBoxEditor.of(ValueBoxBase)
. Subclasses
may override this method to provide custom error-handling when using the
Editor framework.
asEditor
in interface IsEditor<ValueBoxEditor<T>>
Editor
of type Epublic void cancelKey()
public int getCursorPos()
public HasDirection.Direction getDirection()
HasDirection
getDirection
in interface HasDirection
RTL
if the directionality is right-to-left,
LTR
if the directionality is left-to-right, or
DEFAULT
if the directionality is not explicitly specifiedpublic DirectionEstimator getDirectionEstimator()
getDirectionEstimator
in interface HasDirectionEstimator
public java.lang.String getName()
HasName
getName
in interface HasName
public java.lang.String getSelectedText()
public int getSelectionLength()
public java.lang.String getText()
HasText
getText
in interface AutoDirectionHandler.Target
getText
in interface HasText
public T getValue()
getValue
in interface TakesValue<T>
getValue
in interface HasValue<T>
TakesValue.setValue(V)
public T getValueOrThrow() throws java.text.ParseException
java.text.ParseException
- if the value cannot be parsedpublic boolean isReadOnly()
true
if the widget is currently read-only,
false
if the widget is currently editablepublic void onBrowserEvent(Event event)
EventListener
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Widget
event
- the event received@Deprecated public void removeChangeListener(ChangeListener listener)
HandlerRegistration.removeHandler()
method on the
object returned by addChangeHandler(com.google.gwt.event.dom.client.ChangeHandler)
instead
public void selectAll()
public void setAlignment(ValueBoxBase.TextAlignment align)
public void setCursorPos(int pos)
pos
- the new cursor positionpublic void setDirection(HasDirection.Direction direction)
HasDirection
setDirection
in interface HasDirection
direction
- RTL
if the directionality should be set to right-to-left,
LTR
if the directionality should be set to left-to-right
DEFAULT
if the directionality should not be explicitly setpublic void setDirectionEstimator(boolean enabled)
setDirectionEstimator
in interface HasDirectionEstimator
enabled
- Whether to enable direction estimation. If true
,
sets the DirectionEstimator
object to a default
DirectionEstimator
.public void setDirectionEstimator(DirectionEstimator directionEstimator)
setDirectionEstimator
in interface HasDirectionEstimator
directionEstimator
- The DirectionEstimator
to be set. null
means turning off direction estimation.@Deprecated public void setKey(char key)
key
- the new key valuepublic void setName(java.lang.String name)
HasName
setName
in interface HasName
name
- the widget's new namepublic void setReadOnly(boolean readOnly)
readOnly
- if true
, the widget becomes read-only; if
false
the widget becomes editablepublic void setSelectionRange(int pos, int length)
pos
- the position of the first character to be selectedlength
- the number of characters to be selectedpublic void setText(java.lang.String text)
\r
from the text, except IE which will add a \r
before each \n
. Use getText()
to get the text
directly from the widget.
setText
in interface AutoDirectionHandler.Target
setText
in interface HasText
text
- the object's new textpublic void setValue(T value)
HasValue
It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values.
Widgets must accept null as a valid value. By convention, setting a widget to
null clears value, calling getValue() on a cleared widget returns null. Widgets
that can not be cleared (e.g. CheckBox
) must find another valid meaning
for null input.
setValue
in interface TakesValue<T>
setValue
in interface HasValue<T>
value
- the object's new valueTakesValue.getValue()
public void setValue(T value, boolean fireEvents)
HasValue
ValueChangeEvent
when
fireEvents is true and the new value does not equal the existing value.
It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values.
setValue
in interface HasValue<T>
value
- the object's new valuefireEvents
- fire events if true and value is newprotected com.google.gwt.user.client.ui.impl.TextBoxImpl getImpl()
protected void onLoad()
Widget
onLoad
in class Widget
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |