Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
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 Smile 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 #1713587 is a reply to message #1713575] Thu, 05 November 2015 10:50 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I did not process each of your points yet.

execLoadTableData() => execLoadData() was announced with mars:
https://wiki.eclipse.org/Scout/NewAndNoteworthy/5.0#Deprecate_execLoadTableData.28.29_in_table_pages

My advice at this point is:
Before you start, you should have a Mars application with as less as possible warnings.
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 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
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 #1713673 is a reply to message #1713587] Thu, 05 November 2015 21:12 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Jeremie Bresson wrote on Thu, 05 November 2015 11:50
I did not process each of your points yet.

execLoadTableData() => execLoadData() was announced with mars:
https://wiki.eclipse.org/Scout/NewAndNoteworthy/5.0#Deprecate_execLoadTableData.28.29_in_table_pages

My advice at this point is:
Before you start, you should have a Mars application with as less as possible warnings.


Hi Jeremie

In Mars I did not have any warnings when using execLoadTableData(). Besides, switching from Object[][] to TablePageData is not a trivial change (less of a problem for my private projects but a significant change in our work projects).

Anyway, it seems that importTableData() that is listed in the NewAndNoteworthy section basically does the same as I did (with the exception of adding an AtomicReference). I changed my code to use importTableData() but the result is still the same. My html-ui-dev console shows the following error and the web gui shows the error attached below.

2015-11-05 22:07:11,524 WARN  qtp1211076369-10 org.eclipse.scout.rt.ui.html.UiSession - Could not find text for contributed UI text key 'ui.copy' [Urs Beeli @ POST /json ]
2015-11-05 22:07:18,976 ERROR qtp1211076369-12 o.e.s.rt.ui.html.json.JsonMessageRequestHandler - scout.Widget.prototype.render@http://localhost:8082/res/scout.js:1721:1
scout.ModelAdapter.prototype.render@http://localhost:8082/res/scout.js:5204:24
scout.MenuBar.prototype._renderMenuItems/<@http://localhost:8082/res/scout.js:16042:21
scout.MenuBar.prototype._renderMenuItems@http://localhost:8082/res/scout.js:16034:1
scout.MenuBar.prototype._updateItems@http://localhost:8082/res/scout.js:15924:19
scout.MenuBar.prototype.rebuildItemsInternal@http://localhost:8082/res/scout.js:15879:19
scout.MenuBarLayout.prototype.layout@http://localhost:8082/res/scout.js:16163:25
scout.HtmlComponent.prototype.validateLayout@http://localhost:8082/res/scout.js:8822:27
scout.HtmlComponent.prototype.revalidateLayout@http://localhost:8082/res/scout.js:8836:25
scout.MenuBar.prototype.rebuildItems@http://localhost:8082/res/scout.js:15871:19
scout.MenuBar.prototype.updateItems@http://localhost:8082/res/scout.js:15893:21
scout.Table.prototype._updateMenuBar@http://localhost:8082/res/scout.js:21527:18
scout.Table.prototype._renderMenus@http://localhost:8082/res/scout.js:21518:18
scout.Table.prototype._renderProperties@http://localhost:8082/res/scout.js:20691:18
scout.Widget.prototype._renderInternal@http://localhost:8082/res/scout.js:1749:18
scout.ModelAdapter.prototype._renderInternal@http://localhost:8082/res/scout.js:5211:24
scout.Widget.prototype.render@http://localhost:8082/res/scout.js:1726:18
scout.ModelAdapter.prototype.render@http://localhost:8082/res/scout.js:5204:24
scout.Desktop.prototype.setOutlineContent@http://localhost:8082/res/scout.js:31334:21
scout.Outline.prototype._updateOutlineNode@http://localhost:8082/res/scout.js:33545:19
scout.Outline.prototype.handleOutlineContent@http://localhost:8082/res/scout.js:33313:21
scout.Outline.prototype._onNodeMouseDown@http://localhost:8082/res/scout.js:33508:21
jQuery.event.dispatch@http://localhost:8082/res/jquery-all.js:4435:15
jQuery.event.add/elemData.handle@http://localhost:8082/res/jquery-all.js:4122:6
 (Code J0) [Urs Beeli @ POST /json 1:20151105220709087]


index.php/fa/23842/0/
Re: [neon][ugm] Questions about migration of Scout Apps from Luna/Mars -> Neon [message #1713675 is a reply to message #1713673] Thu, 05 November 2015 21:27 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Urs Beeli wrote on Thu, 05 November 2015 22:12
In Mars I did not have any warnings when using execLoadTableData().

This is strange because the method is deprecated:
AbstractPageWithTable.java branch 5.0.x


Urs Beeli wrote on Thu, 05 November 2015 22:12

My html-ui-dev console shows the following error and the web gui shows the error attached below.


I have of course no idea with what is gooing on... but you can start the old "Divide and conquer" strategy:
* Have you the problem with all table or just this one?
* What if you have no data in the table?
* Can you reduce the problem to a specific row or column (maybe a column type) or value?
And also:
* Key 'ui.copy': is it something you have in your table? You could try to search for this String in you java code.


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 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
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:27
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 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 Wink
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.
Re: [neon][ugm] Questions about migration of Scout Apps from Luna/Mars -> Neon [message #1713681 is a reply to message #1713616] Thu, 05 November 2015 22:07 Go to previous message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Hi Andre

Andre Wegmueller wrote on Thu, 05 November 2015 15:16

ByteArrayOutputStream bos = new ByteArrayOutputStream();
myReport.save(bos);
ClientSessionProvider.currentSession().getDesktop().openUri(new BinaryResource("my.xlsx", bos.toByteArray()), OpenUriAction.DOWNLOAD);


Thanks, that works perfectly, actually, just the last line is enough, as the ReportService already returns a byte[].

I've also been able to resolve the loading of the report template that I asked about:

Replacing the following lines
      URL url = new URL("platform:/plugin/ch.bee.mediathek.reports/reports/" + reportName + ".jrxml");
      InputStream inputStream = url.openConnection().getInputStream();

with the following line
      InputStream inputStream = getClass().getClassLoader().getResourceAsStream("ch/bee/mediathek/server/reports/" + reportName + ".jrxml");

solved that issue. I am now again able to print reports.
Previous Topic:How to export a standalone application
Next Topic:Wizard: Cancel Button
Goto Forum:
  


Current Time: Wed Apr 24 20:37:48 GMT 2024

Powered by FUDForum. Page generated in 0.03348 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top