org.apache.ojb.tools.mapping.reversedb2.dnd2
Class DragHelper

java.lang.Object
  extended byorg.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 $
Author:
Florian Bruckner

Nested Class Summary
 class DragHelper.DGListener
          For more information see the javadocs of java.awt.DragGestureListener
 class DragHelper.DSListener
          an implementation of java.awt.dnd.DragSourceListener.
 
Constructor Summary
DragHelper(DragCopyCutWorkerInterface pDragWorker)
          Easiest way to setup dragging for your GUI.
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.
DragHelper(java.awt.dnd.DragSource pDragSource, java.lang.Class pRecognizerAbstractClass, DragCopyCutWorkerInterface pDragWorker)
          A more complex way of setting up dragging.
 
Method Summary
 void registerComponent(java.awt.Component c)
          add a Component to this Worker.
 void unregisterComponent(java.awt.Component c)
          remove drag support from the given Component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.

Parameters:
pDgListener - Your implementation of DragGestureListener. In case you want to use the default supplied within this class, instantiate a DGListener and supply it here.
pDsListener - Your implementation of DragSourceListener. In case you want to use the default supplied within this class, instantiate a DSListener and supply it here.
pDragSource - Your DragSource implementation. The default AWT DragSource is exposed by java.awt.dnd.DragSource.getDefaultDragSource()
pRecognizerAbstractClass - The drag gesture recognizer. To use the AWT-built-in default supply a null here.
pDragWorker - Your DragWorker implementation

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)

Parameters:
pDragSource - The drag source
pRecognizerAbstractClass - The recognizer, may be null if you want to use the Swing default implementation
pDragWorker - Your DragCopyCutWorkerInterface

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.

Parameters:
pDragWorker - Your implementation of the DragCopyCutWorkerInterface
Method Detail

registerComponent

public void registerComponent(java.awt.Component c)
add a Component to this Worker. After the call dragging is enabled for this Component.

Parameters:
c - the Component to register

unregisterComponent

public void unregisterComponent(java.awt.Component c)
remove drag support from the given Component.

Parameters:
c - the Component to remove


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14