Search in sources :

Example 26 with Node

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

the class ScriptApiTest method test_Controller_select_Node_toSelect.

public void test_Controller_select_Node_toSelect() {
    map = c.newMap();
    final Node firstChild = map.getRoot().createChild("child 1");
    final Node secondChild = map.getRoot().createChild("child 2");
    final Node thirdChild = map.getRoot().createChild("child 3");
    c.select(secondChild);
    final Set<Node> set = set(secondChild);
    final Set<Node> selected = set(c.getSelecteds());
    assertEquals("one node should be selected", set, selected);
    c.select(firstChild);
    assertEquals("one node should be selected", set(firstChild), set(c.getSelecteds()));
    c.select(thirdChild);
    assertEquals("one node should be selected", set(thirdChild), set(c.getSelecteds()));
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 27 with Node

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

the class ScriptApiTest method test_NodeRO_isDescendantOf_Node_p.

public void test_NodeRO_isDescendantOf_Node_p() {
    createTestMap();
    final Node root = map.getRoot();
    assertTrue("a node is its own descendant", root.isDescendantOf(root));
    assertFalse("siblings aren't descendants of each other", firstChild(root).isDescendantOf(root.getChildren().get(1)));
    assertFalse("siblings aren't descendants of each other", root.getChildren().get(1).isDescendantOf(firstChild(root)));
    assertTrue("children are descendants of their parents", firstChild(root).isDescendantOf(root));
    final Node grandchild = firstChild(root).createChild();
    assertTrue("grandchildren are descendants of their parents", firstChild(root).isDescendantOf(root));
    assertTrue("grandchildren are descendants of their grandparents", grandchild.isDescendantOf(root));
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 28 with Node

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

the class ScriptApiTest method test_MapRO_node_String_id.

public void test_MapRO_node_String_id() {
    map = c.newMap();
    final Node firstChild = map.getRoot().createChild("child 1");
    final String id = firstChild.getId();
    assertEquals("get by id returned wrong node", firstChild, map.node(id));
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 29 with Node

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

the class ScriptApiTest method test_NodeRO_getChildren.

public void test_NodeRO_getChildren() {
    map = c.newMap();
    final Node child1 = map.getRoot().createChild("child 1");
    final Node child2 = map.getRoot().createChild("child 2");
    final List<Node> children = map.getRoot().getChildren();
    assertEquals("wrong children count", 2, children.size());
    assertEquals("wrong order", child1, children.get(0));
    assertEquals("wrong order", child2, children.get(1));
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 30 with Node

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

the class ScriptApiTest method test_ControllerRO_getSelected.

// 
// public void test_ConnectorRO_getColor() {
// 
// }
// 
// public void test_ConnectorRO_getEndArrow() {
// 
// }
// 
// public void test_ConnectorRO_getMiddleLabel() {
// 
// }
// 
// public void test_ConnectorRO_getSource() {
// 
// }
// 
// public void test_ConnectorRO_getSourceLabel() {
// 
// }
// 
// public void test_ConnectorRO_getStartArrow() {
// 
// }
// 
// public void test_ConnectorRO_getTarget() {
// 
// }
// 
// public void test_ConnectorRO_getTargetLabel() {
// 
// }
// 
// public void test_ConnectorRO_simulatesEdge() {
// 
// }
// 
// public void test_Connector_setColor_Color_color() {
// 
// }
// 
// public void test_Connector_setEndArrow_ArrowType_arrowType() {
// 
// }
// 
// public void test_Connector_setMiddleLabel_String_label() {
// 
// }
// 
// public void test_Connector_setSimulatesEdge_boolean_simulatesEdge() {
// 
// }
// 
// public void test_Connector_setSourceLabel_String_label() {
// 
// }
// 
// public void test_Connector_setStartArrow_ArrowType_arrowType() {
// 
// }
// 
// public void test_Connector_setTargetLabel_String_label() {
// 
// }
public void test_ControllerRO_getSelected() {
    map = c.newMap();
    assertEquals("new root node should be selected", map.getRoot(), c.getSelected());
    final Node firstChild = map.getRoot().createChild("child 1");
    final Node secondChild = map.getRoot().createChild("child 2");
    // FIXME: why aren't the new node selected?
    assertEquals("root node should still be selected after adding nodes", map.getRoot(), c.getSelected());
    c.selectMultipleNodes(list(firstChild, secondChild));
    // what's the rule?
    assertEquals("last selected node should be returned", secondChild, c.getSelected());
}
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