com.threerings.opengl.gui
Class LocalTransferHandler<T>

java.lang.Object
  extended by com.threerings.opengl.gui.TransferHandler
      extended by com.threerings.opengl.gui.LocalTransferHandler<T>

public class LocalTransferHandler<T>
extends TransferHandler

A handler for local object references.


Field Summary
protected  Class<T> _clazz
          The class that we handle.
protected  DataFlavor _flavor
          The corresponding data flavor.
 
Fields inherited from class com.threerings.opengl.gui.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
LocalTransferHandler(Class<T> clazz)
          Creates a new transfer handler for the specified class.
 
Method Summary
protected  boolean canImport(Component comp)
          Determines whether the component can import an object.
 boolean canImport(Component comp, DataFlavor[] transferFlavors)
          Determines whether the specified component can accept an import prior to attempting one.
protected  Transferable createTransferable(Component comp)
          Creates the transferable to use as the source for a data transfer.
protected  void exportDone(Component source, T object, int action)
          Called when the export action has completed.
protected  void exportDone(Component source, Transferable data, int action)
          Invoked after data has been exported.
protected  T getObject(Component comp)
          Returns the object associated with the component.
protected  Icon getVisualRepresentation(T object)
          Returns the visual representation for the specified object, or null to use the default.
 Icon getVisualRepresentation(Transferable data)
          Returns the visual representation for the specified transferable, or null to use the default.
 boolean importData(Component comp, Transferable data)
          Attempts to import data from the specified component.
protected  boolean importObject(Component comp, T object)
          Attempts to import the specified object.
 
Methods inherited from class com.threerings.opengl.gui.TransferHandler
exportAsDrag, exportToClipboard, getSourceActions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_clazz

protected Class<T> _clazz
The class that we handle.


_flavor

protected DataFlavor _flavor
The corresponding data flavor.

Constructor Detail

LocalTransferHandler

public LocalTransferHandler(Class<T> clazz)
Creates a new transfer handler for the specified class.

Method Detail

getVisualRepresentation

public Icon getVisualRepresentation(Transferable data)
Description copied from class: TransferHandler
Returns the visual representation for the specified transferable, or null to use the default.

Overrides:
getVisualRepresentation in class TransferHandler

canImport

public boolean canImport(Component comp,
                         DataFlavor[] transferFlavors)
Description copied from class: TransferHandler
Determines whether the specified component can accept an import prior to attempting one.

Overrides:
canImport in class TransferHandler

importData

public boolean importData(Component comp,
                          Transferable data)
Description copied from class: TransferHandler
Attempts to import data from the specified component.

Overrides:
importData in class TransferHandler
Returns:
true if the data was successfully imported, false if not.

createTransferable

protected Transferable createTransferable(Component comp)
Description copied from class: TransferHandler
Creates the transferable to use as the source for a data transfer.

Overrides:
createTransferable in class TransferHandler

exportDone

protected void exportDone(Component source,
                          Transferable data,
                          int action)
Description copied from class: TransferHandler
Invoked after data has been exported.

Overrides:
exportDone in class TransferHandler

getVisualRepresentation

protected Icon getVisualRepresentation(T object)
Returns the visual representation for the specified object, or null to use the default.


canImport

protected boolean canImport(Component comp)
Determines whether the component can import an object.


importObject

protected boolean importObject(Component comp,
                               T object)
Attempts to import the specified object.


getObject

protected T getObject(Component comp)
Returns the object associated with the component.


exportDone

protected void exportDone(Component source,
                          T object,
                          int action)
Called when the export action has completed.