Page 1 of 1

Graph panel ingores rotate (shift + mouse drag)

PostPosted: Fri Mar 13, 2015 9:19 pm
by mordenkainen
I was working with a graph panel. There were some input, switching between modes, adding and collapsing nodes and so on. And suddenly the panel started to ignore shift + mouse drag event. Drag without shift works normally - the graph is moved. But when I try to rotate it with shift + mouse drag nothing happens. And plenty of stack traces is written to the stderr. They all are identical and complains about Null Pointer Exception.
Code: Select all
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
   at org.wandora.application.gui.topicpanels.graphpanel.mousetools.RotateMouseTool.mouseDragged(
   at org.wandora.application.gui.topicpanels.graphpanel.MouseToolManager.dispatchEvent(
   at org.wandora.application.gui.topicpanels.graphpanel.MouseToolManager.processEvent(
   at org.wandora.application.gui.topicpanels.graphpanel.MouseToolManager.mouseDragged(
   at org.wandora.application.gui.topicpanels.graphpanel.TopicMapGraphPanel.mouseDragged(
   at java.awt.Component.processMouseMotionEvent(
   at javax.swing.JComponent.processMouseMotionEvent(
   at java.awt.Component.processEvent(
   at java.awt.Container.processEvent(
   at java.awt.Component.dispatchEventImpl(
   at java.awt.Container.dispatchEventImpl(
   at java.awt.Component.dispatchEvent(
   at java.awt.LightweightDispatcher.retargetMouseEvent(
   at java.awt.LightweightDispatcher.processMouseEvent(
   at java.awt.LightweightDispatcher.dispatchEvent(
   at java.awt.Container.dispatchEventImpl(
   at java.awt.Window.dispatchEventImpl(
   at java.awt.Component.dispatchEvent(
   at java.awt.EventQueue.dispatchEventImpl(
   at java.awt.EventQueue.access$300(
   at java.awt.EventQueue$
   at java.awt.EventQueue$
   at Method)
   at java.awt.EventQueue$
   at java.awt.EventQueue$
   at Method)
   at java.awt.EventQueue.dispatchEvent(
   at java.awt.EventDispatchThread.pumpOneEventForFilters(
   at java.awt.EventDispatchThread.pumpEventsForFilter(
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(
   at java.awt.EventDispatchThread.pumpEvents(
   at java.awt.EventDispatchThread.pumpEvents(

I could not reproduce this behabior. Newly created graph panels works normally.

Re: Graph panel ingores rotate (shift + mouse drag)

PostPosted: Sat Mar 14, 2015 12:57 am
by akivela
Thanks Mordenkainen. This was a real bug and easily reproduced. Graph rotation used the current topic as a rotation center. If the node for the current topic is closed, there is no rotation center and the rotation fails as you reported.

I have committed a bug fix to Github ( that resolves the rotation center using three steps. First, rotation center is the node of current topic if it is available. If there is no node for the current topic the rotation center is one of the selected topics. And finally, if there is no nodes selected the rotation center is graph panel's center. After these steps, the rotation center should never be null.

Again, thanks for reporting the bug.

Kind Regards,
Aki / Wandora Team