use of java.awt.dnd.DragSourceEvent in project jdk8u_jdk by JetBrains.
the class SunDragSourceContextPeer method dragExit.
/**
* upcall from native code
*/
protected final void dragExit(final int x, final int y) {
DragSourceEvent event = new DragSourceEvent(getDragSourceContext(), x, y);
EventDispatcher dispatcher = new EventDispatcher(DISPATCH_EXIT, event);
SunToolkit.invokeLaterOnAppContext(SunToolkit.targetToAppContext(getComponent()), dispatcher);
startSecondaryEventLoop();
}
use of java.awt.dnd.DragSourceEvent in project freeplane by freeplane.
the class MNodeDragListener method dragGestureRecognized.
public void dragGestureRecognized(final DragGestureEvent e) {
final MainView mainView = (MainView) e.getComponent();
final NodeView nodeView = mainView.getNodeView();
final MapView mapView = nodeView.getMap();
mapView.select();
if (!nodeView.isSelected()) {
nodeView.getMap().getModeController().getController().getSelection().selectAsTheOnlyOneSelected(nodeView.getModel());
}
Rectangle bounds = new Rectangle(0, 0, mainView.getWidth(), mainView.getHeight());
if (!bounds.contains(e.getDragOrigin()))
return;
final int dragActionType = e.getDragAction();
if (dragActionType == DnDConstants.ACTION_MOVE) {
final NodeModel node = nodeView.getModel();
if (node.isRoot()) {
if (!isLinkDragEvent(e))
return;
}
}
final String dragActionName;
Cursor cursor = getCursorByAction(dragActionType);
if (isLinkDragEvent(e)) {
cursor = DragSource.DefaultLinkDrop;
dragActionName = "LINK";
} else if ((e.getTriggerEvent().getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) {
cursor = DragSource.DefaultCopyDrop;
dragActionName = "COPY";
} else {
dragActionName = "MOVE";
}
final Transferable t = ClipboardController.getController().copy(Controller.getCurrentController().getSelection());
((MindMapNodesSelection) t).setDropAction(dragActionName);
try {
e.startDrag(cursor, t, new DragSourceListener() {
public void dragDropEnd(final DragSourceDropEvent dsde) {
}
public void dragEnter(final DragSourceDragEvent e) {
}
public void dragExit(final DragSourceEvent dse) {
}
public void dragOver(final DragSourceDragEvent dsde) {
}
public void dropActionChanged(final DragSourceDragEvent dsde) {
dsde.getDragSourceContext().setCursor(getCursorByAction(dsde.getUserAction()));
}
});
} catch (final InvalidDnDOperationException ex) {
}
}
use of java.awt.dnd.DragSourceEvent in project jdk8u_jdk by JetBrains.
the class SunDragSourceContextPeer method dragDropFinished.
/**
* upcall from native code via implemented class (do)
*/
protected final void dragDropFinished(final boolean success, final int operations, final int x, final int y) {
DragSourceEvent event = new DragSourceDropEvent(getDragSourceContext(), operations & sourceActions, success, x, y);
EventDispatcher dispatcher = new EventDispatcher(DISPATCH_FINISH, event);
SunToolkit.invokeLaterOnAppContext(SunToolkit.targetToAppContext(getComponent()), dispatcher);
startSecondaryEventLoop();
setNativeContext(0);
dragImage = null;
dragImageOffset = null;
}
Aggregations