com.sage.swt.client.widget
Interface BehavesAsTextBox

All Superinterfaces:
BehavesAsFocusWidget, com.google.gwt.user.client.ui.Focusable, com.google.gwt.event.dom.client.HasAllKeyHandlers, com.google.gwt.event.dom.client.HasBlurHandlers, HasCancellableFocusHandlers, com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasFocusHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.event.dom.client.HasKeyDownHandlers, com.google.gwt.event.dom.client.HasKeyPressHandlers, com.google.gwt.event.dom.client.HasKeyUpHandlers, HasReadOnly
All Known Implementing Classes:
AbstractSwtTextBox, SwtPasswordTextBox, SwtTextArea, SwtTextBox

public interface BehavesAsTextBox
extends BehavesAsFocusWidget, HasReadOnly

This is a "convenience" interface that mimics the interface of the TextBoxBase base class.


Field Summary
static com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_CENTER
          Center the text.
static com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_JUSTIFY
          Justify the text.
static com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_LEFT
          Align the text to the left edge.
static com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_RIGHT
          Align the text to the right.
 
Method Summary
 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).
 java.lang.String getSelectedText()
          Gets the text currently selected within this text box.
 int getSelectionLength()
          Gets the length of the current text selection.
 void selectAll()
          Selects all of the text in the box.
 void setCursorPos(int pos)
          Sets the cursor position.
 void setSelectionRange(int pos, int length)
          Sets the range of text to be selected.
 void setTextAlignment(com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment align)
          Sets the alignment of the text in the text box.
 
Methods inherited from interface com.sage.swt.client.widget.BehavesAsFocusWidget
isEnabled, setEnabled
 
Methods inherited from interface com.google.gwt.event.dom.client.HasClickHandlers
addClickHandler
 
Methods inherited from interface com.google.gwt.user.client.ui.Focusable
getTabIndex, setAccessKey, setFocus, setTabIndex
 
Methods inherited from interface com.google.gwt.event.dom.client.HasKeyUpHandlers
addKeyUpHandler
 
Methods inherited from interface com.google.gwt.event.dom.client.HasKeyDownHandlers
addKeyDownHandler
 
Methods inherited from interface com.google.gwt.event.dom.client.HasKeyPressHandlers
addKeyPressHandler
 
Methods inherited from interface com.sage.swt.client.widget.HasCancellableFocusHandlers
addBeforeFocusHandler
 
Methods inherited from interface com.google.gwt.event.dom.client.HasFocusHandlers
addFocusHandler
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 
Methods inherited from interface com.google.gwt.event.dom.client.HasBlurHandlers
addBlurHandler
 
Methods inherited from interface com.sage.swt.client.widget.HasReadOnly
isReadOnly, setReadOnly
 

Field Detail

ALIGN_CENTER

static final com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_CENTER
Center the text.


ALIGN_JUSTIFY

static final com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_JUSTIFY
Justify the text.


ALIGN_LEFT

static final com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_LEFT
Align the text to the left edge.


ALIGN_RIGHT

static final com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment ALIGN_RIGHT
Align the text to the right.

Method Detail

cancelKey

void cancelKey()
If a keyboard event is currently being handled on this text box, calling this method will suppress it. This allows handlers to easily filter keyboard input.


getCursorPos

int getCursorPos()
Gets the current position of the cursor (this also serves as the beginning of the text selection).

Returns:
the cursor's position

getSelectedText

java.lang.String getSelectedText()
Gets the text currently selected within this text box.

Returns:
the selected text, or an empty string if none is selected

getSelectionLength

int getSelectionLength()
Gets the length of the current text selection.

Returns:
the text selection length

selectAll

void selectAll()
Selects all of the text in the box. This will only work when the widget is attached to the document.


setCursorPos

void setCursorPos(int pos)
Sets the cursor position.

Parameters:
pos - the new cursor position

setSelectionRange

void setSelectionRange(int pos,
                       int length)
Sets the range of text to be selected. This will only work when the widget is attached to the document.

Parameters:
pos - the position of the first character to be selected
length - the number of characters to be selected

setTextAlignment

void setTextAlignment(com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment align)
Sets the alignment of the text in the text box.

Parameters:
align - the text alignment (as specified by ALIGN_CENTER, ALIGN_JUSTIFY, ALIGN_LEFT, and ALIGN_RIGHT)


Copyright © 2011 Sage Software, Inc. All rights reserved.