Java 类sun.awt.datatransfer.DataTransferer 实例源码

项目:OpenJSharp    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:OpenJSharp    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:jdk8u-jdk    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:jdk8u-jdk    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:Java8CN    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:jdk8u_jdk    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:jdk8u_jdk    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:lookaside_java-1.8.0-openjdk    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:lookaside_java-1.8.0-openjdk    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:VarJ    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:jdk-1.7-annotated    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:infobip-open-jdk-8    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:infobip-open-jdk-8    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:jdk8u-dev-jdk    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         byte[].class.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:jdk8u-dev-jdk    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:jdk7-jdk    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:jdk7-jdk    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:openjdk-source-code-learn    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:openjdk-source-code-learn    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:OLD-OpenJDK8    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:OLD-OpenJDK8    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:openjdk-jdk7u-jdk    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:openjdk-jdk7u-jdk    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:openjdk-icedtea7    文件:DataFlavor.java   
private String paramString() {
    String params = "";
    params += "mimetype=";
    if (mimeType == null) {
        params += "null";
    } else {
        params += mimeType.getBaseType();
    }
    params += ";representationclass=";
    if (representationClass == null) {
       params += "null";
    } else {
       params += representationClass.getName();
    }
    if (DataTransferer.isFlavorCharsetTextType(this) &&
        (isRepresentationClassInputStream() ||
         isRepresentationClassByteBuffer() ||
         DataTransferer.byteArrayClass.equals(representationClass)))
    {
        params += ";charset=" + DataTransferer.getTextCharset(this);
    }
    return params;
}
项目:openjdk-icedtea7    文件:XDataTransferer.java   
protected String getCharsetForTextFormat(Long lFormat) {
    long format = lFormat.longValue();
    if (isMimeFormat(format, "text")) {
        String nat = getNativeForFormat(format);
        DataFlavor df = new DataFlavor(nat, null);
        // Ignore the charset parameter of the MIME type if the subtype
        // doesn't support charset.
        if (!DataTransferer.doesSubtypeSupportCharset(df)) {
            return null;
        }
        String charset = df.getParameter("charset");
        if (charset != null) {
            return charset;
        }
    }
    return super.getCharsetForTextFormat(lFormat);
}
项目:OpenJSharp    文件:DataFlavor.java   
/**
 * Returns hash code for this <code>DataFlavor</code>.
 * For two equal <code>DataFlavor</code>s, hash codes are equal.
 * For the <code>String</code>
 * that matches <code>DataFlavor.equals(String)</code>, it is not
 * guaranteed that <code>DataFlavor</code>'s hash code is equal
 * to the hash code of the <code>String</code>.
 *
 * @return a hash code for this <code>DataFlavor</code>
 */
public int hashCode() {
    int total = 0;

    if (representationClass != null) {
        total += representationClass.hashCode();
    }

    if (mimeType != null) {
        String primaryType = mimeType.getPrimaryType();
        if (primaryType != null) {
            total += primaryType.hashCode();
        }

        // Do not add subType.hashCode() to the total. equals uses
        // MimeType.match which reports a match if one or both of the
        // subTypes is '*', regardless of the other subType.

        if ("text".equals(primaryType)) {
            if (DataTransferer.doesSubtypeSupportCharset(this)
                    && representationClass != null
                    && !isStandardTextRepresentationClass()) {
                String charset = DataTransferer.canonicalName(getParameter("charset"));
                if (charset != null) {
                    total += charset.hashCode();
                }
            }

            if ("html".equals(getSubType())) {
                String document = this.getParameter("document");
                if (document != null) {
                    total += document.hashCode();
                }
            }
        }
    }

    return total;
}
项目:OpenJSharp    文件:SunDropTargetContextPeer.java   
/**
 * @return current DataFlavors available
 */
// NOTE: This method may be called by privileged threads.
//       DO NOT INVOKE CLIENT CODE ON THIS THREAD!

