Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Generate a tree node with icon and multiline text using GEF(Generate a tree node with icon and multiline text using GEF)
Generate a tree node with icon and multiline text using GEF [message #1814195] Thu, 05 September 2019 13:26 Go to next message
girijanandan nucha is currently offline girijanandan nuchaFriend
Messages: 25
Registered: January 2019
Location: Bangalore, India
Junior Member
Hi All,

I want to create a tree which has a node containing an image, multiline text, and also has a partition line. (as attached in image)

I was thinking to build using GeometryNode.
Please suggest if is this right path ?
If not, any help to achieve attached result is very much appreciated.

Thanks and Regards,
Giri
  • Attachment: vep_node.PNG
    (Size: 3.91KB, Downloaded 85 times)
Re: Generate a tree node with icon and multiline text using GEF [message #1814197 is a reply to message #1814195] Thu, 05 September 2019 14:09 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi,

you do not need GeometryNode for this kind of visualisation. GeometryNode is only useful for displaying GEF geometries. It comes with some gimmicks, e.g. resizing and (invisible) clickable-area around the rendered geometry.

I would suggest that you have a look at the following JavaFX nodes: VBox, HBox, ImageView, Text, Separator.

It should be easy to compose something similar.

The node hierarchy could potentially look something like this:

VBox
- HBox (css-class: "title")
-- ImageView
-- Text
-- Text (aligned right)
- Separator
- VBox (css-class: "details")
-- Text
-- Text

The individual colors, stroke widths, icons, etc. could be specified via CSS.

Best regards,
Matthias
Re: Generate a tree node with icon and multiline text using GEF [message #1814200 is a reply to message #1814197] Thu, 05 September 2019 14:31 Go to previous messageGo to next message
girijanandan nucha is currently offline girijanandan nuchaFriend
Messages: 25
Registered: January 2019
Location: Bangalore, India
Junior Member
Hi Matthias,

Thanks for quick reply.
I will surely tryout JavaFX nodes.

I have few follow up questions
1) Is there a provision to add mouse double click action as well on these nodes ?
2) I am planning to use SpaceTreeLayoutAlgorithm for displaying my tree. How to ensure that my tree always fits in ViewPort ?
3) How do i convert from javafx.scene.Node to org.eclipse.gef.graph.Node (Necessary for creating Graph) ?

Thanks and Regards,
Giri

[Updated on: Thu, 05 September 2019 14:39]

Report message to a moderator

Re: Generate a tree node with icon and multiline text using GEF [message #1814203 is a reply to message #1814200] Thu, 05 September 2019 15:06 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi,

1) JavaFX supports mouse click handlers where you can check if the click-count equals 2 to test for double-click. In the context of GEF 5.x you would implement an IOnClickHandler and test for double-click inside the click() method.
2) I believe the viewport can be set via LayoutProperties [1].
3) That does not make sense to me. Javafx.scene.Node represents a node in a scene graph (visual), o.e.gef.graph.Node represents a node in a general graph model. Usually, it is the other way around, i.e. you compose a GEF Graph for which Content-Parts are derived that create and control the visualisation (javafx.scene.Node).

Best regards,
Matthias

[1] https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.gef.layout.doc%2Freference%2Fapi%2Forg%2Feclipse%2Fgef%2Flayout%2FLayoutProperties.html&anchor=BOUNDS_PROPERTY
Re: Generate a tree node with icon and multiline text using GEF [message #1814222 is a reply to message #1814203] Fri, 06 September 2019 05:26 Go to previous messageGo to next message
girijanandan nucha is currently offline girijanandan nuchaFriend
Messages: 25
Registered: January 2019
Location: Bangalore, India
Junior Member
Hi,

Thanks for answers 1) and 2)
Let me rephrase question 3.

3) I meant to ask, how do i create a model of graph with node that will be rendered as similar to attached image in 1st question ?

I am assuming following things,
1) If i want to use SpaceTreeLayoutAlgorithm, I need my model to be of type o.e.gef.graph.Graph.
2) Nodes in o.e.gef.graph.Graph. are of type o.e.gef.graph.Node.

I am still new to GEF, please do not mind if i am asking a very basic question.

Thanks,
Giri

[Updated on: Fri, 06 September 2019 05:29]

Report message to a moderator

Re: Generate a tree node with icon and multiline text using GEF [message #1814452 is a reply to message #1814222] Wed, 11 September 2019 15:18 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi,

the graph model is usually derived from your content model. The visualisation is then controlled by the content parts. You could, for instance, extend Zest NodePart and adjust it to your needs, or implement your own.

1) SpaceTreeLayoutAlgorithm uses o.e.gef.Graph as input and output. However, you could use any content model and just transform it to compute a layout.
2) Exactly.

