Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Bug In GEF MVC Tutorial
Bug In GEF MVC Tutorial [message #1796191] Mon, 08 October 2018 08:03 Go to next message
Servan Kilec is currently offline Servan KilecFriend
Messages: 7
Registered: October 2018
Junior Member
I just completed the GEF MVC tutorial and I am getting an error where it says that the "MindMapConnectionPart cannot be cast to ITransformableContentPart". This error occurs if I select the whole content and try to resize it. I cloned the GEF tutorial file from git and the error occurs in there too.

the stack:
java.lang.ClassCastException: com.itemis.gef.tutorial.mindmap.parts.MindMapConnectionPart cannot be cast to org.eclipse.gef.mvc.fx.parts.ITransformableContentPart
	at org.eclipse.gef.mvc.fx.handlers.ResizeTranslateFirstAnchorageOnHandleDragHandler.getTargetPart(ResizeTranslateFirstAnchorageOnHandleDragHandler.java:203)
	at org.eclipse.gef.mvc.fx.handlers.ResizeTranslateFirstAnchorageOnHandleDragHandler.isMultiSelection(ResizeTranslateFirstAnchorageOnHandleDragHandler.java:222)
	at org.eclipse.gef.mvc.fx.handlers.ResizeTranslateFirstAnchorageOnHandleDragHandler.isResizeTranslate(ResizeTranslateFirstAnchorageOnHandleDragHandler.java:254)
	at org.eclipse.gef.mvc.fx.handlers.ResizeTranslateFirstAnchorageOnHandleDragHandler.startDrag(ResizeTranslateFirstAnchorageOnHandleDragHandler.java:282)
	at org.eclipse.gef.mvc.fx.gestures.ClickDragGesture.press(ClickDragGesture.java:426)
	at org.eclipse.gef.mvc.fx.gestures.ClickDragGesture$1.handle(ClickDragGesture.java:106)
	at org.eclipse.gef.mvc.fx.gestures.ClickDragGesture$1.handle(ClickDragGesture.java:1)
	at com.sun.javafx.event.CompositeEventHandler$NormalEventFilterRecord.handleCapturingEvent(CompositeEventHandler.java:282)
	at com.sun.javafx.event.CompositeEventHandler.dispatchCapturingEvent(CompositeEventHandler.java:98)
	at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:223)
	at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:180)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
	at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
	at com.sun.glass.ui.View.notifyMouse(View.java:937)
Re: Bug In GEF MVC Tutorial [message #1802541 is a reply to message #1796191] Mon, 11 February 2019 17:16 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Servan,

thank you for reporting this issue. This should not happen of course.

There are multiple underlying problems here, I believe:

1) The name of the handler in the stack trace (ResizeTranslateFirstAnchorageOnHandleDragHandler) implies that it should only be used to resize/translate a single, resizable and transformable content part for which resize/translate handles were generated for the user to interact with. I believe that the same handles that are generated for a single selection are also generated for a multi-selection. Therefore, the same handler is executed also for the multi-selection.

2) The connection part does not implement IBendableContentPart. Therefore, it will not work together nicely with the other GEF concepts w.r.t. connections (e.g. bending).

There are several options for implementing resize of a multi-selection. One option is subclassing both ResizeTranslateFirstAnchorageOnHandleDragHandler and ResizeTransformSelectedOnHandleDragHandler. The RTFAOHDH needs to be disabled for multi-selections. The RTSOHDH needs to be disabled for single selections and it needs to disregard connection parts.

Alternatively, you could make ConnectionPart implement IBendableContentPart.

Best regards,
Matthias
Re: Bug In GEF MVC Tutorial [message #1803112 is a reply to message #1802541] Fri, 22 February 2019 15:17 Go to previous message
Servan Kilec is currently offline Servan KilecFriend
Messages: 7
Registered: October 2018
Junior Member
Hi Matthias

Thank you very much I implemented IBendableContentPart<Connection> to the ConnectionPart and now it works like a charm.

Best regards
Servan Kilec

[Updated on: Wed, 20 March 2019 08:34]

Report message to a moderator

Previous Topic:Create general handler for creating/deleting parts
Next Topic:How to make dashed and customized Connection
Goto Forum:
  


Current Time: Fri Apr 19 20:49:59 GMT 2024

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

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

Back to the top