Home » Eclipse Projects » Eclipse Scout » [neon][ugm] Questions about migration of Scout Apps from Luna/Mars -> Neon
[neon][ugm] Questions about migration of Scout Apps from Luna/Mars -> Neon [message #1713575] |
Thu, 05 November 2015 09:27 |
Urs Beeli Messages: 573 Registered: October 2012 Location: Bern, Switzerland |
Senior Member |
|
|
As I described in this forum post: https://www.eclipse.org/forums/index.php/t/1071844/, I received a copy of the (not yet public) Scout Neon versions at the EclipseCon Europe Unconference Scout User Group Meeting [ugm] .
After finally getting my HelloWorld app up and running, I merged in my code from another Scout Mars application and tried to get rid of all errors. I've managed to get quite far but there are still some open issues.
- in my application I was still using the Object[][] way to populate the table pages. So on the server side I have a method
Object[][] getXxxData(SearchFilter filter);
On the client side, I used the following method:
@Override
protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
return SERVICES.getService(IXxxxService.class).getXxxData(filter);
}
Apparently execLoadTableData() no longer exists, so I replaced this with the following code:
@Override
protected void execLoadData(SearchFilter filter) {
Object[][] xxxData = BEANS.get(IXxxService.class).getXxxData(filter);
getTable().replaceRowsByMatrix(xxxData);
}
This seems to work in as far as the server code is called and data is returned, but it is never shown in the table. Instead there is an error dump in the ui-html-dev console listing a ton of JSON errors that don't help me (sadly I forgot to copy paste them from my home computer where I managed to get Neon working, I'll append them to this post tonight). However, when clicking on the table headers (which are visible) the values are offered for filtering, so it seems that they ended up on the client at least partially...
Is this not the recommended way to populate table pages any more? I know that TableFormData was introduced a while back, but I never got around to converting my applications (both privately and at work).
- my tables have context menus that make liberaly use of execPrepareAction() (yes, I know it has been deprecated since Mars) and execAboutToShow() (which I believe was the recommended alternative in Mars). Neither of those methods seem to available anymore. How do I conditionally enabled/disable context menus on tables in Neon?
- the ScoutInfoForm seems to have problems calculating its correct size. Showing it, not all lines are shown and there is no initial scrollbar. Only after resizing that window is the scroll bar added. Is this a known Neon-Bug?
- in my application I had added support for Jasper Reports following the how to on the Scout Wiki. There are some code parts that seem to be bundle based that I am uncertain on how to migrate:
In ReportService.createReport() there is
URL url = new URL("platform:/plugin/ch.bee.mediathek.reports/reports/" + reportName + ".jrxml");
InputStream inputStream = url.openConnection().getInputStream();
How does that need to be migrated?
Then on the client side there was
byte[] report = BEANS.get(IReportingService.class).createReport(ids, "DvdList", getConfiguredText());
BEANS.get(IFileService.class).openPdfFile(report);
which in turn calls the file service which implemented openPdfFile() as follows:
public void openPdfFile(byte[] contents) throws ProcessingException {
if (contents.length > 0) {
// get a path to save the file
File tmpPath = Activator.getDefault().getStateLocation().toFile();
File tmpFile;
try {
String extension = ".pdf";
String name = "report-";
// get e unique temporary name
tmpFile = File.createTempFile(name, extension, tmpPath);
FileOutputStream fo = new FileOutputStream(tmpFile);
fo.write(contents);
fo.close();
// let the vm handle the deletion of the temp file
tmpFile.deleteOnExit();
// use the ShellService to open the associated program
BEANS.get(IShellService.class).shellOpen(tmpFile.getAbsolutePath());
}
catch (IOException e) {
throw new ProcessingException("Can't create or write to tmp File.", e);
}
}
else {
throw new ProcessingException("Can't open report file.");
}
}
What is the suggested way to create this temporary file in the correct location and does the ShellService still exist and work to display the resulting PDF file?
Also, I have extended the createReportMethod() to provide the file path to clien/resource/icons so they could be used in the report. In order to do that I wrote the following method:
private String getIconPath() {
String clientBundleName = Activator.getDefault().getBundle().getSymbolicName().replace(".server", ".client");
return BundleUtility.getBundlePath(clientBundleName, "/resources/icons");
}
How do I migrate this to provide the new icon path?
- all my tabel pages have a corresponding SearchForm. In the search form there was an interface method startSearch() which apparently no longer exists on the interface. I just removed the @Override annotation but do not see the search form on the gui (or only on one table pages and even there only partially). What is the recommended way of associating search forms to table pages in Neon?
I think for the moment, these are all my questions I'd appreciate any input on how to solve these issues. My goal is to collect as much experience as possible while migrating my smaller private projects in order to make the migration of our huge work project easier.
[Updated on: Thu, 05 November 2015 09:37] Report message to a moderator
|
|
| |
Re: [neon][ugm] Questions about migration of Scout Apps from Luna/Mars -> Neon [message #1713616 is a reply to message #1713575] |
Thu, 05 November 2015 14:16 |
|
Hi Urs.
Maybe I can answer your question regarding the PDF report. Since Scout with Html UI is now a plain web-application, the ShellService does not exist anymore, since we cannot access the shell (OS) from the browser. For the same reason you should no longer create temporary files on the client-side, since the (Java) client now runs on a central server and not on the workstation where the browser runs.
With Html UI you use a BinaryResource and the IDesktop#openUri method to initiate a file download or an "open file" action in the browser. Here's a code sample where an Excel-Sheet is created in the client code, and then downloaded by the browser. This will also work for PDFs or any other binary file (as long as your browser knows what to do with the mime-type of that file).
ByteArrayOutputStream bos = new ByteArrayOutputStream();
myReport.save(bos);
ClientSessionProvider.currentSession().getDesktop().openUri(new BinaryResource("my.xlsx", bos.toByteArray()), OpenUriAction.DOWNLOAD);
Eclipse Scout Homepage | Documentation | GitHub
|
|
| | |
Re: [neon][ugm] Questions about migration of Scout Apps from Luna/Mars -> Neon [message #1713676 is a reply to message #1713575] |
Thu, 05 November 2015 21:34 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
PS: Next time, please split your question in several topics, because this is really hard to follow.
Urs Beeli wrote on Thu, 05 November 2015 10:27all my tabel pages have a corresponding SearchForm. In the search form there was an interface method startSearch() which apparently no longer exists on the interface. I just removed the @Override annotation but do not see the search form on the gui (or only on one table pages and even there only partially). What is the recommended way of associating search forms to table pages in Neon?
I really appreciate that you share your first impression / problem with us. This know-how will be valuable for everyone. Thank you for being the first
It is now time for BSI to share the internal knowledge about the new Neon version of Eclipse Scout.
In your case, you can compare the 2 implementation of the Contacts application:
* Mars: CompanySearchForm
* Neon: OrganizationSearchForm
From what I see, there is now a unique method start() on the IForm, and this method gets called by AbstractPageWithTable.ensureSearchFormStarted().
The migration is probably: In your search form, replace startSearch() with start().
As every year we will write a New And Noteworthy Page for Neon. (I know some people have some draft of such a document, now that the source code is finally pushed to Eclipse. It is time to share. Another source for the documentation will be the slides from the presentation given by Matthias at the Scout User Group Meeting).
Do not hesitate to write what you have discovered in the New And Noteworthy Page. If everybody participates (Scout community and BSI), we will obtain a really good document.
|
|
| |
Goto Forum:
Current Time: Wed Apr 24 20:37:48 GMT 2024
Powered by FUDForum. Page generated in 0.03348 seconds
|