public DataFlavor[] getTransferDataFlavors() {
    final Transferable    localTransferable = local;

    if (localTransferable != null) {
        return localTransferable.getTransferDataFlavors();
    } else {
        return DataTransferer.getInstance().getFlavorsForFormatsAsArray
            (currentT, DataTransferer.adaptFlavorMap
                (currentDT.getFlavorMap()));
    }
}
项目:OpenJSharp    文件:SunDropTargetContextPeer.java   
/**
 * @return if the flavor is supported
 */

public boolean isDataFlavorSupported(DataFlavor df) {
    Transferable localTransferable = local;

    if (localTransferable != null) {
        return localTransferable.isDataFlavorSupported(df);
    } else {
        return DataTransferer.getInstance().getFlavorsForFormats
            (currentT, DataTransferer.adaptFlavorMap
                (currentDT.getFlavorMap())).
            containsKey(df);
    }
}
项目:OpenJSharp    文件:SunDropTargetContextPeer.java   
protected int postDropTargetEvent(final Component component,
                                  final int x, final int y,
                                  final int dropAction,
                                  final int actions,
                                  final long[] formats,
                                  final long nativeCtxt,
                                  final int eventID,
                                  final boolean dispatchType) {
    AppContext appContext = SunToolkit.targetToAppContext(component);

    EventDispatcher dispatcher =
        new EventDispatcher(this, dropAction, actions, formats, nativeCtxt,
                            dispatchType);

    SunDropTargetEvent event =
        new SunDropTargetEvent(component, eventID, x, y, dispatcher);

    if (dispatchType == SunDropTargetContextPeer.DISPATCH_SYNC) {
        DataTransferer.getInstance().getToolkitThreadBlockedHandler().lock();
    }

    // schedule callback
    SunToolkit.postEvent(appContext, event);

    eventPosted(event);

    if (dispatchType == SunDropTargetContextPeer.DISPATCH_SYNC) {
        while (!dispatcher.isDone()) {
            DataTransferer.getInstance().getToolkitThreadBlockedHandler().enter();
        }

        DataTransferer.getInstance().getToolkitThreadBlockedHandler().unlock();

        // return target's response
        return dispatcher.getReturnValue();
    } else {
        return 0;
    }
}
项目: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    文件:BasicTransferable.java   
private InputStream createInputStream(DataFlavor flavor, String data)
        throws IOException, UnsupportedFlavorException {
    String cs = DataTransferer.getTextCharset(flavor);
    if (cs == null) {
        throw new UnsupportedFlavorException(flavor);
    }
    return new ByteArrayInputStream(data.getBytes(cs));
}
项目:OpenJSharp    文件:XClipboard.java   
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;
    }
}
项目:OpenJSharp    文件:XSelection.java   
/**
 * Blocks the current thread till SelectionNotify or PropertyNotify (in case of INCR transfer) arrives.
 */
private static void waitForSelectionNotify(WindowPropertyGetter dataGetter) throws InterruptedException {
    long startTime = System.currentTimeMillis();
    XToolkit.awtLock();
    try {
        do {
            DataTransferer.getInstance().processDataConversionRequests();
            XToolkit.awtLockWait(250);
        } while (propertyGetter == dataGetter && System.currentTimeMillis() < startTime + UNIXToolkit.getDatatransferTimeout());
    } finally {
        XToolkit.awtUnlock();
    }
}
项目:jdk8u-jdk    文件:DataFlavor.java   
/**
 * Returns hash code for this <code>DataFlavor</code>.
 * For two equal <code>DataFlavor</code>s, hash codes are equal.
 * For the <code>String</code>
 * that matches <code>DataFlavor.equals(String)</code>, it is not
 * guaranteed that <code>DataFlavor</code>'s hash code is equal
 * to the hash code of the <code>String</code>.
 *
 * @return a hash code for this <code>DataFlavor</code>
 */
