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.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.FileMultiUploadField
FileMultiUploadField.QueueUploadCompleteEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.UploadField
UploadField.DropZone, UploadField.FileUploadErrorEvent, UploadField.FileUploadEvent, UploadField.FileUploadFinishEvent, UploadField.FileUploadStartEvent
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected static final int
protected UiComponentProperties
protected UploadField.DropZone
protected String
protected long
protected Messages
protected ComponentContainer
protected UUID
protected TemporaryStorage
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Fields inherited from interface io.jmix.ui.component.FileMultiUploadField
NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds file upload error listener.Adds file upload finish listener.Adds file upload start listener.Adds queue upload complete listener.void
void
Clear uploads listprotected JmixFileUpload
protected void
fireFileUploadError
(String fileName, long contentLength, Exception cause) protected void
fireFileUploadFinish
(String fileName, long contentLength) protected void
fireFileUploadStart
(String fileName, long contentLength) protected void
void
focus()
Sets focus to this componentReturns comma separated types of files.long
Returns maximum allowed file size in bytes.protected String
Returns white list of file extensions.int
Gets the tabulator index of theHasTabIndex
component.Get uploads mapprotected void
initComponent
(JmixFileUpload impl) void
Sets the mask for files to filter them in the file selection dialog.void
setComponentProperties
(UiComponentProperties componentProperties) 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
Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.void
setMessages
(Messages messages) void
setPasteZone
(ComponentContainer pasteZone) Sets paste zone reference to this upload component.void
setPermittedExtensions
(Set<String> permittedExtensions) Sets white list of file extensions.void
setTabIndex
(int tabIndex) Sets the tabulator index of theFocusable
component.void
setTemporaryStorage
(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, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
isFocusable, setFocusable
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, 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
-
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:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
createComponent
-
initComponent
-
getUploadsMap
Get uploads map- Specified by:
getUploadsMap
in interfaceFileMultiUploadField
- Returns:
- Map (UUID - Id of file in Temporary storage, String - FileName )
-
clearUploads
public void clearUploads()Description copied from interface:FileMultiUploadField
Clear uploads list- Specified by:
clearUploads
in interfaceFileMultiUploadField
-
addQueueUploadCompleteListener
public Subscription addQueueUploadCompleteListener(Consumer<FileMultiUploadField.QueueUploadCompleteEvent> listener) Description copied from interface:FileMultiUploadField
Adds queue upload complete listener. It is invoked when all selected files are uploaded to the temporary storage.- Specified by:
addQueueUploadCompleteListener
in interfaceFileMultiUploadField
- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-
setIcon
Description copied from interface:Component.HasIcon
Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.- Specified by:
setIcon
in interfaceComponent.HasIcon
- Overrides:
setIcon
in classAbstractComponent<JmixFileUpload>
-
getAccept
Description copied from interface:UploadField
Returns comma separated types of files.- Specified by:
getAccept
in interfaceUploadField
- Returns:
- comma separated types of files
-
setAccept
Description copied from interface:UploadField
Sets the mask for files to filter them in the file selection dialog.
uploadField.setAccept(".png,.jpeg");
- Specified by:
setAccept
in interfaceUploadField
- Parameters:
accept
- comma separated types of files
-
getDropZone
- Specified by:
getDropZone
in interfaceUploadField
- Returns:
- current drop zone
-
setDropZone
Description copied from interface:UploadField
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.- Specified by:
setDropZone
in interfaceUploadField
- Parameters:
dropZone
- drop zone descriptor
-
getPasteZone
- Specified by:
getPasteZone
in interfaceUploadField
- Returns:
- current paste zone container
-
setPasteZone
Description copied from interface:UploadField
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.- Specified by:
setPasteZone
in interfaceUploadField
- Parameters:
pasteZone
- paste zone container
-
getDropZonePrompt
- Specified by:
getDropZonePrompt
in interfaceUploadField
- Returns:
- current drop zone prompt
-
setDropZonePrompt
Description copied from interface:UploadField
Sets drop zone prompt that will be shown on drag over window with file.- Specified by:
setDropZonePrompt
in interfaceUploadField
- Parameters:
dropZonePrompt
- drop zone prompt
-
fireFileUploadStart
-
fireFileUploadFinish
-
fireFileUploadError
-
fireQueueUploadComplete
protected void fireQueueUploadComplete() -
getFileSizeLimit
public long getFileSizeLimit()Description copied from interface:UploadField
Returns maximum allowed file size in bytes.- Specified by:
getFileSizeLimit
in interfaceUploadField
-
setFileSizeLimit
public void setFileSizeLimit(long fileSizeLimit) Description copied from interface:UploadField
Sets maximum allowed file size in bytes. Default value is 0. In this case component uses system value.- Specified by:
setFileSizeLimit
in interfaceUploadField
-
getPermittedExtensions
Description copied from interface:UploadField
Returns white list of file extensions.- Specified by:
getPermittedExtensions
in interfaceUploadField
- Returns:
- set of file extensions.
-
setPermittedExtensions
Description copied from interface:UploadField
Sets white list of file extensions. Each extension should start with dot symbol, e.g. ".png".uploadField.setPermittedExtensions(Sets.newHashSet(".png", ".jpg"));
- Specified by:
setPermittedExtensions
in interfaceUploadField
- Parameters:
permittedExtensions
- permitted extensions.
-
focus
public void focus()Description copied from interface:Component.Focusable
Sets focus to this component- Specified by:
focus
in interfaceComponent.Focusable
-
getTabIndex
public int getTabIndex()Description copied from interface:Component.Focusable
Gets the tabulator index of theHasTabIndex
component.- Specified by:
getTabIndex
in interfaceComponent.Focusable
- Returns:
- tab index set for the
HasTabIndex
component
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:Component.Focusable
Sets the tabulator index of theFocusable
component. 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:
setTabIndex
in interfaceComponent.Focusable
- Parameters:
tabIndex
- tab index
-
getFileSizeLimitString
-
addFileUploadStartListener
Description copied from interface:UploadField
Adds file upload start listener. It is invoked when start uploading the file.- Specified by:
addFileUploadStartListener
in 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:UploadField
Adds file upload finish listener. It is invoked when file is uploaded.- Specified by:
addFileUploadFinishListener
in interfaceUploadField
- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-
addFileUploadErrorListener
Description copied from interface:UploadField
Adds file upload error listener. It is invoked when the uploads are finished, but unsuccessful.- Specified by:
addFileUploadErrorListener
in interfaceUploadField
- Parameters:
listener
- a listener to add- Returns:
- a registration object for removing an event listener
-