Registering children of a group [message #1729403] |
Wed, 13 April 2016 17:01  |
Eclipse User |
|
|
|
I have a couple of parts with complex content, so I am using a Group to render them. That is, my part extends AbstractFXContentPart<Group>, and adds the children in createVisual().
I do it like this because the children are purely used for visual purposes, and have no corresponding model objects. An example is a line of trees (the overall view represents a map). The model object is called TreeLine, and is represented by a (gef4.geometry) Polyline. To render this, I have a number of images of trees, and so I create a Group containing several ImageViews spaced along the outline of the Polyline. I don't want to have the actual polyline rendered, so I have also created a transparent javafx Polyline and added that to the Group to act as a proxy for the shape's outline.
In my selection handle part factory, I look for a target of that type, and instead of getting the Group's outline, I use the proxy Polyline to generate the selection handles. The problem is that the selection handle factory is never getting invoked.
I presume this is because it is the Group that is getting registered as the visual for the part, and it is transparent to mouse events and so is not getting picked up by the FXClickDragTool. Is there a way to register the proxy Polyline so that it will pick up the mouse events?
|
|
|
|
Re: Registering children of a group [message #1729458 is a reply to message #1729442] |
Thu, 14 April 2016 05:54  |
Eclipse User |
|
|
|
It's okay, I found the issue. I had refactored my different parts (around 40) into 5 base classes, and then one superclass above those 5, so that I could attach the common policies to the top superclass. The two parts that didn't fit neatly into the other types had just been left extending AbstractFXContentPart directly - I thought I had refactored them to use the common superclass. As you said, all the child visuals are getting registered, they just weren't picking up the common policy. When I changed them to extend the superclass, the selection handles appeared okay.
Thanks Matthias.
|
|
|
Powered by
FUDForum. Page generated in 0.08704 seconds