Package org.vaadin.miki.shared.text
Class TextModificationDelegate<C extends com.vaadin.flow.component.Component & CanSelectText & CanReceiveSelectionEventsFromClient & CanModifyText>
- java.lang.Object
-
- org.vaadin.miki.shared.text.TextSelectionDelegate<C>
-
- org.vaadin.miki.shared.text.TextModificationDelegate<C>
-
- All Implemented Interfaces:
Serializable,TextSelectionNotifier<C>,CanModifyText,CanReceiveSelectionEventsFromClient,CanSelectText
public class TextModificationDelegate<C extends com.vaadin.flow.component.Component & CanSelectText & CanReceiveSelectionEventsFromClient & CanModifyText> extends TextSelectionDelegate<C> implements CanModifyText
A delegate to handleCanModifyTextin various components. Extension of theTextSelectionDelegate, as the js function is in the same module, but should not be exposed to all components.- Since:
- 2021-03-26
- Author:
- miki
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.vaadin.miki.shared.text.TextSelectionDelegate
SELECTED_TEXT_ATTRIBUTE_NAME
-
-
Constructor Summary
Constructors Constructor Description TextModificationDelegate(C source, com.vaadin.flow.component.ComponentEventBus eventBus, com.vaadin.flow.function.SerializableSupplier<String> stringValueSupplier)Creates the delegate for a given component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmodifyText(String replacement, int from, int to)Modifies the text at given coordinates.-
Methods inherited from class org.vaadin.miki.shared.text.TextSelectionDelegate
addTextSelectionListener, clearSelectionOnValueChange, fireTextSelectionEvent, getSource, getSourceElement, informClientAboutSendingEvents, isReceivingSelectionEventsFromClient, onAttach, onDetach, reinitialiseListeners, select, selectAll, selectNone, setReceivingSelectionEventsFromClient
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.vaadin.miki.markers.CanModifyText
modifyText, modifyText
-
-
-
-
Constructor Detail
-
TextModificationDelegate
public TextModificationDelegate(C source, com.vaadin.flow.component.ComponentEventBus eventBus, com.vaadin.flow.function.SerializableSupplier<String> stringValueSupplier)
Creates the delegate for a given component.- Parameters:
source- Source of all events, data, etc.eventBus- Event bus to use for firing events. Typically,source.getEventBus().stringValueSupplier- Method to obtain current value of the component as aString.
-
-
Method Detail
-
modifyText
public void modifyText(String replacement, int from, int to)
Description copied from interface:CanModifyTextModifies the text at given coordinates.- Specified by:
modifyTextin interfaceCanModifyText- Parameters:
replacement- Text to put.from- The starting index of what to replace.to- The end index of what to replace.
-
-