fredsa / gwt-dnd

Library providing easy to use mouse or touch based drag-and-drop capabilities to GWT
43 stars 41 forks source link

Error in AbstractInsertPanelDropController #191

Open loresarti74 opened 8 years ago

loresarti74 commented 8 years ago

Hi, I'm using gwt-dnd in my application and I experienced an error in the method onMove implemented in AbstractInsertPanelDropController. My drop controller is constituted by a VerticalPanel and it is implemented by means of a VerticalPanelDropController. The vertical panel is added to an absolute panel A, whereas A is added to a content panel. The height of the content panel is smaller than the height of A, so a vertical scroll bar is added. When the content panel automatically scrolls during the drag operation, the onMove method in the AbstractInsertPanelDropController causes a RunTime error (Null Pointer exception). As a matter of fact, the attribute positioner of the class, that represents the widget that shows the preview of the drag operation, becomes null during the scroll and the call to the method dropTarget.insert(positioner, targetIndex) rises the above error. Unfortunately, the attribute positioner is private and has no getter. So, in order to fix the bug, I should completely reimplement both AbstractInsertPanelDropController and VerticalPanelDropController, in order to fix the onMove behavior. In my actual implementation, when positioner becomes null, it is recomputed again using the method newPositioner. I don't know exactly if this method is the best one but actually it works.

I hope my submission can be helpful for the mainteinance of the library.

loresarti74