use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.
the class MTextController method splitNode.
public void splitNode(final NodeModel node, final int caretPosition, final String newText) {
if (node.isRoot()) {
return;
}
final String futureText = newText != null ? newText : node.getText();
final String[] strings = getContent(futureText, caretPosition);
if (strings == null) {
return;
}
final String newUpperContent = makePlainIfNoFormattingFound(strings[0]);
final String newLowerContent = makePlainIfNoFormattingFound(strings[1]);
setNodeObject(node, newUpperContent);
final NodeModel parent = node.getParentNode();
final ModeController modeController = Controller.getCurrentModeController();
final NodeModel lowerNode = ((MMapController) modeController.getMapController()).addNewNode(parent, parent.getChildPosition(node) + 1, node.isLeft());
final MNodeStyleController nodeStyleController = (MNodeStyleController) NodeStyleController.getController();
nodeStyleController.copyStyle(node, lowerNode);
setNodeObject(lowerNode, newLowerContent);
}
use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.
the class SplitNode method splitNode.
private void splitNode(final NodeModel node) {
if (node.isRoot()) {
return;
}
final String text = node.getText();
final String[] parts = splitNode(text);
if (parts == null || parts.length == 1) {
return;
}
final ModeController c = Controller.getCurrentModeController();
int firstPartNumber = 0;
while (parts[firstPartNumber] == null) {
firstPartNumber++;
}
((MTextController) TextController.getController()).setNodeText(node, parts[firstPartNumber]);
final NodeModel parent = node.getParentNode();
final int nodePosition = parent.getChildPosition(node) + 1;
for (int i = parts.length - 1; i > firstPartNumber; i--) {
final MMapController mapController = (MMapController) c.getMapController();
final NodeModel lowerNode = mapController.addNewNode(parent, nodePosition, node.isLeft());
final String part = parts[i];
if (part == null) {
continue;
}
((MTextController) TextController.getController()).setNodeText(lowerNode, part);
final MNodeStyleController nodeStyleController = (MNodeStyleController) NodeStyleController.getController();
nodeStyleController.copyStyle(node, lowerNode);
mapController.setFolded(lowerNode, !lowerNode.isFolded());
}
}
use of org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController in project freeplane by freeplane.
the class NodeProxy method setFormat.
public void setFormat(final String format) {
final MNodeStyleController styleController = (MNodeStyleController) Controller.getCurrentModeController().getExtension(NodeStyleController.class);
styleController.setNodeFormat(getDelegate(), format);
}
Aggregations