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

下面列出了怎么用java.awt.dnd.DragSourceContext的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * 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;
            }
        });
}
 
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();
    }
}
 
源代码3 项目: TencentKona-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;
            }
        });
}
 
源代码4 项目: TencentKona-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();
    }
}
 
源代码5 项目: jdk8u60   文件: 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;
            }
        });
}
 
源代码6 项目: jdk8u60   文件: 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();
    }
}
 
源代码7 项目: openjdk-jdk8u   文件: 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;
            }
        });
}
 
源代码8 项目: openjdk-jdk8u   文件: 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();
    }
}
 
源代码9 项目: netbeans   文件: DnDSupport.java
public void dragMouseMoved(DragSourceDragEvent e) {
    Point location = WindowDnDManager.getLocationWorkaround(e);
    DragSourceContext context = e.getDragSourceContext();
    if( isButtonDrag ) {
        int action = e.getDropAction();
        if ((action & DnDConstants.ACTION_MOVE) != 0) {
            context.setCursor( dragMoveCursor );
        } else {
            if( isInToolbarPanel( location ) ) {
                context.setCursor( dragNoDropCursor );
            } else {
                context.setCursor( dragRemoveCursor );
            }
        }
    } else if( isToolbarDrag && null != dragWindow ) {
        Point p = new Point( location );
        p.x -= startingPoint.x;
        p.y -= startingPoint.y;
        dragWindow.setLocation(p);
        context.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );

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

        ToolbarRow oldRow = currentRow;
        currentRow = row;
        if( null != oldRow && oldRow != currentRow ) {
            oldRow.hideDropFeedback();
            config.repaint();
        }
        if( null != currentRow )
            currentRow.showDropFeedback( sourceContainer, location, dragImage );
        if( !config.isLastRow(currentRow) )
            config.maybeRemoveLastRow();
    }
}
 
/**
 * 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;
            }
        });
}
 
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();
    }
}
 
源代码12 项目: 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);
}
 
源代码13 项目: Bytecoder   文件: 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;
            }
        });
}
 
源代码14 项目: Bytecoder   文件: 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();
    }
}
 
源代码15 项目: openjdk-jdk9   文件: 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;
            }
        });
}
 
源代码16 项目: openjdk-jdk9   文件: 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();
    }
}
 
源代码17 项目: 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;
            }
        });
}
 
源代码18 项目: 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();
    }
}
 
源代码19 项目: hottub   文件: 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;
            }
        });
}
 
源代码20 项目: hottub   文件: 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();
    }
}
 
/**
 * 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;
            }
        });
}
 
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();
    }
}
 
源代码23 项目: openjdk-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;
            }
        });
}
 
源代码24 项目: openjdk-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();
    }
}
 
源代码25 项目: 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;
            }
        });
}
 
源代码26 项目: 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();
    }
}
 
/**
 * 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();
}
 
/**
 * Drag target entered.
 *
 * @param evt
 *            Drag event
 */
@Override
public void dragEnter(DragSourceDragEvent evt) {
	// Show drag cursor
	DragSourceContext ctx = evt.getDragSourceContext();
	ctx.setCursor(cursor);
}
 
源代码29 项目: 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;
            }
        });
}
 
源代码30 项目: 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();
    }
}
 
 类所在包
 同包方法