public class TextFieldImpl<V> extends AbstractField<JmixTextField,java.lang.String,V> implements TextField<V>, org.springframework.beans.factory.InitializingBean
TextInputField.CaseConversion, TextInputField.CaseConversionSupported, TextInputField.CursorPositionSupported, TextInputField.EnterPressEvent, TextInputField.EnterPressNotifier, TextInputField.HtmlNameSupported, TextInputField.MaxLengthLimited, TextInputField.TextChangeEvent, TextInputField.TextChangeEventMode, TextInputField.TextChangeNotifier, TextInputField.TextSelectionSupported, TextInputField.TrimSupportedHasValue.ValueChangeEvent<V>Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.WrapperHasContextHelp.ContextHelpIconClickEvent| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
conversionErrorMessage |
protected DataAwareComponentsTools |
dataAwareComponentsTools |
protected io.jmix.core.metamodel.datatype.Datatype<V> |
datatype |
protected com.vaadin.shared.Registration |
enterShortcutRegistration |
protected Formatter<? super V> |
formatter |
protected java.util.Locale |
locale |
protected boolean |
trimming |
editable, parentEditableChangeListener, validators, VALIDATORS_LIST_INITIAL_CAPACITYinternalValue, uiTestIdsSupport, valueBindingalignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentNAME, TYPE_BIGDECIMAL, TYPE_DATE, TYPE_DATETIME, TYPE_DEFAULT, TYPE_DOUBLE, TYPE_INTEGER, TYPE_LOCALDATE, TYPE_LOCALDATETIME, TYPE_LONG, TYPE_OFFSETTIME, TYPE_STRING, TYPE_TIMEAUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE| Constructor and Description |
|---|
TextFieldImpl() |
| Modifier and Type | Method and Description |
|---|---|
io.jmix.core.common.event.Subscription |
addEnterPressListener(java.util.function.Consumer<TextInputField.EnterPressEvent> listener)
Adds a listener that is invoked when the user presses Enter.
|
io.jmix.core.common.event.Subscription |
addTextChangeListener(java.util.function.Consumer<TextInputField.TextChangeEvent> listener)
Adds a listener that is fired when the component value is changed.
|
void |
afterPropertiesSet() |
void |
commit()
Updates all changes since the previous commit to the data source.
|
protected void |
componentValueChanged(java.lang.String prevComponentValue,
java.lang.String newComponentValue,
boolean isUserOriginated) |
protected V |
convertToModel(java.lang.String componentRawValue) |
protected java.lang.String |
convertToPresentation(V modelValue) |
protected JmixTextField |
createComponent() |
void |
discard()
Discards all changes since last commit.
|
protected void |
fireTextChangeEvent(java.lang.String newComponentValue) |
void |
focus()
Sets focus to this component
|
TextInputField.CaseConversion |
getCaseConversion() |
java.lang.String |
getConversionErrorMessage() |
protected java.lang.String |
getConversionErrorMessageInternal() |
io.jmix.core.metamodel.datatype.Datatype<V> |
getDatatype() |
Formatter<V> |
getFormatter() |
java.lang.String |
getHtmlName() |
java.lang.String |
getInputPrompt() |
int |
getMaxLength() |
java.lang.String |
getRawValue()
Returns a string representation of the value.
|
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
TextInputField.TextChangeEventMode |
getTextChangeEventMode() |
int |
getTextChangeTimeout()
Gets the timeout used to fire
TextInputField.TextChangeEvents and ValueChangeEvents when the
TextInputField.TextChangeNotifier.getTextChangeEventMode() is TextInputField.TextChangeEventMode.LAZY or
TextInputField.TextChangeEventMode.TIMEOUT. |
protected void |
initComponent(JmixTextField component) |
protected void |
internalRemoveEnterPressListener(java.util.function.Consumer<TextInputField.EnterPressEvent> listener) |
boolean |
isBuffered() |
boolean |
isEmpty() |
boolean |
isModified()
Tests if the value stored in the object has been modified since it was
last updated from the data source.
|
boolean |
isTrimming() |
void |
selectAll() |
void |
setBuffered(boolean buffered)
Sets the buffered mode.
|
void |
setCaseConversion(TextInputField.CaseConversion caseConversion)
Disable automatic case conversion or enable with chosen mode
|
void |
setConversionErrorMessage(java.lang.String conversionErrorMessage)
Sets custom conversion error message that is used when value doesn't correspond to datatype.
|
void |
setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication) |
void |
setCursorPosition(int position)
Sets the cursor position in the field.
|
void |
setDataAwareComponentsTools(DataAwareComponentsTools dataAwareComponentsTools) |
void |
setDatatype(io.jmix.core.metamodel.datatype.Datatype<V> datatype)
Sets the given
datatype to the component. |
void |
setFormatter(Formatter<? super V> formatter) |
void |
setHtmlName(java.lang.String htmlName)
Sets the given
htmlName as a value of "name" HTML attribute. |
void |
setInputPrompt(java.lang.String inputPrompt)
Sets the input prompt - a textual prompt that is displayed when the field
would otherwise be empty, to prompt the user for input.
|
void |
setMaxLength(int maxLength) |
void |
setSelectionRange(int pos,
int length) |
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
void |
setTextChangeEventMode(TextInputField.TextChangeEventMode mode)
Sets the mode how the TextField triggers
TextInputField.TextChangeEvents and ValueChangeEvents. |
void |
setTextChangeTimeout(int timeout)
The text change timeout modifies how often text change events are
communicated to the application when
TextInputField.TextChangeNotifier.getTextChangeEventMode() is
TextInputField.TextChangeEventMode.LAZY or TextInputField.TextChangeEventMode.TIMEOUT. |
void |
setTrimming(boolean trimming) |
protected void |
valueBindingConnected(ValueSource<V> valueSource) |
addValidator, attachValueChangeListener, getDatatypeConversionErrorMsg, getDefaultRequiredMessage, getErrorMessage, getRequiredMessage, getValidators, isEditable, isRequired, isValid, removeValidator, setEditable, setEditableToComponent, setParent, setRequired, setRequiredMessage, setupComponentErrorProvider, triggerValidators, validateaddValueChangeListener, fieldValueEquals, getValue, getValueSource, setUiTestId, setUiTestIdsSupport, setValue, setValueSource, setValueToPresentation, valueBindingActivatedaddAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetValueSource, setValueSourceaddValueChangeListener, clear, getEmptyValue, getValue, setValueisEditable, isEditableWithParent, setEditablegetFrame, setFrameaddStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionisValid, isValidateOnCommit, validategetIcon, setIcon, setIconFromSetgetContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabledisCaptionAsHtml, setCaptionAsHtmlgetCaption, setCaptiongetDescription, setDescriptionisDescriptionAsHtml, setDescriptionAsHtmlisHtmlSanitizerEnabled, setHtmlSanitizerEnabledaddValidator, addValidators, getValidators, removeValidatorgetRequiredMessage, isRequired, setRequired, setRequiredMessageisFocusable, setFocusableprotected io.jmix.core.metamodel.datatype.Datatype<V> datatype
protected java.util.Locale locale
protected boolean trimming
protected com.vaadin.shared.Registration enterShortcutRegistration
protected java.lang.String conversionErrorMessage
protected DataAwareComponentsTools dataAwareComponentsTools
@Autowired public void setDataAwareComponentsTools(DataAwareComponentsTools dataAwareComponentsTools)
@Autowired public void setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication)
protected JmixTextField createComponent()
public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanprotected void initComponent(JmixTextField component)
protected void valueBindingConnected(ValueSource<V> valueSource)
valueBindingConnected in class AbstractValueComponent<JmixTextField,java.lang.String,V>protected java.lang.String convertToPresentation(@Nullable
V modelValue)
throws ConversionException
convertToPresentation in class AbstractValueComponent<JmixTextField,java.lang.String,V>ConversionException@Nullable protected V convertToModel(@Nullable java.lang.String componentRawValue) throws ConversionException
convertToModel in class AbstractValueComponent<JmixTextField,java.lang.String,V>ConversionExceptionpublic void setConversionErrorMessage(@Nullable
java.lang.String conversionErrorMessage)
HasConversionErrorMessagesetConversionErrorMessage in interface HasConversionErrorMessageconversionErrorMessage - custom conversion error message@Nullable public java.lang.String getConversionErrorMessage()
getConversionErrorMessage in interface HasConversionErrorMessageprotected java.lang.String getConversionErrorMessageInternal()
protected void componentValueChanged(java.lang.String prevComponentValue,
java.lang.String newComponentValue,
boolean isUserOriginated)
componentValueChanged in class AbstractValueComponent<JmixTextField,java.lang.String,V>@Nullable public io.jmix.core.metamodel.datatype.Datatype<V> getDatatype()
getDatatype in interface HasDatatype<V>public void setDatatype(io.jmix.core.metamodel.datatype.Datatype<V> datatype)
HasDatatypedatatype to the component. Its value will be formatted according to this
datatype.setDatatype in interface HasDatatype<V>datatype - Datatype instancepublic TextInputField.CaseConversion getCaseConversion()
getCaseConversion in interface TextInputField.CaseConversionSupportedpublic void setCaseConversion(TextInputField.CaseConversion caseConversion)
TextInputField.CaseConversionSupportedsetCaseConversion in interface TextInputField.CaseConversionSupported@Nullable public Formatter<V> getFormatter()
getFormatter in interface HasFormatter<V>public void setFormatter(@Nullable
Formatter<? super V> formatter)
setFormatter in interface HasFormatter<V>public int getMaxLength()
getMaxLength in interface TextInputField.MaxLengthLimitedpublic void setMaxLength(int maxLength)
setMaxLength in interface TextInputField.MaxLengthLimitedpublic boolean isTrimming()
isTrimming in interface TextInputField.TrimSupportedpublic void setTrimming(boolean trimming)
setTrimming in interface TextInputField.TrimSupported@Nullable public java.lang.String getInputPrompt()
getInputPrompt in interface HasInputPromptpublic void setInputPrompt(@Nullable
java.lang.String inputPrompt)
HasInputPromptsetInputPrompt in interface HasInputPromptinputPrompt - input promptpublic void setCursorPosition(int position)
TextInputField.CursorPositionSupportedsetCursorPosition in interface TextInputField.CursorPositionSupportedposition - new cursor positionpublic java.lang.String getRawValue()
TextFieldgetRawValue in interface TextField<V>public void selectAll()
selectAll in interface TextInputField.TextSelectionSupportedpublic void setSelectionRange(int pos,
int length)
setSelectionRange in interface TextInputField.TextSelectionSupportedprotected void fireTextChangeEvent(java.lang.String newComponentValue)
public void setTextChangeTimeout(int timeout)
TextInputField.TextChangeNotifierTextInputField.TextChangeNotifier.getTextChangeEventMode() is
TextInputField.TextChangeEventMode.LAZY or TextInputField.TextChangeEventMode.TIMEOUT.setTextChangeTimeout in interface TextInputField.TextChangeNotifiertimeout - timeout in millisecondspublic io.jmix.core.common.event.Subscription addTextChangeListener(java.util.function.Consumer<TextInputField.TextChangeEvent> listener)
TextInputField.TextChangeNotifieraddTextChangeListener in interface TextInputField.TextChangeNotifierlistener - a listener to addSubscription objectpublic int getTextChangeTimeout()
TextInputField.TextChangeNotifierTextInputField.TextChangeEvents and ValueChangeEvents when the
TextInputField.TextChangeNotifier.getTextChangeEventMode() is TextInputField.TextChangeEventMode.LAZY or
TextInputField.TextChangeEventMode.TIMEOUT.getTextChangeTimeout in interface TextInputField.TextChangeNotifierpublic TextInputField.TextChangeEventMode getTextChangeEventMode()
getTextChangeEventMode in interface TextInputField.TextChangeNotifierTextInputField.TextChangeEvents and ValueChangeEvents.public void setTextChangeEventMode(TextInputField.TextChangeEventMode mode)
TextInputField.TextChangeNotifierTextInputField.TextChangeEvents and ValueChangeEvents.setTextChangeEventMode in interface TextInputField.TextChangeNotifiermode - the new modepublic io.jmix.core.common.event.Subscription addEnterPressListener(java.util.function.Consumer<TextInputField.EnterPressEvent> listener)
TextInputField.EnterPressNotifieraddEnterPressListener in interface TextInputField.EnterPressNotifierlistener - a listener to addSubscriptionprotected void internalRemoveEnterPressListener(java.util.function.Consumer<TextInputField.EnterPressEvent> listener)
public void focus()
Component.Focusablefocus in interface Component.Focusablepublic int getTabIndex()
Component.FocusableHasTabIndex component.getTabIndex in interface Component.FocusableHasTabIndex componentpublic void setTabIndex(int tabIndex)
Component.FocusableFocusable component.
The tab index property is used to specify the order in which the
fields are focused when the user presses the Tab key. Components with
a defined tab index are focused sequentially first, and then the
components with no tab index.setTabIndex in interface Component.FocusabletabIndex - tab indexpublic void commit()
Bufferedcommit in interface Bufferedcommit in class AbstractValueComponent<JmixTextField,java.lang.String,V>public void discard()
Buffereddiscard in interface Buffereddiscard in class AbstractValueComponent<JmixTextField,java.lang.String,V>public boolean isBuffered()
isBuffered in interface BufferedisBuffered in class AbstractValueComponent<JmixTextField,java.lang.String,V>true if buffered mode is on, false otherwisepublic void setBuffered(boolean buffered)
Buffered
When in buffered mode, an internal buffer will be used to store changes
until Buffered.commit() is called. Calling Buffered.discard() will revert
the internal buffer to the value of the data source.
When in non-buffered mode both read and write operations will be done
directly on the data source. In this mode the Buffered.commit() and
Buffered.discard() methods serve no purpose.
setBuffered in interface BufferedsetBuffered in class AbstractValueComponent<JmixTextField,java.lang.String,V>buffered - true if buffered mode should be turned on, false otherwisepublic boolean isModified()
BufferedisModified in interface BufferedisModified in class AbstractValueComponent<JmixTextField,java.lang.String,V>true if the value in the object has been modified
since the last data source update, false if not.public void setHtmlName(@Nullable
java.lang.String htmlName)
TextInputField.HtmlNameSupportedhtmlName as a value of "name" HTML attribute.setHtmlName in interface TextInputField.HtmlNameSupportedhtmlName - name@Nullable public java.lang.String getHtmlName()
getHtmlName in interface TextInputField.HtmlNameSupported