Package io.jmix.flowui.download
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 Summary
Modifier and TypeFieldDescriptionprotected CoreProperties
protected FileStorage
protected FileStorageLocator
protected Messages
protected boolean
protected UiProperties
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
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) Show/Download resource at client sidevoid
download
(DownloadDataProvider dataProvider, String resourceName, DownloadFormat downloadFormat) Show/Download resource at client sideprotected boolean
handleFileNotFoundException
(JmixFileDownloader.FileNotFoundContext fileNotFoundEvent) protected boolean
protected boolean
isIPhone()
boolean
void
setCoreProperties
(CoreProperties coreProperties) void
setFileStorage
(FileStorage fileStorage) Sets a file storage where the files will be downloaded from.void
setFileStorageLocator
(FileStorageLocator fileStorageLocator) void
setMessages
(Messages messages) void
setShowNewWindow
(boolean showNewWindow) Sets explicit new window option.void
setUiProperties
(UiProperties uiProperties) protected void
writeFileNotFoundException
(com.vaadin.flow.server.VaadinResponse response, String message)
-
Field Details
-
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
-
setUiProperties
-
setCoreProperties
-
setMessages
-
setFileStorageLocator
-
setFileStorage
Description copied from interface:Downloader
Sets a file storage where the files will be downloaded from.- Specified by:
setFileStorage
in interfaceDownloader
- Parameters:
fileStorage
- file storage
-
isShowNewWindow
public boolean isShowNewWindow()- Specified by:
isShowNewWindow
in interfaceDownloader
- 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 interfaceDownloader
- Parameters:
showNewWindow
-true
if downloader opens new window, otherwisefalse
-
download
public void download(DownloadDataProvider dataProvider, String resourceName, @Nullable DownloadFormat downloadFormat) Show/Download resource at client side- Specified by:
download
in interfaceDownloader
- Parameters:
dataProvider
- DownloadDataProviderresourceName
- ResourceName for client sidedownloadFormat
- DownloadFormat- See Also:
-
download
Show/Download resource at client side- Specified by:
download
in interfaceDownloader
- Parameters:
dataProvider
- DownloadDataProviderresourceName
- ResourceName for client side- See Also:
-
download
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 interfaceDownloader
- Parameters:
fileReference
- file reference
-
download
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 interfaceDownloader
- Parameters:
fileReference
- file referenceformat
- download format, can be null
-
download
Description copied from interface:Downloader
Downloads passed byte array.- Specified by:
download
in interfaceDownloader
- Parameters:
data
- data in the form of byte arrayresourceName
- resource name
-
download
Description copied from interface:Downloader
Downloads passed byte array.- Specified by:
download
in interfaceDownloader
- Parameters:
data
- data in the form of byte arrayresourceName
- resource nameformat
- 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()
-