Package io.jmix.ui.download
Interface Downloader
- All Known Implementing Classes:
DownloaderImpl
public interface Downloader
Generic interface to download data from the system.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Downloads passed byte array.void
download
(byte[] data, String resourceName, DownloadFormat format) Downloads passed byte array.void
Downloads a file from file storage.void
download
(FileRef fileReference, DownloadFormat format) Downloads a file from file storage.void
download
(DownloadDataProvider dataProvider, String resourceName) Downloads an arbitrary resource defined by a DownloadDataProvider.void
download
(DownloadDataProvider dataProvider, String resourceName, DownloadFormat format) Downloads an arbitrary resource defined by a DownloadDataProvider.boolean
void
setFileStorage
(FileStorage fileStorage) Sets a file storage where the files will be downloaded from.void
setShowNewWindow
(boolean showNewWindow) Sets explicit new window option.
-
Method Details
-
download
void download(DownloadDataProvider dataProvider, String resourceName, @Nullable DownloadFormat format) Downloads an arbitrary resource defined by a DownloadDataProvider.- Parameters:
dataProvider
- resource providerresourceName
- resource nameformat
- download format, can be null
-
download
Downloads an arbitrary resource defined by a DownloadDataProvider.- Parameters:
dataProvider
- resource providerresourceName
- resource name
-
download
Downloads a file from file storage.The default file storage of the system is used by default. Different file storage can be set in
setFileStorage(FileStorage)
.- Parameters:
fileReference
- file reference
-
download
Downloads a file from file storage.The default file storage of the system is used by default. Different file storage can be set in
setFileStorage(FileStorage)
.- Parameters:
fileReference
- file referenceformat
- download format, can be null
-
download
Downloads passed byte array.- Parameters:
data
- data in the form of byte arrayresourceName
- resource name
-
download
Downloads passed byte array.- Parameters:
data
- data in the form of byte arrayresourceName
- resource nameformat
- download format, can be null
-
setFileStorage
Sets a file storage where the files will be downloaded from.- Parameters:
fileStorage
- file storage
-
isShowNewWindow
boolean isShowNewWindow()- Returns:
true
if downloader should open a new window with the file content
-
setShowNewWindow
void setShowNewWindow(boolean showNewWindow) Sets explicit new window option.- Parameters:
showNewWindow
-true
if downloader opens new window, otherwisefalse
-