Java Code Examples for java.awt.datatransfer.DataFlavor#getMimeType()
The following examples show how to use
java.awt.datatransfer.DataFlavor#getMimeType() .
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: GetNativesForNewFlavorTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void initMappings() throws Exception { //initialize mapping variables used in this test //create a DataFlavor from Button class test_flavor1 = new DataFlavor(Class.forName("java.awt.Button"), "Button"); //create an Encoded String native using Button class MIME Type String buttonMIME = test_flavor1.getMimeType(); test_encoded = SystemFlavorMap.encodeJavaMIMEType(buttonMIME); //create a DataFlavor from the Encoded String native test_flavor2 = SystemFlavorMap.decodeDataFlavor(test_encoded); //create and initialize DataFlavor arrays test_flavors_set = new DataFlavor[] {test_flavor1}; //create and initialize String native arrays test_natives_set = new String[] {test_encoded}; }
Example 2
Source File: SetDataFlavorsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void verifyNewMappings() { // Enumerate through all DataFlavors for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) { DataFlavor key = (DataFlavor)e.nextElement(); java.util.List listNatives = flavorMap.getNativesForFlavor(key); Vector vectorFlavors = new Vector(listNatives); // Compare the list of Natives if ( !vectorFlavors.equals(hashVerify.get(key))) { throw new RuntimeException("\n*** Error in verifyNewMappings()" + "\nmethod1: setNativesForFlavor(DataFlavor flav, String[] natives)" + "\nmethod2: List getNativesForFlavor(DataFlavor flav)" + "\nDataFlavor: " + key.getMimeType() + "\nThe Returned List did not match the original set of Natives."); } } System.out.println("*** DataFlavor size = " + hashVerify.size()); }
Example 3
Source File: GetFlavorsForNewNativeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void initMappings() throws Exception { //initialize mapping variables used in this test //create an Unencoded String native test_native1 = "TEST1"; //create a DataFlavor from Button class test_flavor1 = new DataFlavor(Class.forName("java.awt.Button"), "Button"); //create an Encoded String native using Button class MIME Type String buttonMIME = test_flavor1.getMimeType(); test_encoded = SystemFlavorMap.encodeJavaMIMEType(buttonMIME); //create a DataFlavor from the Encoded String native test_flavor2 = SystemFlavorMap.decodeDataFlavor(test_encoded); //create and initialize DataFlavor arrays test_flavors_set = new DataFlavor[] {test_flavor2}; //create and initialize String native arrays test_natives_set = new String[] {test_encoded}; }
Example 4
Source File: ManyFlavorMapTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void verifyListDataFlavorEntries() { // Enumerate through all natives for (Enumeration e = hashNatives.keys() ; e.hasMoreElements() ;) { String key = (String)e.nextElement(); // SystemFlavorMap preferred value DataFlavor value = (DataFlavor)hashNatives.get(key); java.util.List listFlavors = flavorMap.getFlavorsForNative(key); Vector vectorFlavors = new Vector(listFlavors); // First element should be preferred value DataFlavor prefFlavor = (DataFlavor)vectorFlavors.firstElement(); if ( value != prefFlavor ) { throw new RuntimeException("\n*** Error in verifyListDataFlavorEntries()" + "\nAPI Test: List getFlavorsForNative(String nat)" + "\native: " + key + "\nSystemFlavorMap preferred native: " + value.getMimeType() + "\nList first entry: " + prefFlavor.getMimeType() + "\nTest failed because List first entry does not match preferred"); } } System.out.println("*** native size = " + hashNatives.size()); }
Example 5
Source File: ManyFlavorMapTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void verifyListNativeEntries() { // Enumerate through all DataFlavors for (Enumeration e = hashFlavors.keys() ; e.hasMoreElements() ;) { DataFlavor key = (DataFlavor)e.nextElement(); // SystemFlavorMap preferred value String value = (String)hashFlavors.get(key); java.util.List listNatives = flavorMap.getNativesForFlavor(key); Vector vectorNatives = new Vector(listNatives); // First element should be preferred value String prefNative = (String)vectorNatives.firstElement(); if ( value != prefNative ) { throw new RuntimeException("\n*** Error in verifyListNativeEntries()" + "\nAPI Test: List getNativesForFlavor(DataFlavor flav)" + "\nDataFlavor: " + key.getMimeType() + "\nSystemFlavorMap preferred native: " + value + "\nList first entry: " + prefNative + "\nTest failed because List first entry does not match preferred"); } } System.out.println("*** DataFlavor size = " + hashFlavors.size()); }
Example 6
Source File: DataFlavorComparatorTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 7
Source File: DataFlavorComparatorTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 8
Source File: DataFlavorComparatorTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 9
Source File: DataFlavorComparatorTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 10
Source File: DataFlavorComparatorTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 11
Source File: DataFlavorComparatorTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 12
Source File: DataFlavorComparatorTest.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 13
Source File: DataFlavorComparatorTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 14
Source File: DataFlavorComparatorTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { Comparator<DataFlavor> comparator = DataFlavorUtil.getDataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 15
Source File: AddNativeTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public boolean verifyNewMappings() { boolean result = true; // Enumerate through all DataFlavors for (Enumeration e = hashVerify.keys() ; e.hasMoreElements() ;) { DataFlavor key = (DataFlavor)e.nextElement(); java.util.List listNatives = flavorMap.getNativesForFlavor(key); Vector vectorNatives = new Vector(listNatives); // Compare the list of Natives //Next line changed by Kanishk to comply with bug 4696522 //if ( !vectorNatives.equals((Vector)hashVerify.get(key))) { if ( !(vectorNatives.containsAll((Vector)hashVerify.get(key)) && ((Vector)hashVerify.get(key)).containsAll(vectorNatives))) { throw new RuntimeException("\n*** Error in verifyNewMappings()" + "\nmethod1: addUnencodedNativeForFlavor(DataFlavor flav, String nat)" + "\nmethod2: List getNativesForFlavor(DataFlavor flav)" + "\nDataFlavor: " + key.getMimeType() + "\nAfter adding several mappings with addUnencodedNativeForFlavor," + "\nthe returned list did not match the mappings that were added." + "\nThe mapping was not included in the list."); } } System.out.println("*** DataFlavor size = " + hashVerify.size()); System.out.println("*** verifyNewMappings result: " + result + "\n"); return result; }
Example 16
Source File: DataFlavorComparatorTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 17
Source File: DataFlavorComparatorTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 18
Source File: DataFlavorComparatorTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }
Example 19
Source File: DataFlavorComparatorTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator(); DataFlavor flavor1 = DataFlavor.imageFlavor; DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor; if (comparator.compare(flavor1, flavor2) == 0) { throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() + " should not be equal"); } }