Home » Eclipse Projects » Eclipse Scout » Menu Separator not shown
Menu Separator not shown [message #1856700] |
Fri, 23 December 2022 07:57  |
Eclipse User |
|
|
|
Hello,
I have been using Scout (Classic) since version 4, it was possible to add a separator in the context menu, for instance in a page table menu. This menu item was drawing a line on the menu, separating the items as expected.
There is still AbstractMenuSeparator in Scout 22, but the separators are not shown.
I don't know from which version it happens, I have used several versions including 11 but I didn't pay attention to this. I just checked with Scout 11 and there is also this behaviour.
It seems that the menu of type AbstractMenuSeparator does nothing, at least on a web interface.
Is it normal ? What should I do to make it work ? Or what is the purpose of AbstractMenuSeparator if it doesn't show a menu separator ?
Thank you !
|
|
| |
Re: Menu Separator not shown [message #1856853 is a reply to message #1856800] |
Thu, 05 January 2023 11:05   |
Eclipse User |
|
|
|
Hi Claudio,
Ok.... Thank you for the answer, and the hints !
I will try, because I think that it will help my users.
Some context: actually I have developed a nice, not so simple, application back in the times of Scout 4, and after that the change of design of the framework made it a huge step to upgrade it. I tried last year to Scout 11 but didn't succeed, this time I took a completely different approach to move to Scout 22 and it worked. I also used more recent versions of Scout for other projects though, but yes, there were separating lines in these versions and also the popup menus were not so long so I didn't notice the issue before.
PS: when I write "not so simple application", this application integrates a workflow system (Bonita from Bonitasoft), a DMS (Alfresco), a directory (LDAP) to share personal data with several other applications, a single-sign on (CAS), reports generation (Jasper Reports), office document generation and upload processing (Apache POI). So I was not at all sure of being able to upgrade it and had little time for that...
|
|
|
Re: Menu Separator not shown [message #1856874 is a reply to message #1856700] |
Fri, 06 January 2023 07:58   |
Eclipse User |
|
|
|
Hello again Claudio,
I tried hard, read the documentation I found, tried to understand the widget example, but I must be missing something because I am lost.
NB: I use Scout "Classic".
The documentation (for Scout JS) explains how to +extend+ a widget with the Extension but after that I don't know how to use the extended menu from the client model.
I did something like :
MyContextMenu.js:
import { Extension, ContextMenuPopup } from '@eclipse-scout/core';
export default class MyContextMenuPopupExtension extends Extension {
init() {
this.extend(ContextMenuPopup.prototype, '_renderMenuItems');
}
_renderMenuItems(menus, initialSubMenuRendering) {
... // modifier version of the function here
}
}
MyApp.js:
import {App, Extension} from '@eclipse-scout/core';
export default class MyApp extends App {
_installExtensions() {
Extension.install([
'virades.MyContextMenuPopupExtension'
]);
}
}
But then what ?
On the other hand the widget example shows how to extends classes but I don't see how to use a ContextMenuPopup in the model, it is in a TablePage and there are only AbstractMenu's there, I have no clue of how these menus are converted into a ContextMenuPopup in the ui application.
Which one is the right direction, and what is the next step ?
Thank you,
Best regards
Michel
|
|
|
Re: Menu Separator not shown [message #1856876 is a reply to message #1856874] |
Fri, 06 January 2023 10:04   |
Eclipse User |
|
|
|
Hi Michael,
you are on the right track ;-)
It looks like you are registering the extension in a new app, but you need to register it in the app you already have.
You may have a file called virades.js or something similar, it is the entry point into your application. In that file, create a custom app as you have already done but extend from `RemoteApp` which is necessary for Scout Classic. Then initialize your custom app rather than the RemoteApp directly.
class MyApp extends RemoteApp {
_installExtensions() {
Extension.install([
'virades.MyContextMenuPopupExtension'
]);
}
}
new MyApp().init();
You also need to register your JavaScript file in your index.js, otherwise the extension won't be found on your namespace 'virades'.
Instead of using the extension pattern you could also use the ObjectFactory. With the extension, the method is replaced, with the object factory, inheritance is used to override specific methods. It should not be of relevance in your case which way you choose.
ContextMenuPopup does not exist in the Java part, but Scout JS will take the menu items and display them in the ContextMenuPopup.
[Updated on: Fri, 06 January 2023 10:05] by Moderator
|
|
| | |
Re: Menu Separator not shown [message #1857043 is a reply to message #1856935] |
Sat, 14 January 2023 04:56   |
Eclipse User |
|
|
|
Hi Claudio,
The documentation looks great, it tells what to do and where to do it, with relevant code parts which are not obvious when you never did that, thank you !
So about the upgrade, here is the longer story.
This application was built with Scout 4 around 2015 or 2016 and the framework was not upgraded for lack of resource, it was more important to develop new functionalities or other projects, and the application was in production and working well. However I tried to upgrade it to Scout 10 or 11 by following an upgrade path, starting with the whole application and applying changes and patches as documented (and not documented). But the structure of the old application was really too different to make it work, many things were completely removed or working completely differently, due mostly IMHO to the switch from an Eclipse plugin to a real web application. So I was left with lots of code not working, some of it I had to make it work and some of it I had to remove, and I didn't know what to do with that, and hadn't unlimited time to do that so I gave up.
This year I thought, the functional code (forms, pages, services, ...) was still mostly usable or I could fix it, and I knew it since it was my code, so instead of copying the whole old project tree and applying fixes on a lot of garbage, I created a brand new, clean Scout 22 application, and then injected in it the functionalities package by package, and fixed them (often by batch replaces). I started by the shared project (excepted generated sources), then the client, then the server, then the additional modules which were before embedded as "bundles" (generation of Jasper reports, communication with Bonita workflows, document storage in Alfresco, ...) and now simple Maven dependencies.
So this worked.
Best regards
Michel
|
|
| |
Re: Menu Separator not shown [message #1857183 is a reply to message #1857124] |
Sun, 22 January 2023 10:52  |
Eclipse User |
|
|
|
I am glad too because maintaining a Scout 4 application was painful and at risk, I really had to do it.
The customer was happy of the new look and general ergonomy. I didn't tell him in advance because I was not sure I could make it...
|
|
|
Goto Forum:
Current Time: Tue Mar 18 21:02:14 EDT 2025
Powered by FUDForum. Page generated in 0.04957 seconds
|