Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Traverse diagram elements based on underlying EObject Properties
Traverse diagram elements based on underlying EObject Properties [message #1751389] Mon, 09 January 2017 16:33 Go to next message
Tobias Mehre is currently offline Tobias MehreFriend
Messages: 5
Registered: August 2016
Junior Member
Good evening everybody

maybe it is just too trivial but i didn't manage to handle tab key based traversal of diagram elements. I already searched the forum but had no luck.

I already managed to handle tab key and the focusPart retrieval implementing a custom KeyHandler but now i got stucked iterating over all elements and checking underlying model attributes.

e.g.:
the diagram shows some kind of path (startpoint > first point > second point> .. >lastpoint). The points are connected via FreeFormConnections decorated with a text label.

What would be the best approach to navigate to the next element that is editable? The property "editable" should be derived from the model.

Thanks in advance for your help.
Re: Traverse diagram elements based on underlying EObject Properties [message #1751417 is a reply to message #1751389] Tue, 10 January 2017 07:46 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1886
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Tobias,

if I understood you correctly, you want to use the tab key to navigate through the diagram and select the shapes in an order you specify programmatically, right? I haven't tried that, and I'm not sure if that will be possible...

Graphiti relies on GEF for the keyboard based navigation and I have not heared of any functionality allowing to influence GEF on the next element to select on keyboard navigation. Hooking in via KeyHandler as you tried could be the only option. What I can say for sure is that Graphiti does not offer anything here. Maybe you should also ask this question in the GEF forum.

Anyhow, when you have the GEF diagram elements, you might use getModel() on an EditPart to get to the Graphiti shape/connection, then use Graphiti functionality (getBusinessObject) to go to your domain model and check any properties there.

HTH,
Michael

Re: Traverse diagram elements based on underlying EObject Properties [message #1751426 is a reply to message #1751417] Tue, 10 January 2017 09:25 Go to previous messageGo to next message
Tobias Mehre is currently offline Tobias MehreFriend
Messages: 5
Registered: August 2016
Junior Member
Hey Michael,

thanks for your kind reply. The strategy you mentioned matches with my experience so far. Good to know that there is no best way achieving this by using graphiti api only.

In general the algorithm is like:
handle tab key > find suitable sibling > navigate to suitable sibling

Maybe solution could be a nice extension to the graphiti api?? What do you think?
Re: Traverse diagram elements based on underlying EObject Properties [message #1751528 is a reply to message #1751426] Wed, 11 January 2017 08:06 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1886
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Tobias,

Yes, this would be a nice extension to the framework if we get it in a shape that allows general usage.

However, I will most probably not find the time to invest on that in the near future. If you are Interessested and find the time for that, it would be cool if you could contribute on that. The very first step would be to create an enhancement bugzilla.

Michael
Previous Topic:Bring Connection shape to front (z-index)
Next Topic:Custom Undo and Redo Behaviour for CreateConnectionFeature
Goto Forum:
  


Current Time: Sun Apr 22 20:14:19 GMT 2018

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

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