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
  • Field Details

  • Constructor Details

    • FileMultiUploadFieldImpl

      public FileMultiUploadFieldImpl()
  • Method Details

    • setTemporaryStorage

      @Autowired public void setTemporaryStorage(TemporaryStorage temporaryStorage)
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setComponentProperties

      @Autowired public void setComponentProperties(UiComponentProperties componentProperties)
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • createComponent

      protected JmixFileUpload createComponent()
    • initComponent

      protected void initComponent(JmixFileUpload impl)
    • getUploadsMap

      public Map<UUID,String> getUploadsMap()
      Get uploads map
      Specified by:
      getUploadsMap in interface FileMultiUploadField
      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 interface FileMultiUploadField
    • 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 interface FileMultiUploadField
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • setIcon

      public void setIcon(@Nullable String icon)
      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 interface Component.HasIcon
      Overrides:
      setIcon in class AbstractComponent<JmixFileUpload>
    • getAccept

      @Nullable public String getAccept()
      Description copied from interface: UploadField
      Returns comma separated types of files.
      Specified by:
      getAccept in interface UploadField
      Returns:
      comma separated types of files
    • setAccept

      public void setAccept(@Nullable String accept)
      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 interface UploadField
      Parameters:
      accept - comma separated types of files
    • getDropZone

      @Nullable public UploadField.DropZone getDropZone()
      Specified by:
      getDropZone in interface UploadField
      Returns:
      current drop zone
    • setDropZone

      public void setDropZone(@Nullable UploadField.DropZone dropZone)
      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 interface UploadField
      Parameters:
      dropZone - drop zone descriptor
    • getPasteZone

      @Nullable public ComponentContainer getPasteZone()
      Specified by:
      getPasteZone in interface UploadField
      Returns:
      current paste zone container
    • setPasteZone

      public void setPasteZone(@Nullable ComponentContainer pasteZone)
      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 interface UploadField
      Parameters:
      pasteZone - paste zone container
    • getDropZonePrompt

      @Nullable public String getDropZonePrompt()
      Specified by:
      getDropZonePrompt in interface UploadField
      Returns:
      current drop zone prompt
    • setDropZonePrompt

      public void setDropZonePrompt(@Nullable String dropZonePrompt)
      Description copied from interface: UploadField
      Sets drop zone prompt that will be shown on drag over window with file.
      Specified by:
      setDropZonePrompt in interface UploadField
      Parameters:
      dropZonePrompt - drop zone prompt
    • fireFileUploadStart

      protected void fireFileUploadStart(String fileName, long contentLength)
    • fireFileUploadFinish

      protected void fireFileUploadFinish(String fileName, long contentLength)
    • fireFileUploadError

      protected void fireFileUploadError(String fileName, long contentLength, Exception cause)
    • fireQueueUploadComplete

      protected void fireQueueUploadComplete()
    • getFileSizeLimit

      public long getFileSizeLimit()
      Description copied from interface: UploadField
      Returns maximum allowed file size in bytes.
      Specified by:
      getFileSizeLimit in interface UploadField
    • 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 interface UploadField
    • getPermittedExtensions

      @Nullable public Set<String> getPermittedExtensions()
      Description copied from interface: UploadField
      Returns white list of file extensions.
      Specified by:
      getPermittedExtensions in interface UploadField
      Returns:
      set of file extensions.
    • setPermittedExtensions

      public void setPermittedExtensions(@Nullable Set<String> permittedExtensions)
      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 interface UploadField
      Parameters:
      permittedExtensions - permitted extensions.
    • focus

      public void focus()
      Description copied from interface: Component.Focusable
      Sets focus to this component
      Specified by:
      focus in interface Component.Focusable
    • getTabIndex

      public int getTabIndex()
      Description copied from interface: Component.Focusable
      Gets the tabulator index of the HasTabIndex component.
      Specified by:
      getTabIndex in interface Component.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 the Focusable 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 interface Component.Focusable
      Parameters:
      tabIndex - tab index
    • getFileSizeLimitString

      protected String getFileSizeLimitString()
    • addFileUploadStartListener

      public Subscription addFileUploadStartListener(Consumer<UploadField.FileUploadStartEvent> listener)
      Description copied from interface: UploadField
      Adds file upload start listener. It is invoked when start uploading the file.
      Specified by:
      addFileUploadStartListener in interface UploadField
      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 interface UploadField
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener
    • addFileUploadErrorListener

      public Subscription addFileUploadErrorListener(Consumer<UploadField.FileUploadErrorEvent> listener)
      Description copied from interface: UploadField
      Adds file upload error listener. It is invoked when the uploads are finished, but unsuccessful.
      Specified by:
      addFileUploadErrorListener in interface UploadField
      Parameters:
      listener - a listener to add
      Returns:
      a registration object for removing an event listener