/**
   * This method is called to query whether the transfer can be imported.
   *
   * <p>Will return true for urls, strings, javaFileLists
   *
   * @override
   */
  public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {

    // accept this if any input flavor matches any of our supported flavors
    for (int i = 0; i < transferFlavors.length; i++) {
      DataFlavor inflav = transferFlavors[i];
      if (inflav.match(urlFlavor)
          || inflav.match(stringFlavor)
          || inflav.match(DataFlavor.javaFileListFlavor)) return true;
    }

    // nope, never heard of this type
    return false;
  }
  /**
   * This method is called to query whether the transfer can be imported.
   *
   * <p>Will return true for urls, strings, javaFileLists
   */
  @Override
  public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
    if (!EntryTableTransferHandler.DROP_ALLOWED) {
      return false;
    }

    // accept this if any input flavor matches any of our supported flavors
    for (DataFlavor inflav : transferFlavors) {
      if (inflav.match(urlFlavor)
          || inflav.match(stringFlavor)
          || inflav.match(DataFlavor.javaFileListFlavor)) {
        return true;
      }
    }

    // System.out.println("drop type forbidden");
    // nope, never heard of this type
    return false;
  }
示例#3
0
 /**
  * Returns an object which represents the data to be transferred. The class of the object returned
  * is defined by the representation class of the flavor.
  *
  * @param flavor the requested flavor for the data
  * @return DOCUMENT ME!
  * @exception UnsupportedFlavorException if the requested data flavor is not supported.
  * @exception IOException if the data is no longer available in the requested flavor.
  * @see DataFlavor#getRepresentationClass
  */
 @Override
 public Object getTransferData(final DataFlavor flavor)
     throws UnsupportedFlavorException, IOException {
   return flavor.match(CIDS_TYPE_FLAVOR) ? o : null;
 }
示例#4
0
 /**
  * Returns whether or not the specified data flavor is supported for this object.
  *
  * @param flavor the requested flavor for the data
  * @return boolean indicating whether or not the data flavor is supported
  */
 @Override
 public boolean isDataFlavorSupported(final DataFlavor flavor) {
   return flavor.match(CIDS_TYPE_FLAVOR);
 }