/**
  * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor)
  */
 public boolean isDataFlavorSupported(DataFlavor flavor) {
   /*
    * System.out.println("isDataFlavorSupported: " + flavor.getMimeType()
    * + " " + flavor.getHumanPresentableName());
    */
   for (Iterator<DataFlavor> i = exportFlavors.iterator(); i.hasNext(); ) {
     DataFlavor supportedFlavor = i.next();
     if (supportedFlavor.getPrimaryType().equals(flavor.getPrimaryType())
         && supportedFlavor.getSubType().equals(flavor.getSubType())
         && flavor
             .getRepresentationClass()
             .isAssignableFrom(supportedFlavor.getRepresentationClass())) {
       return true;
     }
   }
   return false;
 }
 /**
  * @param flavor
  * @param supportedFlavors
  * @return
  */
 public static boolean isFlavorSupported(DataFlavor flavor, DataFlavor[] supportedFlavors) {
   for (int i = 0; i < supportedFlavors.length; i++) {
     if (supportedFlavors[i].getPrimaryType().equals(flavor.getPrimaryType())
         && supportedFlavors[i].getSubType().equals(flavor.getSubType())
         && flavor
             .getRepresentationClass()
             .isAssignableFrom(supportedFlavors[i].getRepresentationClass())) {
       return true;
     }
   }
   return false;
 }
示例#3
0
 public boolean isDataFlavorSupported(DataFlavor flavor) {
   return flavor.equals(DataFlavor.stringFlavor)
       || flavor.getPrimaryType().equals("application")
           && flavor.getSubType().equals("x-java-serialized-object")
           && flavor.getRepresentationClass().isAssignableFrom(obj.getClass());
 }