Package com.vaadin.featurepack.ui
Interface InputSelectionCapable<V>
- Type Parameters:
V- the value type of the component that uses the selection controller
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
FAbstractTextField
- All Known Implementing Classes:
FPasswordField,FTextArea,FTextField
Interface providing input selection capabilities to Vaadin Flow components
that do not inherently support features like cursor positioning or text
selection. This interface requires the implementing component to provide an
InputSelectionController.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the last known cursor position of the field as tracked on the server side.Returns the controller that manages input selection logic for this component.default voidSelects all text in the field.default voidsetCursorPosition(int pos) Sets the cursor position in the field.default voidsetSelectionRange(int pos, int length) Sets the range of text to be selected and focuses the field on the client side.
-
Method Details
-
getInputSelectionController
InputSelectionController<V> getInputSelectionController()Returns the controller that manages input selection logic for this component.- Returns:
- the
InputSelectionControllerinstance
-
setCursorPosition
default void setCursorPosition(int pos) Sets the cursor position in the field. This also focuses the field on the client side. The actual cursor position on the client may differ due to asynchronous updates.- Parameters:
pos- the position to move the cursor to
-
getCursorPosition
default int getCursorPosition()Returns the last known cursor position of the field as tracked on the server side. The actual cursor position on the client may differ due to asynchronous updates.- Returns:
- the last known cursor position
-
selectAll
default void selectAll()Selects all text in the field. Focuses the field and attempts to set the selection range from start to end of the current value. -
setSelectionRange
default void setSelectionRange(int pos, int length) Sets the range of text to be selected and focuses the field on the client side. The component will attempt to select the specified text range. If the provided indices are out of range, the actual client-side behavior may differ.- Parameters:
pos- the starting position of the selectionlength- the number of characters to select
-