Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Accessing Pictures in Custom Widgets
Accessing Pictures in Custom Widgets [message #755142] Mon, 07 November 2011 13:51 Go to next message
S. SchulzFriend
Messages: 72
Registered: September 2011
Member
Hallo!

(I'm trying this for the second time, for whatever reason the forum thought my question was not important enough and deleted it when I tried to preview.)

We finally created a custom widget with Qooxdoo and the LCA of RAP. While researching the possibilities we are now facing another problem. How do you register images in RAP to be used in Qooxdoo?

Now RAP does this inside org.eclipse.swt.internal.widgets.displaykit.ClientResources this way:

String name = "resource/widget/rap/ctabfolder/maximize.gif";
IResourceManager resourceManager = RWT.getResourceManager();
resourceManager.register(name, openResourceStream(name));

When accessing the file in Qooxdoo, it uses this approach:

maxIcon = "widget/ctabfolder/maximize.gif";
this.maxButton.setIcon(maxIcon);


So why did the path of the picture change? What is happening internally while registering? And how would we go about registering our own images? (Recreating the above scenario inside our own plug-in didn't work at all.)

Thank you for your kind help.
Re: Accessing Pictures in Custom Widgets [message #755193 is a reply to message #755142] Mon, 07 November 2011 16:13 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2427
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
to use an image in a custom widget you have to:
1. Register the image as a resource - pragmatic or declarative (or use
Graphics#getImage).
2. Get the image real path by using:
String imagePath = ImageFactory.getImagePath( image );
and pass it to the client-side custom widget through the LCA. See
ToggleHyperlinkLCA class in the forms bundle as an example.
HTH,
Ivan

On 11/7/2011 3:51 PM, s.schulz wrote:
> Hallo!
>
> (I'm trying this for the second time, for whatever reason the forum
> thought my question was not important enough and deleted it when I
> tried to preview.)
>
> We finally created a custom widget with Qooxdoo and the LCA of RAP.
> While researching the possibilities we are now facing another problem.
> How do you register images in RAP to be used in Qooxdoo?
>
> Now RAP does this inside
> org.eclipse.swt.internal.widgets.displaykit.ClientResources this way:
>
> String name = "resource/widget/rap/ctabfolder/maximize.gif";
> IResourceManager resourceManager = RWT.getResourceManager();
> resourceManager.register(name, openResourceStream(name));
>
> When accessing the file in Qooxdoo, it uses this approach:
>
> maxIcon = "widget/ctabfolder/maximize.gif";
> this.maxButton.setIcon(maxIcon);
>
>
> So why did the path of the picture change? What is happening
> internally while registering? And how would we go about registering
> our own images? (Recreating the above scenario inside our own plug-in
> didn't work at all.)
>
> Thank you for your kind help.
Re: Accessing Pictures in Custom Widgets [message #755329 is a reply to message #755193] Tue, 08 November 2011 08:04 Go to previous messageGo to next message
S. SchulzFriend
Messages: 72
Registered: September 2011
Member
Thank you so far.

The problem is, the widget in question is only a JavaScript widget that is used to build many other widgets. In this case, it's an error decoration that is put next to some other controls to show the validation status. We have already tried successfully the above approach, but it would mean many other controls would have to call and/or implement writeImage() in their LCA's AND would have a additional method setErrorImage() in their JavaScript classes. All of that seems to be a lot of duplicated code, which we'd like to avoid, since the same image is used every single time.
Re: Accessing Pictures in Custom Widgets [message #755412 is a reply to message #755329] Tue, 08 November 2011 12:00 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2427
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Probably, the solution will be to keep these images in the "widget that
is used to build many other widgets". Other widgets will get the images
from it. For me it sounds like WidgetsBuilder#getDecorationImage,
WidgetsBuilder#getErrorImage
Best,
Ivan

On 11/8/2011 10:04 AM, s.schulz wrote:
> Thank you so far.
> The problem is, the widget in question is only a JavaScript widget
> that is used to build many other widgets. In this case, it's an error
> decoration that is put next to some other controls to show the
> validation status. We have already tried successfully the above
> approach, but it would mean many other controls would have to call
> and/or implement writeImage() in their LCA's AND would have a
> additional method setErrorImage() in their JavaScript classes. All of
> that seems to be a lot of duplicated code, which we'd like to avoid,
> since the same image is used every single time.
Re: Accessing Pictures in Custom Widgets [message #755672 is a reply to message #755412] Wed, 09 November 2011 09:22 Go to previous message
S. SchulzFriend
Messages: 72
Registered: September 2011
Member
> Probably, the solution will be to keep these images in the "widget that is used to build many other widgets".

That's what we want to do, but the Decoration has no Java counterpart, so can only access the images via Qooxdoo, and that is not working so far.

> For me it sounds like WidgetsBuilder#getDecorationImage, WidgetsBuilder#getErrorImage

But this way each of the other widgets would have to set the image manually, after getting it from the WidgetsBuilder.
Re: Accessing Pictures in Custom Widgets [message #755673 is a reply to message #755412] Wed, 09 November 2011 09:22 Go to previous message
S. SchulzFriend
Messages: 72
Registered: September 2011
Member
> Probably, the solution will be to keep these images in the "widget that is used to build many other widgets".

That's what we want to do, but the Decoration has no Java counterpart, so can only access the images via Qooxdoo, and that is not working so far.

> For me it sounds like WidgetsBuilder#getDecorationImage, WidgetsBuilder#getErrorImage

But this way each of the other widgets would have to set the image manually, after getting it from the WidgetsBuilder.
Previous Topic:Accessing Pictures in Custom Widgets
Next Topic:Set scroll behavior for Scroller
Goto Forum:
  


Current Time: Wed Sep 25 20:34:56 GMT 2024

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

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

Back to the top