Search in sources :

Example 11 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class WorkspaceRootNode method getChildAt.

public AWorkspaceTreeNode getChildAt(int childIndex) {
    AWorkspaceTreeNode node = null;
    int offset = super.getChildCount();
    if (offset > 0) {
        node = super.getChildAt(childIndex);
    }
    if (node == null) {
        node = (AWorkspaceTreeNode) WorkspaceController.getCurrentModel().getChild(this, childIndex);
    }
    return node;
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)

Example 12 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class ProjectModel method valueForPathChanged.

public void valueForPathChanged(TreePath path, Object newValue) {
    AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();
    if (node instanceof IWorkspaceNodeActionListener) {
        ((IWorkspaceNodeActionListener) node).handleAction(new WorkspaceActionEvent(node, WorkspaceActionEvent.WSNODE_CHANGED, newValue));
        nodeChanged(node);
    } else {
        node.setName(newValue.toString());
    }
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) IWorkspaceNodeActionListener(org.freeplane.plugin.workspace.event.IWorkspaceNodeActionListener) WorkspaceActionEvent(org.freeplane.plugin.workspace.event.WorkspaceActionEvent)

Example 13 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class ProjectModel method nodeChanged.

public void nodeChanged(AWorkspaceTreeNode node) {
    if (listenerList != null && node != null) {
        AWorkspaceTreeNode parent = node.getParent();
        if (parent != null) {
            int anIndex = parent.getIndex(node);
            if (anIndex != -1) {
                int[] cIndexs = new int[1];
                cIndexs[0] = anIndex;
                nodesChanged(parent, cIndexs);
            }
        } else if (node == getRoot()) {
            nodesChanged(node, null);
        }
    }
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)

Example 14 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class ProjectModel method addIndexOnlyRecursively.

private void addIndexOnlyRecursively(AWorkspaceTreeNode node) {
    this.hashStringKeyIndex.put(node.getKey(), node);
    if (node.getChildCount() > 0) {
        for (int i = 0; i < node.getChildCount(); i++) {
            AWorkspaceTreeNode childNode = node.getChildAt(i);
            addIndexOnlyRecursively(childNode);
        }
    }
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)

Example 15 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class ProjectModel method addToIndexRecursively.

private void addToIndexRecursively(AWorkspaceTreeNode node, AWorkspaceTreeNode targetNode) {
    this.hashStringKeyIndex.put(node.getKey(), node);
    if (node.getChildCount() > 0) {
        int[] indices = new int[node.getChildCount()];
        for (int i = 0; i < node.getChildCount(); i++) {
            AWorkspaceTreeNode childNode = node.getChildAt(i);
            addToIndexRecursively(childNode, node);
            indices[i] = targetNode.getChildCount() - 1;
        }
        nodesWereInserted(targetNode, indices);
    }
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)

Aggregations

AWorkspaceTreeNode (org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)51 File (java.io.File)13 URI (java.net.URI)9 ArrayList (java.util.ArrayList)8 WorkspaceTransferable (org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)7 TreePath (javax.swing.tree.TreePath)6 DefaultFileNode (org.freeplane.plugin.workspace.nodes.DefaultFileNode)6 JTree (javax.swing.JTree)5 IOException (java.io.IOException)4 IWorkspaceView (org.freeplane.plugin.workspace.components.IWorkspaceView)4 IFileSystemRepresentation (org.freeplane.plugin.workspace.io.IFileSystemRepresentation)4 LinkTypeFileNode (org.freeplane.plugin.workspace.nodes.LinkTypeFileNode)4 Vector (java.util.Vector)3 IWorkspaceNodeActionListener (org.freeplane.plugin.workspace.event.IWorkspaceNodeActionListener)3 WorkspaceActionEvent (org.freeplane.plugin.workspace.event.WorkspaceActionEvent)3 SkipTaskException (org.freeplane.plugin.workspace.io.SkipTaskException)3 AWorkspaceProject (org.freeplane.plugin.workspace.model.project.AWorkspaceProject)3 FolderLinkNode (org.freeplane.plugin.workspace.nodes.FolderLinkNode)3 List (java.util.List)2 WorkspacePopupMenu (org.freeplane.plugin.workspace.components.menu.WorkspacePopupMenu)2