Package org.freeplane.plugin.workspace.model

Examples of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode


  /**
   * @param node
   */
  public void cutNodeFromParent(AWorkspaceTreeNode node) {
    AWorkspaceTreeNode parent = node.getParent();
    removeFromIndexRecursively(node);
    parent.removeChild(node);
    fireTreeNodesRemoved(this, parent.getTreePath(), null, new Object[] { node });
  }
View Full Code Here


    List<AWorkspaceTreeNode> removes = new ArrayList<AWorkspaceTreeNode>();
    this.hashStringKeyIndex.remove(node.getKey());
    if (node.getChildCount() > 0) {
      int[] indices = new int[node.getChildCount()];
      for (int i = 0; i < node.getChildCount(); i++) {
        AWorkspaceTreeNode childNode = node.getChildAt(i);
        removeFromIndexRecursively(childNode);
        removes.add(childNode);
        indices[i] = i;
      }
      fireTreeNodesRemoved(this, node.getTreePath(), indices, removes.toArray());
View Full Code Here

   */
  private void removeIndexOnlyRecursively(AWorkspaceTreeNode node) {
    this.hashStringKeyIndex.remove(node.getKey());
    if (node.getChildCount() > 0) {
      for (int i = 0; i < node.getChildCount(); i++) {
        AWorkspaceTreeNode childNode = node.getChildAt(i);
        removeIndexOnlyRecursively(childNode);
      }
    }
  }
View Full Code Here

 
  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);
      }
    }
  }
View Full Code Here

  public AWorkspaceTreeNode getRoot() {
    return root;
  }

  public void setRoot(AWorkspaceTreeNode newRoot) {
    AWorkspaceTreeNode oldRoot = this.root;
    this.root = newRoot;
    if(this.root != null) {
      this.root.setModel(this);
      if(oldRoot == null) {
        fireTreeNodesInserted(this, null, new int[]{}, new Object[]{root});
View Full Code Here

  public boolean isLeaf(Object node) {
    return ((AWorkspaceTreeNode) node).isLeaf();
  }

  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());
    }
  }
View Full Code Here

    if(type == null || !creatorTable.containsKey(type)) {
      return null;
    }
   
    AWorkspaceNodeCreator creator = creatorTable.get(type);
    AWorkspaceTreeNode node = creator.getNode(data);
    return node;
  }
View Full Code Here

    return new ITask() {     
      public void exec(Properties properties) throws IOException {
        if(onSkipList(destFile.getParentFile(), properties)) {
          throw new SkipTaskException();
        }
        AWorkspaceTreeNode parent = node.getParent();
        targetNode.getModel().cutNodeFromParent(node);
        parent.refresh();
        targetNode.getModel().nodeMoved(node, srcFile, destFile);
      }
     
      private boolean onSkipList(File dest, Properties properties) {
        if(properties == null || dest == null) {
View Full Code Here

   **********************************************************************************/

  private void processWorkspaceNodeDrop(AWorkspaceTreeNode targetNode, List<AWorkspaceTreeNode> nodes, int dropAction) {
    try
      for(AWorkspaceTreeNode node : nodes) {
        AWorkspaceTreeNode newNode = null;
        if(node instanceof DefaultFileNode) {         
          newNode = createFSNodeLinks(targetNode, ((DefaultFileNode) node).getFile());
        }
        else {
          if(dropAction == DnDConstants.ACTION_COPY) {
            newNode = node.clone();
          }
          else if (dropAction == DnDConstants.ACTION_MOVE) {
            AWorkspaceTreeNode parent = node.getParent();
            targetNode.getModel().cutNodeFromParent(node);
            parent.refresh();
            newNode = node;
          }
        }
        if(newNode == null) {
          continue;
View Full Code Here

  }
 
  private void processFileListDrop(AWorkspaceTreeNode targetNode, List<File> files, int dropAction) {
    try {   
      for(File srcFile : files) {
        AWorkspaceTreeNode node = createFSNodeLinks(targetNode, srcFile);
        targetNode.getModel().addNodeTo(node, targetNode);
        node.refresh();
      }
//      WorkspaceUtils.saveCurrentConfiguration();
    }
    catch (Exception e) {
      LogUtils.warn(e);
View Full Code Here

TOP

Related Classes of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.