org.jhotdraw.draw
Class DefaultDrawingViewTransferHandler

java.lang.Object
  extended by javax.swing.TransferHandler
      extended by org.jhotdraw.draw.DefaultDrawingViewTransferHandler
All Implemented Interfaces:
java.io.Serializable

public class DefaultDrawingViewTransferHandler
extends javax.swing.TransferHandler

Default TransferHandler for DrawingView objects.

Version:
$Id: DefaultDrawingViewTransferHandler.java 604 2010-01-09 12:00:29Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Nested Class Summary
private static class DefaultDrawingViewTransferHandler.DragHandler
          This is the default drag handler for drag and drop operations that use the TransferHandler.
private static class DefaultDrawingViewTransferHandler.SwingDragGestureRecognizer
           
 
Nested classes/interfaces inherited from class javax.swing.TransferHandler
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport
 
Field Summary
private static boolean DEBUG
           
private  java.util.HashSet<Figure> exportedFigures
          We keep the exported figures in this list, so that we don't need to rely on figure selection, when method exportDone is called.
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE
 
Constructor Summary
DefaultDrawingViewTransferHandler()
          Creates a new instance.
 
Method Summary
 boolean canImport(javax.swing.JComponent comp, java.awt.datatransfer.DataFlavor[] transferFlavors)
           
protected  java.awt.datatransfer.Transferable createTransferable(DrawingView view, java.util.Set<Figure> transferFigures)
           
protected  java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
           
 void exportAsDrag(javax.swing.JComponent comp, java.awt.event.InputEvent e, int action)
           
protected  void exportDone(javax.swing.JComponent source, java.awt.datatransfer.Transferable data, int action)
           
private  void getDrawing()
           
 int getSourceActions(javax.swing.JComponent c)
           
 javax.swing.Icon getVisualRepresentation(java.awt.datatransfer.Transferable t)
           
 boolean importData(javax.swing.JComponent comp, java.awt.datatransfer.Transferable t)
           
protected  boolean importData(javax.swing.JComponent comp, java.awt.datatransfer.Transferable t, java.util.HashSet<Figure> transferFigures, java.awt.Point dropPoint)
          Imports data and stores the transferred figures into the supplied transferFigures collection.
 boolean importData(javax.swing.TransferHandler.TransferSupport support)
           
protected  void moveToDropPoint(javax.swing.JComponent component, java.util.HashSet<Figure> transferFigures, java.awt.Point dropPoint)
           
 
Methods inherited from class javax.swing.TransferHandler
canImport, exportToClipboard, getCopyAction, getCutAction, getPasteAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

exportedFigures

private java.util.HashSet<Figure> exportedFigures
We keep the exported figures in this list, so that we don't need to rely on figure selection, when method exportDone is called.

Constructor Detail

DefaultDrawingViewTransferHandler

public DefaultDrawingViewTransferHandler()
Creates a new instance.

Method Detail

importData

public boolean importData(javax.swing.JComponent comp,
                          java.awt.datatransfer.Transferable t)
Overrides:
importData in class javax.swing.TransferHandler

importData

public boolean importData(javax.swing.TransferHandler.TransferSupport support)
Overrides:
importData in class javax.swing.TransferHandler

importData

protected boolean importData(javax.swing.JComponent comp,
                             java.awt.datatransfer.Transferable t,
                             java.util.HashSet<Figure> transferFigures,
                             java.awt.Point dropPoint)
Imports data and stores the transferred figures into the supplied transferFigures collection.


moveToDropPoint

protected void moveToDropPoint(javax.swing.JComponent component,
                               java.util.HashSet<Figure> transferFigures,
                               java.awt.Point dropPoint)

getSourceActions

public int getSourceActions(javax.swing.JComponent c)
Overrides:
getSourceActions in class javax.swing.TransferHandler

createTransferable

protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
Overrides:
createTransferable in class javax.swing.TransferHandler

createTransferable

protected java.awt.datatransfer.Transferable createTransferable(DrawingView view,
                                                                java.util.Set<Figure> transferFigures)

exportDone

protected void exportDone(javax.swing.JComponent source,
                          java.awt.datatransfer.Transferable data,
                          int action)
Overrides:
exportDone in class javax.swing.TransferHandler

exportAsDrag

public void exportAsDrag(javax.swing.JComponent comp,
                         java.awt.event.InputEvent e,
                         int action)
Overrides:
exportAsDrag in class javax.swing.TransferHandler

getVisualRepresentation

public javax.swing.Icon getVisualRepresentation(java.awt.datatransfer.Transferable t)
Overrides:
getVisualRepresentation in class javax.swing.TransferHandler

canImport

public boolean canImport(javax.swing.JComponent comp,
                         java.awt.datatransfer.DataFlavor[] transferFlavors)
Overrides:
canImport in class javax.swing.TransferHandler

getDrawing

private void getDrawing()