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 Constants
    Enum Constant
    Description
    Permits copying, and nothing else.
    Permits both copying and moving, leaving the choice between the two to the drag and drop operation itself.
    Permits linking, and nothing else: the drop creates a reference to the data rather than a copy of it, and neither COPY nor MOVE covers it.
    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 Type
    Method
    Description
    boolean
    Tells whether every transfer the given action permits is also permitted by this one.
    boolean
    Tells whether copying is one of the transfers this constant permits.
    boolean
    Tells whether linking is the transfer this constant permits.
    boolean
    Tells whether moving is one of the transfers this constant permits.
    int
    Returns the number AWT and Swing use for this set of transfers, which is what TransferHandler and DnDConstants speak in.
    Returns the enum constant of this class with the specified name.
    static UI.DragAction[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface swingtree.UIEnum

    isNoneOf, isNoneOf, isNoneOf, isOneOf, isOneOf, isOneOf
  • Enum Constant Details

    • NONE

      public static final UI.DragAction NONE
      Permits no transfer at all, which is how a component refuses to be dragged away and how a target refuses every drop.
    • COPY

      public static final UI.DragAction 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

      public static final UI.DragAction 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

      public static final UI.DragAction 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, so includes(DragAction) answers true for both COPY and MOVE here.
  • Method Details

    • values

      public static UI.DragAction[] 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

      public static UI.DragAction valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • toIntCode

      public int toIntCode()
      Returns the number AWT and Swing use for this set of transfers, which is what TransferHandler and DnDConstants speak in.
      Returns:
      TransferHandler.NONE, TransferHandler.COPY, TransferHandler.MOVE, TransferHandler.COPY_OR_MOVE or TransferHandler.LINK.
    • isCopy

      public boolean isCopy()
      Tells whether copying is one of the transfers this constant permits.
      Returns:
      True for COPY and COPY_OR_MOVE.
    • isMove

      public boolean isMove()
      Tells whether moving is one of the transfers this constant permits.
      Returns:
      True for MOVE and COPY_OR_MOVE.
    • isLink

      public boolean isLink()
      Tells whether linking is the transfer this constant permits.
      Returns:
      True for LINK.
    • includes

      public boolean includes(UI.DragAction action)
      Tells whether every transfer the given action permits is also permitted by this one. A drop target which accepts COPY_OR_MOVE accepts a source asking only to copy, while a target which accepts COPY has 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 NONE permits, which is nothing.

      Parameters:
      action - The action to test for being permitted by this one.
      Returns:
      True if this action permits everything action permits.