Class DownloaderImpl

java.lang.Object
io.jmix.ui.download.DownloaderImpl
All Implemented Interfaces:
Downloader

@Component("ui_Downloader") @Scope("prototype") public class DownloaderImpl extends Object implements Downloader
Shows exported data in the web browser or downloads it.
  • Field Details

    • backgroundWorker

      @Autowired protected BackgroundWorker backgroundWorker
    • uiProperties

      @Autowired protected UiProperties uiProperties
    • coreProperties

      @Autowired protected CoreProperties coreProperties
    • messages

      protected Messages messages
    • fileStorageLocator

      protected FileStorageLocator fileStorageLocator
    • fileStorage

      protected FileStorage fileStorage
    • newWindow

      protected boolean newWindow
    • useViewList

      protected boolean useViewList
  • Constructor Details

    • DownloaderImpl

      public DownloaderImpl()
      Constructor with newWindow=false
    • DownloaderImpl

      public DownloaderImpl(boolean newWindow)
      Parameters:
      newWindow - if true, show data in the same browser window; if false, open new browser window
  • Method Details

    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setFileStorageLocator

      @Autowired public void setFileStorageLocator(FileStorageLocator fileStorageLocator)
    • download

      public void download(DownloadDataProvider dataProvider, String resourceName, @Nullable DownloadFormat downloadFormat)
      Show/Download resource at client side
      Specified by:
      download in interface Downloader
      Parameters:
      dataProvider - DownloadDataProvider
      resourceName - ResourceName for client side
      downloadFormat - DownloadFormat
      See Also:
    • download

      public void download(DownloadDataProvider dataProvider, String resourceName)
      Show/Download resource at client side
      Specified by:
      download in interface Downloader
      Parameters:
      dataProvider - DownloadDataProvider
      resourceName - ResourceName for client side
      See Also:
    • download

      public void download(FileRef fileReference)
      Description copied from interface: Downloader
      Downloads a file from file storage.

      The default file storage of the system is used by default. Different file storage can be set in Downloader.setFileStorage(FileStorage).

      Specified by:
      download in interface Downloader
      Parameters:
      fileReference - file reference
    • download

      public void download(FileRef fileReference, @Nullable DownloadFormat format)
      Description copied from interface: Downloader
      Downloads a file from file storage.

      The default file storage of the system is used by default. Different file storage can be set in Downloader.setFileStorage(FileStorage).

      Specified by:
      download in interface Downloader
      Parameters:
      fileReference - file reference
      format - download format, can be null
    • download

      public void download(byte[] data, String resourceName)
      Description copied from interface: Downloader
      Downloads passed byte array.
      Specified by:
      download in interface Downloader
      Parameters:
      data - data in the form of byte array
      resourceName - resource name
    • download

      public void download(byte[] data, String resourceName, @Nullable DownloadFormat format)
      Description copied from interface: Downloader
      Downloads passed byte array.
      Specified by:
      download in interface Downloader
      Parameters:
      data - data in the form of byte array
      resourceName - resource name
      format - download format, can be null
    • setFileStorage

      public void setFileStorage(FileStorage fileStorage)
      Description copied from interface: Downloader
      Sets a file storage where the files will be downloaded from.
      Specified by:
      setFileStorage in interface Downloader
      Parameters:
      fileStorage - file storage
    • isShowNewWindow

      public boolean isShowNewWindow()
      Specified by:
      isShowNewWindow in interface Downloader
      Returns:
      true if downloader should open a new window with the file content
    • setShowNewWindow

      public void setShowNewWindow(boolean showNewWindow)
      Description copied from interface: Downloader
      Sets explicit new window option.
      Specified by:
      setShowNewWindow in interface Downloader
      Parameters:
      showNewWindow - true if downloader opens new window, otherwise false
    • isNewWindow

      @Deprecated public boolean isNewWindow()
      Deprecated.
    • setNewWindow

      @Deprecated public void setNewWindow(boolean newWindow)
      Deprecated.
    • isBrowserSupportsPopups

      public boolean isBrowserSupportsPopups()
    • isIOS

      protected boolean isIOS()
    • handleFileNotFoundException

      protected boolean handleFileNotFoundException(Exception exception, com.vaadin.server.VaadinResponse response)
    • writeFileNotFoundException

      protected void writeFileNotFoundException(com.vaadin.server.VaadinResponse response, String message) throws IOException
      Throws:
      IOException