public class SelectableTextSelectionDelegate extends Object implements SelectionDelegate
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 |
---|
SelectableTextSelectionDelegate(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 SelectableTextSelectionDelegate(SelectableTextInput element)
element
- the owner elementpublic void select()
public String getSelectedText()
null
if there is no selected text.null
if there is no selected textpublic int getSelectionStart()
getSelectionStart
in interface SelectionDelegate
public void setSelectionStart(int selectionStart)
setSelectionStart
in interface SelectionDelegate
selectionStart
- the start position of the selected text in the owner elementpublic int getSelectionEnd()
getSelectionEnd
in interface SelectionDelegate
public void setSelectionEnd(int selectionEnd)
setSelectionEnd
in interface SelectionDelegate
selectionEnd
- the end position of the selected text in the owner elementCopyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.