diva.graph.schematic
Class GraphDropTarget

java.lang.Object
  extended by java.awt.dnd.DropTarget
      extended by diva.graph.schematic.GraphDropTarget
All Implemented Interfaces:
DropTargetListener, Serializable, EventListener

public class GraphDropTarget
extends DropTarget

This class provides customizable drag-and-drop support for the graph editor widget. Users can register string keys and object values that get cloned when the keys are dropped onto the graph editor. When a drop occurs, the graph controller is asked to create a node instance with the value as its semantic object.

Version:
$Revision: 1.4 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.dnd.DropTarget
DropTarget.DropTargetAutoScroller
 
Field Summary
 HashMap _map
          A hastable to store the key->figure mapping.
 
Constructor Summary
GraphDropTarget(JGraph g)
          Construct a new graph target to operate on the given JGraph.
 
Method Summary
 void addDropKey(String key, Object val)
          Add a key to the drop target so that when they key is dropped the figure will be cloned and placed as a node in the graph.
 void removeDropKey(String key)
          Remove a key from the target.
 
Methods inherited from class java.awt.dnd.DropTarget
addDropTargetListener, addNotify, clearAutoscroll, createDropTargetAutoScroller, createDropTargetContext, dragEnter, dragExit, dragOver, drop, dropActionChanged, 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

_map

public HashMap _map
A hastable to store the key->figure mapping.

Constructor Detail

GraphDropTarget

public GraphDropTarget(JGraph g)
Construct a new graph target to operate on the given JGraph.

Method Detail

addDropKey

public void addDropKey(String key,
                       Object val)
Add a key to the drop target so that when they key is dropped the figure will be cloned and placed as a node in the graph. Key must be a unique string.


removeDropKey

public void removeDropKey(String key)
Remove a key from the target.

See Also:
addDropKey(String,Figure)


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.