I have a weird problem with my MPR + Vaadin 7 app. When I click “download”, it resizes the screen incorrectly. First of all, here are images of the Vaadin 7 app:
Hi,
what does Download do ?
Unfortunately the images have low quality and I can’t see anything.
But anyway it’s more important what the application does on Download action.
The key with the pictures is the scrollbars. Figure 2 ( pure Vaadin 7 ) has no scrollbars after download ( while it is hard to see the download file in the image, it is still visible at the bottom left corner ). With Figure 4 ( MPR + Vaadin 7 ), it adds scrollbars after the download is complete (the scrollbars on the side and bottom and the download file on the bottom left are visible enough to show the issue, I hope). Sorry for the unclear images. Didn’t think it would matter because the scrollbars are clear ( while a lot of the other stuff is all fuzzy ).
Anyway, as for what the application is doing, it is, in this case, downloading a CSV file from my server using the FileDownloader feature. These are all Vaadin 7 features, not converted yet to pure Flow.
User clicks download button, which is a normal button extended with FileDownloader ( code below )
FileDownloader code talks to backend, telling backend to create a CSV file, and backend gives CSV file back to frontend. This happens in a overriden getFileDownloadResource()
Generated file downloads to machine.
The point is that the same code works fine in pure Vaadin 7 but does weird things with the sizing in MPR + Vaadin 7. I have a similar issue with the exporter add-on, https://vaadin.com/directory/component/exporter/discussions. I assume I am hitting some weird style issue. I am currently using MprTheme with my custom Valo theme, if that helps.
First of all, the customer CsvFileDownloader:
private class CsvFileDownloader extends FileDownloader {
/**
*
*/
private static final long serialVersionUID = -1703929900936413587L;
public CsvFileDownloader(Resource resource) {
super(resource);
}
@Override
public Resource getFileDownloadResource() {
FileResource csvFileResource = null;
try {
LOGGER.info("Getting CSV file resource for " + type.toString());
csvFileResource = generateCsvDataFile();
csvFileResource.setCacheTime(0);
if( csvFileResource instanceof FileResource ) {
LOGGER.info("Got CSV file resource " + csvFileResource.getFilename() );
} else {
throw new WMSException( "Error getting CSV file resource for " +
"downloading data for " + type.toString() );
}
} catch (WMSException e) {
String message = e.getMessage();
if( message == null || message.trim().isEmpty() ) {
message = "Error getting data file for export.";
}
Notification.show("CSV Files", message, Type.ERROR_MESSAGE );
LOGGER.severe(message);
}
return csvFileResource;
}
}
Secondly, how it is used and added to the form:
protected FileDownloader buildCsvDownloader() {
FileResource tempResource = new FileResource(new File(""));
return new CsvFileDownloader(tempResource);
}
protected Button buildDownloadDataCsvBtn() {
csvDataDownloader = buildCsvDownloader();
// csvDataDownloader = new FileDownloader(tempResource);
// csvDataDownloader.extend(csvDataDownloaderBtn);
final Button downloadDataBtn = buildDownloadCsvBtn();
csvDataDownloader.extend(downloadDataBtn);
return downloadDataBtn;
}
So, do I understand correctly that you don’t add anything on the page as a result of the code execution ?
It’s just your FileDownloader extension implementation .
And nothing else is involved in the action ?
So this code with the custom FileDownloader works fine in V7 but has scrolling issue in MPR, right ?
It looks like a bug.
Could you please create a ticket ?
I don’t think anything else is involved. I suppose I might display error messages and what not, but I don’t in this case as far as I know because no errors.
Yes, code works with pure V7. I made one minor change for my MPR + Vaadin 7 code - since FileDownloader, by it’s very nature, starts a new thread and my code requires the UI and Session, I had to pass the local copies of this down to the FileDownloder stuff ( Vaadin 7 does not have this requirement, but Flow of course does, as per the documentation ). I cannot create a ticket ( not that type of account ), but I can submit a bug report to github if you want me to.