Cursor shape while dragging

Hi. I have two questions whose answers I cannot figure on my own:



1. What’s the purpose of JGoView.computeAcceptableDrop? What do int values it returns mean?



2. In my class which extends JGoView, I’ve overriden the isDropFlavorAcceptable, dragOver and drop methods to allow changing node name by dragging String onto it. That works perfectly - when I grab JTree node and drag it to canvas, cursor shape shows “doesn’t accept this type of data” until I hover it over the node. At that point, cursor changes into “accepts this type of data” kind of cursor.



However, when I drag a JGo node from JGoPalette to canvas, cursor is in “accepts this type of data” shape all the time, no matter what isDropFlavorAcceptable method returns. I’d like the cursor to behave the same as for the string data flavor, since I want to enable dropping JGo nodes only on specific parts of JGoView canvas. How do I do that?

  1. JGoView.computeAcceptableDrop returns one of the DnDConstants in Swing (such as DnDConstants.ACTION_COPY_OR_MOVE), or one of the DND constants in SWT (such as DND.DROP_COPY | DND.DROP_MOVE).
  2. I’m not sure about the cursor. As you can see in JGoView.java, it should be calling DropTargetDragEvent.rejectDrag or acceptDrag (in Swing) appropriately.
    But the drop behavior is working correctly for you, isn’t it?
  1. I thought so, why does computeAcceptableDrop() exist at all? To check the acceptable DND operations for that drop? For example, if DnDConstants.ACTION_COPY is returned, than only copy is acceptable behavior, and move will be rejected?



    2. I’m not sure either; it happens only when dragging items from JGoPalette, when DataFlavor of dragged object is JGoDocument.getStandardDataFlavor(). If I’m dragging something else (for example, text/plain), than it works. But since I probably won’t be using JGoPalette, I’ll probably pass on that one. BTW, yes, drop behavior works correctly.



    Note: I wasn’t able to look inside .java files since I haven’t bought JGo yet - I wanted to check if it worked for me first. But from what I’ve seen so far, it’s just what I needed, so you’ve got yourself another customer.