How to get JNode that is droped to a view


#1

I am new to JGO, doing some experiment with it right now. I have a problem with getting the droped object in JGoView.
void jGoView_WorkFlow_viewChanged(JGoViewEvent e) {
JGoObject obj = null;
switch (e.getHint()){
case JGoViewEvent.EXTERNAL_OBJECTS_DROPPED:
System.out.println(“EXTERNAL_OBJECTS_DROPPE”);
obj =((JGoObject) e.getJGoObject()).getTopLevelObject();
if(obj == null)
System.out.println("Null objects ");
// jp.remove();
else
//do something with this dropped JGoObject.
break;
}
but, I always get a null pointer with e.getJGoObject ()here. What method should I use? how to solve this problem?
Thanks a lot.
Li Wang


#2
There might be more than one object that is dropped by the user, so we cannot depend on the value of getJGoObject(). Instead, that event assumes that the view's selection holds all the objects that were dropped, or that you have some other way of identifying the new objects (perhaps in your override of JGoView.doDrop).