JDragDropList.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:pdfjumbler 作者:
@Override
public boolean importData(TransferHandler.TransferSupport info) {
    if (!info.isDrop()) {
        return false;
    }
    if (!canImportHere(info)) {
        if (
            (JDragDropList.this.dropListener != null) &&
            JDragDropList.this.dropListener.acceptDrop(JDragDropList.this, info)
        ) {
            return JDragDropList.this.dropListener.handleDrop(JDragDropList.this, info);
        } else {
            return false;
        }
    }

    JDDLTransferData<T> data = getData(info);
    int destIndex = JDragDropList.this.getDropLocation().getIndex();        

    /*
    System.err.print("[ ");
    for (int index : data.getIndices()) {
        System.err.print(index + " ");
    }
    System.err.print("] -> ");
    System.err.println(destIndex);
    */

    if ((info.getDropAction() & DnDConstants.ACTION_COPY) != 0) {
        copyItems(data.getSourceList(), JDragDropList.this, data.getValuesList(), destIndex);
    } else if ((info.getDropAction() & DnDConstants.ACTION_MOVE) != 0) {
        moveItems(data.getSourceList(), JDragDropList.this, data.getIndices(), destIndex);  
    } else {
        return false;
    }

    return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号