Package io.jmix.ui.component
Interface SingleFileUploadField
- All Superinterfaces:
Buffered
,Component
,Component.BelongToFrame
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,UploadField
- All Known Subinterfaces:
FileStorageUploadField
,FileUploadField
,WebdavDocumentUploadField
- All Known Implementing Classes:
AbstractFileStorageUploadField
,AbstractSingleFileUploadField
,FileStorageUploadFieldImpl
,FileUploadFieldImpl
,WebdavDocumentUploadFieldImpl
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Describes after value clear event.static class
Describes before value clear event.static class
Describes file upload succeeded event when the uploads are successfully finished.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
Nested classes/interfaces inherited from interface io.jmix.ui.component.UploadField
UploadField.DropZone, UploadField.FileUploadErrorEvent, UploadField.FileUploadEvent, UploadField.FileUploadFinishEvent, UploadField.FileUploadStartEvent
-
Field Summary
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Method Summary
Modifier and TypeMethodDescriptionAdds a callback interface which is invoked by theSingleFileUploadField
after value has been cleared using clear button.Sets a callback interface which is invoked by theSingleFileUploadField
before value clearing when user use clear button.Adds file upload succeed listener.boolean
boolean
void
setClearButtonCaption
(String caption) Setup clear button caption.void
setClearButtonDescription
(String description) Setup clear button description.void
setClearButtonIcon
(String icon) Setup clear button icon.void
setContentProvider
(Supplier<InputStream> contentProvider) Set content provider which contains file data.void
setShowClearButton
(boolean showClearButton) Enable or disable displaying name of clear button.void
setShowFileName
(boolean showFileName) Enable or disable displaying name of uploaded file next to upload button.void
setUploadButtonCaption
(String caption) Setup caption of upload button.void
setUploadButtonDescription
(String description) Setup upload button description.void
setUploadButtonIcon
(String icon) Setup upload button icon.Methods inherited from interface io.jmix.ui.component.Buffered
commit, discard, isBuffered, isModified, setBuffered
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
Methods inherited from interface io.jmix.ui.component.UploadField
addFileUploadErrorListener, addFileUploadFinishListener, addFileUploadStartListener, getAccept, getDropZone, getDropZonePrompt, getFileSizeLimit, getPasteZone, getPermittedExtensions, setAccept, setDropZone, setDropZonePrompt, setFileSizeLimit, setPasteZone, setPermittedExtensions
-
Method Details
-
getFileContent
- Returns:
- content of uploaded file.
-
setShowFileName
Enable or disable displaying name of uploaded file next to upload button. -
isShowFileName
boolean isShowFileName()- Returns:
- true if name of uploaded file is shown.
-
setUploadButtonCaption
Setup caption of upload button. -
getUploadButtonCaption
- Returns:
- upload button caption.
-
setUploadButtonIcon
Setup upload button icon. -
getUploadButtonIcon
- Returns:
- upload button icon.
-
setUploadButtonDescription
@StudioProperty(type=LOCALIZED_STRING) void setUploadButtonDescription(@Nullable String description) Setup upload button description. -
getUploadButtonDescription
- Returns:
- upload button description.
-
setShowClearButton
Enable or disable displaying name of clear button. -
isShowClearButton
boolean isShowClearButton()- Returns:
- true if clear button is shown.
-
setClearButtonCaption
Setup clear button caption. -
getClearButtonCaption
- Returns:
- clear button caption.
-
setClearButtonIcon
Setup clear button icon. -
getClearButtonIcon
- Returns:
- clear button icon.
-
setClearButtonDescription
Setup clear button description. -
getClearButtonDescription
String getClearButtonDescription()- Returns:
- clear button description.
-
addFileUploadSucceedListener
Subscription addFileUploadSucceedListener(Consumer<SingleFileUploadField.FileUploadSucceedEvent> listener) Adds file upload succeed listener. It is invoked when the uploads are successfully finished.- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-
addBeforeValueClearListener
Subscription addBeforeValueClearListener(Consumer<SingleFileUploadField.BeforeValueClearEvent> listener) Sets a callback interface which is invoked by theSingleFileUploadField
before value clearing when user use clear button.Listener can prevent value clearing using
SingleFileUploadField.BeforeValueClearEvent.preventClearAction()
.- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
- See Also:
-
addAfterValueClearListener
Subscription addAfterValueClearListener(Consumer<SingleFileUploadField.AfterValueClearEvent> listener) Adds a callback interface which is invoked by theSingleFileUploadField
after value has been cleared using clear button.- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
- See Also:
-
setContentProvider
Set content provider which contains file data.Passed content provider will be used for downloading by clicking the link with file name or as source for
getFileContent()
method.- Parameters:
contentProvider
- content provider
-
getContentProvider
- Returns:
- FileContentProvider which can be used to read data from field
-