Search in sources :

Example 6 with MNodeStyleController

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);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 7 with MNodeStyleController

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());
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) ModeController(org.freeplane.features.mode.ModeController)

Example 8 with MNodeStyleController

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);
}
Also used : MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController)

Aggregations

MNodeStyleController (org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController)8 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)6 MMapController (org.freeplane.features.map.mindmapmode.MMapController)5 ModeController (org.freeplane.features.mode.ModeController)5 NodeModel (org.freeplane.features.map.NodeModel)4 Controller (org.freeplane.features.mode.Controller)4 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)4 AttributeController (org.freeplane.features.attribute.AttributeController)3 MAttributeController (org.freeplane.features.attribute.mindmapmode.MAttributeController)3 CloudController (org.freeplane.features.cloud.CloudController)3 MCloudController (org.freeplane.features.cloud.mindmapmode.MCloudController)3 EdgeController (org.freeplane.features.edge.EdgeController)3 MEdgeController (org.freeplane.features.edge.mindmapmode.MEdgeController)3 IconController (org.freeplane.features.icon.IconController)3 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)3 LinkController (org.freeplane.features.link.LinkController)3 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)3 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)3 NoteController (org.freeplane.features.note.NoteController)3 MNoteController (org.freeplane.features.note.mindmapmode.MNoteController)3