Class MarkdownEditor
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<JmixMarkdownEditor,String>
com.vaadin.flow.component.AbstractSinglePropertyField<JmixMarkdownEditor,String>
io.jmix.flowui.kit.component.markdowneditor.JmixMarkdownEditor
io.jmix.flowui.component.markdowneditor.MarkdownEditor
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<JmixMarkdownEditor>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<JmixMarkdownEditor>,com.vaadin.flow.component.FocusNotifier<JmixMarkdownEditor>,com.vaadin.flow.component.HasAriaLabel,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasPlaceholder,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixMarkdownEditor,,String>, String> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixMarkdownEditor,,String>, String> com.vaadin.flow.component.shared.HasThemeVariant<MarkdownEditorVariant>,com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.component.shared.HasValidationProperties,com.vaadin.flow.data.binder.HasValidator<String>,com.vaadin.flow.data.value.HasValueChangeMode,HasRequired,SupportsStatusChangeHandler<MarkdownEditor>,SupportsValidation<String>,SupportsValueSource<String>,HasAutofocus,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public class MarkdownEditor
extends JmixMarkdownEditor
implements SupportsValueSource<String>, SupportsValidation<String>, SupportsStatusChangeHandler<MarkdownEditor>, HasRequired, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
A markdown editor field component that supports editing and rendered preview.
The component provides an Edit/Preview tab bar, a formatting toolbar with
common markdown actions and keyboard shortcuts, and renders the preview using
the built-in vaadin-markdown component.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.flowui.kit.component.markdowneditor.JmixMarkdownEditor
JmixMarkdownEditor.JmixMarkdownEditorI18n, JmixMarkdownEditor.ModeChangedEventNested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>Nested classes/interfaces inherited from interface io.jmix.flowui.component.SupportsStatusChangeHandler
SupportsStatusChangeHandler.StatusContext<C extends com.vaadin.flow.component.Component> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected FieldDelegate<MarkdownEditor, String, String> Fields inherited from class io.jmix.flowui.kit.component.markdowneditor.JmixMarkdownEditor
currentMode, defaultValidator, i18n, validationController, valueChangeTimeoutFields inherited from interface io.jmix.flowui.kit.component.HasAutofocus
AUTOFOCUS_PROPERTY_NAMEFields inherited from interface io.jmix.flowui.component.HasRequired
PROPERTY_REQUIREDFields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUTFields inherited from interface io.jmix.flowui.component.SupportsValidation
PROPERTY_ERROR_MESSAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddValidator(Validator<? super String> validator) Adds a validator to the list of validators for the component.voidprotected FieldDelegate<MarkdownEditor, String, String> voidExecutes all registered validators against the current value of the component.@Nullable String@Nullable StringReturns the custom validation message to be displayed if the component is marked as required and the validation fails due to a missing value.@Nullable ValueSource<String> Returns the currentValueSourceassociated with this component.protected voidprotected voidinitI18n()booleanisEmpty()booleanvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetErrorMessage(@Nullable String errorMessage) voidsetInvalid(boolean invalid) Sets invalid state to the field considering result of field validation.protected voidsetModelValue(String newModelValue, boolean fromClient) protected voidsetPresentationValue(String newPresentationValue) voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) voidsetRequiredMessage(@Nullable String requiredMessage) Sets a message that will be displayed or logged when a required field or input is not provided.voidsetStatusChangeHandler(@Nullable Consumer<SupportsStatusChangeHandler.StatusContext<MarkdownEditor>> handler) Sets a callback to be used to handle component status changes, e.g.voidsetValueSource(@Nullable ValueSource<String> valueSource) Sets aValueSourcefor this component, allowing it to bind its value to a specified data source.protected voidvalidate()Validates the current value against the field constraints and updates the invalid state and error message accordingly.Methods inherited from class io.jmix.flowui.kit.component.markdowneditor.JmixMarkdownEditor
addModeChangedListener, applyChangeTimeout, getDefaultValidator, getI18n, getI18nErrorMessage, getMode, getValueChangeMode, getValueChangeTimeout, isRequired, onAttach, runBeforeClientResponse, setI18n, setI18nWithJS, setManualValidation, setMode, setRequired, setValueChangeMode, setValueChangeTimeoutMethods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, bindValue, getEmptyValue, getValue, setValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface io.jmix.flowui.kit.component.HasAutofocus
isAutofocus, setAutofocusMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
bindHelperText, getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods inherited from interface com.vaadin.flow.component.HasPlaceholder
bindPlaceholder, getPlaceholder, setPlaceholderMethods inherited from interface io.jmix.flowui.component.HasRequired
isRequired, setRequiredMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListenerMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setReadOnly
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
fieldDelegate
-
-
Constructor Details
-
MarkdownEditor
public MarkdownEditor()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
initComponent
protected void initComponent() -
initI18n
protected void initI18n() -
setModelValue
- Overrides:
setModelValuein classcom.vaadin.flow.component.AbstractField<JmixMarkdownEditor,String>
-
setPresentationValue
- Overrides:
setPresentationValuein classcom.vaadin.flow.component.AbstractSinglePropertyField<JmixMarkdownEditor,String>
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixMarkdownEditor,String>, String> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixMarkdownEditor,String>, String>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixMarkdownEditor,String>, String> - Overrides:
isEmptyin classcom.vaadin.flow.component.AbstractField<JmixMarkdownEditor,String>
-
getRequiredMessage
Description copied from interface:HasRequiredReturns the custom validation message to be displayed if the component is marked as required and the validation fails due to a missing value.- Specified by:
getRequiredMessagein interfaceHasRequired- Returns:
- the required message set for the component, or
nullif no message is defined
-
setRequiredMessage
Description copied from interface:HasRequiredSets a message that will be displayed or logged when a required field or input is not provided.- Specified by:
setRequiredMessagein interfaceHasRequired- Parameters:
requiredMessage- the message to be set for required fields. Ifnull, the default message or no message will be used.
-
getErrorMessage
- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.shared.HasValidationProperties- Specified by:
getErrorMessagein interfaceSupportsValidation<String>
-
setErrorMessage
- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.shared.HasValidationProperties- Specified by:
setErrorMessagein interfaceSupportsValidation<String>
-
setStatusChangeHandler
public void setStatusChangeHandler(@Nullable Consumer<SupportsStatusChangeHandler.StatusContext<MarkdownEditor>> handler) Description copied from interface:SupportsStatusChangeHandlerSets a callback to be used to handle component status changes, e.g. validation messages set byHasValidation.setErrorMessage(String).- Specified by:
setStatusChangeHandlerin interfaceSupportsStatusChangeHandler<MarkdownEditor>- Parameters:
handler- a handler to set
-
addValidator
Description copied from interface:SupportsValidationAdds a validator to the list of validators for the component. The provided validator will be used to validate the value of the component during validation execution.- Specified by:
addValidatorin interfaceSupportsValidation<String>- Parameters:
validator- the validator to be added; should not benull- Returns:
- a
Registrationobject that allows removing the added validator
-
executeValidators
Description copied from interface:SupportsValidationExecutes all registered validators against the current value of the component. If any of the validators fail, aValidationExceptionis thrown to indicate the failure. The exact behavior and order of validation depend on the validators added.- Specified by:
executeValidatorsin interfaceSupportsValidation<String>- Throws:
ValidationException- if validation fails for one or more validators
-
validate
protected void validate()Description copied from class:JmixMarkdownEditorValidates the current value against the field constraints and updates the invalid state and error message accordingly. Has no effect when manual validation is enabled.- Overrides:
validatein classJmixMarkdownEditor
-
isInvalid
public boolean isInvalid()- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
isInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties
-
setInvalid
public void setInvalid(boolean invalid) Description copied from interface:SupportsValidationSets invalid state to the field considering result of field validation.- Invalid - false and validation passed - false = field is invalid
- Invalid - false and validation passed - true = field is valid
- Invalid - true and validation passed - false = field is invalid
- Invalid - true and validation passed - true = field is invalid
- Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
setInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties- Specified by:
setInvalidin interfaceSupportsValidation<String>- Parameters:
invalid- whether field should be invalid
-
getValueSource
Description copied from interface:SupportsValueSourceReturns the currentValueSourceassociated with this component.- Specified by:
getValueSourcein interfaceSupportsValueSource<String>- Returns:
- the associated
ValueSource, ornullif no value source is set
-
setValueSource
Description copied from interface:SupportsValueSourceSets aValueSourcefor this component, allowing it to bind its value to a specified data source.- Specified by:
setValueSourcein interfaceSupportsValueSource<String>- Parameters:
valueSource- theValueSourceto be associated with this component, ornullto remove the current association
-
createFieldDelegate
-