Search in sources :

Example 86 with IActor

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

the class MNodeStyleController method setBorderDashMatchesEdgeDash.

public void setBorderDashMatchesEdgeDash(final NodeModel node, final Boolean borderDashMatchesEdgeDash) {
    final Boolean oldBorderDashMatchesEdgeDash = NodeBorderModel.getBorderDashMatchesEdgeDash(node);
    final IActor actor = new IActor() {

        public void act() {
            NodeBorderModel.setBorderDashMatchesEdgeDash(node, borderDashMatchesEdgeDash);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }

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

        public void undo() {
            NodeBorderModel.setBorderDashMatchesEdgeDash(node, oldBorderDashMatchesEdgeDash);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }
    };
    getModeController().execute(actor, node.getMap());
}
Also used : IActor(org.freeplane.core.undo.IActor) MapController(org.freeplane.features.map.MapController)

Example 87 with IActor

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

the class MNodeStyleController method setBorderDash.

public void setBorderDash(final NodeModel node, final DashVariant borderDash) {
    final DashVariant oldBorderDash = NodeBorderModel.getBorderDash(node);
    final IActor actor = new IActor() {

        public void act() {
            NodeBorderModel.setBorderDash(node, borderDash);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }

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

        public void undo() {
            NodeBorderModel.setBorderDash(node, oldBorderDash);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }
    };
    getModeController().execute(actor, node.getMap());
}
Also used : DashVariant(org.freeplane.features.DashVariant) IActor(org.freeplane.core.undo.IActor) MapController(org.freeplane.features.map.MapController)

Example 88 with IActor

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

the class MNodeStyleController method setBold.

/**
 * @param bold
 */
public void setBold(final NodeModel node, final Boolean bold) {
    final Boolean oldBold = NodeStyleModel.isBold(node);
    if (oldBold == bold || oldBold != null && oldBold.equals(bold)) {
        return;
    }
    createOwnStyleModel(node);
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setBold(bold);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }

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

        public void undo() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setBold(oldBold);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : NodeStyleModel(org.freeplane.features.nodestyle.NodeStyleModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Example 89 with IActor

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

the class MNodeStyleController method setMinNodeWidth.

public void setMinNodeWidth(final NodeModel node, final Quantity<LengthUnits> minNodeWidth) {
    Quantity.assertNonNegativeOrNull(minNodeWidth);
    final NodeSizeModel sizeModel = createOwnSizeModel(node);
    final Quantity<LengthUnits> oldValue = NodeSizeModel.getMinNodeWidth(node);
    final IActor actor = new IActor() {

        public void act() {
            sizeModel.setMinNodeWidth(minNodeWidth);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }

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

        public void undo() {
            sizeModel.setMinNodeWidth(oldValue);
            final MapController mapController = getModeController().getMapController();
            mapController.nodeChanged(node);
        }
    };
    getModeController().execute(actor, node.getMap());
    final Quantity<LengthUnits> maxNodeWidth = getMaxWidth(node);
    if (maxNodeWidth != null && minNodeWidth != null && maxNodeWidth.toBaseUnits() < minNodeWidth.toBaseUnits()) {
        setMaxNodeWidth(node, minNodeWidth);
    }
}
Also used : LengthUnits(org.freeplane.core.ui.LengthUnits) NodeSizeModel(org.freeplane.features.nodestyle.NodeSizeModel) IActor(org.freeplane.core.undo.IActor) MapController(org.freeplane.features.map.MapController)

Example 90 with IActor

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

the class UndoableSlide method unsetFoldsNodes.

public void unsetFoldsNodes() {
    final boolean foldedNodes = slide.foldsNodes();
    if (!foldedNodes)
        return;
    final Set<String> oldFoldedNodeIds = slide.getFoldedNodeIds();
    IActor actor = new IActor() {

        @Override
        public String getDescription() {
            return "unsetFoldsNodes";
        }

        @Override
        public void act() {
            slide.unsetFoldsNodes();
        }

        @Override
        public void undo() {
            slide.setFoldedNodeIDs(oldFoldedNodeIds);
        }
    };
    controller.execute(actor, mapModel);
}
Also used : IActor(org.freeplane.core.undo.IActor)

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