Class DefaultDragSession

java.lang.Object
com.simsilica.lemur.dnd.DefaultDragSession
All Implemented Interfaces:
DragSession

public class DefaultDragSession extends Object implements DragSession
  • Constructor Details

    • DefaultDragSession

      public DefaultDragSession(Spatial source, Vector2f dragLocation)
  • Method Details

    • set

      public void set(String name, Object attribute)
      Description copied from interface: DragSession
      Sets an application-specific session attribute that lives as long as this specific drag session. Applications can use this to store their payload or attributes relating to the drag payload or advanced status not provided by the DragSession's normal book-keeping. Most often this is used to store a reference to the dragged item. For standardization, the callers can use the ITEM constant for a default location for dragged items. Setting an attribute to null will remove it from the session.
      Specified by:
      set in interface DragSession
    • get

      public <T> T get(String name, T defaultValue)
      Description copied from interface: DragSession
      Returns an attribute previously stored in this session or the default value if no such attribute exists.
      Specified by:
      get in interface DragSession
    • hasAttribute

      public boolean hasAttribute(String name)
      Description copied from interface: DragSession
      Returns true if the session has the specified attribute defined.
      Specified by:
      hasAttribute in interface DragSession
    • getDragSource

      public Spatial getDragSource()
      Description copied from interface: DragSession
      Returns the container Spatial upon which the drag operation was initiated.
      Specified by:
      getDragSource in interface DragSession
    • setDraggable

      protected void setDraggable(Draggable draggable)
    • getDraggable

      public Draggable getDraggable()
      Description copied from interface: DragSession
      Returns the application-provided "Draggable" that is used to display the current drag location.
      Specified by:
      getDraggable in interface DragSession
    • setDragStatus

      public void setDragStatus(DragStatus status)
      Description copied from interface: DragSession
      Called by drop event handlers to indicate that a drop target and location are valid or invalid. If there is no current drop target than the drag status is DragStatus.NoTarget.
      Specified by:
      setDragStatus in interface DragSession
    • getDragStatus

      public DragStatus getDragStatus()
      Description copied from interface: DragSession
      Return the drop status of this drag session. If there is no current drop target then the drag status is DragStatus.NoTarget. DragStatus.InvalidTarget indicates that the drag is over a drop target but either the container or the location in the container is not valid.
      Specified by:
      getDragStatus in interface DragSession
    • close

      protected void close(DragEvent event)
    • setDropTarget

      protected void setDropTarget(Spatial dropTarget, DragEvent event)
    • getDropTarget

      public Spatial getDropTarget()
      Description copied from interface: DragSession
      Returns the current drop target or null if the drag is not currently over a drop target.
      Specified by:
      getDropTarget in interface DragSession
    • getDragLocation

      public Vector2f getDragLocation()
      Description copied from interface: DragSession
      Returns the current drag location in 'cursor space', ie: the 2D coordinate of the screen or viewport that indicates the drag location.
      Specified by:
      getDragLocation in interface DragSession
    • setDropCollision

      protected void setDropCollision(CollisionResult collision)
    • getDropCollision

      public CollisionResult getDropCollision()
      Description copied from interface: DragSession
      Returns the current 'drop' collision information or null if there is no current drop target.
      Specified by:
      getDropCollision in interface DragSession