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
Modifier and TypeFieldDescriptionfinal Collection<String>
Set of valid actions available throughexecute(String)
final int
Flags describing the current selection, as a bitwise combination of theFLAG_*
constants.final RectF
The bounds of the current selection in screen coordinates.final String
Text content of the current selection. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Collapse the current selection to its end position.void
Collapse the current selection to its start position.void
copy()
Copy the selected content onto the clipboard.void
cut()
Copy onto the clipboard then delete the selected content.void
delete()
Delete the selected content.void
Execute anGeckoSession.SelectionActionDelegate
action.void
hide()
Hide selection actions and causeGeckoSession.SelectionActionDelegate.onHideAction(org.mozilla.geckoview.GeckoSession, int)
to be called.boolean
isActionAvailable
(String action) Checks if the passed action is availablevoid
paste()
Replace the selected content with the clipboard content.void
Replace the selected content with the clipboard content as plain text.void
Select the entire content of the document or editor.void
unselect()
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.SelectionActionDelegate
to perform- Returns:
- True if the action is available.
-
execute
Execute anGeckoSession.SelectionActionDelegate
action.- Parameters:
action
- AGeckoSession.SelectionActionDelegate
action.- 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.
-