Class DownloaderImpl

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

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

    • flowuiProperties

      protected FlowuiProperties flowuiProperties
    • coreProperties

      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

    • setFlowuiProperties

      @Autowired public void setFlowuiProperties(FlowuiProperties flowuiProperties)
    • setCoreProperties

      @Autowired public void setCoreProperties(CoreProperties coreProperties)
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setFileStorageLocator

      @Autowired public void setFileStorageLocator(FileStorageLocator fileStorageLocator)
    • 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
    • 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
    • checkUIAccess

      protected void checkUIAccess()
    • handleFileNotFoundException

      protected boolean handleFileNotFoundException(JmixFileDownloader.FileNotFoundContext fileNotFoundEvent)
    • writeFileNotFoundException

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

      protected boolean isBrowserSupportsPopups()
    • isIPhone

      protected boolean isIPhone()