com.threerings.opengl.gui
Class TransferHandler

java.lang.Object
  extended by com.threerings.opengl.gui.TransferHandler
Direct Known Subclasses:
LocalTransferHandler

public class TransferHandler
extends Object

Handles drag and drop, cut and paste operations.


Field Summary
static int COPY
          Indicates that only the copy action is supported.
static int COPY_OR_MOVE
          Indicates that the copy and move actions are supported.
static int MOVE
          Indicates that the move action is supported.
static int NONE
          Indicates that no source actions are supported.
 
Constructor Summary
TransferHandler()
           
 
Method Summary
 boolean canImport(Component comp, DataFlavor[] transferFlavors)
          Determines whether the specified component can accept an import prior to attempting one.
 void exportAsDrag(Component comp, InputEvent event, int action)
          Initiates a drag operation.
 void exportToClipboard(Component comp, Clipboard clipboard, int action)
          Exports from the specified component to the given clipboard.
 int getSourceActions(Component comp)
          Returns the source actions supported by the specified component.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Indicates that no source actions are supported.

See Also:
Constant Field Values

COPY

public static final int COPY
Indicates that only the copy action is supported.

See Also:
Constant Field Values

MOVE

public static final int MOVE
Indicates that the move action is supported.

See Also:
Constant Field Values

COPY_OR_MOVE

public static final int COPY_OR_MOVE
Indicates that the copy and move actions are supported.

See Also:
Constant Field Values
Constructor Detail

TransferHandler

public TransferHandler()
Method Detail

getSourceActions

public int getSourceActions(Component comp)
Returns the source actions supported by the specified component.

Returns:
a bitwise OR of the action flags, COPY or MOVE.

exportAsDrag

public void exportAsDrag(Component comp,
                         InputEvent event,
                         int action)
Initiates a drag operation.


exportToClipboard

public void exportToClipboard(Component comp,
                              Clipboard clipboard,
                              int action)
Exports from the specified component to the given clipboard.


getVisualRepresentation

public Icon getVisualRepresentation(Transferable data)
Returns the visual representation for the specified transferable, or null to use the default.


canImport

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


importData

public boolean importData(Component comp,
                          Transferable data)
Attempts to import data from the specified component.

Returns:
true if the data was successfully imported, false if not.


Copyright © 2011. All Rights Reserved.