Package mindnotes.shared.model

Examples of mindnotes.shared.model.Node


   *            parent</c> is not a root node, <c>loc</c> is ignored and
   *            parent node location is used.
   */
  private Node addChild(Node node, NodeLocation loc) {

    Node child = new Node();
    child.setText("New node");
    if (node.getNodeLocation() == NodeLocation.ROOT) {
      child.setNodeLocation(loc);
    } else {
      child.setNodeLocation(node.getNodeLocation());
    }

    node.addChildNode(child);

    _mindMapView.holdLayout();
View Full Code Here


    return child;

  }

  private Node insertChild(Node parent, Node current, boolean above) {
    Node child = new Node();
    child.setText("New node");
    child.setNodeLocation(current.getNodeLocation());

    if (above) {
      parent.insertBefore(child, current);
    } else {
      parent.insertAfter(child, current);
View Full Code Here

  public void setCurrentNode(Node node) {
    setCurrentNode(node, false);
  }

  private void setCurrentNode(Node node, boolean enterTextMode) {
    Node oldCurrentNode = _selection.getCurrentNode();
    _mindMapView.holdLayout();
    // check if the new current node is different from the last one
    if (oldCurrentNode != node) {
      // update old current node ui
      if (oldCurrentNode != null) {
View Full Code Here

      @Override
      public void execute() {
        final MindMap mm = new MindMap();
        _currentMapKey = null;
        mm.setTitle("New Untitled Mind Map");
        Node n = new Node();
        n.setText("New Mind Map");
        Node n1 = new Node();
        n1.setText("A bubble");
        n1.setNodeLocation(NodeLocation.LEFT);
        Node n2 = new Node();
        n2.setText("Another bubble");
        n2.setNodeLocation(NodeLocation.RIGHT);
        n.addChildNode(n1);
        n.addChildNode(n2);
        mm.setRootNode(n);
        setMindMap(mm);
        _isDirty = false;
View Full Code Here

    _mindMapView.setTitle(title);
  }

  public void copy() {
    /* take note that copy (contrary to paste or cut) is not undoable*/
    Node n = new Node();
    _selection.getCurrentNode().copyTo(n);
    _clipboard.setCurrentNode(n);
  }
View Full Code Here

   * its children or its parent.
   *
   * @param where
   */
  private void navigateToSide(NodeLocation where) {
    Node n = _selection.getCurrentNode();
    if (n.getNodeLocation() == where) {
      // we are going deeper into children, f.e. moving left from a node
      // that is on the left
      if (n.getChildCount() <= 0)
        return;
      setCurrentNode(n.getChildren().iterator().next());

    } else if (n.getNodeLocation() == NodeLocation.ROOT) {
      // moving from the root, which has no parent and children in either
      // direction
      if (n.getChildCount() <= 0)
        return;
      for (Node child : n.getChildren()) {
        if (child.getNodeLocation() == where) {
          setCurrentNode(child);
          return;
        }
      }
    } else {
      // moving towards the parent (moving right on left-sided node)
      setCurrentNode(n.getParent());
    }

  }
View Full Code Here

    }

  }

  public void navigateUp() {
    Node n = _selection.getCurrentNode();
    if (n.getNodeLocation() == NodeLocation.ROOT)
      return;
    Node parent = n.getParent();
    int index = parent.getChildren().indexOf(n);
    if (index > 0) {

      // search siblings for the first sibling after current node that is
      // on the same side
      for (int i = index - 1; i >= 0; i--) {
        Node candidate = parent.getChildren().get(i);
        if (candidate.getNodeLocation() == n.getNodeLocation()) {
          setCurrentNode(candidate);
          return;
        }

      }
View Full Code Here

      }
    }
  }

  public void navigateDown() {
    Node n = _selection.getCurrentNode();
    if (n.getNodeLocation() == NodeLocation.ROOT)
      return;
    Node parent = n.getParent();
    int index = parent.getChildren().indexOf(n);
    if (index < parent.getChildCount() - 1) {

      // search siblings for the first sibling after current node that is
      // on the same side
      for (int i = index + 1; i < parent.getChildCount(); i++) {
        Node candidate = parent.getChildren().get(i);
        if (candidate.getNodeLocation() == n.getNodeLocation()) {
          setCurrentNode(candidate);
          return;
        }

      }
View Full Code Here

      _above = above;
    }

    @Override
    public boolean doAction() {
      Node current = _selection.getCurrentNode();
      _createdNode = insertChild(current.getParent(), current, _above);

      setCurrentNode(_createdNode);
      return true;
    }
View Full Code Here

public class PersistenceTest extends GWTTestCase {

  public void testBasicMap() {
    MindMap m = new MindMap();
    m.getRootNode().addChildNode(new Node());
    m.getRootNode().addChildNode(new Node());
    Node n = new Node();
    m.getRootNode().addChildNode(n);
    m.getRootNode().addChildNode(n);
    roundtrip(m);
  }
View Full Code Here

TOP

Related Classes of mindnotes.shared.model.Node

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.