Java 类java.awt.dnd.DragSourceContext 实例源码

项目:KATscans    文件:DraggableTree.java   
@Override
public void dragOver(DragSourceDragEvent dsde) {
    DragSourceContext context = dsde.getDragSourceContext();

    if (!checkDropValid()) {
        context.setCursor(DragSource.DefaultMoveNoDrop);
        return;
    }

    switch (dsde.getDropAction()) {
        case DnDConstants.ACTION_MOVE:
            context.setCursor(DragSource.DefaultMoveDrop);
            break;
        case DnDConstants.ACTION_COPY:
            context.setCursor(DragSource.DefaultCopyDrop);
            break;
        default:
            context.setCursor(DragSource.DefaultMoveNoDrop);
            break;
    }
}
项目:cn1    文件:WinDragSource.java   
public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point ioff)
        throws InvalidDnDOperationException {

    synchronized (this) {
        context = dsc;
        cursor = c;
    }
    mouseLocation = getCurrentMouseLocation();
    userAction = 0;
    targetActions = 0;

    DataSource dataSource = new DataSource(context.getTransferable());
    final DataSnapshot snapshot = new DataSnapshot(dataSource);
    final int srcActions = getWinActions(context.getSourceActions());

    WinEventQueue.Task task = new WinEventQueue.Task() {
        @Override
        public void perform() {
            WinDataTransfer.startDrag(snapshot, 
                    WinDragSource.this, srcActions);
        }
    };
    winEventQueue.performLater(task);
}
项目:freeVM    文件:WinDragSource.java   
public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point ioff)
        throws InvalidDnDOperationException {

    synchronized (this) {
        context = dsc;
        cursor = c;
    }
    mouseLocation = getCurrentMouseLocation();
    userAction = 0;
    targetActions = 0;

    DataSource dataSource = new DataSource(context.getTransferable());
    final DataSnapshot snapshot = new DataSnapshot(dataSource);
    final int srcActions = getWinActions(context.getSourceActions());

    WinEventQueue.Task task = new WinEventQueue.Task() {
        @Override
        public void perform() {
            WinDataTransfer.startDrag(snapshot, 
                    WinDragSource.this, srcActions);
        }
    };
    winEventQueue.performLater(task);
}
项目:freeVM    文件:WinDragSource.java   
public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point ioff)
        throws InvalidDnDOperationException {

    synchronized (this) {
        context = dsc;
        cursor = c;
    }
    mouseLocation = getCurrentMouseLocation();
    userAction = 0;
    targetActions = 0;

    DataSource dataSource = new DataSource(context.getTransferable());
    final DataSnapshot snapshot = new DataSnapshot(dataSource);
    final int srcActions = getWinActions(context.getSourceActions());

    WinEventQueue.Task task = new WinEventQueue.Task() {
        @Override
        public void perform() {
            WinDataTransfer.startDrag(snapshot, 
                    WinDragSource.this, srcActions);
        }
    };
    winEventQueue.performLater(task);
}
项目:vars    文件:JTreeDragAndDropDecorator.java   
/**
 * This method is called when a drag enters (over) the component with
 * this listener.
 *
 * @param  e the <code>DragSourceEvent</code> event
 */
public void dragEnter(final DragSourceDragEvent e) {

    // Grag the DragSourceContext from the event
    final DragSourceContext context = e.getDragSourceContext();

    // Get the action from the event
    final int myaction = e.getDropAction();

    // Check to make sure it is compatible with any actions in this listener
    if ((myaction & DnDConstants.ACTION_COPY) != 0) {
        context.setCursor(DragSource.DefaultCopyDrop);
    }
    else {
        context.setCursor(DragSource.DefaultCopyNoDrop);
    }
}
项目:incubator-netbeans    文件:DnDSupport.java   
public void dragMouseMoved(DragSourceDragEvent e) {
    DragSourceContext context = e.getDragSourceContext();
    if( isButtonDrag ) {
        int action = e.getDropAction();
        if ((action & DnDConstants.ACTION_MOVE) != 0) {
            context.setCursor( dragMoveCursor );
        } else {
            if( isInToolbarPanel( e.getLocation() ) ) {
                context.setCursor( dragNoDropCursor );
            } else {
                context.setCursor( dragRemoveCursor );
            }
        }
    } else if( isToolbarDrag && null != dragWindow ) {
        Point p = new Point( e.getLocation() );
        p.x -= startingPoint.x;
        p.y -= startingPoint.y;
        dragWindow.setLocation(p);
        context.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );

        ToolbarRow row = config.getToolbarRowAt( e.getLocation() );
        if( null == row && (sourceRow.countVisibleToolbars() > 1 || !config.isLastRow(sourceRow)) ) {
            row = config.maybeAddEmptyRow( e.getLocation() );
        }

        ToolbarRow oldRow = currentRow;
        currentRow = row;
        if( null != oldRow && oldRow != currentRow ) {
            oldRow.hideDropFeedback();
            config.repaint();
        }
        if( null != currentRow )
            currentRow.showDropFeedback( sourceContainer, e.getLocation(), dragImage );
        if( !config.isLastRow(currentRow) )
            config.maybeRemoveLastRow();
    }
}
项目:rapidminer    文件:AbstractPatchedTransferHandler.java   
/**
 * as the operation completes
 */
