fredsa / gwt-dnd

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

Creating a PickupDragController with boundaryPanel = null causes NPE #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using GWT 1.4.61 & dnd 2.0.2.

According to the API I should be able to create a PickupDragController with
a boundaryPanel set to null:
"the desired boundary panel or null if entire page is to be included".

However when I do this, it will cause a nullpointer exception further down
the hierarchy of parent calls:
java.lang.NullPointerException: null
    at
com.allen_sauer.gwt.dnd.client.drop.AbstractDropController.<init>(AbstractDropCo
ntroller.java:46)
    at
com.allen_sauer.gwt.dnd.client.drop.AbstractPositioningDropController.<init>(Abs
tractPositioningDropController.java:32)
    at
com.allen_sauer.gwt.dnd.client.drop.AbsolutePositionDropController.<init>(Absolu
tePositionDropController.java:63)
    at
com.allen_sauer.gwt.dnd.client.drop.BoundaryDropController.<init>(BoundaryDropCo
ntroller.java:33)
    at
com.allen_sauer.gwt.dnd.client.PickupDragController.newBoundaryDropController(Pi
ckupDragController.java:299)
    at
com.allen_sauer.gwt.dnd.client.PickupDragController.<init>(PickupDragController.
java:98)
    at
com.ycp.client.ui.ClassplanEditVisualPanel.<init>(ClassplanEditVisualPanel.java:
36)

Is the documentation not up to date here and has this changed in 2.x? Or is
it a problem with the code?

Cheers,
Martijn

Original issue reported on code.google.com by martijn....@gmail.com on 15 Dec 2007 at 11:00

GoogleCodeExporter commented 9 years ago
Martijn,

Thanks for the detailed description/bug report!

I had just noticed this myself, committed a pair of updates in r587/r588 for 
the next
release: I decided to simplify and no longer allow 'null', but instead require 
client
code to explicitly pass 'RootPanel.get()'.

This change amounts to less code in the gwt-dnd implementation (all those null
checks), and makes client code more readable, i.e. the 'boundaryPanel' 
parameter is
'RootPanel.get()' instead of 'null'.

Original comment by fredsa on 16 Dec 2007 at 1:35

GoogleCodeExporter commented 9 years ago
Javadoc change made for gwt-dnd 2.0.3

Original comment by fredsa on 16 Dec 2007 at 8:51