Search in sources :

Example 41 with IActor

use of org.freeplane.core.undo.IActor in project freeplane by freeplane.

the class MMapController method deleteSingleNode.

private void deleteSingleNode(final NodeModel parentNode, final int index) {
    final NodeModel node = parentNode.getChildAt(index);
    final IActor actor = new IActor() {

        public void act() {
            deleteWithoutUndo(parentNode, index);
        }

        public String getDescription() {
            return "delete";
        }

        public void undo() {
            (Controller.getCurrentModeController().getMapController()).insertNodeIntoWithoutUndo(node, parentNode, index);
        }
    };
    Controller.getCurrentModeController().execute(actor, parentNode.getMap());
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor)

Example 42 with IActor

use of org.freeplane.core.undo.IActor in project freeplane by freeplane.

the class MLinkController method changeArrowsOfArrowLink.

public void changeArrowsOfArrowLink(final ConnectorModel link, final ArrowType startArrow, final ArrowType endArrow) {
    final IActor actor = new IActor() {

        private final ArrowType oldEndArrow = link.getEndArrow();

        private final ArrowType oldStartArrow = link.getStartArrow();

        public void act() {
            link.setStartArrow(startArrow);
            link.setEndArrow(endArrow);
            fireNodeConnectorChange(link.getSource(), link);
        }

        public String getDescription() {
            return "changeArrowsOfArrowLink";
        }

        public void undo() {
            link.setStartArrow(oldStartArrow);
            link.setEndArrow(oldEndArrow);
            fireNodeConnectorChange(link.getSource(), link);
        }
    };
    Controller.getCurrentModeController().execute(actor, link.getSource().getMap());
}
Also used : IActor(org.freeplane.core.undo.IActor) ArrowType(org.freeplane.features.link.ArrowType)

Example 43 with IActor

use of org.freeplane.core.undo.IActor in project freeplane by freeplane.

the class MLinkController method setMiddleLabel.

public void setMiddleLabel(final ConnectorModel model, String label) {
    if ("".equals(label)) {
        label = null;
    }
    String oldLabel = model.getMiddleLabel();
    if ("".equals(oldLabel)) {
        oldLabel = null;
    }
    if (label == oldLabel || label != null && label.equals(oldLabel)) {
        return;
    }
    final IActor actor = new MiddleLabelSetter(model, oldLabel, label);
    Controller.getCurrentModeController().execute(actor, model.getSource().getMap());
}
Also used : IActor(org.freeplane.core.undo.IActor)

Example 44 with IActor

use of org.freeplane.core.undo.IActor in project freeplane by freeplane.

the class MLinkController method setLabelFontFamily.

public void setLabelFontFamily(final ConnectorModel connector, final String family) {
    final String oldFamily = connector.getLabelFontFamily();
    if (oldFamily.equals(family)) {
        return;
    }
    final IActor actor = new IActor() {

        public void act() {
            connector.setLabelFontFamily(family);
            final NodeModel node = connector.getSource();
            fireNodeConnectorChange(node, connector);
        }

        public String getDescription() {
            return "setConnectorWidth";
        }

        public void undo() {
            connector.setLabelFontFamily(oldFamily);
            final NodeModel node = connector.getSource();
            fireNodeConnectorChange(node, connector);
        }
    };
    Controller.getCurrentModeController().execute(actor, connector.getSource().getMap());
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor)

Example 45 with IActor

use of org.freeplane.core.undo.IActor in project freeplane by freeplane.

the class MLinkController method setArrowLinkEndPoints.

public void setArrowLinkEndPoints(final ConnectorModel link, final Point startPoint, final Point endPoint) {
    final IActor actor = new IActor() {

        private final Point oldEndPoint = link.getEndInclination();

        private final Point oldStartPoint = link.getStartInclination();

        public void act() {
            link.setStartInclination(startPoint);
            link.setEndInclination(endPoint);
            fireNodeConnectorChange(link.getSource(), link);
        }

        public String getDescription() {
            return "setArrowLinkEndPoints";
        }

        public void undo() {
            link.setStartInclination(oldStartPoint);
            link.setEndInclination(oldEndPoint);
            fireNodeConnectorChange(link.getSource(), link);
        }
    };
    Controller.getCurrentModeController().execute(actor, link.getSource().getMap());
}
Also used : IActor(org.freeplane.core.undo.IActor) Point(java.awt.Point)

Aggregations

IActor (org.freeplane.core.undo.IActor)123 NodeModel (org.freeplane.features.map.NodeModel)30 ModeController (org.freeplane.features.mode.ModeController)28 MapModel (org.freeplane.features.map.MapModel)27 MapController (org.freeplane.features.map.MapController)11 AttributeRegistry (org.freeplane.features.attribute.AttributeRegistry)10 Color (java.awt.Color)8 Point (java.awt.Point)6 MMapController (org.freeplane.features.map.mindmapmode.MMapController)6 NodeStyleModel (org.freeplane.features.nodestyle.NodeStyleModel)6 Controller (org.freeplane.features.mode.Controller)5 IStyle (org.freeplane.features.styles.IStyle)5 MapStyleModel (org.freeplane.features.styles.MapStyleModel)5 NoSuchElementException (java.util.NoSuchElementException)4 LengthUnits (org.freeplane.core.ui.LengthUnits)4 AttributeRegistryElement (org.freeplane.features.attribute.AttributeRegistryElement)4 Date (java.util.Date)3 IExtension (org.freeplane.core.extension.IExtension)3 IUndoHandler (org.freeplane.core.undo.IUndoHandler)3 EdgeModel (org.freeplane.features.edge.EdgeModel)3