Package com.simsilica.lemur.dnd
Interface DragSession
- All Known Implementing Classes:
DefaultDragSession
public interface DragSession
Provides information about an active drag and drop session.
A DragSession is initiated when the drag is first detected.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<T> T
Returns an attribute previously stored in this session or the default value if no such attribute exists.Returns the application-provided "Draggable" that is used to display the current drag location.Returns the current drag location in 'cursor space', ie: the 2D coordinate of the screen or viewport that indicates the drag location.Returns the container Spatial upon which the drag operation was initiated.Return the drop status of this drag session.Returns the current 'drop' collision information or null if there is no current drop target.Returns the current drop target or null if the drag is not currently over a drop target.boolean
hasAttribute
(String name) Returns true if the session has the specified attribute defined.void
Sets an application-specific session attribute that lives as long as this specific drag session.void
setDragStatus
(DragStatus status) Called by drop event handlers to indicate that a drop target and location are valid or invalid.
-
Field Details
-
ITEM
- See Also:
-
-
Method Details
-
set
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. -
get
Returns an attribute previously stored in this session or the default value if no such attribute exists. -
hasAttribute
Returns true if the session has the specified attribute defined. -
setDragStatus
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. -
getDragStatus
DragStatus getDragStatus()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. -
getDragSource
Spatial getDragSource()Returns the container Spatial upon which the drag operation was initiated. -
getDropTarget
Spatial getDropTarget()Returns the current drop target or null if the drag is not currently over a drop target. -
getDropCollision
CollisionResult getDropCollision()Returns the current 'drop' collision information or null if there is no current drop target. -
getDraggable
Draggable getDraggable()Returns the application-provided "Draggable" that is used to display the current drag location. -
getDragLocation
Vector2f getDragLocation()Returns the current drag location in 'cursor space', ie: the 2D coordinate of the screen or viewport that indicates the drag location.
-