|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.nodes.NodeTransfer
Class that contains specific datatransfer flavors and methods to work with nodes. There are flavors to allow a node to be copied or cut, and to decide its paste types.
This is a dummy utility class--no instances are possible.
Nested Class Summary | |
static interface |
NodeTransfer.Paste
An intelligent source of paste types (ways how to paste) for a target node. |
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 nodes (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 nodes (destroy the original). |
Method Summary | |
static Node.Cookie |
cookie(Transferable t,
int action,
Class cookie)
Obtain a cookie instance from the copied node in a transferable. |
static ExTransferable.Single |
createPaste(NodeTransfer.Paste paste)
Creates transfer object that is used to carry an intelligent paste source through transferable or clipboard. |
static NodeTransfer.Paste |
findPaste(Transferable t)
Find an intelligent source of paste types in a transferable. |
static Node |
node(Transferable t,
int action)
Obtain a node from a transferable. |
static Node[] |
nodes(Transferable t,
int action)
Obtain a list of nodes from a transferable. |
static ExTransferable.Single |
transferable(Node n,
int actions)
Creates transferable that represents a node 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 |
public static final int DND_NONE
DnDConstants
.
public static final int DND_COPY
public static final int DND_MOVE
public static final int DND_COPY_OR_MOVE
public static final int DND_LINK
public static final int DND_REFERENCE
public static final int CLIPBOARD_COPY
DND_COPY
, because
copy to clipboard and d'n'd copy should be the same.
public static final int CLIPBOARD_CUT
public static final int COPY
CLIPBOARD_COPY
or DND_COPY
.
public static final int MOVE
CLIPBOARD_CUT
or DND_MOVE
.
Method Detail |
public static ExTransferable.Single transferable(Node n, int actions)
node(java.awt.datatransfer.Transferable, int)
, nodes(java.awt.datatransfer.Transferable, int)
, and cookie(java.awt.datatransfer.Transferable, int, java.lang.Class)
.
n
- the node to create a transferable foractions
- the action performed on the node
public static Node node(Transferable t, int action)
t
- transferableaction
- one of the DND_*
or CLIPBOARD_*
constants
null
public static Node[] nodes(Transferable t, int action)
node(java.awt.datatransfer.Transferable, int)
.
If there is a multiple transfer
(of at least one element),
each element of which
contains a node, 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 nodes at once. (By default, ExplorerActions
will
fallback to presenting each component of a multiple-item transferable separately when checking for paste
types on a target node, so if you have only one paste type and it makes no difference whether all of the nodes
are pasted together or separately, you can just use node(java.awt.datatransfer.Transferable, int)
.)
If you wish to test for cookies, you should do so manually according to your specific logic.
t
- the transferable to probeaction
- a DnD or clipboard constant
null
public static Node.Cookie cookie(Transferable t, int action, Class cookie)
First of all it checks whether the given transferable contains a node and then asks for the cookie.
If you wish to specially support multiple-node transfers, please use nodes(java.awt.datatransfer.Transferable, int)
and manually check for the desired combination of cookies.
t
- transferable to check incookie
- cookie representation class to look foraction
- the action which was used to store the node
null
if it does not existpublic static ExTransferable.Single createPaste(NodeTransfer.Paste paste)
findPaste(java.awt.datatransfer.Transferable)
can retrieve it.
paste
- the intelligent source of paste types
public static NodeTransfer.Paste findPaste(Transferable t)
AbstractNode.createPasteTypes(java.awt.datatransfer.Transferable, java.util.List)
looks for this
by default, so cut/copied nodes may specify how they may be pasted
to some external node target.
t
- the transferable to test
null
if none is in the transferable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |