Search in sources :

Example 1 with NodeContainsCondition

use of org.freeplane.features.text.NodeContainsCondition in project freeplane by freeplane.

the class ScriptApiTest method test_Controller_undo_redo_stuff.

@SuppressWarnings("deprecation")
public void test_Controller_undo_redo_stuff() {
    map = c.newMap();
    map.getRoot().createChild("child 1");
    assertFalse("node should be there before undo", c.find(new NodeContainsCondition(TextController.FILTER_NODE, "child 1", false)).isEmpty());
    c.undo();
    assertTrue("node should be away after undo", c.find(new NodeContainsCondition(TextController.FILTER_NODE, "child 1", false)).isEmpty());
    c.redo();
    assertFalse("node should be there after redo", c.find(new NodeContainsCondition(TextController.FILTER_NODE, "child 1", false)).isEmpty());
    c.deactivateUndo();
    c.undo();
    assertTrue("node should still be there after undo since undo is deactivated", c.find(new NodeContainsCondition(TextController.FILTER_NODE, "child 1", false)).isEmpty());
}
Also used : NodeContainsCondition(org.freeplane.features.text.NodeContainsCondition)

Example 2 with NodeContainsCondition

use of org.freeplane.features.text.NodeContainsCondition 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 3 with NodeContainsCondition

use of org.freeplane.features.text.NodeContainsCondition in project freeplane by freeplane.

the class ScriptApiTest method test_NodeRO_isVisible.

public void test_NodeRO_isVisible() {
    map = c.newMap();
    map.getRoot().createChild("first node");
    map.getRoot().createChild("second node");
    assertTrue("initially all nodes should be visible", firstChild().isVisible());
    new Filter(new NodeContainsCondition(TextController.FILTER_NODE, "first", false), true, true, true).applyFilter(this, Controller.getCurrentController().getMap(), true);
    assertTrue("first node should be  matched by the filter", firstChild().isVisible());
    assertFalse("second node should not be matched by the filter", map.getRoot().getChildren().get(1).isVisible());
    c.setStatusInfo("filter", (String) null);
}
Also used : NodeContainsCondition(org.freeplane.features.text.NodeContainsCondition) Filter(org.freeplane.features.filter.Filter)

Example 4 with NodeContainsCondition

use of org.freeplane.features.text.NodeContainsCondition in project freeplane by freeplane.

the class ScriptApiTest method test_NodeRO_find_ICondition_condition.

/**
 * copy of {@link #test_ControllerRO_find_ICondition_condition()}.
 */
@SuppressWarnings("deprecation")
public void test_NodeRO_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)

Aggregations

NodeContainsCondition (org.freeplane.features.text.NodeContainsCondition)4 Node (org.freeplane.plugin.script.proxy.Proxy.Node)2 Filter (org.freeplane.features.filter.Filter)1