Search in sources :

Example 11 with Node

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

the class ScriptApiTest method test_ControllerRO_getSelecteds.

public void test_ControllerRO_getSelecteds() {
    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");
    assertEquals("root node should still be selected after adding nodes", set(map.getRoot()), set(c.getSelecteds()));
    c.selectMultipleNodes(list(firstChild, secondChild));
    assertEquals("only the nodes selected via selectMultipleNodes should be returned", set(firstChild, secondChild), set(c.getSelecteds()));
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 12 with Node

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

the class ScriptApiTest method test_NodeRO_getId.

public void test_NodeRO_getId() {
    map = c.newMap();
    final Node root = map.getRoot();
    assertTrue("unknown node id pattern in '" + root.getId() + "'", root.getId().matches("ID_[1-9]\\d+"));
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 13 with Node

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

the class ScriptApiTest method test_NodeRO_getIcons.

// 
// public void test_NodeRO_getConnectorsIn() {
// 
// }
// 
// public void test_NodeRO_getConnectorsOut() {
// 
// }
// 
// public void test_NodeRO_getExternalObject() {
// 
// }
public void test_NodeRO_getIcons() {
    map = c.newMap();
    final Node root = map.getRoot();
    assertTrue("by default a node has no icons", root.getIcons().getIcons().isEmpty());
    root.getIcons().add("bee");
    assertEquals("one icon added", 1, root.getIcons().getIcons().size());
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node)

Example 14 with Node

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

the class ScriptApiTest method test_NodeRO_getCreatedAt.

public void test_NodeRO_getCreatedAt() {
    map = c.newMap();
    final Node child = map.getRoot().createChild("a node");
    final Date initialCreatedAt = child.getCreatedAt();
    final long diff = System.currentTimeMillis() - initialCreatedAt.getTime();
    // one second should be enough
    assertTrue(// 
    "createdAt seems to be set incorrectly. It says it's " + diff + " ms ago", diff >= 0 && diff < 1000L);
    final Date epoch = new Date(0);
    child.setCreatedAt(epoch);
    child.setText("changed");
    assertEquals(// 
    "createdAt should not be changed after changing the node text", epoch, child.getCreatedAt());
}
Also used : Node(org.freeplane.plugin.script.proxy.Proxy.Node) Date(java.util.Date)

Example 15 with Node

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

the class ScriptApiTest method test_NodeRO_getPlainText.

// public void test_NodeRO_getStyle() {
// 
// }
// 
public void test_NodeRO_getPlainText() {
    map = c.newMap();
    final Node root = map.getRoot();
    final String plainText = " xxx ";
    root.setText(plainText);
    assertEquals("", plainText, root.getText());
    assertEquals("plain text should be kept untouched", plainText, root.getPlainText());
    final String xml = "<x> yyy </x>";
    root.setText(xml);
    assertEquals("xml tags are not stripped", xml, root.getPlainText());
    root.setText("<html> <em>zzzzz</em> </hmtl>");
    assertEquals("html tags should be stripped", "zzzzz", root.getPlainText());
}
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