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

  • Method Details

    • addFileUploadStartListener

      Subscription addFileUploadStartListener(Consumer<UploadField.FileUploadStartEvent> listener)
      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

      Subscription addFileUploadFinishListener(Consumer<UploadField.FileUploadFinishEvent> listener)
      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

      Subscription addFileUploadErrorListener(Consumer<UploadField.FileUploadErrorEvent> listener)
      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

      @StudioProperty void setFileSizeLimit(long fileSizeLimit)
      Sets maximum allowed file size in bytes. Default value is 0. In this case component uses system value.
    • getAccept

      @Nullable String getAccept()
      Returns comma separated types of files.
      Returns:
      comma separated types of files
    • setAccept

      @StudioProperty(type=STRING) void setAccept(@Nullable String accept)
      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

      @StudioProperty(type=STRING) void setPermittedExtensions(@Nullable Set<String> permittedExtensions)
      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

      @Nullable Set<String> getPermittedExtensions()
      Returns white list of file extensions.
      Returns:
      set of file extensions.
    • getDropZone

      @Nullable UploadField.DropZone 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

      @Nullable ComponentContainer getPasteZone()
      Returns:
      current paste zone container
    • getDropZonePrompt

      @Nullable String getDropZonePrompt()
      Returns:
      current drop zone prompt
    • setDropZonePrompt

      @StudioProperty(type=LOCALIZED_STRING) void setDropZonePrompt(@Nullable String dropZonePrompt)
      Sets drop zone prompt that will be shown on drag over window with file.
      Parameters:
      dropZonePrompt - drop zone prompt