Home » Eclipse Projects » Eclipse Scout » Menu Separator not shown
|
Re: Menu Separator not shown [message #1856800 is a reply to message #1856700] |
Tue, 03 January 2023 09:15 |
|
Hi,
when we implemented the web ui (Scout 5.2), we decided not to show the menu separators in the context menu but only in the menu bar.
With the redesign of Scout 22, there are no lines between the menu items in the context menu anymore, so showing a separator would be possible, but we still haven't implemented it. If you would like to do it by yourself you could extend the ContextMenuPopup.js class and make sure the separators are rendered (_renderMenuItems method). You probably also have to add some CSS rules to make them visible.
Greetings
Claudio
|
|
|
Re: Menu Separator not shown [message #1856853 is a reply to message #1856800] |
Thu, 05 January 2023 16:05 |
Michel R Messages: 46 Registered: April 2015 |
Member |
|
|
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 12:58 |
Michel R Messages: 46 Registered: April 2015 |
Member |
|
|
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 15:04 |
|
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 15:05] Report message to a moderator
|
|
| | |
Re: Menu Separator not shown [message #1857043 is a reply to message #1856935] |
Sat, 14 January 2023 09:56 |
Michel R Messages: 46 Registered: April 2015 |
Member |
|
|
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
|
|
| | |
Goto Forum:
Current Time: Thu Dec 26 10:00:28 GMT 2024
Powered by FUDForum. Page generated in 0.04120 seconds
|