Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Own Palette Design in GEF Editor
Own Palette Design in GEF Editor [message #1863051] Fri, 12 January 2024 16:20 Go to next message
Sebastian Heinrich is currently offline Sebastian HeinrichFriend
Messages: 28
Registered: July 2018
Junior Member
Hello

I want to create my own Palette in an GEF Editor.
The layout/design of the palette should be as in GEF 3 with the GraphicalEditorWithPalette. A constantly shown palette on the left side with "categories" sorting the elements of the palette.

The plan is to use an JavaFX Accordion for this.
What I did first was to introduce an accordion in PaletteRootPart and adapted the EditorViewersComposite (written along the MvcLogoExampleViewersComposite example code) such that the scrollbars are disabled.

Now I have two problems:

1. The first was that Accordion needs an instantiated JavaFX Toolkit. Since the PaletteRootParts method createContentLayer() is called during dependency injection this is not the case. But (and that took me a lot of time) the exception is hidden by the behaviour of org.eclipse.gef.common.adapt.inject.Adapterjector. The AdaptorInjector catches this exception and puts it into a List of Strings. The missleading exception that is then thrown later in the process is a NoClassDefinitionFoundException.
I figured out a solution by only creatinga Group in this method and creating the rest of the stuff (Accordion and TitledPanes etc. ) later.

2. The next problem is then, that one can never get rid of the "behaviour" of InfiniteCanvas.
E.g. the Accordion should stick to the top but as soon as it is scrolled inside the palette the Accordion moves.
Or it is possible to zoom - which I don't see a necessity for a palette.
This is just an example of the problems I stumble over.

What I tried is to implement a different behaviour by implementing in the module (subclass of MvcFxModule) that the ViewPortPolicy and/or the ScrollGesture is only put into the adapterMapBinder on the CONTENT_VIEWER_ROLE.
But this had no effect. Whether it was due to an missconfigured module by myself or whether it was because it is the wrong approach I don't know for sure.

The only possible solution I see is to write my own canvas and PaletteViewer (implementing then a IPaletteViewer extends IViewer) interface. This I got successfull to run - just copying the InviniteCanvas and InfiniteCanvasViewer as a test whether I am able to change the module such that for the content viewer the InfiniteCanvasViewer and for the palette my own PaletteViewer is used.

But I wonder now what your suggestion would be. What is the best approach to have a very simple palette Viewer as described.
Changing the injection behaviour in the module or writing an own Canvas and its viewer?
Since the IViewer interface states that it is not intended to be subclassed I am not sure.
How else can I configure the module in a way that it uses for PaletteViewer and ContentViewer different viewer classes - Since the IViewer Interface is bound to InfiniteCanvasViewer and LATER the PaletteRootPart is bound as Adapter for the IViewer I see only the possibility with my own interface.

Is it clear what I try to do? I hope my (long) explanation give a hint of what I tried so far and what my goal is.
Can you advise please?

Many thanks for help in advance
Re: Own Palette Design in GEF Editor [message #1863385 is a reply to message #1863051] Tue, 30 January 2024 14:57 Go to previous message
Sebastian Heinrich is currently offline Sebastian HeinrichFriend
Messages: 28
Registered: July 2018
Junior Member
I have found a solution by myself now.

I did as described above already and stick almost to the GEF MVC example:
1. Within PaletteRootParts "createContentLayer"-Method only create a Group (or only return the Group created in super method call).
2. I created another Method that takes a Group as parameter and fills the pallete group with an accordion.

The trick is now to call the method from 2. AFTER the JfavaFX is initialized.
This means, by sticking again to the GEF MVX Logo example:
Within the class that extends AbstractFXView the method createPartControl is called from eclipse platform.
Here one can get the PaletteRootPart with getDomain().getAdapter(AdapterKey.get(IViewer.class,YourPaletteViewer.PALETTE_VIEWER_ROLE))
Then one is able to call the fill palette group method. This time it will work because the JavaFX platform is already properly initialized.

The second problem was that I was not sure whether the InfiniteCanvasViews is the correct viewer to be user for that kind of palette.
I think it is and can be used as is - fortunately one can disable the scrolling behaviour in the Guice Module with NOT calling
bindPanOrZoomOnScrollHandlerAsIRootPartAdapter and bindChangeViewportPolicyAsIRootPartAdapter as I accidentially did.
The guice dependency injection combinded with the adapter pattern (see Alexander Nyssen post here http://nyssen.blogspot.com/2014/11/) results in a very huge and not very clear module class from my point of view.
The advantage of using the infiniteCanvasViewer is obviously that e.g. a feedback layer ect. exists ...
My question is therefore solved.


Previous Topic:Running GEF5 with Open JDK 17 and Open JavaFX 17 on Eclipse 4.25
Next Topic:Adding connection decorations =GEF Mindmap Tutorial series.
Goto Forum:
  


Current Time: Wed Feb 05 04:55:58 GMT 2025

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

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

Back to the top