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
Modifier and TypeInterfaceDescriptionstatic class
Drop zone descriptor.static class
Describes file upload error event.static class
Base class for UploadField events.static class
Describes file upload finish event.static class
Describes 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.long
Returns maximum allowed file size in bytes.Returns white list of file extensions.void
Sets the mask for files to filter them in the file selection dialog.void
setDropZone
(UploadField.DropZone dropZone) Sets drop zone reference to this upload component.void
setDropZonePrompt
(String dropZonePrompt) Sets drop zone prompt that will be shown on drag over window with file.void
setFileSizeLimit
(long fileSizeLimit) Sets maximum allowed file size in bytes.void
setPasteZone
(ComponentContainer pasteZone) Sets paste zone reference to this upload component.void
setPermittedExtensions
(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, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods 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
-