Methods Summary |
---|
private void | clearState()
dndArmedEvent = null;
component = null;
|
private static javax.swing.plaf.basic.DragRecognitionSupport | getDragRecognitionSupport()Returns the DragRecognitionSupport for the caller's AppContext.
DragRecognitionSupport support =
(DragRecognitionSupport)AppContext.getAppContext().
get(DragRecognitionSupport.class);
if (support == null) {
support = new DragRecognitionSupport();
AppContext.getAppContext().put(DragRecognitionSupport.class, support);
}
return support;
|
private int | mapDragOperationFromModifiers(java.awt.event.MouseEvent me, javax.swing.TransferHandler th)
if (th == null || !SwingUtilities.isLeftMouseButton(me)) {
return TransferHandler.NONE;
}
return SunDragSourceContextPeer.
convertModifiersToDropAction(me.getModifiersEx(),
th.getSourceActions(component));
|
public static boolean | mouseDragged(java.awt.event.MouseEvent me, javax.swing.plaf.basic.DragRecognitionSupport$BeforeDrag bd)Returns whether or not a drag gesture recognition is ongoing.
return ((DragRecognitionSupport)getDragRecognitionSupport()).
mouseDraggedImpl(me, bd);
|
private boolean | mouseDraggedImpl(java.awt.event.MouseEvent me, javax.swing.plaf.basic.DragRecognitionSupport$BeforeDrag bd)Returns whether or not a drag gesture recognition is ongoing.
/* no recognition is in progress */
if (dndArmedEvent == null) {
return false;
}
/* component has changed unexpectedly, so bail */
if (me.getSource() != component) {
clearState();
return false;
}
int dx = Math.abs(me.getX() - dndArmedEvent.getX());
int dy = Math.abs(me.getY() - dndArmedEvent.getY());
if ((dx > motionThreshold) || (dy > motionThreshold)) {
TransferHandler th = component.getTransferHandler();
int action = mapDragOperationFromModifiers(me, th);
if (action != TransferHandler.NONE) {
/* notify the BeforeDrag instance */
if (bd != null) {
bd.dragStarting(dndArmedEvent);
}
th.exportAsDrag(component, dndArmedEvent, action);
clearState();
}
}
return true;
|
public static boolean | mousePressed(java.awt.event.MouseEvent me)Returns whether or not the event is potentially part of a drag sequence.
return ((DragRecognitionSupport)getDragRecognitionSupport()).
mousePressedImpl(me);
|
private boolean | mousePressedImpl(java.awt.event.MouseEvent me)Returns whether or not the event is potentially part of a drag sequence.
component = (JComponent)me.getSource();
if (mapDragOperationFromModifiers(me, component.getTransferHandler())
!= TransferHandler.NONE) {
motionThreshold = DragSource.getDragThreshold();
dndArmedEvent = me;
return true;
}
clearState();
return false;
|
public static java.awt.event.MouseEvent | mouseReleased(java.awt.event.MouseEvent me)If a dnd recognition has been going on, return the MouseEvent
that started the recognition. Otherwise, return null.
return ((DragRecognitionSupport)getDragRecognitionSupport()).
mouseReleasedImpl(me);
|
private java.awt.event.MouseEvent | mouseReleasedImpl(java.awt.event.MouseEvent me)If a dnd recognition has been going on, return the MouseEvent
that started the recognition. Otherwise, return null.
/* no recognition has been going on */
if (dndArmedEvent == null) {
return null;
}
MouseEvent retEvent = null;
if (me.getSource() == component) {
retEvent = dndArmedEvent;
} // else component has changed unexpectedly, so return null
clearState();
return retEvent;
|