Package org.mozilla.geckoview
Class GeckoSession.SelectionActionDelegate.Selection
Object
org.mozilla.geckoview.GeckoSession.SelectionActionDelegate.Selection
- Enclosing interface:
- GeckoSession.SelectionActionDelegate
Represents attributes of a selection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Collection<String>Set of valid actions available throughexecute(String)final intFlags describing the current selection, as a bitwise combination of theFLAG_*constants.final RectFThe bounds of the current selection in screen coordinates.final StringText content of the current selection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCollapse the current selection to its end position.voidCollapse the current selection to its start position.voidcopy()Copy the selected content onto the clipboard.voidcut()Copy onto the clipboard then delete the selected content.voiddelete()Delete the selected content.voidExecute anGeckoSession.SelectionActionDelegateaction.voidhide()Hide selection actions and causeGeckoSession.SelectionActionDelegate.onHideAction(org.mozilla.geckoview.GeckoSession, int)to be called.booleanisActionAvailable(String action) Checks if the passed action is availablevoidpaste()Replace the selected content with the clipboard content.voidReplace the selected content with the clipboard content as plain text.voidSelect the entire content of the document or editor.voidunselect()Clear the current selection.
-
Field Details
-
flags
public final int flagsFlags describing the current selection, as a bitwise combination of theFLAG_*constants. -
text
Text content of the current selection. An empty string indicates the selection is collapsed or the selection cannot be represented as plain text. -
screenRect
The bounds of the current selection in screen coordinates. -
availableActions
Set of valid actions available throughexecute(String)
-
-
Constructor Details
-
Selection
protected Selection()Empty constructor for tests.
-
-
Method Details
-
isActionAvailable
Checks if the passed action is available- Parameters:
action- AnGeckoSession.SelectionActionDelegateto perform- Returns:
- True if the action is available.
-
execute
Execute anGeckoSession.SelectionActionDelegateaction.- Parameters:
action- AGeckoSession.SelectionActionDelegateaction.- Throws:
IllegalStateException- If the action was not available.
-
hide
@AnyThread public void hide()Hide selection actions and causeGeckoSession.SelectionActionDelegate.onHideAction(org.mozilla.geckoview.GeckoSession, int)to be called.- Throws:
IllegalStateException- If the action was not available.
-
cut
@AnyThread public void cut()Copy onto the clipboard then delete the selected content.- Throws:
IllegalStateException- If the action was not available.
-
copy
@AnyThread public void copy()Copy the selected content onto the clipboard.- Throws:
IllegalStateException- If the action was not available.
-
delete
@AnyThread public void delete()Delete the selected content.- Throws:
IllegalStateException- If the action was not available.
-
paste
@AnyThread public void paste()Replace the selected content with the clipboard content.- Throws:
IllegalStateException- If the action was not available.
-
pasteAsPlainText
@AnyThread public void pasteAsPlainText()Replace the selected content with the clipboard content as plain text.- Throws:
IllegalStateException- If the action was not available.
-
selectAll
@AnyThread public void selectAll()Select the entire content of the document or editor.- Throws:
IllegalStateException- If the action was not available.
-
unselect
@AnyThread public void unselect()Clear the current selection.- Throws:
IllegalStateException- If the action was not available.
-
collapseToStart
@AnyThread public void collapseToStart()Collapse the current selection to its start position.- Throws:
IllegalStateException- If the action was not available.
-
collapseToEnd
@AnyThread public void collapseToEnd()Collapse the current selection to its end position.- Throws:
IllegalStateException- If the action was not available.
-