Feel free to ask any questions. I will tell you when an answer exceeds the scope of the forum / requires extensive elaboration. However, I already advised you to do the mind map tutorial, because I am certain it would resolve some confusion.

Edit: I just realised that I advised you to do "a tutorial" without providing a link to the mind map tutorial, so, here you are: https://www.itemis.com/en/gef/tutorials/part-1-the-foundations/

Best regards,
Matthias

[Updated on: Wed, 11 September 2019 15:29]

Report message to a moderator

Re: Generate a tree node with icon and multiline text using GEF [message #1814813 is a reply to message #1814195] Thu, 19 September 2019 05:51 Go to previous messageGo to next message
girijanandan nucha is currently offline girijanandan nuchaFriend
Messages: 25
Registered: January 2019
Location: Bangalore, India
Junior Member
Hi Matthias ,

I am able to render the tree in eclipse IDE now.

However, I am facing following issue when i try to render from same application built through maven.

Caused by: java.lang.NoClassDefFoundError: javafx/beans/property/BooleanProperty
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at org.eclipse.e4.core.internal.di.InjectorImpl.getDeclaredConstructors(InjectorImpl.java:785)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:343)
... 65 more
Caused by: java.lang.ClassNotFoundException: javafx.beans.property.BooleanProperty cannot be found by org.eclipse.gef.mvc.fx_5.1.0.201906180202
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)
at java.lang.ClassLoader.loadClass(Unknown Source)

Any idea how to resolve this issue ?

Thanks and Regards,
Giri
Re: Generate a tree node with icon and multiline text using GEF [message #1814816 is a reply to message #1814813] Thu, 19 September 2019 07:04 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
It seems to me like JavaFX is either missing or not correctly loaded in an OSGi context. You can take a look at how GEF is using e(fx)clipse to load JavaFX.

Depending on Java version (e.g. 7, 8, 9, 11, 12, 13) and vendor (Oracle JDK vs. OpenJDK) this can be a cumbersome problem to solve (a colleague of mine is setting up environments for Java 8 and Java 11 with OpenJDK and it is a PITA).

I would like to have the time to investigate this myself, but that is unfortunately not possible ATM. That's why I am awaiting the results of my colleague, and might be able to give a more helpful answer in the future.

Best regards,
Matthias
Re: Generate a tree node with icon and multiline text using GEF [message #1814855 is a reply to message #1814816] Fri, 20 September 2019 11:37 Go to previous messageGo to next message
girijanandan nucha is currently offline girijanandan nuchaFriend
Messages: 25
Registered: January 2019
Location: Bangalore, India
Junior Member
Hi Matthias,

I was able to resolve the issue.
Following post helped me.
https://www.eclipse.org/forums/index.php/t/1087013/

I have few more questions
1) How to disable the + and - hover options on the nodes of tree ?
2) Is there any example for using CompositeLayoutAlgorithm ?

Thanks,
Giri


Re: Generate a tree node with icon and multiline text using GEF [message #1815034 is a reply to message #1814855] Tue, 24 September 2019 14:20 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi,

have a look at the documentation:

1) https://github.com/eclipse/gef/wiki/Zest#hidehoverhandlepart-showhiddenneighborshoverhandlepart-zestfxhoverhandlepartfactory

You can exchange the hover handle part factory / hover-intent handle part factory in order to change what hover handles / hover-intent handles are generated, respectively.

2) https://github.com/eclipse/gef/wiki/Layout#algorithms and https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.gef.layout.doc%2Freference%2Fapi%2Forg%2Feclipse%2Fgef%2Flayout%2FILayoutAlgorithm.html

The wiki gives examples for some of the algorithms and the javadoc explains how CompositeLayoutAlgorithm works.

Best regards,
Matthias
Re: Generate a tree node with icon and multiline text using GEF [message #1815076 is a reply to message #1815034] Wed, 25 September 2019 08:53 Go to previous message
girijanandan nucha is currently offline girijanandan nuchaFriend
Messages: 25
Registered: January 2019
Location: Bangalore, India
Junior Member
Hi Matthias,

1) Worked perfectly.
2) I will give this a try.

Thanks for the help, I am able to render the tree now.
I have some layout related problem, I will open separate thread for that.

Thanks and Regards,
Giri

[Updated on: Wed, 25 September 2019 11:26]

Report message to a moderator

Previous Topic:GEF5 MVC - Large Model Performance
Next Topic:GEF 5.1.0 compatibilty with gtk3
Goto Forum:
  


Current Time: Mon Oct 18 05:44:05 GMT 2021

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

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

Back to the top