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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations