Package docking.dnd

Class DragSrcAdapter

java.lang.Object
docking.dnd.DragSrcAdapter
All Implemented Interfaces:
DragSourceListener, EventListener

public class DragSrcAdapter extends Object implements DragSourceListener
Adapter class that receives notifications in order to provide drag over effects.

When the operation ends, this class receives a dragDropEnd message, and is responsible for checking the success of the operation. If the operation was successful, and if it was a Move, then this class will remove the source data.

  • Field Details

    • dragComponent

      protected Draggable dragComponent
  • Constructor Details

    • DragSrcAdapter

      public DragSrcAdapter(Draggable dragComponent)
      Constructor
      Parameters:
      dragComponent - component that can be dragged.
  • Method Details

    • dragDropEnd

      public void dragDropEnd(DragSourceDropEvent e)
      Called when the drag-drop operation completes. Calls the drag component's move() method if the action is a move operation.
      Specified by:
      dragDropEnd in interface DragSourceListener
    • dragEnter

      public void dragEnter(DragSourceDragEvent e)
      Called as the hotspot enters a platform dependent drop site.
      Specified by:
      dragEnter in interface DragSourceListener
    • dragOver

      public void dragOver(DragSourceDragEvent e)
      Called as the hotspot moves over a platform dependent drop site.
      Specified by:
      dragOver in interface DragSourceListener
    • dragExit

      public void dragExit(DragSourceEvent e)
      Called as the hotspot exits a platform dependent drop site.
      Specified by:
      dragExit in interface DragSourceListener
    • dropActionChanged

      public void dropActionChanged(DragSourceDragEvent e)
      Drop action changed, i.e., ctrl key pressed during drag to change to a copy operation.
      Specified by:
      dropActionChanged in interface DragSourceListener
    • setDragOverFeedback

      protected void setDragOverFeedback(DragSourceDragEvent e)
      Sets the cursor according to the actions that are legal.
    • getDropOkCursor

      protected Cursor getDropOkCursor(int action)
      Get the cursor for an "OK" drop.
      Parameters:
      action - action for the drag operation (copy, move, link)
      Returns:
      cursor that is appropriate for the give action