src/java.desktop/share/classes/java/awt/datatransfer/SystemFlavorMap.java

Print this page




 697             {
 698                 returnValue.add(DataFlavor.plainTextFlavor);
 699             }
 700         } else {
 701             // Non-charset text natives should be treated as
 702             // opaque, 8-bit data in any of its various
 703             // representations.
 704             for (String encodedTextClassName : ENCODED_TEXT_CLASSES) {
 705                 DataFlavor toAdd = null;
 706                 try {
 707                     toAdd = new DataFlavor(baseType +
 708                          ";class=" + encodedTextClassName);
 709                 } catch (ClassNotFoundException cannotHappen) {
 710                 }
 711                 returnValue.add(toAdd);
 712             }
 713         }
 714         return returnValue;
 715     }
 716 
 717     private static final String [] htmlDocumntTypes =
 718             new String [] {"all", "selection", "fragment"};
 719 
 720     private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
 721                                                              String mimeType) {
 722 
 723         LinkedHashSet<String> returnValues = new LinkedHashSet<>();
 724 
 725         if (HTML_TEXT_BASE_TYPE.equals(baseType)) {
 726             for (String documentType : htmlDocumntTypes) {
 727                 returnValues.add(mimeType + ";document=" + documentType);
 728             }
 729         } else {
 730             returnValues.add(mimeType);
 731         }
 732 
 733         return returnValues;
 734     }
 735 
 736     /**
 737      * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
 738      * their most preferred <code>String</code> native. Each native value will
 739      * be the same as the first native in the List returned by
 740      * <code>getNativesForFlavor</code> for the specified flavor.
 741      * <p>
 742      * If a specified <code>DataFlavor</code> is previously unknown to the
 743      * data transfer subsystem, then invoking this method will establish a
 744      * mapping in both directions between the specified <code>DataFlavor</code>
 745      * and an encoded version of its MIME type as its native.
 746      *




 697             {
 698                 returnValue.add(DataFlavor.plainTextFlavor);
 699             }
 700         } else {
 701             // Non-charset text natives should be treated as
 702             // opaque, 8-bit data in any of its various
 703             // representations.
 704             for (String encodedTextClassName : ENCODED_TEXT_CLASSES) {
 705                 DataFlavor toAdd = null;
 706                 try {
 707                     toAdd = new DataFlavor(baseType +
 708                          ";class=" + encodedTextClassName);
 709                 } catch (ClassNotFoundException cannotHappen) {
 710                 }
 711                 returnValue.add(toAdd);
 712             }
 713         }
 714         return returnValue;
 715     }
 716 
 717     private static final String [] htmlDocumentTypes =
 718             new String [] {"all", "selection", "fragment"};
 719 
 720     private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
 721                                                              String mimeType) {
 722 
 723         LinkedHashSet<String> returnValues = new LinkedHashSet<>();
 724 
 725         if (HTML_TEXT_BASE_TYPE.equals(baseType)) {
 726             for (String documentType : htmlDocumentTypes) {
 727                 returnValues.add(mimeType + ";document=" + documentType);
 728             }
 729         } else {
 730             returnValues.add(mimeType);
 731         }
 732 
 733         return returnValues;
 734     }
 735 
 736     /**
 737      * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
 738      * their most preferred <code>String</code> native. Each native value will
 739      * be the same as the first native in the List returned by
 740      * <code>getNativesForFlavor</code> for the specified flavor.
 741      * <p>
 742      * If a specified <code>DataFlavor</code> is previously unknown to the
 743      * data transfer subsystem, then invoking this method will establish a
 744      * mapping in both directions between the specified <code>DataFlavor</code>
 745      * and an encoded version of its MIME type as its native.
 746      *