@Override
public void dragDropEnd(DragSourceDropEvent dsde) {
    DragSourceContext dsc = dsde.getDragSourceContext();
    JComponent c = (JComponent) dsc.getComponent();
    if (dsde.getDropSuccess()) {
        ((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(),
                dsde.getDropAction());
    } else {
        ((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(), NONE);
    }
    c.setAutoscrolls(scrolls);
    fireDragEnded();
}
项目:freecol    文件:DefaultTransferHandler.java   
/**
 * {@inheritDoc}
 */
public void dragDropEnd(DragSourceDropEvent dsde) {
    DragSourceContext dsc = dsde.getDragSourceContext();
    JComponent c = (JComponent)dsc.getComponent();

    if (dsde.getDropSuccess()) {
        ((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
            dsc.getTransferable(), dsde.getDropAction());
    } else {
        ((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
            null, NONE);
    }
    c.setAutoscrolls(scrolls);
}
项目:OpenJSharp    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:OpenJSharp    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:jdk8u-jdk    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:jdk8u-jdk    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:openjdk-jdk10    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:openjdk-jdk10    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:FreeCol    文件:DefaultTransferHandler.java   
/**
 * {@inheritDoc}
 */
public void dragDropEnd(DragSourceDropEvent dsde) {
    DragSourceContext dsc = dsde.getDragSourceContext();
    JComponent c = (JComponent)dsc.getComponent();

    if (dsde.getDropSuccess()) {
        ((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
            dsc.getTransferable(), dsde.getDropAction());
    } else {
        ((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
            null, NONE);
    }
    c.setAutoscrolls(scrolls);
}
项目:openjdk9    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:openjdk9    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:jdk8u_jdk    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:jdk8u_jdk    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:lookaside_java-1.8.0-openjdk    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:SweetHome3D    文件:VisualTransferHandler.java   
public void dragDropEnd(DragSourceDropEvent ev)
{
    DragSourceContext dragSourceContext = ev.getDragSourceContext();
    JComponent component = (JComponent) dragSourceContext.getComponent();
    if (ev.getDropSuccess())
    {
        exportDone(component, dragSourceContext.getTransferable(), ev.getDropAction());
    }
    else
    {
        exportDone(component, dragSourceContext.getTransferable(), NONE);
    }
    component.setAutoscrolls(this.autoscrolls);
}
项目:javify    文件:Demo.java   
public void dragEnter(DragSourceDragEvent e)
{
  DragSourceContext ctx = e.getDragSourceContext();

  int action = e.getDropAction();
  if ((action & DnDConstants.ACTION_COPY) != 0)
    ctx.setCursor(DragSource.DefaultCopyDrop);
  else
    ctx.setCursor(DragSource.DefaultCopyNoDrop);
}
项目:javify    文件:TransferHandler.java   
public void dragDropEnd(DragSourceDropEvent e)
{
  DragSourceContext ctx = e.getDragSourceContext();
  JComponent c = (JComponent) ctx.getComponent();
  TransferHandler th = c.getTransferHandler();
  if (e.getDropSuccess())
    {
      th.exportDone(c, ctx.getTransferable(), e.getDropAction());
    }
  else
    {
      th.exportDone(c, ctx.getTransferable(), e.getDropAction());
    }
  c.setAutoscrolls(autoscrolls);
}
项目:javify    文件:GtkDragSourceContextPeer.java   
public void startDrag(DragSourceContext context, Cursor c, Image i, Point p)
    throws InvalidDnDOperationException
{
  this.context = context;

  if (p == null)
    p = new Point();

  // FIXME: use proper DataFlavor, not "text/plain".
  // Also, add check to determine if dragging.

  setCursor(c);
  nativeStartDrag(i, p.x, p.y, context.getTrigger().getDragAction(),
                  "text/plain");
}
项目:rapidminer-studio    文件:AbstractPatchedTransferHandler.java   
/**
 * as the operation completes
 */
@Override
public void dragDropEnd(DragSourceDropEvent dsde) {
    DragSourceContext dsc = dsde.getDragSourceContext();
    JComponent c = (JComponent) dsc.getComponent();
    if (dsde.getDropSuccess()) {
        ((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(),
                dsde.getDropAction());
    } else {
        ((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(), NONE);
    }
    c.setAutoscrolls(scrolls);
    fireDragEnded();
}
项目:keystore-explorer    文件:KeyStoreEntryDragGestureListener.java   
/**
 * Drag target entered.
 *
 * @param evt
 *            Drag event
 */
@Override
public void dragEnter(DragSourceDragEvent evt) {
    // Show drag cursor
    DragSourceContext ctx = evt.getDragSourceContext();
    ctx.setCursor(cursor);
}
项目:jvm-stm    文件:Demo.java   
public void dragEnter(DragSourceDragEvent e)
{
  DragSourceContext ctx = e.getDragSourceContext();

  int action = e.getDropAction();
  if ((action & DnDConstants.ACTION_COPY) != 0)
    ctx.setCursor(DragSource.DefaultCopyDrop);
  else
    ctx.setCursor(DragSource.DefaultCopyNoDrop);
}
项目:jvm-stm    文件:TransferHandler.java   
public void dragDropEnd(DragSourceDropEvent e)
{
  DragSourceContext ctx = e.getDragSourceContext();
  JComponent c = (JComponent) ctx.getComponent();
  TransferHandler th = c.getTransferHandler();
  if (e.getDropSuccess())
    {
      th.exportDone(c, ctx.getTransferable(), e.getDropAction());
    }
  else
    {
      th.exportDone(c, ctx.getTransferable(), e.getDropAction());
    }
  c.setAutoscrolls(autoscrolls);
}
项目:jvm-stm    文件:GtkDragSourceContextPeer.java   
public void startDrag(DragSourceContext context, Cursor c, Image i, Point p)
    throws InvalidDnDOperationException
{   
  this.context = context;

  if (p == null)
    p = new Point();

  // FIXME: use proper DataFlavor, not "text/plain".
  // Also, add check to determine if dragging.

  setCursor(c);
  nativeStartDrag(i, p.x, p.y, context.getTrigger().getDragAction(),
                  "text/plain");
}
项目:umple    文件:DefaultDrawingViewTransferHandler.java   
/**
 * as the operation completes
 */
@Override
public void dragDropEnd(DragSourceDropEvent dsde) {
    DragSourceContext dsc = dsde.getDragSourceContext();
    JComponent c = (JComponent) dsc.getComponent();
    DefaultDrawingViewTransferHandler th = (DefaultDrawingViewTransferHandler) c.getTransferHandler();
    if (dsde.getDropSuccess()) {
        th.exportDone(c, dsc.getTransferable(), dsde.getDropAction());
    } else {
        th.exportDone(c, dsc.getTransferable(), NONE);
    }
    c.setAutoscrolls(scrolls);
}
项目:tellervo    文件:Tree.java   
public void dragEnter(DragSourceDragEvent event) {
    DragSourceContext context = event.getDragSourceContext(); // Q: do i need to do any of this?
    int myAction = event.getDropAction();
    if ((myAction & DnDConstants.ACTION_COPY) != 0)
    context.setCursor(DragSource.DefaultCopyDrop);
    else
    context.setCursor(DragSource.DefaultMoveDrop);
    // context.setCursor(DragSource.DefaultCopyNoDrop);
}
项目:infobip-open-jdk-8    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:infobip-open-jdk-8    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:jdk8u-dev-jdk    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
        getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
            (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:jdk8u-dev-jdk    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:jdk7-jdk    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
         (transferable, DataTransferer.adaptFlavorMap
             (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:jdk7-jdk    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
项目:openjdk-source-code-learn    文件:SunDragSourceContextPeer.java   
/**
 * initiate a DnD operation ...
 */

public void startDrag(DragSourceContext dsc, Cursor c, Image di, Point p)
  throws InvalidDnDOperationException {

    /* Fix for 4354044: don't initiate a drag if event sequence provided by
     * DragGestureRecognizer is empty */
    if (getTrigger().getTriggerEvent() == null) {
        throw new InvalidDnDOperationException("DragGestureEvent has a null trigger");
    }

    dragSourceContext = dsc;
    cursor            = c;
    sourceActions     = getDragSourceContext().getSourceActions();
    dragImage         = di;
    dragImageOffset   = p;

    Transferable transferable  = getDragSourceContext().getTransferable();
    SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
         (transferable, DataTransferer.adaptFlavorMap
             (getTrigger().getDragSource().getFlavorMap()));
    long[] formats = DataTransferer.getInstance().
        keysToLongArray(formatMap);
    startDrag(transferable, formats, formatMap);

    /*
     * Fix for 4613903.
     * Filter out all mouse events that are currently on the event queue.
     */
    discardingMouseEvents = true;
    EventQueue.invokeLater(new Runnable() {
            public void run() {
                discardingMouseEvents = false;
            }
        });
}
项目:openjdk-source-code-learn    文件:SunDragSourceContextPeer.java   
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}