Package io.jmix.ui.download
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 Summary
FieldsModifier and TypeFieldDescriptionprotected BackgroundWorkerprotected CorePropertiesprotected FileStorageprotected FileStorageLocatorprotected Messagesprotected booleanprotected UiPropertiesprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDownloads passed byte array.voiddownload(byte[] data, String resourceName, DownloadFormat format) Downloads passed byte array.voidDownloads a file from file storage.voiddownload(FileRef fileReference, DownloadFormat format) Downloads a file from file storage.voiddownload(DownloadDataProvider dataProvider, String resourceName) Show/Download resource at client sidevoiddownload(DownloadDataProvider dataProvider, String resourceName, DownloadFormat downloadFormat) Show/Download resource at client sideprotected booleanhandleFileNotFoundException(Exception exception, com.vaadin.server.VaadinResponse response) booleanprotected booleanisIOS()booleanDeprecated.booleanvoidsetFileStorage(FileStorage fileStorage) Sets a file storage where the files will be downloaded from.voidsetFileStorageLocator(FileStorageLocator fileStorageLocator) voidsetMessages(Messages messages) voidsetNewWindow(boolean newWindow) Deprecated.voidsetShowNewWindow(boolean showNewWindow) Sets explicit new window option.protected voidwriteFileNotFoundException(com.vaadin.server.VaadinResponse response, String message)
-
Field Details
-
backgroundWorker
-
uiProperties
-
coreProperties
-
messages
-
fileStorageLocator
-
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
-
setFileStorageLocator
-
download
public void download(DownloadDataProvider dataProvider, String resourceName, @Nullable DownloadFormat downloadFormat) Show/Download resource at client side- Specified by:
downloadin interfaceDownloader- Parameters:
dataProvider- DownloadDataProviderresourceName- ResourceName for client sidedownloadFormat- DownloadFormat- See Also:
-
download
Show/Download resource at client side- Specified by:
downloadin interfaceDownloader- Parameters:
dataProvider- DownloadDataProviderresourceName- ResourceName for client side- See Also:
-
download
Description copied from interface:DownloaderDownloads 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:
downloadin interfaceDownloader- Parameters:
fileReference- file reference
-
download
Description copied from interface:DownloaderDownloads 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:
downloadin interfaceDownloader- Parameters:
fileReference- file referenceformat- download format, can be null
-
download
Description copied from interface:DownloaderDownloads passed byte array.- Specified by:
downloadin interfaceDownloader- Parameters:
data- data in the form of byte arrayresourceName- resource name
-
download
Description copied from interface:DownloaderDownloads passed byte array.- Specified by:
downloadin interfaceDownloader- Parameters:
data- data in the form of byte arrayresourceName- resource nameformat- download format, can be null
-
setFileStorage
Description copied from interface:DownloaderSets a file storage where the files will be downloaded from.- Specified by:
setFileStoragein interfaceDownloader- Parameters:
fileStorage- file storage
-
isShowNewWindow
public boolean isShowNewWindow()- Specified by:
isShowNewWindowin interfaceDownloader- Returns:
trueif downloader should open a new window with the file content
-
setShowNewWindow
public void setShowNewWindow(boolean showNewWindow) Description copied from interface:DownloaderSets explicit new window option.- Specified by:
setShowNewWindowin interfaceDownloader- Parameters:
showNewWindow-trueif downloader opens new window, otherwisefalse
-
isNewWindow
Deprecated. -
setNewWindow
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
-
isShowNewWindow()