Search in sources :

Example 51 with IActor

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

the class MLogicalStyleController method moveConditionalStyleDown.

public void moveConditionalStyleDown(final MapModel map, final ConditionalStyleModel conditionalStyleModel, final int index) {
    int maxIndex = conditionalStyleModel.getStyleCount() - 1;
    if (index < 0 || index >= maxIndex) {
        return;
    }
    IActor actor = new IActor() {

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

        public void act() {
            MLogicalStyleController.super.moveConditionalStyleDown(conditionalStyleModel, index);
        }

        public void undo() {
            MLogicalStyleController.super.moveConditionalStyleUp(conditionalStyleModel, index + 1);
        }
    };
    Controller.getCurrentModeController().execute(actor, map);
}
Also used : IActor(org.freeplane.core.undo.IActor)

Example 52 with IActor

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

the class MLogicalStyleController method moveConditionalStyleUp.

public void moveConditionalStyleUp(final MapModel map, final ConditionalStyleModel conditionalStyleModel, final int index) {
    int maxIndex = conditionalStyleModel.getStyleCount() - 1;
    if (index <= 0 || index > maxIndex) {
        return;
    }
    IActor actor = new IActor() {

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

        public void act() {
            MLogicalStyleController.super.moveConditionalStyleUp(conditionalStyleModel, index);
        }

        public void undo() {
            MLogicalStyleController.super.moveConditionalStyleDown(conditionalStyleModel, index - 1);
        }
    };
    Controller.getCurrentModeController().execute(actor, map);
}
Also used : IActor(org.freeplane.core.undo.IActor)

Example 53 with IActor

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

the class UndoableSlide method setShowsDescendants.

public void setShowsDescendants(final boolean showDescendants) {
    final boolean oldShowsDescendants = slide.showsDescendants();
    if (showDescendants == oldShowsDescendants)
        return;
    IActor actor = new IActor() {

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

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

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

Example 54 with IActor

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

the class UndoableSlide method setCurrentFoldedNodeIDs.

public void setCurrentFoldedNodeIDs() {
    final Collection<String> currentFoldedNodeIds = slide.getCurrentFoldedNodeIds();
    final Set<String> oldFoldedNodeIds = slide.getFoldedNodeIds();
    final boolean foldedNodes = slide.foldsNodes();
    if (currentFoldedNodeIds == oldFoldedNodeIds && foldedNodes)
        return;
    IActor actor = new IActor() {

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

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

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

Example 55 with IActor

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

the class UndoableSlide method removeSelectedNodeIds.

public void removeSelectedNodeIds(final Collection<String> selectedNodeIds) {
    final Set<String> removedNodeIds = new HashSet<>(selectedNodeIds);
    removedNodeIds.retainAll(slide.getSelectedNodeIds());
    if (removedNodeIds.isEmpty())
        return;
    IActor actor = new IActor() {

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

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

        @Override
        public void undo() {
            slide.addSelectedNodeIds(removedNodeIds);
        }
    };
    controller.execute(actor, mapModel);
}
Also used : IActor(org.freeplane.core.undo.IActor) HashSet(java.util.HashSet)

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