Java 类java.awt.datatransfer.FlavorTable 实例源码

项目:openjdk-jdk10    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is {@code null}
 */
public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set<DataFlavor> flavorSet = new HashSet<>(formats.length);

    for (long format : formats) {
        List<DataFlavor> flavors = map.getFlavorsForNative(getNativeForFormat(format));
        for (DataFlavor flavor : flavors) {
            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                    flavor.isFlavorJavaFileListType() ||
                    DataFlavor.imageFlavor.equals(flavor) ||
                    flavor.isRepresentationClassSerializable() ||
                    flavor.isRepresentationClassInputStream() ||
                    flavor.isRepresentationClassRemote()) {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:openjdk9    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is {@code null}
 */
public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set<DataFlavor> flavorSet = new HashSet<>(formats.length);

    for (long format : formats) {
        List<DataFlavor> flavors = map.getFlavorsForNative(getNativeForFormat(format));
        for (DataFlavor flavor : flavors) {
            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                    flavor.isFlavorJavaFileListType() ||
                    DataFlavor.imageFlavor.equals(flavor) ||
                    flavor.isRepresentationClassSerializable() ||
                    flavor.isRepresentationClassInputStream() ||
                    flavor.isRepresentationClassRemote()) {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:OpenJSharp    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:OpenJSharp    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:OpenJSharp    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:OpenJSharp    文件:IkvmDataTransferer.java   
public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
    SortedMap retval = super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:jdk8u-jdk    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:jdk8u-jdk    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:jdk8u-jdk    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:jdk8u-jdk    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:openjdk-jdk10    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(Transferable contents,
                                                            FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return Collections.emptySortedMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:openjdk-jdk10    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:openjdk-jdk10    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:openjdk9    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(Transferable contents,
                                                            FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return Collections.emptySortedMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:openjdk9    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:openjdk9    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:jdk8u_jdk    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:jdk8u_jdk    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:lookaside_java-1.8.0-openjdk    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:lookaside_java-1.8.0-openjdk    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:lookaside_java-1.8.0-openjdk    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:lookaside_java-1.8.0-openjdk    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:infobip-open-jdk-8    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:infobip-open-jdk-8    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:infobip-open-jdk-8    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:infobip-open-jdk-8    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:jdk8u-dev-jdk    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:jdk8u-dev-jdk    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:jdk8u-dev-jdk    文件:WDataTransferer.java   
@Override
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:jdk8u-dev-jdk    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:jdk7-jdk    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:jdk7-jdk    文件:WDataTransferer.java   
public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
    SortedMap retval = super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:openjdk-source-code-learn    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:openjdk-source-code-learn    文件:WDataTransferer.java   
public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
    SortedMap retval = super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:OLD-OpenJDK8    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:OLD-OpenJDK8    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:OLD-OpenJDK8    文件:WDataTransferer.java   
public SortedMap <Long, DataFlavor> getFormatsForFlavors(
        DataFlavor[] flavors, FlavorTable map)
{
    SortedMap <Long, DataFlavor> retval =
            super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}
项目:OLD-OpenJDK8    文件:DataFlavorSearcher.java   
static public DataFlavor getByteDataFlavorForNative(String[] nats) {
    FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();

    for (String nat : nats) {
        java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
        for (DataFlavor flavor : flavors) {
            if (flavor != null
                    && flavor.getRepresentationClass().equals(byte[].class)) {
                return flavor;
            }
        }
    }
    throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
}
项目:openjdk-jdk7u-jdk    文件:DataTransferer.java   
/**
 * Returns a Set of all DataFlavors for which
 * 1) a mapping from at least one of the specified formats exists in the
 * specified map and
 * 2) the data translation for this mapping can be performed by the data
 * transfer subsystem.
 *
 * @param formats the data formats
 * @param map the FlavorTable which contains mappings between
 *            DataFlavors and data formats
 * @throws NullPointerException if formats or map is <code>null</code>
 */
public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
    Set flavorSet = new HashSet(formats.length);

    for (int i = 0; i < formats.length; i++) {
        String nat = getNativeForFormat(formats[i]);
        List flavors = map.getFlavorsForNative(nat);

        for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
            DataFlavor flavor = (DataFlavor)iter.next();

            // Don't explicitly test for String, since it is just a special
            // case of Serializable
            if (flavor.isFlavorTextType() ||
                flavor.isFlavorJavaFileListType() ||
                DataFlavor.imageFlavor.equals(flavor) ||
                flavor.isRepresentationClassSerializable() ||
                flavor.isRepresentationClassInputStream() ||
                flavor.isRepresentationClassRemote())
            {
                flavorSet.add(flavor);
            }
        }
    }

    return flavorSet;
}
项目:openjdk-jdk7u-jdk    文件:WDataTransferer.java   
public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
    SortedMap retval = super.getFormatsForFlavors(flavors, map);

    // The Win32 native code does not support exporting LOCALE data, nor
    // should it.
    retval.remove(L_CF_LOCALE);

    return retval;
}