com.jgraph.plaf.basic
Class BasicGraphDropTargetListener

java.lang.Object
  extended bycom.jgraph.plaf.basic.BasicGraphDropTargetListener
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.dnd.DropTargetListener, java.util.EventListener, javax.swing.plaf.UIResource
Direct Known Subclasses:
BasicGraphUI.GraphDropTargetListener

public class BasicGraphDropTargetListener
extends java.lang.Object
implements java.awt.dnd.DropTargetListener, javax.swing.plaf.UIResource, java.awt.event.ActionListener

COPY OF JAVAX.SWING.PLAF.BASIC WITH A PUBLIC MODIFIER AND CONSTRUCTOR

The Swing DropTarget implementation supports multicast notification to listeners, so this implementation is used as an additional listener that extends the primary drop target functionality (i.e. linkage to the TransferHandler) to include autoscroll and establish an insertion point for the drop. This is used by the ComponentUI of components supporting a selection mechanism, which have a way of indicating a location within their model.

The autoscroll functionality is based upon the Swing scrolling mechanism of the Scrollable interface. The unit scroll increment is used to as the scroll amount, and the scrolling is based upon JComponent.getVisibleRect and JComponent.scrollRectToVisible. The band of area around the visible rectangle used to invoke autoscroll is based upon the unit scroll increment as that is assumed to represent the last possible item in the visible region.

The subclasses are expected to implement the following methods to manage the insertion location via the components selection mechanism.


Constructor Summary
BasicGraphDropTargetListener()
          construct a DropTargetAutoScroller
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The timer fired, perform autoscroll if the pointer is within the autoscroll region.
 void dragEnter(java.awt.dnd.DropTargetDragEvent e)
           
 void dragExit(java.awt.dnd.DropTargetEvent e)
           
 void dragOver(java.awt.dnd.DropTargetDragEvent e)
           
 void drop(java.awt.dnd.DropTargetDropEvent e)
           
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
           
protected  void restoreComponentState(javax.swing.JComponent c)
          called to restore the state of a component in case a drop is not performed.
protected  void restoreComponentStateForDrop(javax.swing.JComponent c)
          called to restore the state of a component in case a drop is performed.
protected  void saveComponentState(javax.swing.JComponent c)
          called to save the state of a component in case it needs to be restored because a drop is not performed.
protected  void updateInsertionLocation(javax.swing.JComponent c, java.awt.Point p)
          called to set the insertion location to match the current mouse pointer coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicGraphDropTargetListener

public BasicGraphDropTargetListener()
construct a DropTargetAutoScroller

Method Detail

saveComponentState

protected void saveComponentState(javax.swing.JComponent c)
called to save the state of a component in case it needs to be restored because a drop is not performed.


restoreComponentState

protected void restoreComponentState(javax.swing.JComponent c)
called to restore the state of a component in case a drop is not performed.


restoreComponentStateForDrop

protected void restoreComponentStateForDrop(javax.swing.JComponent c)
called to restore the state of a component in case a drop is performed.


updateInsertionLocation

protected void updateInsertionLocation(javax.swing.JComponent c,
                                       java.awt.Point p)
called to set the insertion location to match the current mouse pointer coordinates.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
The timer fired, perform autoscroll if the pointer is within the autoscroll region.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the ActionEvent

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent e)
Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent e)
Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent e)
Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

drop

public void drop(java.awt.dnd.DropTargetDropEvent e)
Specified by:
drop in interface java.awt.dnd.DropTargetListener

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent e)
Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener