Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » ImageColumn
ImageColumn [message #902374] Fri, 17 August 2012 11:36 Go to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
Is there a way to have an ImageColumn? I could not find a counterpart to ImageField. Or is there a workaround to use icons and set them on a cell table?

But the icon should be dynamic and read from database and/or file system, not static from the *.jar.

Thanks,
Adrian
Re: ImageColumn [message #902453 is a reply to message #902374] Fri, 17 August 2012 16:14 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
Hi Adrian

As far as I know, there is no direct counterpart to an ImageField.

What you can do is to use an AbstractObjectColumn (or any other) and overwrite the execDecorateCell method.
In this method you set the icon id, i.e. cell.setIconId(imageId);

In Swing, the icon is retrieved by calling getIcon in the AbstractSwingEnvironment. Thus you can overwrite the getIcon method in your SwingEnvironment and handle the Icon retrieval there.

To somehow have a proper solution, you can create a cache for your images (e.g. in the Activator class). You explicitly cache the image in the execDecorateMethod (before calling cell.setIconId), and retrieve it from cache in getIcon of the SwingEnvironment.

Let me know if you need further information.

Stephan
Re: ImageColumn [message #902750 is a reply to message #902453] Mon, 20 August 2012 09:19 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
Hi there

Actually it should not be necessary to override any method in the swing environment. Just put the icon in the recources/icons folder of your client plugin and it should automatically be loaded and even cached.

Regards
Claudio
Re: ImageColumn [message #902797 is a reply to message #902374] Mon, 20 August 2012 13:37 Go to previous messageGo to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
Putting images/icons into the resources folder is only possible for static images. But how to display dynamic images e.g. data uploaded by an user to an ImageField/ImageColumn?

The workaround proposed by Stephan seems to be ok for Swing, but it would be nice to do this without GUI framework dependency (SWT, Swing, RAP).
Re: ImageColumn [message #902889 is a reply to message #902797] Mon, 20 August 2012 22:24 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
Hi Adrian

I will create an example application for you. It should work with any supported GUI framework. Just the part of overwriting the getIcon method needs to be done in all environments, the other code does not depend on a specific GUI.

Stephan
Re: ImageColumn [message #903127 is a reply to message #902889] Wed, 22 August 2012 07:21 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
Have a look at Display images in an a table page for a step-by-step description. The link for the example application is at the bottom of the page.

Regards
Stephan
Re: ImageColumn [message #904839 is a reply to message #902374] Wed, 29 August 2012 08:55 Go to previous messageGo to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
Thanks for your wiki entry, Stephan.
It works as described.

The only problem remaining, the cell view seems to cutoff the image. It is not the size shown when debugging the Image creation in StandaloneRwtEnvironment.

index.php/fa/11317/0/
  • Attachment: imageCol.png
    (Size: 3.82KB, Downloaded 574 times)
Re: ImageColumn [message #905841 is a reply to message #904839] Fri, 31 August 2012 07:21 Go to previous message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
Hi Adrian

This may be a limitation of the swt and therefore rap table, but I don't know really. Have you tried to use html content? If you are using Scout 3.8.0 you can refer to registered images with cid:.

Example (not tested):
<html>
<img width="16" height="16" src="cid:iconId"/>
</html>

As far as I know this only works with the rap ui so far.

BTW: Even though loading dynamic images by overriding IRwtEnvironment#getIcon() works, it looks a little complicated to me. It should be far easier by implementing a custom IIconProviderService which is able to load the images dynamically.

Regards
Claudio
Previous Topic:Script in AbstractBrowser
Next Topic:Calendar field improvements
Goto Forum:
  


Current Time: Wed Apr 24 19:38:54 GMT 2024

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

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

Back to the top