Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Selection Behaviour of edges
Selection Behaviour of edges [message #1801237] Tue, 15 January 2019 17:00 Go to next message
Kyle Girard is currently offline Kyle GirardFriend
Messages: 12
Registered: March 2012
Junior Member
I'm using GEF 5 MVC....

I would like to be able to click an edge on my graph and highlight the connected nodes to make them standout... the highlighted nodes do not need handles or be added to SelectionModel...

I'm guessing that I have to create a custom EdgeSelectionBehavior class ...and some sort of different feedback.... is that the right way or is there another way of accomplishing what I'm attempting?
Re: Selection Behaviour of edges [message #1802909 is a reply to message #1801237] Mon, 18 February 2019 20:05 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Kyle,

there are multiple ways of tackling this (as always).

Some options for implementing the feedback/highlight, graduating from most simple & special to most general & complex:
- Add a JavaFX Effect to the visuals that need highlighting (if possible).
- Render as part of your regular parts, for example, by using an isHighlighted field that you can set and call refreshVisual().
- Reuse selectionFeedbackPartFactory etc. but from another behavior, so that it is independent from SelectionModel.
- Implement custom feedback parts for the highlighting (as well as factory, model, and behavior).

Personally, I like your suggestion, because it is a reusable pattern that can be applied in many situations:
- Create a Model (e.g. HighlightModel)
- Create a Behavior (e.g. HighlightBehavior) that listens to Model changes
- Create a Policy and an Operation for manipulation of the new Model (e.g. ChangeHighlightOperation, HighlightPolicy)
- Create Handlers that write to the Model (e.g. HighlightConnectedOnClickHandler, RemoveHighlightOnClickHandler (at rootpart or something))

That is a solid setup where you can still decide if you want to apply the highlight lightweight (effect, or as part of your parts) or controlled by feedback parts (where you can still decide to reuse selection stuff, e.g. geometry provider, color, etc.).

Best regards,

[Updated on: Mon, 18 February 2019 20:05]

Report message to a moderator

Previous Topic:Part+Visuals
Next Topic:GEF application is slow with Java 11
Goto Forum:

Current Time: Wed Dec 06 18:41:11 GMT 2023

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

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

Back to the top