Package com.simsilica.lemur.dnd
Class DefaultDragSession
java.lang.Object
com.simsilica.lemur.dnd.DefaultDragSession
- All Implemented Interfaces:
DragSession
-
Field Summary
Fields inherited from interface com.simsilica.lemur.dnd.DragSession
ITEM
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
<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.protected void
setDraggable
(Draggable draggable) void
setDragStatus
(DragStatus status) Called by drop event handlers to indicate that a drop target and location are valid or invalid.protected void
setDropCollision
(CollisionResult collision) protected void
setDropTarget
(Spatial dropTarget, DragEvent event)
-
Constructor Details
-
DefaultDragSession
-
-
Method Details
-
set
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 interfaceDragSession
-
get
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 interfaceDragSession
-
hasAttribute
Description copied from interface:DragSession
Returns true if the session has the specified attribute defined.- Specified by:
hasAttribute
in interfaceDragSession
-
getDragSource
Description copied from interface:DragSession
Returns the container Spatial upon which the drag operation was initiated.- Specified by:
getDragSource
in interfaceDragSession
-
setDraggable
-
getDraggable
Description copied from interface:DragSession
Returns the application-provided "Draggable" that is used to display the current drag location.- Specified by:
getDraggable
in interfaceDragSession
-
setDragStatus
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 interfaceDragSession
-
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 interfaceDragSession
-
close
-
setDropTarget
-
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 interfaceDragSession
-
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 interfaceDragSession
-
setDropCollision
-
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 interfaceDragSession
-