net.lucidviews.util.gui.swing.dnd
Class DefaultSwingDropTarget

java.lang.Object
  extended by java.awt.dnd.DropTarget
      extended by net.lucidviews.util.gui.swing.dnd.DefaultDropTarget
          extended by net.lucidviews.util.gui.swing.dnd.DefaultSwingDropTarget
All Implemented Interfaces:
DropTargetListener, Serializable, EventListener
Direct Known Subclasses:
JWebAddress.WebAddressDropTarget

public class DefaultSwingDropTarget
extends DefaultDropTarget

An extension of the DropTarget class for Swing components that invokes state changes on the drag'n'drop event.

This class must be sub-classed and the drag/drop methods overridden with custom implementations. NB: overridden methods must call the super method to invoke the state change on the event.

Since:
1.3
Version:
$Revision: 1.1.2.1 $
Author:
Stephen Battey
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.dnd.DropTarget
DropTarget.DropTargetAutoScroller
 
Field Summary
private static long serialVersionUID
          Serialisation version id.
protected  JComponent target
          The component that is the target of dropped content.
 
Fields inherited from class net.lucidviews.util.gui.swing.dnd.DefaultDropTarget
canImport, supportedActions
 
Constructor Summary
protected DefaultSwingDropTarget(JComponent component, int supportedActions)
          Create a drop target for the specified Swing component.
 
Method Summary
protected  boolean dataFlavourSupported(Component component, DataFlavor[] flavours)
          Check if a data type is accepted by this drop target.
 
Methods inherited from class net.lucidviews.util.gui.swing.dnd.DefaultDropTarget
dragEnter, dragExit, dragOver, drop, dropActionChanged
 
Methods inherited from class java.awt.dnd.DropTarget
addDropTargetListener, addNotify, clearAutoscroll, createDropTargetAutoScroller, createDropTargetContext, getComponent, getDefaultActions, getDropTargetContext, getFlavorMap, initializeAutoscrolling, isActive, removeDropTargetListener, removeNotify, setActive, setComponent, setDefaultActions, setFlavorMap, updateAutoscroll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serialisation version id.

See Also:
Constant Field Values

target

protected JComponent target
The component that is the target of dropped content.

Constructor Detail

DefaultSwingDropTarget

protected DefaultSwingDropTarget(JComponent component,
                                 int supportedActions)
Create a drop target for the specified Swing component.

Parameters:
component - the GUI component that is to accept DnDs
supportedActions - the actions that will be supported - a bit mask of DnDConstants
Method Detail

dataFlavourSupported

protected boolean dataFlavourSupported(Component component,
                                       DataFlavor[] flavours)
Check if a data type is accepted by this drop target.
By default, all data flavours are supported. This method can be overridden to change that behaviour.

Overrides:
dataFlavourSupported in class DefaultDropTarget
Parameters:
component - the component being targeted
flavours - the data flavour(s) of the incoming drag'n'drop event
Returns:
a Boolean value indicating if the data flavour is accepted by this drop target