org.openide.loaders
Class LoaderTransfer

java.lang.Object
  |
  +--org.openide.loaders.LoaderTransfer

public abstract class LoaderTransfer
extends Object

Class that contains specific datatransfer flavors and methods to work with transfered DataObjects. There are flavors to allow a DataObject to be copied or cut into clipboard, and to retrieve them from clipboard when implementing paste operation.

This is a dummy utility class--no instances are possible.

Since:
1.21

Field Summary
static int CLIPBOARD_COPY
          Constant indicating copying to the clipboard.
static int CLIPBOARD_CUT
          Constant indicating cutting to the clipboard.
static int COPY
          Generic mask for copying DataObjects (do not destroy the original).
static int DND_COPY
           
static int DND_COPY_OR_MOVE
           
static int DND_LINK
           
static int DND_MOVE
           
static int DND_NONE
          Constants for drag-n-drop operations.
static int DND_REFERENCE
           
static int MOVE
          Generic mask for moving DataObjects (destroy the original).
 
Method Summary
static DataObject getDataObject(Transferable t, int action)
          Obtain a DataObject from a transferable.
static DataObject[] getDataObjects(Transferable t, int action)
          Obtain a list of DataObjects from a transferable.
static ExTransferable.Single transferable(DataObject d, int actions)
          Creates transferable that represents an operation, such as cut-to-clipboard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DND_NONE

public static final int DND_NONE
Constants for drag-n-drop operations. Are exactly the same as constants in DnDConstants.

DND_COPY

public static final int DND_COPY

DND_MOVE

public static final int DND_MOVE

DND_COPY_OR_MOVE

public static final int DND_COPY_OR_MOVE

DND_LINK

public static final int DND_LINK

DND_REFERENCE

public static final int DND_REFERENCE

CLIPBOARD_COPY

public static final int CLIPBOARD_COPY
Constant indicating copying to the clipboard. Equal to DND_COPY, because copy to clipboard and d'n'd copy should be the same.

CLIPBOARD_CUT

public static final int CLIPBOARD_CUT
Constant indicating cutting to the clipboard.

COPY

public static final int COPY
Generic mask for copying DataObjects (do not destroy the original). Equal to CLIPBOARD_COPY or DND_COPY.

MOVE

public static final int MOVE
Generic mask for moving DataObjects (destroy the original). Equal to CLIPBOARD_CUT or DND_MOVE.
Method Detail

transferable

public static ExTransferable.Single transferable(DataObject d,
                                                 int actions)
Creates transferable that represents an operation, such as cut-to-clipboard. The transferable will be recognizable by getDataObject(java.awt.datatransfer.Transferable, int) and getDataObjects(java.awt.datatransfer.Transferable, int).
Parameters:
d - the DataObject to create a transferable for
actions - the action performed on the DataObject's node
Returns:
the transferable

getDataObject

public static DataObject getDataObject(Transferable t,
                                       int action)
Obtain a DataObject from a transferable. Probes the transferable in case it includes a flavor corresponding to a DataObject's node operation (which you must specify a mask for).
Parameters:
t - transferable
action - one of the DND_* or CLIPBOARD_* constants
Returns:
the DataObject or null

getDataObjects

public static DataObject[] getDataObjects(Transferable t,
                                          int action)
Obtain a list of DataObjects from a transferable. If there is only a single DataObject in the transferable, this will just return a singleton array like getDataObject(java.awt.datatransfer.Transferable, int). If there is a multiple transfer (of at least one element), each element of which contains a DataObject, then an array of these will be returned. If neither of these things is true, null will be returned.

This is a convenience method intended for those who wish to specially support pastes of multiple DataObjects at once.

Parameters:
t - the transferable to probe
action - a DnD or clipboard constant
Returns:
a non-empty array of nodes, or null


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.