Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.tools.dnd
Class DnDListener

    java.lang.Object
      java.awt.dnd.DragGestureRecognizer
          java.awt.dnd.MouseDragGestureRecognizer
              com.bbn.openmap.tools.dnd.DnDListener

All Implemented Interfaces:
  java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

Direct Known Subclasses:
  DefaultDnDCatcher

public class DnDListener
extends java.awt.dnd.MouseDragGestureRecognizer
implements java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener

DnDListener acts as the base DnD and MouseListener class. Some of its methods should be overriden by extending classes.

See Also:
  `DefaultDnDCatcher`, Serialized Form

Field Summary
`protected int` | `default_action`
`protected boolean` | `startDrag`

Fields inherited from class java.awt.dnd.DragGestureRecognizer
`component, dragGestureListener, dragSource, events, sourceActions`

Constructor Summary
`protected` | `DnDListener(java.awt.dnd.DragSource ds)` Constructs a new DnDListener given the DragSource for the Component.
`protected` | `DnDListener(java.awt.dnd.DragSource ds, java.awt.Component c)` Construct a new DnDListener given the DragSource for the Component c, and the Component to observe.
`protected` | `DnDListener(java.awt.dnd.DragSource ds, java.awt.Component c, int act)`
`protected` | `DnDListener(java.awt.dnd.DragSource ds, java.awt.Component c, int act, java.awt.dnd.DragGestureListener dgl)`

Method Summary
`void` | `dragDropEnd(java.awt.dnd.DragSourceDropEvent dsde)` This method is invoked to signify that the Drag and Drop operation is complete.
`void` | `dragEnter(java.awt.dnd.DragSourceDragEvent dsde)` Called as the hotspot enters a platform dependent drop site.
`void` | `dragEnter(java.awt.dnd.DropTargetDragEvent dtde)` Called when a drag operation has encountered the `DropTarget`.
`void` | `dragExit(java.awt.dnd.DragSourceEvent dse)` Called as the hotspot exits a platform dependent drop site.
`void` | `dragExit(java.awt.dnd.DropTargetEvent dte)` The drag operation has departed the `DropTarget` without dropping.
`void` | `dragOver(java.awt.dnd.DragSourceDragEvent dsde)` Called as the hotspot moves over a platform dependent drop site.
`void` | `dragOver(java.awt.dnd.DropTargetDragEvent dtde)` Called when a drag operation is ongoing on the `DropTarget`.
`void` | `drop(java.awt.dnd.DropTargetDropEvent dtde)` The drag operation has terminated with a drop on this `DropTarget`.
`void` | `dropActionChanged(java.awt.dnd.DragSourceDragEvent dsde)` Called when the user has modified the drop gesture.
`void` | `dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)` Called if the user has modified the current drop gesture.
`java.awt.Cursor` | `getCursor(java.awt.Cursor default_cursor)` Get the Cursor object associated with the default_cursor.
`int` | `getDefaultAction()` Returns the default DnD action.
`void` | `setCursor(java.awt.Image img, java.awt.Cursor default_cursor)` Sets a custom Cursor object associated with the default_cursor.
`void` | `setDefaultAction(int newAction)` Sets the default DnD action.

Methods inherited from class java.awt.dnd.MouseDragGestureRecognizer
`mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, registerListeners, unregisterListeners`

Methods inherited from class java.awt.dnd.DragGestureRecognizer
`addDragGestureListener, appendEvent, fireDragGestureRecognized, getComponent, getDragSource, getSourceActions, getTriggerEvent, removeDragGestureListener, resetRecognizer, setComponent, setSourceActions`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### startDrag

    protected boolean startDrag

### default_action

    protected int default_action

Constructor Detail

### DnDListener

    protected DnDListener(java.awt.dnd.DragSource ds)

  Constructs a new DnDListener given the DragSource for the Component.

Parameters:
  `ds` - the DragSource for the Component

### DnDListener

    protected DnDListener(java.awt.dnd.DragSource ds,
                          java.awt.Component c)

  Construct a new DnDListener given the DragSource for the Component c, and the Component to observe.

Parameters:
  `ds` - the DragSource for the Component c
  `c` - the Component to observe

### DnDListener

    protected DnDListener(java.awt.dnd.DragSource ds,
                          java.awt.Component c,
                          int act)

### DnDListener

    protected DnDListener(java.awt.dnd.DragSource ds,
                          java.awt.Component c,
                          int act,
                          java.awt.dnd.DragGestureListener dgl)

Method Detail

### dragDropEnd

    public void dragDropEnd(java.awt.dnd.DragSourceDropEvent dsde)

  This method is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of the `DragSourceDropEvent` can be used to determine the termination state. The getDropAction() method returns the operation that the `DropTarget` selected (via the DropTargetDropEvent acceptDrop() parameter) to apply to the Drop operation. Once this method is complete, the current `DragSourceContext` and associated resources become invalid.

  Specified by:
    `dragDropEnd` in interface `java.awt.dnd.DragSourceListener`
  Parameters:
    `dsde` - the `DragSourceDropEvent`

