java.lang.Object
org.apache.ojb.tools.mapping.reversedb2.dnd2.DragHelper
- public class DragHelper
- extends java.lang.Object
This class allows you to implement the drag of DnD in your GUI by simply creating
an instance of this class, supplying your implementation of a DragCopyCutWorkerInterface
and register the Component with the helper using registerCopmponent().
If the default implementation of DnD by this class doesn't satisfy your needs
you can override all of the functionality by supplying your own DragGestureListener
and DragSourceListener. Those interfaces are part of the Java 1.2/1.3 Dnd framework,
so more information about these interfaces can be found in the JDK docs.
This class is closely related to DropTargetHelper, the class responsible for
the drop in DnD.
To implement DnD for any Component, you have to write the following code:
new DragHelper(new YourDragCopyCutWorkerInterfaceImplementation()).registerComponent(aComponent);
- Version:
- $Id: DragHelper.java,v 1.4 2002/09/01 15:45:48 florianbruckner Exp $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dgListener
private java.awt.dnd.DragGestureListener dgListener
dsListener
private java.awt.dnd.DragSourceListener dsListener
dragSource
private java.awt.dnd.DragSource dragSource
hmDragGestureRecognizers
private java.util.Map hmDragGestureRecognizers
recognizerAbstractClass
private java.lang.Class recognizerAbstractClass
dragWorker
private DragCopyCutWorkerInterface dragWorker
DragHelper
public DragHelper(java.awt.dnd.DragGestureListener pDgListener,
java.awt.dnd.DragSourceListener pDsListener,
java.awt.dnd.DragSource pDragSource,
java.lang.Class pRecognizerAbstractClass,
DragCopyCutWorkerInterface pDragWorker)
- Using this constructor you can completely customize the drag behaviour. You
have to supply your own DragGestureListener and DragSourcecListener in addition
to the DragSource, the drag gesture recognizer and the worker.
The default implementation of DragGestureListener and DragSourceListener are
exposed publicly in this class, so you are able to provide your own
implementation for DragGestureListener or DragSourceListener and use the default
one for the other.
DragHelper
public DragHelper(java.awt.dnd.DragSource pDragSource,
java.lang.Class pRecognizerAbstractClass,
DragCopyCutWorkerInterface pDragWorker)
- A more complex way of setting up dragging. In addition to your worker you need
to supply the recognizer and the DragSource (usually
java.awt.dnd.DragSource.getDefaultDragSource(), but you can supply your own
here)
DragHelper
public DragHelper(DragCopyCutWorkerInterface pDragWorker)
- Easiest way to setup dragging for your GUI. The default implementations for
DragGestureListener, DragSourceListener and the drag gesture recognizer
are used. You just need to supply a DragCopyCutWorkerInterface.
registerComponent
public void registerComponent(java.awt.Component c)
- add a Component to this Worker. After the call dragging is enabled for this
Component.
unregisterComponent
public void unregisterComponent(java.awt.Component c)
- remove drag support from the given Component.