Java Code Examples for sun.awt.datatransfer.DataTransferer#keysToLongArray()

The following examples show how to use sun.awt.datatransfer.DataTransferer#keysToLongArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XClipboard.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 2
Source File: XClipboard.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 3
Source File: XClipboard.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 4
Source File: XClipboard.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 5
Source File: XClipboard.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 6
Source File: SunDragSourceContextPeer.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
            }
        });
}
 
Example 7
Source File: SunDragSourceContextPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
            }
        });
}
 
Example 8
Source File: XClipboard.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 9
Source File: XClipboard.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 10
Source File: XClipboard.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 11
Source File: XClipboard.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(flavorMap));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 12
Source File: XClipboard.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(flavorMap));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 13
Source File: XClipboard.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 14
Source File: XClipboard.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}
 
Example 15
Source File: XClipboard.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected synchronized void setContentsNative(Transferable contents) {
    SortedMap<Long,DataFlavor> formatMap =
        DataTransferer.getInstance().getFormatsForTransferable
            (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
    long[] formats = DataTransferer.keysToLongArray(formatMap);

    if (!selection.setOwner(contents, formatMap, formats,
                            XToolkit.getCurrentServerTime())) {
        this.owner = null;
        this.contents = null;
    }
}