Class JmixFileUploadField<C extends AbstractSingleUploadField<C,byte[],byte[]>>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,byte[]>
io.jmix.flowui.kit.component.upload.AbstractSingleUploadField<C,byte[],byte[]>
io.jmix.flowui.kit.component.upload.JmixFileUploadField<C>
- Type Parameters:
C- the type of the inheriting component that extendsAbstractSingleUploadField
- 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.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,,byte[]>, byte[]> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,,byte[]>, byte[]> com.vaadin.flow.component.shared.HasTooltip,Serializable
- Direct Known Subclasses:
FileUploadField
public class JmixFileUploadField<C extends AbstractSingleUploadField<C,byte[],byte[]>>
extends AbstractSingleUploadField<C,byte[],byte[]>
A component for uploading files with support for displaying the uploaded file name and handling file upload events.
- 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> 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<?>> -
Field Summary
FieldsFields 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, uploadText -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringconvertValueToFileName(byte[] value) protected com.vaadin.flow.server.streams.UploadHandlerprotected Stringprotected StringgetContentType(String fileName) protected String@Nullable String@Nullable Stringprotected voidonSucceeded(SupportUploadSuccessHandler.UploadSuccessContext<byte[]> context) protected voidsaveFile(SupportUploadSuccessHandler.UploadSuccessContext<byte[]> context) voidsetFileName(@Nullable String fileName) Sets file name to be shown in the component next to upload button.protected voidsetInternalValue(@org.jspecify.annotations.Nullable byte[] value, boolean fromClient) protected booleanvalueEquals(@org.jspecify.annotations.Nullable byte[] a, @org.jspecify.annotations.Nullable byte[] b) Methods inherited from class io.jmix.flowui.kit.component.upload.AbstractSingleUploadField
addClassNames, addFileUploadFailedListener, addFileUploadFileRejectedListener, addFileUploadFinishedListener, addFileUploadProgressListener, addFileUploadStartedListener, addFileUploadSucceededListener, addThemeNames, addValueChangeListener, attachContent, attachUploadEvents, createClearComponent, createContentComponent, createDefaultTransferProgressListener, createFileNameComponent, createUploadButtonComponent, createUploadComponent, getAcceptedFileTypes, getClearButtonAriaLabel, getContent, getEmptyValue, getFileNotSelectedText, getI18n, getMaxFileSize, getUploadIcon, getUploadText, getValue, handleJmixUploadInternalError, initClearComponent, initContentComponent, initFileNameComponent, initUploadButtonComponent, initUploadComponent, isClearButtonVisible, isDropAllowed, isFileNameVisible, onClearButtonClick, onFailed, onFileRejectedEvent, onFinished, onJmixUploadInternalError, onProgressUpdate, onStarted, removeClassNames, removeThemeNames, setAcceptedFileTypes, setClearButtonAriaLabel, setClearButtonVisible, setComponentAriaLabel, setComponentClickListener, setComponentEnabled, setComponentText, setDropAllowed, setEnabled, setFileNameVisible, setFileNotSelectedText, setI18n, setInternalValue, setMaxFileSize, setPresentationValue, setReadOnly, setUploadIcon, setUploadText, setValue, updateComponentsVisibilityMethods inherited from class com.vaadin.flow.component.AbstractField
bindValue, isEmpty, setModelValueMethods 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, onAttach, 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.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabledMethods 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.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.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
-
Field Details
-
fileName
-
uploadedFileName
-
-
Constructor Details
-
JmixFileUploadField
public JmixFileUploadField() -
JmixFileUploadField
public JmixFileUploadField(byte[] defaultValue)
-
-
Method Details
-
getFileName
- Returns:
- file name to be shown in the component next to upload button
-
setFileName
Sets file name to be shown in the component next to upload button. The file name of the newly uploaded file will rewrite the caption.The default value is "attachment (file_size Kb)". See also message key "
fileUploadField.noFileName".- Parameters:
fileName- file name to show
-
getUploadedFileName
- Returns:
- name of the uploaded file or
nullif no file was uploaded using "Upload" button
-
generateFileName
- Specified by:
generateFileNamein classAbstractSingleUploadField<C extends AbstractSingleUploadField<C,byte[], byte[]>, byte[], byte[]>
-
convertValueToFileName
-
getDefaultUploadText
- Specified by:
getDefaultUploadTextin classAbstractSingleUploadField<C extends AbstractSingleUploadField<C,byte[], byte[]>, byte[], byte[]>
-
onSucceeded
- Overrides:
onSucceededin classAbstractSingleUploadField<C extends AbstractSingleUploadField<C,byte[], byte[]>, byte[], byte[]>
-
saveFile
-
setInternalValue
protected void setInternalValue(@org.jspecify.annotations.Nullable byte[] value, boolean fromClient) - Overrides:
setInternalValuein classAbstractSingleUploadField<C extends AbstractSingleUploadField<C,byte[], byte[]>, byte[], byte[]>
-
valueEquals
protected boolean valueEquals(@org.jspecify.annotations.Nullable byte[] a, @org.jspecify.annotations.Nullable byte[] b) - Overrides:
valueEqualsin classcom.vaadin.flow.component.AbstractField<C extends AbstractSingleUploadField<C,byte[], byte[]>, byte[]>
-
createUploadHandler
protected com.vaadin.flow.server.streams.UploadHandler createUploadHandler()- Specified by:
createUploadHandlerin classAbstractSingleUploadField<C extends AbstractSingleUploadField<C,byte[], byte[]>, byte[], byte[]>
-
getContentType
- Specified by:
getContentTypein classAbstractSingleUploadField<C extends AbstractSingleUploadField<C,byte[], byte[]>, byte[], byte[]>
-