|
|
|
Re: [Neon] - insert dynamic image into menu without being icons. [message #1810823 is a reply to message #1766708] |
Tue, 20 August 2019 08:47 |
Krzysztof Leja Messages: 55 Registered: April 2019 |
Member |
|
|
Hi,
In my Scout application I would like to do a very similar thing: present in the desktop menu, dynamically determined avatar from a graphic file downloaded ad-hock from the Internet. I referred to the above-mentioned example BuddyAvatarIconProviderService.java, but I have the following problem with it. During desktop initialization, the icon content (using the loadLocalAvatarIconSpec method) is downloaded twice by a web browser:
- Initial POST request, where in the above-mentioned loadLocalAvatarIconSpec method, the ClientSession.get() call returns the session object, and thus further download of the image content is done correctly.
- Second GET method, where in the above-mentioned loadLocalAvatarIconSpec method, the ClientSession.get () call returns NULL, and thus the icon content cannot be read (in the session object I store information necessary to download the icon). This finally results in the avatar not being displayed in the menu.
My question:
Why does the ClientSession.get() method return NULL while handling this second GET request?
How to solve this problem?
|
|
|
Re: [Neon] - insert dynamic image into menu without being icons. [message #1814829 is a reply to message #1810823] |
Thu, 19 September 2019 10:35 |
|
Hi Krzysztof
I overlooked your question, because it was in an old thread. In newer Scout releases this is quite simple. Use an AbstractFormFieldMenu and place an AbstractImageField in the menu, which simply points to the URL of the image. Example code:
@ClassId("ee078d57-7f35-4f8e-9cc8-0e243a4965fe")
public class GraphicalMenu extends AbstractFormFieldMenu {
@ClassId("e01405aa-4465-42c7-84d5-0068f33142a9")
public class Image extends AbstractImageField {
@Override
protected void execInitField() {
setImageUrl("https://img.icons8.com/color/2x/bmo.png");
}
}
}
See the attached image-menu.jpg for a preview.
Cheers,
André
Eclipse Scout Homepage | Documentation | GitHub
|
|
|
|
Powered by
FUDForum. Page generated in 0.03899 seconds