Package io.jmix.ui.component.impl
Class FileMultiUploadFieldImpl
java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<JmixFileUpload>
io.jmix.ui.component.impl.FileMultiUploadFieldImpl
- All Implemented Interfaces:
AttachNotifier,Component,Component.BelongToFrame,Component.Focusable,Component.HasCaption,Component.HasDescription,Component.HasIcon,Component.HasXmlDescriptor,Component.Wrapper,FileMultiUploadField,HasContextHelp,HasDebugId,HasHtmlCaption,HasHtmlDescription,HasHtmlSanitizer,UploadField,org.springframework.beans.factory.InitializingBean
public class FileMultiUploadFieldImpl
extends AbstractComponent<JmixFileUpload>
implements FileMultiUploadField, org.springframework.beans.factory.InitializingBean
-
Nested Class Summary
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.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.FileMultiUploadField
FileMultiUploadField.QueueUploadCompleteEventNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.UploadField
UploadField.DropZone, UploadField.FileUploadErrorEvent, UploadField.FileUploadEvent, UploadField.FileUploadFinishEvent, UploadField.FileUploadStartEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected static final intprotected UiComponentPropertiesprotected UploadField.DropZoneprotected Stringprotected longprotected Messagesprotected ComponentContainerprotected UUIDprotected TemporaryStorageFields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZEFields inherited from interface io.jmix.ui.component.FileMultiUploadField
NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds file upload error listener.Adds file upload finish listener.Adds file upload start listener.Adds queue upload complete listener.voidvoidClear uploads listprotected JmixFileUploadprotected voidfireFileUploadError(String fileName, long contentLength, Exception cause) protected voidfireFileUploadFinish(String fileName, long contentLength) protected voidfireFileUploadStart(String fileName, long contentLength) protected voidvoidfocus()Sets focus to this componentReturns comma separated types of files.longReturns maximum allowed file size in bytes.protected StringReturns white list of file extensions.intGets the tabulator index of theHasTabIndexcomponent.Get uploads mapprotected voidinitComponent(JmixFileUpload impl) voidSets the mask for files to filter them in the file selection dialog.voidsetComponentProperties(UiComponentProperties componentProperties) 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.voidSet an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.voidsetMessages(Messages messages) voidsetPasteZone(ComponentContainer pasteZone) Sets paste zone reference to this upload component.voidsetPermittedExtensions(Set<String> permittedExtensions) Sets white list of file extensions.voidsetTabIndex(int tabIndex) Sets the tabulator index of theFocusablecomponent.voidsetTemporaryStorage(TemporaryStorage temporaryStorage) Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIconFromSet, setId, setParent, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
isFocusable, setFocusableMethods 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, 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
-
Field Details
-
BYTES_IN_MEGABYTE
protected static final int BYTES_IN_MEGABYTE- See Also:
-
files
-
fileSizeLimit
protected long fileSizeLimit -
permittedExtensions
-
dropZone
-
pasteZone
-
dropZonePrompt
-
componentProperties
-
messages
-
temporaryStorage
-
tempFileId
-
accept
-
-
Constructor Details
-
FileMultiUploadFieldImpl
public FileMultiUploadFieldImpl()
-
-
Method Details
-
setTemporaryStorage
-
setMessages
-
setComponentProperties
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
createComponent
-
initComponent
-
getUploadsMap
Get uploads map- Specified by:
getUploadsMapin interfaceFileMultiUploadField- Returns:
- Map (UUID - Id of file in Temporary storage, String - FileName )
-
clearUploads
public void clearUploads()Description copied from interface:FileMultiUploadFieldClear uploads list- Specified by:
clearUploadsin interfaceFileMultiUploadField
-
addQueueUploadCompleteListener
public Subscription addQueueUploadCompleteListener(Consumer<FileMultiUploadField.QueueUploadCompleteEvent> listener) Description copied from interface:FileMultiUploadFieldAdds queue upload complete listener. It is invoked when all selected files are uploaded to the temporary storage.- Specified by:
addQueueUploadCompleteListenerin interfaceFileMultiUploadField- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
setIcon
Description copied from interface:Component.HasIconSet an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.- Specified by:
setIconin interfaceComponent.HasIcon- Overrides:
setIconin classAbstractComponent<JmixFileUpload>
-
getAccept
Description copied from interface:UploadFieldReturns comma separated types of files.- Specified by:
getAcceptin interfaceUploadField- Returns:
- comma separated types of files
-
setAccept
Description copied from interface:UploadFieldSets the mask for files to filter them in the file selection dialog.
uploadField.setAccept(".png,.jpeg");- Specified by:
setAcceptin interfaceUploadField- Parameters:
accept- comma separated types of files
-
getDropZone
- Specified by:
getDropZonein interfaceUploadField- Returns:
- current drop zone
-
setDropZone
Description copied from interface:UploadFieldSets drop zone reference to this upload component. Files can be dropped to component of the drop zone to be uploaded by this upload component.- Specified by:
setDropZonein interfaceUploadField- Parameters:
dropZone- drop zone descriptor
-
getPasteZone
- Specified by:
getPasteZonein interfaceUploadField- Returns:
- current paste zone container
-
setPasteZone
Description copied from interface:UploadFieldSets 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.- Specified by:
setPasteZonein interfaceUploadField- Parameters:
pasteZone- paste zone container
-
getDropZonePrompt
- Specified by:
getDropZonePromptin interfaceUploadField- Returns:
- current drop zone prompt
-
setDropZonePrompt
Description copied from interface:UploadFieldSets drop zone prompt that will be shown on drag over window with file.- Specified by:
setDropZonePromptin interfaceUploadField- Parameters:
dropZonePrompt- drop zone prompt
-
fireFileUploadStart
-
fireFileUploadFinish
-
fireFileUploadError
-
fireQueueUploadComplete
protected void fireQueueUploadComplete() -
getFileSizeLimit
public long getFileSizeLimit()Description copied from interface:UploadFieldReturns maximum allowed file size in bytes.- Specified by:
getFileSizeLimitin interfaceUploadField
-
setFileSizeLimit
public void setFileSizeLimit(long fileSizeLimit) Description copied from interface:UploadFieldSets maximum allowed file size in bytes. Default value is 0. In this case component uses system value.- Specified by:
setFileSizeLimitin interfaceUploadField
-
getPermittedExtensions
Description copied from interface:UploadFieldReturns white list of file extensions.- Specified by:
getPermittedExtensionsin interfaceUploadField- Returns:
- set of file extensions.
-
setPermittedExtensions
Description copied from interface:UploadFieldSets white list of file extensions. Each extension should start with dot symbol, e.g. ".png".uploadField.setPermittedExtensions(Sets.newHashSet(".png", ".jpg"));- Specified by:
setPermittedExtensionsin interfaceUploadField- Parameters:
permittedExtensions- permitted extensions.
-
focus
public void focus()Description copied from interface:Component.FocusableSets focus to this component- Specified by:
focusin interfaceComponent.Focusable
-
getTabIndex
public int getTabIndex()Description copied from interface:Component.FocusableGets the tabulator index of theHasTabIndexcomponent.- Specified by:
getTabIndexin interfaceComponent.Focusable- Returns:
- tab index set for the
HasTabIndexcomponent
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:Component.FocusableSets the tabulator index of theFocusablecomponent. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.- Specified by:
setTabIndexin interfaceComponent.Focusable- Parameters:
tabIndex- tab index
-
getFileSizeLimitString
-
addFileUploadStartListener
Description copied from interface:UploadFieldAdds file upload start listener. It is invoked when start uploading the file.- Specified by:
addFileUploadStartListenerin interfaceUploadField- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
addFileUploadFinishListener
public Subscription addFileUploadFinishListener(Consumer<UploadField.FileUploadFinishEvent> listener) Description copied from interface:UploadFieldAdds file upload finish listener. It is invoked when file is uploaded.- Specified by:
addFileUploadFinishListenerin interfaceUploadField- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-
addFileUploadErrorListener
Description copied from interface:UploadFieldAdds file upload error listener. It is invoked when the uploads are finished, but unsuccessful.- Specified by:
addFileUploadErrorListenerin interfaceUploadField- Parameters:
listener- a listener to add- Returns:
- a registration object for removing an event listener
-