Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Menu Separator not shown
Menu Separator not shown [message #1856700] Fri, 23 December 2022 12:57 Go to next message
Michel R is currently offline Michel RFriend
Messages: 46
Registered: April 2015
Member
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 #1856800 is a reply to message #1856700] Tue, 03 January 2023 09:15 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 259
Registered: March 2010
Senior Member
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 Go to previous messageGo to next message
Michel R is currently offline Michel RFriend
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 Go to previous messageGo to next message
Michel R is currently offline Michel RFriend
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 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 259
Registered: March 2010
Senior Member
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 #1856881 is a reply to message #1856876] Fri, 06 January 2023 23:00 Go to previous messageGo to next message
Michel R is currently offline Michel RFriend
Messages: 46
Registered: April 2015
Member
Hi Claudio,

Thank you so much.
I still had to find how to declare the extension (looked in the Widget demo), and then to fix missing imports in MyContextMenu.js, but this was not too hard.
It works now.

I think that I would never understand how the custom application and extension work without your help. It would be cool if the Scout people would put a very simple but complete example (like this one :) ) in the documentation... (unless it is there and I didn't find it).

Thanks again
Best regards
Michel



Re: Menu Separator not shown [message #1856935 is a reply to message #1856881] Tue, 10 January 2023 08:23 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 259
Registered: March 2010
Senior Member
Hi Michel,

glad to hear it works now. I updated the tech doc and tried to improve the extensibility chapter of Scout JS: https://eclipsescout.github.io/22.0/technical-guide-js.html#extensibility. Is it more clear now or do you miss something?

Good job btw. upgrading your Scout 4 app! You said you took a completely different approach, what do you mean by this? I am just curious :-)

Regards
Claudio
Re: Menu Separator not shown [message #1857043 is a reply to message #1856935] Sat, 14 January 2023 09:56 Go to previous messageGo to next message
Michel R is currently offline Michel RFriend
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
Re: Menu Separator not shown [message #1857124 is a reply to message #1857043] Wed, 18 January 2023 14:44 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 259
Registered: March 2010
Senior Member
Thank you for sharing your experience! Upgrading from such an old version is definitely not an easy task. I am glad it worked out.
Re: Menu Separator not shown [message #1857183 is a reply to message #1857124] Sun, 22 January 2023 15:52 Go to previous message
Michel R is currently offline Michel RFriend
Messages: 46
Registered: April 2015
Member
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...
Previous Topic:Displaying useful messages to users after failed authentication
Next Topic:Scout 22 with Java 19?
Goto Forum:
  


Current Time: Wed Dec 11 07:06:43 GMT 2024

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

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

Back to the top