@Component(value="ui_Downloader") @Scope(value="prototype") public class DownloaderImpl extends java.lang.Object implements Downloader
Modifier and Type | Field and Description |
---|---|
protected BackgroundWorker |
backgroundWorker |
protected io.jmix.core.CoreProperties |
coreProperties |
protected io.jmix.core.FileStorage |
fileStorage |
protected io.jmix.core.FileStorageLocator |
fileStorageLocator |
protected io.jmix.core.Messages |
messages |
protected boolean |
newWindow |
protected UiProperties |
uiProperties |
protected boolean |
useViewList |
Constructor and Description |
---|
DownloaderImpl()
Constructor with newWindow=false
|
DownloaderImpl(boolean newWindow) |
Modifier and Type | Method and Description |
---|---|
void |
download(byte[] data,
java.lang.String resourceName)
Downloads passed byte array.
|
void |
download(byte[] data,
java.lang.String resourceName,
DownloadFormat format)
Downloads passed byte array.
|
void |
download(DownloadDataProvider dataProvider,
java.lang.String resourceName)
Show/Download resource at client side
|
void |
download(DownloadDataProvider dataProvider,
java.lang.String resourceName,
DownloadFormat downloadFormat)
Show/Download resource at client side
|
void |
download(io.jmix.core.FileRef fileReference)
Downloads a file from file storage.
|
void |
download(io.jmix.core.FileRef fileReference,
DownloadFormat format)
Downloads a file from file storage.
|
protected boolean |
handleFileNotFoundException(java.lang.Exception exception,
com.vaadin.server.VaadinResponse response) |
boolean |
isBrowserSupportsPopups() |
protected boolean |
isIOS() |
boolean |
isNewWindow()
Deprecated.
|
boolean |
isShowNewWindow() |
void |
setFileStorage(io.jmix.core.FileStorage fileStorage)
Sets a file storage where the files will be downloaded from.
|
void |
setFileStorageLocator(io.jmix.core.FileStorageLocator fileStorageLocator) |
void |
setMessages(io.jmix.core.Messages messages) |
void |
setNewWindow(boolean newWindow)
Deprecated.
|
void |
setShowNewWindow(boolean showNewWindow)
Sets explicit new window option.
|
protected void |
writeFileNotFoundException(com.vaadin.server.VaadinResponse response,
java.lang.String message) |
@Autowired protected BackgroundWorker backgroundWorker
@Autowired protected UiProperties uiProperties
@Autowired protected io.jmix.core.CoreProperties coreProperties
protected io.jmix.core.Messages messages
protected io.jmix.core.FileStorageLocator fileStorageLocator
protected io.jmix.core.FileStorage fileStorage
protected boolean newWindow
protected boolean useViewList
public DownloaderImpl()
public DownloaderImpl(boolean newWindow)
newWindow
- if true, show data in the same browser window;
if false, open new browser window@Autowired public void setMessages(io.jmix.core.Messages messages)
@Autowired public void setFileStorageLocator(io.jmix.core.FileStorageLocator fileStorageLocator)
public void download(DownloadDataProvider dataProvider, java.lang.String resourceName, @Nullable DownloadFormat downloadFormat)
download
in interface Downloader
dataProvider
- DownloadDataProviderresourceName
- ResourceName for client sidedownloadFormat
- DownloadFormatFileDataProvider
,
ByteArrayDataProvider
public void download(DownloadDataProvider dataProvider, java.lang.String resourceName)
download
in interface Downloader
dataProvider
- DownloadDataProviderresourceName
- ResourceName for client sideFileDataProvider
,
ByteArrayDataProvider
public void download(io.jmix.core.FileRef fileReference)
Downloader
The default file storage of the system is used by default.
Different file storage can be set in Downloader.setFileStorage(FileStorage)
.
download
in interface Downloader
fileReference
- file referencepublic void download(io.jmix.core.FileRef fileReference, @Nullable DownloadFormat format)
Downloader
The default file storage of the system is used by default.
Different file storage can be set in Downloader.setFileStorage(FileStorage)
.
download
in interface Downloader
fileReference
- file referenceformat
- download format, can be nullpublic void download(byte[] data, java.lang.String resourceName)
Downloader
download
in interface Downloader
data
- data in the form of byte arrayresourceName
- resource namepublic void download(byte[] data, java.lang.String resourceName, @Nullable DownloadFormat format)
Downloader
download
in interface Downloader
data
- data in the form of byte arrayresourceName
- resource nameformat
- download format, can be nullpublic void setFileStorage(io.jmix.core.FileStorage fileStorage)
Downloader
setFileStorage
in interface Downloader
fileStorage
- file storagepublic boolean isShowNewWindow()
isShowNewWindow
in interface Downloader
true
if downloader should open a new window with the file contentpublic void setShowNewWindow(boolean showNewWindow)
Downloader
setShowNewWindow
in interface Downloader
showNewWindow
- true
if downloader opens new window, otherwise false
@Deprecated public boolean isNewWindow()
isShowNewWindow()
@Deprecated public void setNewWindow(boolean newWindow)
setShowNewWindow(boolean)
public boolean isBrowserSupportsPopups()
protected boolean isIOS()
protected boolean handleFileNotFoundException(java.lang.Exception exception, com.vaadin.server.VaadinResponse response)
protected void writeFileNotFoundException(com.vaadin.server.VaadinResponse response, java.lang.String message) throws java.io.IOException
java.io.IOException