### dragEnter

    public void dragEnter(java.awt.dnd.DragSourceDragEvent dsde)

  Called as the hotspot enters a platform dependent drop site. This method is invoked when the following conditions are true:
  - The logical cursor's hotspot initially intersects a GUI `Component`'s visible geometry.
  - That `Component` has an active `DropTarget` associated with it.
  - The `DropTarget`'s registered `DropTargetListener` dragEnter() method is invoked and returns successfully.
  - The registered `DropTargetListener` invokes the `DropTargetDragEvent`'s acceptDrag() method to accept the drag based upon interrogation of the source's potential drop action(s) and available data types ( `DataFlavor` s).

  Specified by:
    `dragEnter` in interface `java.awt.dnd.DragSourceListener`
  Parameters:
    `dsde` - the `DragSourceDragEvent`

### dragEnter

    public void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)

  Called when a drag operation has encountered the `DropTarget`.

  Specified by:
    `dragEnter` in interface `java.awt.dnd.DropTargetListener`
  Parameters:
    `dtde` - the `DropTargetDragEvent`

### dragExit

    public void dragExit(java.awt.dnd.DragSourceEvent dse)

  Called as the hotspot exits a platform dependent drop site. This method is invoked when the following conditions are true:
  - The cursor's logical hotspot no longer intersects the visible geometry of the `Component` associated with the previous dragEnter() invocation.
  OR
  - The `Component` that the logical cursor's hotspot intersected that resulted in the previous dragEnter() invocation no longer has an active `DropTarget` or `DropTargetListener` associated with it.
  OR
  - The current `DropTarget`'s `DropTargetListener` has invoked rejectDrag() since the last dragEnter() or dragOver() invocation.

  Specified by:
    `dragExit` in interface `java.awt.dnd.DragSourceListener`
  Parameters:
    `dse` - the `DragSourceEvent`

### dragExit

    public void dragExit(java.awt.dnd.DropTargetEvent dte)

  The drag operation has departed the `DropTarget` without dropping.

  Specified by:
    `dragExit` in interface `java.awt.dnd.DropTargetListener`
  Parameters:
    `dte` - the `DropTargetEvent`

### dragOver

    public void dragOver(java.awt.dnd.DragSourceDragEvent dsde)

  Called as the hotspot moves over a platform dependent drop site. This method is invoked when the following conditions are true:
  - The cursor's logical hotspot has moved but still intersects the visible geometry of the `Component` associated with the previous dragEnter() invocation.
  - That `Component` still has a `DropTarget` associated with it.
  - That `DropTarget` is still active.
  - The `DropTarget`'s registered `DropTargetListener` dragOver() method is invoked and returns successfully.
  - The `DropTarget` does not reject the drag via rejectDrag()

  Specified by:
    `dragOver` in interface `java.awt.dnd.DragSourceListener`
  Parameters:
    `dsde` - the `DragSourceDragEvent`

### dragOver

    public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)

  Called when a drag operation is ongoing on the `DropTarget`.

  Specified by:
    `dragOver` in interface `java.awt.dnd.DropTargetListener`
  Parameters:
    `dtde` - the `DropTargetDragEvent`

### drop

    public void drop(java.awt.dnd.DropTargetDropEvent dtde)

  The drag operation has terminated with a drop on this `DropTarget`. This method is responsible for undertaking the transfer of the data associated with the gesture. The `DropTargetDropEvent` provides a means to obtain a `Transferable` object that represents the data object(s) to be transfered.

  From this method, the `DropTargetListener` shall accept or reject the drop via the acceptDrop(int dropAction) or rejectDrop() methods of the `DropTargetDropEvent` parameter.

  Subsequent to acceptDrop(), but not before, `DropTargetDropEvent`'s getTransferable() method may be invoked, and data transfer may be performed via the returned `Transferable`'s getTransferData() method.

  At the completion of a drop, an implementation of this method is required to signal the success/failure of the drop by passing an appropriate `boolean` to the `DropTargetDropEvent`'s dropComplete(boolean success) method.

  Note: The actual processing of the data transfer is not required to finish before this method returns. It may be deferred until later.

  Specified by:
    `drop` in interface `java.awt.dnd.DropTargetListener`
  Parameters:
    `dtde` - the `DropTargetDropEvent`

### dropActionChanged

    public void dropActionChanged(java.awt.dnd.DragSourceDragEvent dsde)

  Called when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.

  Specified by:
    `dropActionChanged` in interface `java.awt.dnd.DragSourceListener`
  Parameters:
    `dsde` - the `DragSourceDragEvent`

### dropActionChanged

    public void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)

  Called if the user has modified the current drop gesture.

  Specified by:
    `dropActionChanged` in interface `java.awt.dnd.DropTargetListener`
  Parameters:
    `dtde` - the `DropTargetDragEvent`

### getCursor

    public java.awt.Cursor getCursor(java.awt.Cursor default_cursor)

  Get the Cursor object associated with the default_cursor. If not found, return the passed cursor.

### getDefaultAction

    public int getDefaultAction()

  Returns the default DnD action.

  Returns:
    int

### setCursor

    public void setCursor(java.awt.Image img,
                          java.awt.Cursor default_cursor)

  Sets a custom Cursor object associated with the default_cursor.

### setDefaultAction

    public void setDefaultAction(int newAction)

  Sets the default DnD action.

  Parameters:
    `newAction` - int

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details