Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Is it possible to use FontIcons in a menu from the application model?
Is it possible to use FontIcons in a menu from the application model? [message #1709360] Sun, 27 September 2015 18:45 Go to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hi,

I see there is support for icons fonts in efxclipse (FontIconView, AwesomeIcons, etc.)

Is it possible to set the icon URI of a menu item to use a font icon?

Greetings
Christoph
Re: Is it possible to use FontIcons in a menu from the application model? [message #1709833 is a reply to message #1709360] Thu, 01 October 2015 12:21 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Here is the path I have followed so far:

1) Add OSGi service implementation of IconFontProvider

I used the implementation AwesomeIconFontProvider in
at.bestolution.efxclipse.icons.fontawsome on GitHub.
(I modified the MANIFEST a little bit in my own fork to export the packages.)

=> Now it is possible to use the efxclipse control FontIconView

FontIconView fontIconView = new FontIconView();
fontIconView.setFont(Font.font("FontAwesome"));
fontIconView.setIcon(FontIcon.create(AwesomeIcons.FA_BOMB.getName()));

2) Add OSGi service implementation of GraphicNodeProvider

I addes org.eclipse.fx.ui.services.controlprovider to my product
which provides a GraphicNodeProvider OSGi service for font icons
(implemented by FontIconViewNodeProvider)

=> Now it is possible to set the IconURI in the application model e4xmi to use a font icon

Format: icon://<font family>:<icon name>?providerName=fx.iconprovider
Example: iconURI="icon://FontAwesome:fa-flask?providerName=fx.iconprovider"

This works great! Pretty nice Smile

When I close the app I see an ugly exception in the log that seems to happen in
ProviderComponent#removeGraphicNodeProvider. I filed Bug 478801 for this.

Next up: Find out how to style this stuff with css ...

Re: Is it possible to use FontIcons in a menu from the application model? [message #1709836 is a reply to message #1709833] Thu, 01 October 2015 12:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 01.10.15 14:21, Christoph Keimel wrote:
> Here is the path I have followed so far:
>
> 1) Add OSGi service implementation of IconFontProvider
>
> I used the implementation AwesomeIconFontProvider in
> https://github.com/BestSolution-at/efxclipse_addons on GitHub. (I
> modified the MANIFEST a little bit in
> https://github.com/ckeimel/efxclipse_addons to export the packages.)
>
> => Now it is possible to use the efxclipse control FontIconView
>

With the nightlies this is not required anymore because font-awesome is
already there ;-)

> FontIconView fontIconView = new FontIconView();
> fontIconView.setFont(Font.font("FontAwesome"));
> fontIconView.setIcon(FontIcon.create(AwesomeIcons.FA_BOMB.getName()));
> 2) Add OSGi service implementation of GraphicNodeProvider
>
> I addes org.eclipse.fx.ui.services.controlprovider to my product
> which provides a GraphicNodeProvider OSGi service for font icons
> (implemented by FontIconViewNodeProvider)
>
> => Now it is possible to set the IconURI in the application model e4xmi
> to use a font icon
>
> Format: icon://<font family>:<icon name>?providerName=fx.iconprovider
> Example: iconURI="icon://FontAwesome:fa-flask?providerName=fx.iconprovider"
>

First I'd prefer the iconfont:// as the protocol but we have more ideas.
If you file a bugzilla we can discuss other ways how to make font-icon
support available (which BTW also solves the CSS stuff :-).

Tom
Re: Is it possible to use FontIcons in a menu from the application model? [message #1709838 is a reply to message #1709833] Thu, 01 October 2015 12:50 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
[...]

> This works great! Pretty nice :)
>

Yeah I'm sometimes baffled myself how things come together (when I did
the @Preference stuff I had a similar experience)

> When I close the app I see an ugly exception in the log that seems to
> happen in ProviderComponent#removeGraphicNodeProvider. I filed
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=478801 for this.
>

Stupid mistake - i pushed the fix ;-)

Tom
Re: Is it possible to use FontIcons in a menu from the application model? [message #1709854 is a reply to message #1709836] Thu, 01 October 2015 13:53 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 01.10.15 14:40, Tom Schindl wrote:
> On 01.10.15 14:21, Christoph Keimel wrote:
>> Here is the path I have followed so far:
>>
>> 1) Add OSGi service implementation of IconFontProvider
>>
>> I used the implementation AwesomeIconFontProvider in
>> https://github.com/BestSolution-at/efxclipse_addons on GitHub. (I
>> modified the MANIFEST a little bit in
>> https://github.com/ckeimel/efxclipse_addons to export the packages.)
>>
>> => Now it is possible to use the efxclipse control FontIconView
>>
>
> With the nightlies this is not required anymore because font-awesome is
> already there ;-)
>
>> FontIconView fontIconView = new FontIconView();
>> fontIconView.setFont(Font.font("FontAwesome"));
>> fontIconView.setIcon(FontIcon.create(AwesomeIcons.FA_BOMB.getName()));
>> 2) Add OSGi service implementation of GraphicNodeProvider
>>
>> I addes org.eclipse.fx.ui.services.controlprovider to my product
>> which provides a GraphicNodeProvider OSGi service for font icons
>> (implemented by FontIconViewNodeProvider)
>>
>> => Now it is possible to set the IconURI in the application model e4xmi
>> to use a font icon
>>
>> Format: icon://<font family>:<icon name>?providerName=fx.iconprovider
>> Example: iconURI="icon://FontAwesome:fa-flask?providerName=fx.iconprovider"
>>
>
> First I'd prefer the iconfont:// as the protocol but we have more ideas.
> If you file a bugzilla we can discuss other ways how to make font-icon
> support available (which BTW also solves the CSS stuff :-).
>

Oh this guy is from us :-) so I guess we can not change the URI protocol
anymore because its kind of API

Tom
Re: Is it possible to use FontIcons in a menu from the application model? [message #1709951 is a reply to message #1709854] Fri, 02 October 2015 08:19 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Thomas Schindl wrote on Thu, 01 October 2015 15:53

Oh this guy is from us Smile so I guess we can not change the URI protocol
anymore because its kind of API

Yeah, but we could deprecate it. I would also be in favor of iconfont:// as it is clearer to read.
I opened Bug 478872 for further discussion.
Re: Is it possible to use FontIcons in a menu from the application model? [message #1709953 is a reply to message #1709951] Fri, 02 October 2015 08:34 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
eventually we never released it in any repo if not mistaken (eg it does
not have a pom.xml) so we would break you but most likely nobodyelse

Tom

On 02.10.15 10:19, Christoph Keimel wrote:
> Thomas Schindl wrote on Thu, 01 October 2015 15:53
>> Oh this guy is from us :) so I guess we can not change the URI protocol
>> anymore because its kind of API
>
> Yeah, but we could deprecate it. I would also be in favor of iconfont://
> as it is clearer to read.
> I opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=478872 for
> further discussion.
>
Previous Topic:Unable to display invisible Dialog
Next Topic:Forwarding Program Args to fxpackager
Goto Forum:
  


Current Time: Fri Apr 26 21:49:01 GMT 2024

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

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

Back to the top