Package swingtree
Enum Class UI.DragAction
- All Implemented Interfaces:
Serializable,Comparable<UI.DragAction>,Constable,UIEnum<UI.DragAction>
- Enclosing class:
UI
@Immutable
public static enum UI.DragAction
extends Enum<UI.DragAction>
implements UIEnum<UI.DragAction>
Names which transfers a drag and drop operation permits: copying, moving, linking,
copying or moving, or nothing at all. Every constant maps onto one of the
int constants of TransferHandler and DnDConstants,
which toIntCode() returns.
COPY_OR_MOVE permits two transfers at once, which is why comparing two
constants for equality is not enough to tell whether one is acceptable where the
other was asked for. includes(DragAction) asks that question instead:
does this constant permit everything the other one permits?
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPermits copying, and nothing else.Permits both copying and moving, leaving the choice between the two to the drag and drop operation itself.Permits moving, and nothing else.Permits no transfer at all, which is how a component refuses to be dragged away and how a target refuses every drop. -
Method Summary
Modifier and TypeMethodDescriptionbooleanincludes(UI.DragAction action) Tells whether every transfer the given action permits is also permitted by this one.booleanisCopy()Tells whether copying is one of the transfers this constant permits.booleanisLink()Tells whether linking is the transfer this constant permits.booleanisMove()Tells whether moving is one of the transfers this constant permits.intReturns the number AWT and Swing use for this set of transfers, which is whatTransferHandlerandDnDConstantsspeak in.static UI.DragActionReturns the enum constant of this class with the specified name.static UI.DragAction[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Permits no transfer at all, which is how a component refuses to be dragged away and how a target refuses every drop. -
COPY
Permits copying, and nothing else. The data is copied to a clipboard, or copied elsewhere in a drag and drop operation, and the source keeps its own. -
MOVE
Permits moving, and nothing else. The data is moved to a clipboard (a cut), or moved elsewhere in a drag and drop operation, and the source gives it up. -
COPY_OR_MOVE
Permits both copying and moving, leaving the choice between the two to the drag and drop operation itself. This is the one constant which permits more than a single transfer, soincludes(DragAction)answers true for bothCOPYandMOVEhere. -
LINK
Permits linking, and nothing else: the drop creates a reference to the data rather than a copy of it, and neitherCOPYnorMOVEcovers it.- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toIntCode
public int toIntCode()Returns the number AWT and Swing use for this set of transfers, which is whatTransferHandlerandDnDConstantsspeak in. -
isCopy
public boolean isCopy()Tells whether copying is one of the transfers this constant permits.- Returns:
- True for
COPYandCOPY_OR_MOVE.
-
isMove
public boolean isMove()Tells whether moving is one of the transfers this constant permits.- Returns:
- True for
MOVEandCOPY_OR_MOVE.
-
isLink
public boolean isLink()Tells whether linking is the transfer this constant permits.- Returns:
- True for
LINK.
-
includes
Tells whether every transfer the given action permits is also permitted by this one. A drop target which acceptsCOPY_OR_MOVEaccepts a source asking only to copy, while a target which acceptsCOPYhas to refuse a source insisting on being allowed to move as well. Comparing the two constants for equality answers neither of those correctly.Every action permits everything it permits itself, and every action permits everything
NONEpermits, which is nothing.- Parameters:
action- The action to test for being permitted by this one.- Returns:
- True if this action permits everything
actionpermits.
-