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

public interface SingleFileUploadField extends UploadField, Component.Focusable, Buffered
  • Method Details

    • getFileContent

      @Nullable InputStream getFileContent()
      Returns:
      content of uploaded file.
    • setShowFileName

      @StudioProperty(defaultValue="false") void setShowFileName(boolean showFileName)
      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

      @StudioProperty(type=LOCALIZED_STRING) void setUploadButtonCaption(@Nullable String caption)
      Setup caption of upload button.
    • getUploadButtonCaption

      @Nullable String getUploadButtonCaption()
      Returns:
      upload button caption.
    • setUploadButtonIcon

      @StudioProperty(type=ICON_ID) void setUploadButtonIcon(@Nullable String icon)
      Setup upload button icon.
    • getUploadButtonIcon

      @Nullable String getUploadButtonIcon()
      Returns:
      upload button icon.
    • setUploadButtonDescription

      @StudioProperty(type=LOCALIZED_STRING) void setUploadButtonDescription(@Nullable String description)
      Setup upload button description.
    • getUploadButtonDescription

      @Nullable String getUploadButtonDescription()
      Returns:
      upload button description.
    • setShowClearButton

      @StudioProperty(defaultValue="false") void setShowClearButton(boolean showClearButton)
      Enable or disable displaying name of clear button.
    • isShowClearButton

      boolean isShowClearButton()
      Returns:
      true if clear button is shown.
    • setClearButtonCaption

      @StudioProperty(type=LOCALIZED_STRING) void setClearButtonCaption(@Nullable String caption)
      Setup clear button caption.
    • getClearButtonCaption

      @Nullable String getClearButtonCaption()
      Returns:
      clear button caption.
    • setClearButtonIcon

      @StudioProperty(type=ICON_ID) void setClearButtonIcon(@Nullable String icon)
      Setup clear button icon.
    • getClearButtonIcon

      @Nullable String getClearButtonIcon()
      Returns:
      clear button icon.
    • setClearButtonDescription

      @StudioProperty(type=LOCALIZED_STRING) void setClearButtonDescription(String description)
      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 the SingleFileUploadField 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 the SingleFileUploadField 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

      void setContentProvider(@Nullable Supplier<InputStream> contentProvider)
      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

      @Nullable Supplier<InputStream> getContentProvider()
      Returns:
      FileContentProvider which can be used to read data from field