Search in sources :

Example 1 with WorkspaceTransferable

use of org.freeplane.plugin.workspace.dnd.WorkspaceTransferable in project freeplane by freeplane.

the class LinkTypeFileNode method getTransferable.

public WorkspaceTransferable getTransferable() {
    WorkspaceTransferable transferable = new WorkspaceTransferable();
    try {
        URI uri = URIUtils.getAbsoluteURI(getLinkURI());
        transferable.addData(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR, uri.toString());
        List<File> fileList = new Vector<File>();
        fileList.add(new File(uri));
        transferable.addData(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR, fileList);
        if (!this.isSystem()) {
            List<AWorkspaceTreeNode> objectList = new ArrayList<AWorkspaceTreeNode>();
            objectList.add(this);
            transferable.addData(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR, objectList);
        }
        return transferable;
    } catch (Exception e) {
        LogUtils.warn(e);
    }
    return null;
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) ArrayList(java.util.ArrayList) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable) URI(java.net.URI) File(java.io.File) Vector(java.util.Vector)

Example 2 with WorkspaceTransferable

use of org.freeplane.plugin.workspace.dnd.WorkspaceTransferable in project freeplane by freeplane.

the class FolderLinkNode method getTransferable.

public WorkspaceTransferable getTransferable() {
    WorkspaceTransferable transferable = new WorkspaceTransferable();
    try {
        URI uri = URIUtils.getAbsoluteURI(getPath());
        transferable.addData(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR, uri.toString());
        List<File> fileList = new Vector<File>();
        fileList.add(new File(uri));
        transferable.addData(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR, fileList);
        if (!this.isSystem()) {
            List<AWorkspaceTreeNode> objectList = new ArrayList<AWorkspaceTreeNode>();
            objectList.add(this);
            transferable.addData(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR, objectList);
        }
        return transferable;
    } catch (Exception e) {
        LogUtils.warn(e);
    }
    return null;
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) ArrayList(java.util.ArrayList) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable) URI(java.net.URI) File(java.io.File) Vector(java.util.Vector)

Example 3 with WorkspaceTransferable

use of org.freeplane.plugin.workspace.dnd.WorkspaceTransferable in project freeplane by freeplane.

the class NodeCutAction method actionPerformed.

public void actionPerformed(final ActionEvent event) {
    AWorkspaceTreeNode[] targetNodes = getSelectedNodes(event);
    WorkspaceTransferable transferable = null;
    for (AWorkspaceTreeNode targetNode : targetNodes) {
        if (targetNode instanceof IWorkspaceTransferableCreator) {
            if (transferable == null) {
                transferable = ((IWorkspaceTransferableCreator) targetNode).getTransferable();
            } else {
                transferable.merge(((IWorkspaceTransferableCreator) targetNode).getTransferable());
            }
        }
    }
    if (transferable == null) {
        return;
    }
    transferable.setAsCopy(false);
    Toolkit.getDefaultToolkit().getSystemClipboard().setContents(transferable, new CutClipboardOwner(transferable));
// AWorkspaceTreeNode parent = targetNode.getParent();
// 
// targetNode.getModel().cutNodeFromParent(targetNode);
// if(parent != null) {
// parent.refresh();
// //parent.getModel().requestSave();
// }
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) IWorkspaceTransferableCreator(org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)

Example 4 with WorkspaceTransferable

use of org.freeplane.plugin.workspace.dnd.WorkspaceTransferable in project freeplane by freeplane.

the class DefaultFileNode method getTransferable.

public WorkspaceTransferable getTransferable() {
    WorkspaceTransferable transferable = new WorkspaceTransferable();
    try {
        URI uri = URIUtils.getAbsoluteURI(getFile().toURI());
        transferable.addData(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR, uri.toString());
        List<File> fileList = new Vector<File>();
        fileList.add(new File(uri));
        transferable.addData(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR, fileList);
    } catch (Exception e) {
        LogUtils.warn(e);
    }
    if (!this.isSystem()) {
        List<AWorkspaceTreeNode> objectList = new ArrayList<AWorkspaceTreeNode>();
        objectList.add(this);
        transferable.addData(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR, objectList);
    }
    return transferable;
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) ArrayList(java.util.ArrayList) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable) URI(java.net.URI) File(java.io.File) Vector(java.util.Vector)

Example 5 with WorkspaceTransferable

use of org.freeplane.plugin.workspace.dnd.WorkspaceTransferable in project freeplane by freeplane.

the class FolderVirtualNode method getTransferable.

public WorkspaceTransferable getTransferable() {
    WorkspaceTransferable transferable = new WorkspaceTransferable();
    try {
        List<AWorkspaceTreeNode> objectList = new ArrayList<AWorkspaceTreeNode>();
        objectList.add(this);
        transferable.addData(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR, objectList);
        return transferable;
    } catch (Exception e) {
        LogUtils.warn(e);
    }
    return null;
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) ArrayList(java.util.ArrayList) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)

Aggregations

WorkspaceTransferable (org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)6 AWorkspaceTreeNode (org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)6 ArrayList (java.util.ArrayList)4 File (java.io.File)3 URI (java.net.URI)3 Vector (java.util.Vector)3 IWorkspaceTransferableCreator (org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator)2