Interface SelectionApi
- All Superinterfaces:
- com.vaadin.flow.component.HasElement,- Serializable
- All Known Subinterfaces:
- FluentVaadinTextField<S,- F, - T> 
- All Known Implementing Classes:
- VBigDecimalField,- VDatePicker,- VEmailField,- VIntegerField,- VNumberField,- VPasswordField,- VTextArea,- VTextField
public interface SelectionApi
extends com.vaadin.flow.component.HasElement
- 
Nested Class SummaryNested Classes
- 
Method SummaryModifier and TypeMethodDescriptiondefault voidgetCursorPosition(com.vaadin.flow.function.SerializableConsumer<Integer> callback) Asynchronously gets the current cursor position for this field.default voidAsynchronously gets the current selection for this field.default voidSelects all text in the field and moves the focus to the field.default voidsetCursorPosition(int cursorPosition) Sets the cursor position to given index.default voidsetSelectionRange(int selectionStart, int selectionEnd) Sets the start and end positions of the current text selection.Methods inherited from interface com.vaadin.flow.component.HasElementgetElement
- 
Method Details- 
selectAlldefault void selectAll()Selects all text in the field and moves the focus to the field.
- 
setSelectionRangedefault void setSelectionRange(int selectionStart, int selectionEnd) Sets the start and end positions of the current text selection.Note, that the method simply proxies the parameters to the similarly named method in the browser, without sanity checks or any synchronization. - Parameters:
- selectionStart- The 0-based index of the first selected character. An index greater than the length of the element's value is treated as pointing to the end of the value.
- selectionEnd- The 0-based index for the end of the selection (exclusive). An index greater than the length of the element's value is treated as pointing to the end of the value.
 
- 
setCursorPositiondefault void setCursorPosition(int cursorPosition) Sets the cursor position to given index.- Parameters:
- cursorPosition- the cursor position
 
- 
getSelectionRangeAsynchronously gets the current selection for this field.- Parameters:
- callback- the callback to notify the selection
 
- 
getCursorPositionAsynchronously gets the current cursor position for this field.- Parameters:
- callback- the callback to notify the position
 
 
-