Package limn.scene.event
Class DragEvent
java.lang.Object
limn.scene.event.DragEvent
A drag is over a widget. The widget looks at what is offered and where, and calls
accept() if it would take it there; it then draws where the drop would land. Saying
nothing passes the question to its parent.
A drag driven from the keyboard has no pointer: isKeyboard() is true, the point is
the widget's centre the first time, and each arrow key arrives as a stepX() or
stepY() that moves the place the widget itself keeps. describePlace(java.lang.String) says that
place for a screen reader.
-
Constructor Summary
ConstructorsConstructorDescriptionDragEvent(float x, float y, int modifiers, boolean keyboard, int stepX, int stepY, Offer offer, Set<DropAction> sourceActions, DropAction proposed, @Nullable Object source) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept()Takes the drop here, with the proposed action.voidaccept(DropAction action) Takes the drop here.@Nullable DropActionvoiddescribePlace(String where) Says where the drop would land, for a screen reader following a keyboard drag: "before Order 42", "into Customers".booleanbooleanintoffer()@Nullable Stringplace()@Nullable Objectsource()intstepX()intstepY()floatx()floaty()
-
Constructor Details
-
DragEvent
public DragEvent(float x, float y, int modifiers, boolean keyboard, int stepX, int stepY, Offer offer, Set<DropAction> sourceActions, DropAction proposed, @Nullable Object source) - Parameters:
x- the pointer, in scene coordinatesy- the pointer, in scene coordinatesmodifiers- the modifier keys heldkeyboard- whether the keyboard drives the dragstepX- -1, 0 or 1: an arrow key pressed in a keyboard drag, in reading orderstepY- -1, 0 or 1: an arrow key pressed in a keyboard dragoffer- what is draggedsourceActions- what the source allows, its preference firstproposed- the action the modifier keys ask for, among thosesource- the widget the drag began on, or null when it began in another program
-
-
Method Details
-
x
public float x()- Returns:
- the pointer, in scene coordinates
-
y
public float y()- Returns:
- the pointer, in scene coordinates
-
modifiers
public int modifiers()- Returns:
- the modifier keys held, as
Keys.MOD_*bits
-
isKeyboard
public boolean isKeyboard()- Returns:
- whether the keyboard drives the drag
-
stepX
public int stepX()- Returns:
- -1, 0 or 1: the arrow key pressed, along the line, in a keyboard drag
-
stepY
public int stepY()- Returns:
- -1, 0 or 1: the arrow key pressed, across the lines, in a keyboard drag
-
offer
- Returns:
- what is dragged: its formats now, its values at the drop
-
sourceActions
- Returns:
- what the source allows, its preference first
-
proposedAction
- Returns:
- the action the user is asking for: the one the modifier keys name where the source allows it, and otherwise the source's preference
-
source
- Returns:
- the widget the drag began on, or null when it began in another program
-
accept
public void accept()Takes the drop here, with the proposed action. -
accept
Takes the drop here.- Parameters:
action- what the drop would do- Throws:
IllegalArgumentException- if the source does not allow it
-
isAccepted
public boolean isAccepted()- Returns:
- whether a widget accepted
-
acceptedAction
- Returns:
- the action accepted, or null
-
describePlace
Says where the drop would land, for a screen reader following a keyboard drag: "before Order 42", "into Customers".- Parameters:
where- the place, in the user's language
-
place
- Returns:
- the place described, or null
-