Interface SelectionApi
-
- All Superinterfaces:
com.vaadin.flow.component.HasElement,Serializable
- All Known Subinterfaces:
FluentVaadinTextField<S,F,T>
- All Known Implementing Classes:
VBigDecimalField,VEmailField,VIntegerField,VNumberField,VPasswordField,VTextArea,VTextField
public interface SelectionApi extends com.vaadin.flow.component.HasElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSelectionApi.SelectionRangeCallback
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidgetCursorPosition(com.vaadin.flow.function.SerializableConsumer<Integer> callback)Asynchronously gets the current cursor position for this field.default voidgetSelectionRange(SelectionApi.SelectionRangeCallback callback)Asynchronously gets the current selection for this field.default voidselectAll()Selects 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.
-
-
-
Method Detail
-
selectAll
default void selectAll()
Selects all text in the field and moves the focus to the field.
-
setSelectionRange
default 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.
-
setCursorPosition
default void setCursorPosition(int cursorPosition)
Sets the cursor position to given index.- Parameters:
cursorPosition- the cursor position
-
getSelectionRange
default void getSelectionRange(SelectionApi.SelectionRangeCallback callback)
Asynchronously gets the current selection for this field.- Parameters:
callback- the callback to notify the selection
-
getCursorPosition
default void getCursorPosition(com.vaadin.flow.function.SerializableConsumer<Integer> callback)
Asynchronously gets the current cursor position for this field.- Parameters:
callback- the callback to notify the position
-
-