Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Get Font Image on the fly
Get Font Image on the fly [message #1827795] Sun, 24 May 2020 09:56 Go to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 128
Registered: June 2014
Location: Paris
Senior Member
Hello,
I have a spécific need to create font image from image stored in database on the fly and I do not know if this is possible.
I have an object named group that has an image and I am creating tiles for each instance, I saw that eclipse handle much better font icons than normal icons in case of default tiles
method
getconfiguredOverViewIcon()
so I would like to implement a methode that basicly get the binaryresource of the image from databse and create the font icon when called.
is this possible ?
Kind Regard

Re: Get Font Image on the fly [message #1827903 is a reply to message #1827795] Tue, 26 May 2020 15:17 Go to previous message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
Hi,

the icons are resolved using IIconProviderServices. You could implement a custom icon provider which loads your icons from the database, from the filesystem or from memory, whatever you prefer. You don't need to convert your images to font icons, just return a new IconSpec with the image as content (which is a byte[]).

You can either extend from AbstractIconProviderService which uses an internal cache, in this case, override "findIconSpec". If you have a lot of different icons or the icons can change you maybe don't want to use a cache, in that case, just implement the interface directly and override "getIconSpec".
In both cases you could use a prefix for these kind of icons and abort if the name does not contain the prefix.

  @Override
  public IconSpec getIconSpec(String iconName) {
    if (!iconName.startsWith(PREFIX)) {
      return null;
    }
    // load icon here
  }
Previous Topic:How to create Field Like BSI
Next Topic:Store Cookie in AccessController
Goto Forum:
  


Current Time: Thu Apr 25 14:37:49 GMT 2024

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

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

Back to the top