Search in sources :

Example 6 with Node

use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.

the class ScriptApiTest method test_NodeRO_isFolded.

public void test_NodeRO_isFolded() {
    createTestMap();
    final Node root = map.getRoot();
    final Node child = firstChild();
    final Node grandchild = child.createChild("grandchild");
    assertFalse("initially nothing should be folded", root.isFolded());
    assertFalse("initially nothing should be folded", child.isFolded());
    root.setFolded(true);
    assertFalse("root isn't foldable", root.isFolded());
    child.setFolded(true);
    assertTrue("node should be folded now", child.isFolded());
    assertFalse("folding is not recursive in terms of isFolded()", grandchild.isFolded());
    child.setFolded(false);
    assertFalse("node should be unfolded again", child.isFolded());
    grandchild.setFolded(true);
    assertFalse("a node without children is not foldable", grandchild.isFolded());
    // test undo of folding - give the new node a child first to make it foldable
    grandchild.createChild("grandgrandchild");
    grandchild.setFolded(true);
    assertTrue("node should be folded now", grandchild.isFolded());
    c.undo();
    assertFalse("folding should be undone now", grandchild.isFolded());
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 7 with Node

use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.

the class ScriptApiTest method test_Node_delete.

public void test_Node_delete() {
    map = c.newMap();
    final Node root = map.getRoot();
    final Node child1 = root.createChild("child 1");
    final Node child2 = root.createChild("child 2");
    assertEquals("", 2, root.getChildren().size());
    child1.delete();
    assertEquals("deletion failed", 1, root.getChildren().size());
    assertEquals("wrong node deleted", child2, root.getChildren().get(0));
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 8 with Node

use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.

the class ScriptApiTest method test_NodeRO_getParent.

public void test_NodeRO_getParent() {
    createTestMap();
    final Node root = map.getRoot();
    assertEquals("root has no parent", null, root.getParent());
    final Node child = firstChild(root);
    assertEquals("", root, child.getParent());
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 9 with Node

use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.

the class ScriptApiTest method test_ControllerRO_find_ICondition_condition.

@SuppressWarnings("deprecation")
public void test_ControllerRO_find_ICondition_condition() {
    map = c.newMap();
    @SuppressWarnings("unused") final Node firstChild = map.getRoot().createChild("child 1");
    final Node secondChild = map.getRoot().createChild("child 2");
    final List<Node> found = c.find(new NodeContainsCondition(TextController.FILTER_NODE, "child 2", false));
    assertEquals("one matching node should be found", list(secondChild), found);
}
Also used : NodeContainsCondition(org.freeplane.features.text.NodeContainsCondition) Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 10 with Node

use of org.freeplane.plugin.script.proxy.Proxy.Node in project freeplane by freeplane.

the class ScriptApiTest method test_Node_setFolded_boolean_folded.

// 
// public void test_Node_removeConnector_Connector_connectorToBeRemoved() {
// 
// }
// 
public void test_Node_setFolded_boolean_folded() {
    createTestMap();
    final Node child = firstChild();
    child.createChild("grandchild");
    child.setFolded(true);
    assertTrue("node should be folded now", child.isFolded());
    child.setFolded(false);
    assertFalse("node should be unfolded again", child.isFolded());
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Aggregations

Node (org.freeplane.plugin.script.proxy.Proxy.Node)34 Date (java.util.Date)2 NodeModel (org.freeplane.features.map.NodeModel)2 NodeContainsCondition (org.freeplane.features.text.NodeContainsCondition)2 FreeNode (org.freeplane.features.map.FreeNode)1 IMapSelection (org.freeplane.features.map.IMapSelection)1