Package io.jmix.ui.component
Interface UploadField
- All Superinterfaces:
Component,Component.BelongToFrame,Component.Focusable,Component.HasCaption,Component.HasDescription,Component.HasIcon,HasHtmlCaption,HasHtmlDescription,HasHtmlSanitizer
- All Known Subinterfaces:
FileMultiUploadField,FileStorageUploadField,FileUploadField,SingleFileUploadField,WebdavDocumentUploadField
- All Known Implementing Classes:
AbstractFileStorageUploadField,AbstractSingleFileUploadField,FileMultiUploadFieldImpl,FileStorageUploadFieldImpl,FileUploadFieldImpl,WebdavDocumentUploadFieldImpl
public interface UploadField
extends Component, Component.HasCaption, Component.BelongToFrame, Component.HasIcon, Component.Focusable, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classDrop zone descriptor.static classDescribes file upload error event.static classBase class for UploadField events.static classDescribes file upload finish event.static classDescribes file upload start event.Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper -
Field Summary
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Method Summary
Modifier and TypeMethodDescriptionAdds file upload error listener.Adds file upload finish listener.Adds file upload start listener.Returns comma separated types of files.longReturns maximum allowed file size in bytes.Returns white list of file extensions.voidSets the mask for files to filter them in the file selection dialog.voidsetDropZone(UploadField.DropZone dropZone) Sets drop zone reference to this upload component.voidsetDropZonePrompt(String dropZonePrompt) Sets drop zone prompt that will be shown on drag over window with file.voidsetFileSizeLimit(long fileSizeLimit) Sets maximum allowed file size in bytes.voidsetPasteZone(ComponentContainer pasteZone) Sets paste zone reference to this upload component.voidsetPermittedExtensions(Set<String> permittedExtensions) Sets white list of file extensions.Methods inherited from interface io.jmix.ui.component.Component
addStyleName, 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndexMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
-
Method Details
-
addFileUploadStartListener
Adds file upload start listener. It is invoked when start uploading the file.- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
addFileUploadFinishListener
Adds file upload finish listener. It is invoked when file is uploaded.- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
addFileUploadErrorListener
Adds file upload error listener. It is invoked when the uploads are finished, but unsuccessful.- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
getFileSizeLimit
long getFileSizeLimit()Returns maximum allowed file size in bytes. -
setFileSizeLimit
Sets maximum allowed file size in bytes. Default value is 0. In this case component uses system value. -
getAccept
Returns comma separated types of files.- Returns:
- comma separated types of files
-
setAccept
Sets the mask for files to filter them in the file selection dialog.
uploadField.setAccept(".png,.jpeg");- Parameters:
accept- comma separated types of files
-
setPermittedExtensions
Sets white list of file extensions. Each extension should start with dot symbol, e.g. ".png".uploadField.setPermittedExtensions(Sets.newHashSet(".png", ".jpg"));- Parameters:
permittedExtensions- permitted extensions.
-
getPermittedExtensions
Returns white list of file extensions.- Returns:
- set of file extensions.
-
getDropZone
- Returns:
- current drop zone
-
setDropZone
@StudioProperty(type=COMPONENT_REF, options="io.jmix.ui.component.BoxLayout") void setDropZone(@Nullable UploadField.DropZone dropZone) Sets drop zone reference to this upload component. Files can be dropped to component of the drop zone to be uploaded by this upload component.- Parameters:
dropZone- drop zone descriptor
-
setPasteZone
@StudioProperty(type=COMPONENT_REF, options="io.jmix.ui.component.ComponentContainer") void setPasteZone(@Nullable ComponentContainer pasteZone) Sets paste zone reference to this upload component. PasteZone handles paste shortcut when a text input field in the container is focused.
It is supported by Chromium-based browsers.- Parameters:
pasteZone- paste zone container
-
getPasteZone
- Returns:
- current paste zone container
-
getDropZonePrompt
- Returns:
- current drop zone prompt
-
setDropZonePrompt
Sets drop zone prompt that will be shown on drag over window with file.- Parameters:
dropZonePrompt- drop zone prompt
-