javax.swing.TransferHandler.TransferSupport#isDataFlavorSupported ( )源码实例Demo

下面列出了javax.swing.TransferHandler.TransferSupport#isDataFlavorSupported ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: audiveris   文件: FileDropHandler.java
@Override
public boolean canImport (TransferSupport support)
{
    /* For the time being, only support drops (not clipboard paste) */
    if (!support.isDrop()) {
        return false;
    }

    /* Check that the drop contains a list of files */
    if (!support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
        return false;
    }

    /* Check to see if the source actions contains the COPY action */
    boolean copySupported = (COPY & support.getSourceDropActions()) == COPY;

    /* If COPY is supported, choose COPY and accept the transfer */
    if (copySupported) {
        support.setDropAction(COPY);

        return true;
    }

    /* COPY isn't supported, so reject the transfer */
    return false;
}
 
@Override
public boolean canImport(TransferSupport ts) {
    return ts.getComponent().equals(tree)
            && ts.isDataFlavorSupported(OBJECT_FLAVOR)
            && getDestinationObject(ts) != null
            && !(getDestinationObject(ts) instanceof ORRootInf);
}
 
源代码3 项目: libreveris   文件: FileDropHandler.java
/**
 * {@inheritDoc}
 */
@Override
public boolean canImport (TransferSupport support)
{
    /* For the time being, only support drops (not clipboard paste) */
    if (!support.isDrop()) {
        return false;
    }

    /* Check that the drop contains a list of files */
    if (!support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
        return false;
    }

    /* Check to see if the source actions contains the COPY action */
    boolean copySupported = (COPY & support.getSourceDropActions()) == COPY;

    /* If COPY is supported, choose COPY and accept the transfer */
    if (copySupported) {
        support.setDropAction(COPY);

        return true;
    }

    /* COPY isn't supported, so reject the transfer */
    return false;
}
 
源代码4 项目: jeveassets   文件: ShowToolSettingsPanel.java
@Override
public boolean canImport(TransferSupport info) {
	return info.isDrop() && info.isDataFlavorSupported(localObjectFlavor);
}