Package io.jmix.webdavflowui.component
Class WebdavDocumentUploadField
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,V>
io.jmix.flowui.kit.component.upload.AbstractSingleUploadField<C,V>
io.jmix.flowui.kit.component.upload.JmixFileStorageUploadField<WebdavDocumentUploadField,WebdavDocument>
io.jmix.webdavflowui.component.WebdavDocumentUploadField
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasLabel,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<WebdavDocumentUploadField,,WebdavDocument>, WebdavDocument> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField,,WebdavDocument>, WebdavDocument> com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.component.shared.HasValidationProperties,HasRequired,SupportsStatusChangeHandler<WebdavDocumentUploadField>,SupportsValidation<WebdavDocument>,SupportsValueSource<WebdavDocument>,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public class WebdavDocumentUploadField
extends JmixFileStorageUploadField<WebdavDocumentUploadField,WebdavDocument>
implements SupportsValueSource<WebdavDocument>, SupportsValidation<WebdavDocument>, HasRequired, SupportsStatusChangeHandler<WebdavDocumentUploadField>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, 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 com.vaadin.flow.component.button.Buttonprotected Dialogsprotected WebdavDocumentsManagementServiceprotected com.vaadin.flow.component.button.Buttonprotected Downloaderprotected FileStorageprotected FileStorageLocatorprotected Messagesprotected org.springframework.beans.factory.ObjectProvider<org.springframework.boot.autoconfigure.web.servlet.MultipartProperties>static final Stringprotected Notificationsprotected com.vaadin.flow.component.html.Spanprotected booleanprotected TemporaryStorageprotected UiComponentsprotected WebdavDocumentLinkprotected WebdavPropertiesprotected WebdavToolsFields inherited from class io.jmix.flowui.kit.component.upload.JmixFileStorageUploadField
fileStorageName, fileStoragePutModeFields inherited from class io.jmix.flowui.kit.component.upload.AbstractSingleUploadField
CLEAR_COMPONENT_ARIA_LABEL, CLEAR_COMPONENT_CLASS_NAME, clearButtonVisible, clearComponent, content, FILE_NAME_COMPONENT_CLASS_NAME, FILE_NAME_COMPONENT_EMPTY_CLASS_NAME, FILE_NOT_SELECTED, fileNameComponent, fileNameVisible, fileNotSelectedText, FULL_WIDTH_THEME, INPUT_CONTAINER_CLASS_NAME, internalValue, NO_FILE_NAME_THEME, UPLOAD, uploadButton, uploadTextFields inherited from interface io.jmix.flowui.component.HasRequired
PROPERTY_REQUIREDFields inherited from interface io.jmix.flowui.component.SupportsValidation
PROPERTY_ERROR_MESSAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Consumer<ActionPerformedEvent>com.vaadin.flow.shared.RegistrationaddValidator(Validator<? super WebdavDocument> validator) Adds a validator to the list of validators for the component.voidprotected voidprotected voidprotected voidprotected voidvoidExecutes all registered validators against the current value of the component.protected Stringprotected StringReturns the custom validation message to be displayed if the component is marked as required and the validation fails due to a missing value.Returns the currentValueSourceassociated with this component.protected voidhandleJmixUploadInternalError(String fileName) protected voidbooleanbooleanbooleanprotected booleanprotected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidonDownloadButtonClick(com.vaadin.flow.component.ClickEvent<?> event) protected voidonFailedEvent(com.vaadin.flow.component.upload.FailedEvent event) protected voidonFileRejectedEvent(com.vaadin.flow.component.upload.FileRejectedEvent event) protected voidonSucceededEvent(com.vaadin.flow.component.upload.SucceededEvent event) protected voidonValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField, WebdavDocument> event) protected voidsaveFile(com.vaadin.flow.component.upload.SucceededEvent event) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetClearButtonAriaLabel(String ariaLabel) Sets aria-label attribute to clear button.voidsetClearButtonIcon(String icon) voidsetClearButtonVisible(boolean visible) Enables or disables displaying clear button.voidsetDownloadButtonIcon(String icon) voidsetDownloadButtonText(String text) voidsetDownloadButtonVisible(boolean downloadButtonVisible) voidsetFileNameVisible(boolean visible) Enables or disables displaying name of uploaded file.voidsetFileNotSelectedText(String fileNotSelectedText) Sets text that is shown when file is not uploaded.voidsetInvalid(boolean invalid) Sets invalid state to the field considering result of field validation.voidsetMaxFileSize(int maxFileSize) Specify the maximum file size in bytes allowed to upload.voidsetReadOnly(boolean readOnly) voidsetRequired(boolean required) Sets the required property for the component.voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) voidsetRequiredMessage(String requiredMessage) Sets a message that will be displayed or logged when a required field or input is not provided.voidsetStatusChangeHandler(Consumer<SupportsStatusChangeHandler.StatusContext<WebdavDocumentUploadField>> handler) Sets a callback to be used to handle component status changes, e.g.voidsetValue(WebdavDocument value) voidsetValueSource(ValueSource<WebdavDocument> valueSource) Sets aValueSourcefor this component, allowing it to bind its value to a specified data source.protected voidshowUploadErrorNotification(String fileName) protected WebdavDocumentupdateLink(WebdavDocument webdavDocument) protected voidvalidate()Methods inherited from class io.jmix.flowui.kit.component.upload.JmixFileStorageUploadField
generateFileName, getFileStorageName, getFileStoragePutMode, setFileStorageName, setFileStoragePutModeMethods inherited from class io.jmix.flowui.kit.component.upload.AbstractSingleUploadField
addClassNames, addFileUploadFailedListener, addFileUploadFileRejectedListener, addFileUploadFinishedListener, addFileUploadProgressListener, addFileUploadStartedListener, addFileUploadSucceededListener, addThemeNames, addValueChangeListener, attachContent, attachUploadEvents, createClearComponent, createContentComponent, createFileNameComponent, createUploadButtonComponent, createUploadComponent, createUploadReceiver, getAcceptedFileTypes, getContent, getEmptyValue, getFileNotSelectedText, getI18n, getMaxFileSize, getUploadIcon, getUploadText, getValue, initClearComponent, initContentComponent, initFileNameComponent, initUploadButtonComponent, initUploadComponent, isDropAllowed, onClearButtonClick, onFinishedEvent, onJmixUploadInternalError, onProgressEvent, onStartedEvent, removeClassNames, removeThemeNames, setAcceptedFileTypes, setComponentAriaLabel, setComponentClickListener, setComponentEnabled, setComponentText, setDropAllowed, setEnabled, setI18n, setInternalValue, setInternalValue, setPresentationValue, setUploadIcon, setUploadText, updateComponentsVisibilityMethods inherited from class com.vaadin.flow.component.AbstractField
isEmpty, setModelValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, 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.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods inherited from interface io.jmix.flowui.component.HasRequired
isRequiredMethods inherited from interface com.vaadin.flow.component.HasSize
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, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisibleMethods inherited from interface io.jmix.flowui.component.SupportsValidation
getErrorMessage, setErrorMessage
-
Field Details
-
NAME
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
temporaryStorage
-
fileStorageLocator
-
downloader
-
notifications
-
messages
-
multipartPropertiesProvider
protected org.springframework.beans.factory.ObjectProvider<org.springframework.boot.autoconfigure.web.servlet.MultipartProperties> multipartPropertiesProvider -
fileStorage
-
documentsManagementService
-
webdavProperties
-
uiComponents
-
dialogs
-
webdavTools
-
fieldDelegate
-
webdavDocumentLink
-
placeHolder
protected com.vaadin.flow.component.html.Span placeHolder -
downloadButton
protected com.vaadin.flow.component.button.Button downloadButton -
clearButton
protected com.vaadin.flow.component.button.Button clearButton -
showFileName
protected boolean showFileName
-
-
Constructor Details
-
WebdavDocumentUploadField
public WebdavDocumentUploadField()
-
-
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
-
autowireDependencies
protected void autowireDependencies() -
createFieldDelegate
protected FieldDelegate<WebdavDocumentUploadField,WebdavDocument, createFieldDelegate()WebdavDocument> -
isInvalid
public boolean isInvalid()- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
isInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties
-
setRequired
public void setRequired(boolean required) Description copied from interface:HasRequiredSets the required property for the component. When a component is marked as required, it indicates that a value must be provided for the component in order to pass validation.- Specified by:
setRequiredin interfaceHasRequired- Parameters:
required- a boolean value indicating whether the component is marked as required.trueto mark the component as required,falseotherwise.
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField,WebdavDocument>, WebdavDocument> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField,WebdavDocument>, WebdavDocument>
-
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.
-
addValidator
public com.vaadin.flow.shared.Registration addValidator(Validator<? super WebdavDocument> validator) 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<WebdavDocument>- 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<WebdavDocument>- Throws:
ValidationException- if validation fails for one or more validators
-
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<WebdavDocument>- Parameters:
invalid- whether field should be invalid
-
validate
protected void validate() -
getValueSource
Description copied from interface:SupportsValueSourceReturns the currentValueSourceassociated with this component.- Specified by:
getValueSourcein interfaceSupportsValueSource<WebdavDocument>- 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<WebdavDocument>- Parameters:
valueSource- theValueSourceto be associated with this component, ornullto remove the current association
-
setStatusChangeHandler
public void setStatusChangeHandler(@Nullable Consumer<SupportsStatusChangeHandler.StatusContext<WebdavDocumentUploadField>> 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<WebdavDocumentUploadField>- Parameters:
handler- a handler to set
-
setMaxFileSize
public void setMaxFileSize(int maxFileSize) Specify the maximum file size in bytes allowed to upload. Notice that it is a client-side constraint, which will be checked before sending the request.Note if
MultipartPropertiesis available, the default value will be set fromMultipartProperties.getMaxFileSize()that is equal to 1Mb. To increase maximum file size for all fields in the application useMultipartProperties.getMaxFileSize()property.- Overrides:
setMaxFileSizein classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Parameters:
maxFileSize- the maximum file size in bytes- See Also:
-
Upload.setMaxFileSize(int)MultipartProperties.getMaxFileSize()MultipartProperties.getMaxRequestSize()
-
getDefaultUploadText
- Overrides:
getDefaultUploadTextin classJmixFileStorageUploadField<WebdavDocumentUploadField,WebdavDocument>
-
checkFileStorageInitialized
protected void checkFileStorageInitialized() -
handleJmixUploadInternalError
- Overrides:
handleJmixUploadInternalErrorin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument>
-
showUploadErrorNotification
-
onValueChange
protected void onValueChange(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField, WebdavDocument> event) -
onFileRejectedEvent
protected void onFileRejectedEvent(com.vaadin.flow.component.upload.FileRejectedEvent event) - Overrides:
onFileRejectedEventin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument>
-
onFailedEvent
protected void onFailedEvent(com.vaadin.flow.component.upload.FailedEvent event) - Overrides:
onFailedEventin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument>
-
deleteTempFile
protected void deleteTempFile() -
applyI18nDefaults
protected void applyI18nDefaults() -
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
initComponent
protected void initComponent() -
onDownloadButtonClick
protected void onDownloadButtonClick(com.vaadin.flow.component.ClickEvent<?> event) -
updateLink
-
onSucceededEvent
protected void onSucceededEvent(com.vaadin.flow.component.upload.SucceededEvent event) - Overrides:
onSucceededEventin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument>
-
saveFile
protected void saveFile(com.vaadin.flow.component.upload.SucceededEvent event) -
isVersioningEnabled
protected boolean isVersioningEnabled() -
actionUnderDocumentLock
protected Consumer<ActionPerformedEvent> actionUnderDocumentLock(Consumer<ActionPerformedEvent> handler) -
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField,WebdavDocument>, WebdavDocument> - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField,WebdavDocument>, WebdavDocument> - Overrides:
setReadOnlyin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument>
-
setDownloadButtonIcon
-
setClearButtonIcon
-
isClearButtonVisible
public boolean isClearButtonVisible()- Overrides:
isClearButtonVisiblein classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Returns:
trueif clear button is shown
-
setClearButtonVisible
public void setClearButtonVisible(boolean visible) Description copied from class:AbstractSingleUploadFieldEnables or disables displaying clear button.The default value is
false.- Overrides:
setClearButtonVisiblein classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Parameters:
visible- whether clear button should be shown
-
getClearButtonAriaLabel
- Overrides:
getClearButtonAriaLabelin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Returns:
- aria-label of clear button or
nullif not set
-
setClearButtonAriaLabel
Description copied from class:AbstractSingleUploadFieldSets aria-label attribute to clear button.- Overrides:
setClearButtonAriaLabelin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Parameters:
ariaLabel- aria-label to set
-
setDownloadButtonText
-
getDownloadButtonText
-
setDownloadButtonVisible
public void setDownloadButtonVisible(boolean downloadButtonVisible) -
setValue
- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<WebdavDocumentUploadField,WebdavDocument>, WebdavDocument> - Overrides:
setValuein classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument>
-
isFileNameVisible
public boolean isFileNameVisible()- Overrides:
isFileNameVisiblein classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Returns:
trueif name of uploaded file is shown
-
setFileNameVisible
public void setFileNameVisible(boolean visible) Description copied from class:AbstractSingleUploadFieldEnables or disables displaying name of uploaded file.The default value is
false.- Overrides:
setFileNameVisiblein classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Parameters:
visible- whether file name should be shown
-
setFileNotSelectedText
Description copied from class:AbstractSingleUploadFieldSets text that is shown when file is not uploaded.- Overrides:
setFileNotSelectedTextin classAbstractSingleUploadField<WebdavDocumentUploadField,WebdavDocument> - Parameters:
fileNotSelectedText- text to set
-