Package io.jmix.flowui.download
Interface Downloader
- All Known Implementing Classes:
DownloaderImpl
public interface Downloader
Generic interface to download data from the system.
-
Method Summary
Modifier and TypeMethodDescriptionvoidDownloads passed byte array.voiddownload(byte[] data, String resourceName, DownloadFormat format) Downloads passed byte array.voidDownloads a file from theFileStorageretrieved byFileStorageLocatorusing storage name from FileRef.voiddownload(FileRef fileReference, DownloadFormat format) Downloads a file from theFileStorageretrieved byFileStorageLocatorusing storage name from FileRef.voiddownload(DownloadDataProvider dataProvider, String resourceName) Downloads an arbitrary resource defined by a DownloadDataProvider.voiddownload(DownloadDataProvider dataProvider, String resourceName, DownloadFormat format) Downloads an arbitrary resource defined by a DownloadDataProvider.booleanvoidsetFileStorage(FileStorage fileStorage) Deprecated, for removal: This API element is subject to removal in a future version.voidsetShowNewWindow(boolean showNewWindow) Sets explicit new window option.default voidsetViewFilePredicate(Predicate<String> viewFilePredicate) Sets a predicate that checks if file is allowed to be opened.
-
Method Details
-
setFileStorage
Deprecated, for removal: This API element is subject to removal in a future version.Sets a file storage where the files will be downloaded from.- Parameters:
fileStorage- file storage
-
isShowNewWindow
boolean isShowNewWindow()- Returns:
trueif downloader should open a new window with the file content
-
setShowNewWindow
void setShowNewWindow(boolean showNewWindow) Sets explicit new window option.- Parameters:
showNewWindow-trueif downloader opens new window, otherwisefalse
-
setViewFilePredicate
Sets a predicate that checks if file is allowed to be opened. It takes file extension as an input parameter and returnstrueif file is allowed to be opened orfalseif file should be downloaded.- Parameters:
viewFilePredicate- predicate
-
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 theFileStorageretrieved byFileStorageLocatorusing storage name from FileRef.- Parameters:
fileReference- file reference
-
download
Downloads a file from theFileStorageretrieved byFileStorageLocatorusing storage name from FileRef.- 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
-