Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Customization of the MToolItem rendering
Customization of the MToolItem rendering [message #1387835] Wed, 25 June 2014 17:03 Go to next message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
In my application I need to customize the way the MToolItem with MMenu is rendered. Rather than default SplitMenuButton with ContextMenu, I would like to have something like Button which opens a javafx.stage.Popup with MenuItems rendered in rows (rows ends on separator).
I managed to achieve that by registering custom renderer factory, which simply is a subclass of DefWorkbenchRendererFactory with overridden getToolItemRendererClass() and getToolItemMenuRendererClass() methods. The problem now is that in order to create custom renderers I need to copy much part of the code from DefToolItemRenderer and DefToolItemMenuRenderer in order to customize their behavior. The methods I need to change are private so I can't solve it by extending them.
My question is, if the way I do it is correct or there is some another approach I overlooked?

Thanks,
Jacek
Re: Customization of the MToolItem rendering [message #1387904 is a reply to message #1387835] Wed, 25 June 2014 19:05 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

On 25.06.14 19:03, Jacek Bukowski wrote:
> In my application I need to customize the way the MToolItem with MMenu
> is rendered. Rather than default SplitMenuButton with ContextMenu, I
> would like to have something like Button which opens a
> javafx.stage.Popup with MenuItems rendered in rows (rows ends on
> separator). I managed to achieve that by registering custom renderer
> factory, which simply is a subclass of DefWorkbenchRendererFactory with
> overridden getToolItemRendererClass() and getToolItemMenuRendererClass()
> methods. The problem now is that in order to create custom renderers I
> need to copy much part of the code from DefToolItemRenderer and
> DefToolItemMenuRenderer in order to customize their behavior. The

If you tell me which methods then I can make them protected - still I'd
like to mention that the renderer themselves are not API we'll publish
so you could be broken anytime.

> methods I need to change are private so I can't solve it by extending them.
> My question is, if the way I do it is correct or there is some another
> approach I overlooked?
>

Yes that's the way to go - in 1.1 I plan to provide a way to contribute
renderers to DefWorkbenchRendererFactory using OSGi-Services, so that
you don't need to subclass it.

Another proposal I have for you would be that you contribute your
renderer to e(fx)clipse so that people can flip between the current
split-button and your way of rendering similar to how they can do that
today for the stack-renderer.

Tom
Re: Customization of the MToolItem rendering [message #1388299 is a reply to message #1387904] Thu, 26 June 2014 08:26 Go to previous messageGo to next message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
Thanks for your answer. Currently my code is rather proof-of-concept then something to share. Next days I will try to clean it up and I will then see clearly what methods could be protected and also share the solution with you to check if that is good to contribute.
Re: Customization of the MToolItem rendering [message #1389129 is a reply to message #1388299] Fri, 27 June 2014 11:33 Go to previous messageGo to next message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
I am looking at the newest master branch and I can't see any other Stack renderer then DefStackRenderer. Do I miss something?
Re: Customization of the MToolItem rendering [message #1389138 is a reply to message #1389129] Fri, 27 June 2014 11:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
look into the renderer it makes a check which UI-Element should be created!

Tom

On 27.06.14 13:33, Jacek Bukowski wrote:
> I am looking at the newest master branch and I can't see any other Stack
> renderer then DefStackRenderer. Do I miss something?
Re: Customization of the MToolItem rendering [message #1389380 is a reply to message #1389138] Fri, 27 June 2014 18:24 Go to previous messageGo to next message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
Thanks for pointing me that. I have created some basic implementation. It is still far from perfect but I would like to get your feedback if that goes into a good direction. Please see attached Popup.zip with the files I touched.

The one drawback is that javafx.stage.Popup does not allow any styling (so also does not have any look itself), so my popup is quite ugly.

Any comments appreciated.

  • Attachment: Popup.zip
    (Size: 15.85KB, Downloaded 125 times)
Re: Customization of the MToolItem rendering [message #1391050 is a reply to message #1389380] Mon, 30 June 2014 11:23 Go to previous messageGo to next message
Uwe San is currently offline Uwe SanFriend
Messages: 119
Registered: January 2012
Senior Member
As Jacek said, some details still need to be discussed, but it would be very much appreciated if this approach made it into e(fx)clipse. Smile
Re: Customization of the MToolItem rendering [message #1393777 is a reply to message #1391050] Fri, 04 July 2014 08:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Jacek - please create a bugzilla and attach your code there.

Tom

On 30.06.14 13:23, Uwe San wrote:
> As Jacek said, some details still need to be discussed, but it would be
> very much appreciated if this approach made it into e(fx)clipse. :)
Re: Customization of the MToolItem rendering [message #1393813 is a reply to message #1393777] Fri, 04 July 2014 09:57 Go to previous message
Jacek Bukowski is currently offline Jacek BukowskiFriend
Messages: 15
Registered: May 2014
Junior Member
Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=438908
Previous Topic:Using JavaFX in an Eclipse Plugin: Can't import workbench3
Next Topic:JavaFX Preview
Goto Forum:
  


Current Time: Tue Mar 19 09:47:46 GMT 2024

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

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

Back to the top