public int hashCode() {
    int total = 0;

    if (representationClass != null) {
        total += representationClass.hashCode();
    }

    if (mimeType != null) {
        String primaryType = mimeType.getPrimaryType();
        if (primaryType != null) {
            total += primaryType.hashCode();
        }

        // Do not add subType.hashCode() to the total. equals uses
        // MimeType.match which reports a match if one or both of the
        // subTypes is '*', regardless of the other subType.

        if ("text".equals(primaryType)) {
            if (DataTransferer.doesSubtypeSupportCharset(this)
                    && representationClass != null
                    && !isStandardTextRepresentationClass()) {
                String charset = DataTransferer.canonicalName(getParameter("charset"));
                if (charset != null) {
                    total += charset.hashCode();
                }
            }

            if ("html".equals(getSubType())) {
                String document = this.getParameter("document");
                if (document != null) {
                    total += document.hashCode();
                }
            }
        }
    }

    return total;
}
项目:jdk8u-jdk    文件:SunDropTargetContextPeer.java   
/**
 * @return current DataFlavors available
 */
// NOTE: This method may be called by privileged threads.
//       DO NOT INVOKE CLIENT CODE ON THIS THREAD!

public DataFlavor[] getTransferDataFlavors() {
    final Transferable    localTransferable = local;

    if (localTransferable != null) {
        return localTransferable.getTransferDataFlavors();
    } else {
        return DataTransferer.getInstance().getFlavorsForFormatsAsArray
            (currentT, DataTransferer.adaptFlavorMap
                (currentDT.getFlavorMap()));
    }
}
项目:jdk8u-jdk    文件:SunDropTargetContextPeer.java   
/**
 * @return if the flavor is supported
 */

public boolean isDataFlavorSupported(DataFlavor df) {
    Transferable localTransferable = local;

    if (localTransferable != null) {
        return localTransferable.isDataFlavorSupported(df);
    } else {
        return DataTransferer.getInstance().getFlavorsForFormats
            (currentT, DataTransferer.adaptFlavorMap
                (currentDT.getFlavorMap())).
            containsKey(df);
    }
}
项目:jdk8u-jdk    文件:SunDropTargetContextPeer.java   
protected int postDropTargetEvent(final Component component,
                                  final int x, final int y,
                                  final int dropAction,
                                  final int actions,
                                  final long[] formats,
                                  final long nativeCtxt,
                                  final int eventID,
                                  final boolean dispatchType) {
    AppContext appContext = SunToolkit.targetToAppContext(component);

    EventDispatcher dispatcher =
        new EventDispatcher(this, dropAction, actions, formats, nativeCtxt,
                            dispatchType);

    SunDropTargetEvent event =
        new SunDropTargetEvent(component, eventID, x, y, dispatcher);

    if (dispatchType == SunDropTargetContextPeer.DISPATCH_SYNC) {
        DataTransferer.getInstance().getToolkitThreadBlockedHandler().lock();
    }

    // schedule callback
    SunToolkit.postEvent(appContext, event);

    eventPosted(event);

    if (dispatchType == SunDropTargetContextPeer.DISPATCH_SYNC) {
        while (!dispatcher.isDone()) {
            DataTransferer.getInstance().getToolkitThreadBlockedHandler().enter();
        }

        DataTransferer.getInstance().getToolkitThreadBlockedHandler().unlock();

        // return target's response
        return dispatcher.getReturnValue();
    } else {
        return 0;
    }
}
项目: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    文件:BasicTransferable.java   
private InputStream createInputStream(DataFlavor flavor, String data)
        throws IOException, UnsupportedFlavorException {
    String cs = DataTransferer.getTextCharset(flavor);
    if (cs == null) {
        throw new UnsupportedFlavorException(flavor);
    }
    return new ByteArrayInputStream(data.getBytes(cs));
}
项目:jdk8u-jdk    文件:XClipboard.java   
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;
    }
}