If you need to convert a node into a string for debugging purpose (say, to log it as text or to show it in a test failure message), you can use this bit of code:
public static String renderNodeAsString(SNode node, SRepository repository) {
HeadlessEditorComponent comp = new HeadlessEditorComponent(repository);
try {
comp.editNode(node);
return comp.getRootCell().renderText().getText();
} finally {
comp.dispose();
}
}
It will create a headless (invisible) editor component, render the node in it, then ask the root cell for its text rendering. The resulting string may be multi-line and untrimmed, i.e. contain spaces at the ends of the lines. The text you get is the same that you get when you copy a node to the clipboard and paste it in a text editor. Of course, non-textual cells such as diagrams, trees, or separators, will not get rendered properly.