com.gargoylesoftware.htmlunit.html.impl
Class SelectionDelegate

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.impl.SelectionDelegate
All Implemented Interfaces:
Serializable

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.

Version:
$Revision: 5864 $
Author:
Daniel Gredler
See Also:
Serialized Form

Constructor Summary
SelectionDelegate(SelectableTextInput element)
          Creates a new instance for the specified element.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionDelegate

public SelectionDelegate(SelectableTextInput element)
Creates a new instance for the specified element.

Parameters:
element - the owner element
Method Detail

select

public void select()
Focuses the owner element and selects all of its text.


getSelectedText

public String getSelectedText()
Returns the selected text in the owner element, or null if there is no selected text.

Returns:
the selected text in the owner element, or null if there is no selected text

getSelectionStart

public int getSelectionStart()
Returns the start position of the selected text in the owner element.

Returns:
the start position of the selected text in the owner element

setSelectionStart

public void setSelectionStart(int selectionStart)
Sets the start position of the selected text in the owner element.

Parameters:
selectionStart - the start position of the selected text in the owner element

getSelectionEnd

public int getSelectionEnd()
Returns the end position of the selected text in the owner element.

Returns:
the end position of the selected text in the owner element

setSelectionEnd

public void setSelectionEnd(int selectionEnd)
Sets the end position of the selected text in the owner element.

Parameters:
selectionEnd - the end position of the selected text in the owner element


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.