public class SelectionDelegate extends Object implements Serializable
Contains standard selection-related functionality used by various input elements.
From the HTML5 spec:
Mostly for historical reasons, in addition to the browsing context's selection, each textarea and input element has an independent selection. These are the text field selections.
Constructor and Description |
---|
SelectionDelegate(SelectableTextInput element)
Creates a new instance for the specified element.
|
Modifier and Type | Method and Description |
---|---|
String |
getSelectedText()
Returns the selected text in the owner element, or null if there is no selected text.
|
int |
getSelectionEnd()
Returns the end position of the selected text in the owner element.
|
int |
getSelectionStart()
Returns the start position of the selected text in the owner element.
|
void |
select()
Focuses the owner element and selects all of its text.
|
void |
setSelectionEnd(int selectionEnd)
Sets the end position of the selected text in the owner element.
|
void |
setSelectionStart(int selectionStart)
Sets the start position of the selected text in the owner element.
|
public SelectionDelegate(SelectableTextInput element)
element
- the owner elementpublic void select()
public String getSelectedText()
public int getSelectionStart()
public void setSelectionStart(int selectionStart)
selectionStart
- the start position of the selected text in the owner elementpublic int getSelectionEnd()
public void setSelectionEnd(int selectionEnd)
selectionEnd
- the end position of the selected text in the owner elementCopyright © 2002–2013 Gargoyle Software Inc.. All rights reserved.