Package org.freeplane.plugin.workspace.model

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


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


//    if(parent instanceof IFileSystemRepresentation) {
//      orderDesc = ((IFileSystemRepresentation) parent).orderDescending();
//    }
   
    for (File file : sortFiles(directory.listFiles(new DirectoryFilter(filter)), orderDesc, true)) {
      AWorkspaceTreeNode newParent = createFileNode(parent, FileReadManager.DIRECTORY_HANDLE, file);
      iterateDirectory(newParent, file, filter, orderDesc);

    }
    for (File file : sortFiles(directory.listFiles(new FilesOnlyFilter(filter)), orderDesc, true)) {
      createFileNode(parent, file);
View Full Code Here

      fileExtension = FileReadManager.DEFAULT_HANDLE;
      handlers = getFileTypeHandlers().list(fileExtension);
    }
    if (handlers != null && handlers.size() == 1) { //WORKSPACE - ToDo: what if there is more than one handler for a single type?
      IFileTypeHandler nodeCreator = handlers.get(0);
      AWorkspaceTreeNode newParent = nodeCreator.createFileNode(parent, fileExtension, file);
      return newParent;
    }
    return parent;
 
View Full Code Here

    }
    TreePath path = ((JTree) e.getSource()).getClosestPathForLocation(e.getX(), e.getY());

    ((TreeView) WorkspaceController.getCurrentModeExtension().getView()).addSelectionPath(path);
    if (path != null) {
      AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();
      // encode buttons
      int eventType = 0;
      if (e.getButton() == MouseEvent.BUTTON1) {
        eventType += WorkspaceActionEvent.MOUSE_LEFT;
      }
      if (e.getButton() == MouseEvent.BUTTON3) {
        eventType += WorkspaceActionEvent.MOUSE_RIGHT;
      }
      if (e.getClickCount() % 2 == 0) {
        eventType += WorkspaceActionEvent.MOUSE_DBLCLICK;
      } else {
        eventType += WorkspaceActionEvent.MOUSE_CLICK;
      }

      if (e.isPopupTrigger()) {
        eventType += WorkspaceActionEvent.POPUP_TRIGGER;
      }

      WorkspaceActionEvent event = new WorkspaceActionEvent(node, eventType, e.getX(), e.getY(), e.getComponent());

      List<IWorkspaceNodeActionListener> nodeEventListeners = WorkspaceController.getCurrentModeExtension().getIOController()
          .getNodeActionListeners(node.getClass(), eventType);
      if (nodeEventListeners != null) {
        for (IWorkspaceNodeActionListener listener : nodeEventListeners) {
          if (event.isConsumed()) {
            break;
          }
View Full Code Here

      public boolean accept(KeyEvent e) {
        TreePath path = ((JTree) e.getSource()).getSelectionPath();
        if (path == null) {
          return false;
        }
        AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();
        if(DnDController.isDropAllowed(node)) {
          return true;
        }
        return false;
      }
    }), NodePasteAction.KEY);
    actionKeyMap.put(new HotKeyIdentifier("delete", KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), new KeyEventAcceptor() {
     
      public boolean accept(KeyEvent e) {
        TreePath path = ((JTree) e.getSource()).getSelectionPath();
        if (path == null) {
          return false;
        }
        AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();
        if(!node.isSystem() && node.isTransferable()) {
          return true;
        }
        return false;
      }
    }), NodeRemoveAction.KEY);
    actionKeyMap.put(new HotKeyIdentifier("rename", KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), new KeyEventAcceptor() {
      public boolean accept(KeyEvent event) {
        TreePath path = ((JTree) event.getSource()).getSelectionPath();
        if (path == null) {
          return false;
        }
        AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();
        if(!node.isSystem()) {
          return true;
        }
        return false;
      }
    }), NodeRenameAction.KEY);
View Full Code Here

    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
      TreePath path = ((JTree) e.getSource()).getSelectionPath();
      if (path == null) {
        return;
      }
      AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent();

      if (node instanceof IWorkspaceNodeActionListener) {
        ((IWorkspaceNodeActionListener) node).handleAction(new WorkspaceActionEvent(node, WorkspaceActionEvent.WSNODE_OPEN_DOCUMENT, 0, 0, e
            .getComponent()));
        e.consume();
View Full Code Here

   * @see
   * org.freeplane.core.io.IAttributeWriter#writeAttributes(org.freeplane.
   * core.io.ITreeWriter, java.lang.Object, java.lang.String)
   */
  public void writeAttributes(ITreeWriter writer, Object userObject, String tag) {   
    AWorkspaceTreeNode wsNode = (AWorkspaceTreeNode) userObject;
    if(wsNode.getType() != null) writer.addAttribute("type", wsNode.getType());
    if(wsNode.getName() != null) writer.addAttribute("name", wsNode.getName());
   
    for(Method m : wsNode.getClass().getMethods()) {
      if(m.getAnnotation(ExportAsAttribute.class) != null && m.getParameterTypes().length == 0 && m.getReturnType() != void.class) {       
        writeAdditionalAttribute(writer, wsNode, m);
      }
    }
  }
View Full Code Here

      LogUtils.severe("This should not have happend: ", e);
    }   
  }

  public void writeContent(ITreeWriter writer, Object element, String tag) throws IOException {
    final AWorkspaceTreeNode node = (AWorkspaceTreeNode) element;
    for (int i=0; i < node.getChildCount(); i++) {
      AWorkspaceTreeNode child = node.getChildAt(i);     
      if(child == null || child.getTagName() == null) {
        continue;
      }     
      writer.addElement(child, child.getTagName());     
    }
  }
View Full Code Here

  /***********************************************************************************
   * REQUIRED METHODS FOR INTERFACES
   **********************************************************************************/
  public AWorkspaceTreeNode createFileNode(AWorkspaceTreeNode parent, String fileExtension, final File file) {   
    final AWorkspaceTreeNode node = getNode(file.getName(), file);
    if (node != null) {
      parent.getModel().addNodeTo(node, parent, false);
      return node;
    }
    return parent;   
View Full Code Here

      if(rename(event.getBaggage().toString())) {
        setName(event.getBaggage().toString());
        if(event.getSource() instanceof AWorkspaceTreeNode) {
          Enumeration<AWorkspaceTreeNode> childs = ((AWorkspaceTreeNode)event.getSource()).children();
          while(childs.hasMoreElements()) {
            AWorkspaceTreeNode node = ((AWorkspaceTreeNode) childs.nextElement());
            if(node instanceof DefaultFileNode) {
              ((DefaultFileNode)node).relocateFile(getFile());             
            }
          }
        }
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.