ptolemy.vergil.basic
Class EditorDropTarget.DTListener

java.lang.Object
  extended by ptolemy.vergil.basic.EditorDropTarget.DTListener
All Implemented Interfaces:
java.awt.dnd.DropTargetListener, java.util.EventListener
Enclosing class:
EditorDropTarget

private class EditorDropTarget.DTListener
extends java.lang.Object
implements java.awt.dnd.DropTargetListener

The drop target listener used with the diva graph object.


Field Summary
private  NamedObj _highlighted
           
private  Figure _highlightedFigure
           
private  AnimationRenderer _highlighter
           
 
Constructor Summary
private EditorDropTarget.DTListener()
           
 
Method Summary
private  Figure _getFigureUnder(java.awt.geom.Point2D point)
          Return the figure that is an icon of a NamedObj and is under the specified point, or null if there is none.
private  NamedObj _getObjectUnder(java.awt.geom.Point2D point)
          Return the object under the specified point, or null if there is none.
 void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
          Accept the event if the data is a known key.
 void dragExit(java.awt.dnd.DropTargetEvent dtde)
          Remove any highlighting that might be active.
 void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
          If the location of the event is over an icon for an instance of NamedObj, then highlight that icon.
 void drop(java.awt.dnd.DropTargetDropEvent dtde)
          If the transferrable object is recognized as a Ptolemy II object, then use the MoML description of the object to create a new instance of the object at the drop location.
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
          Accept the event if the data is a known key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_highlighted

private NamedObj _highlighted

_highlightedFigure

private Figure _highlightedFigure

_highlighter

private AnimationRenderer _highlighter
Constructor Detail

EditorDropTarget.DTListener

private EditorDropTarget.DTListener()
Method Detail

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
Accept the event if the data is a known key. This is called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener
Parameters:
dtde - The drop event.

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent dtde)
Remove any highlighting that might be active. This is called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragExit in interface java.awt.dnd.DropTargetListener
Parameters:
dtde - The drop event.

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
If the location of the event is over an icon for an instance of NamedObj, then highlight that icon. This is called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragOver in interface java.awt.dnd.DropTargetListener
Parameters:
dtde - The drop event.

drop

public void drop(java.awt.dnd.DropTargetDropEvent dtde)
If the transferrable object is recognized as a Ptolemy II object, then use the MoML description of the object to create a new instance of the object at the drop location. If the drop location is on top of an icon representing an instance of NamedObj, then make that instance the container of the new object. Otherwise, make the model associated with the graph the container. This is called when the drag operation has terminated with a drop on the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
drop in interface java.awt.dnd.DropTargetListener
Parameters:
dtde - The drop event.

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
Accept the event if the data is a known key. This is called if the user has modified the current drop gesture.

Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener
Parameters:
dtde - The drop event.

_getFigureUnder

private Figure _getFigureUnder(java.awt.geom.Point2D point)
Return the figure that is an icon of a NamedObj and is under the specified point, or null if there is none.

Parameters:
point - The point in the graph pane.
Returns:
The object under the specified point, or null if there is none or it is not a NamedObj.

_getObjectUnder

private NamedObj _getObjectUnder(java.awt.geom.Point2D point)
Return the object under the specified point, or null if there is none.

Parameters:
point - The point in the graph pane.
Returns:
The object under the specified point, or null if there is none or it is not a NamedObj.