|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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.TextBoxBase
public class TextBoxBase
Abstract base class for all text entry widgets.
Nested Class Summary | |
---|---|
static class |
TextBoxBase.TextAlignConstant
Text alignment constant, used in setTextAlignment(TextBoxBase.TextAlignConstant) . |
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject |
---|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled |
Field Summary | |
---|---|
static TextBoxBase.TextAlignConstant |
ALIGN_CENTER
Center the text. |
static TextBoxBase.TextAlignConstant |
ALIGN_JUSTIFY
Justify the text. |
static TextBoxBase.TextAlignConstant |
ALIGN_LEFT
Align the text to the left edge. |
static TextBoxBase.TextAlignConstant |
ALIGN_RIGHT
Align the text to the right. |
Fields inherited from class com.google.gwt.user.client.ui.UIObject |
---|
DEBUG_ID_PREFIX |
Constructor Summary | |
---|---|
protected |
TextBoxBase(Element elem)
Creates a text box that wraps the given browser element handle. |
Method Summary | |
---|---|
HandlerRegistration |
addChangeHandler(ChangeHandler handler)
Adds a ChangeEvent handler. |
void |
addChangeListener(ChangeListener listener)
Deprecated. Use addChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) instead |
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<java.lang.String> handler)
Adds a ValueChangeEvent handler. |
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). |
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. |
java.lang.String |
getValue()
Gets this object's value. |
boolean |
isReadOnly()
Determines whether or not the widget is read-only. |
void |
onBrowserEvent(Event event)
Fired whenever a browser event is received. |
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 |
setCursorPos(int pos)
Sets the cursor position. |
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 |
setTextAlignment(TextBoxBase.TextAlignConstant align)
Sets the alignment of the text in the text box. |
void |
setValue(java.lang.String value)
Sets this object's value without firing any events. |
void |
setValue(java.lang.String value,
boolean fireEvents)
Sets this object's value. |
Methods inherited from class com.google.gwt.user.client.ui.Widget |
---|
addDomHandler, addHandler, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents |
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, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
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.shared.HasHandlers |
---|
fireEvent |
Field Detail |
---|
public static final TextBoxBase.TextAlignConstant ALIGN_CENTER
public static final TextBoxBase.TextAlignConstant ALIGN_JUSTIFY
public static final TextBoxBase.TextAlignConstant ALIGN_LEFT
public static final TextBoxBase.TextAlignConstant ALIGN_RIGHT
Constructor Detail |
---|
protected TextBoxBase(Element elem)
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 handler@Deprecated public void addChangeListener(ChangeListener listener)
addChangeHandler(com.google.gwt.event.dom.client.ChangeHandler)
instead
SourcesChangeEvents
addChangeListener
in interface SourcesChangeEvents
listener
- the listener interface to addpublic HandlerRegistration addValueChangeHandler(ValueChangeHandler<java.lang.String> handler)
HasValueChangeHandlers
ValueChangeEvent
handler.
addValueChangeHandler
in interface HasValueChangeHandlers<java.lang.String>
handler
- the handler
public void cancelKey()
public int getCursorPos()
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 HasText
public java.lang.String getValue()
HasValue
getValue
in interface HasValue<java.lang.String>
public 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
SourcesChangeEvents
removeChangeListener
in interface SourcesChangeEvents
listener
- the listener interface to removepublic void selectAll()
public void setCursorPos(int pos)
pos
- the new cursor position@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 HasText
text
- the object's new textpublic void setTextAlignment(TextBoxBase.TextAlignConstant align)
align
- the text alignment (as specified by ALIGN_CENTER
,
ALIGN_JUSTIFY
, ALIGN_LEFT
, and
ALIGN_RIGHT
)public void setValue(java.lang.String value)
HasValue
It is acceptable to fail assertions or throw (documented) unchecked exceptions in response to bad values.
By convention, GWT widgets that can be cleared accept null for
value
, but it is acceptable for widgets that cannot
be cleared to throw an exception for null values.
setValue
in interface HasValue<java.lang.String>
value
- the object's new valuepublic void setValue(java.lang.String 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<java.lang.String>
value
- the object's new valuefireEvents
- fire events if true and value is newprotected com.google.gwt.user.client.ui.impl.TextBoxImpl getImpl()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |