use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class FilterHistory method undo.
void undo() {
Controller controller = Controller.getCurrentController();
final MapModel map = controller.getMap();
final Filter previous = filters.previous();
undoImpl(map);
while (previous != filters.next()) {
;
}
if (filters.nextIndex() > 1) {
filters.previous();
}
}
use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class FindAction method findNext.
void findNext(Direction direction) {
final MapModel map = Controller.getCurrentController().getMap();
final FoundNodes info = FoundNodes.get(map);
if (info.condition == null) {
displayNoPreviousFindMessage();
return;
}
final FilterController filterController = FilterController.getCurrentFilterController();
final NodeModel start = Controller.getCurrentController().getSelection().getSelected();
final NodeModel root = map.getNodeForID(info.rootID);
if (root == null) {
info.condition = null;
displayNoPreviousFindMessage();
return;
}
final NodeModel next = filterController.findNext(start, null, direction, info.condition);
if (next == null) {
displayNotFoundMessage(root, info.condition);
return;
}
info.displayFoundNode(next);
}
use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class FoundNodes method displayFoundNode.
/**
* Display a node in the display (used by find and the goto action by arrow
* link actions).
*/
void displayFoundNode(final NodeModel node) {
final MapModel map = node.getMap();
final LinkedList<String> nodesUnfoldedByDisplay = new LinkedList<String>();
NodeModel nodeOnPath = null;
for (nodeOnPath = node; nodeOnPath != null && !this.nodesUnfoldedByDisplay.contains(nodeOnPath.createID()); nodeOnPath = nodeOnPath.getParentNode()) {
if (Controller.getCurrentModeController().getMapController().isFolded(nodeOnPath)) {
nodesUnfoldedByDisplay.add(nodeOnPath.createID());
}
}
final ListIterator<String> oldPathIterator = this.nodesUnfoldedByDisplay.listIterator(this.nodesUnfoldedByDisplay.size());
while (oldPathIterator.hasPrevious()) {
final String oldPathNodeID = oldPathIterator.previous();
final NodeModel oldPathNode = map.getNodeForID(oldPathNodeID);
if (oldPathNode != null && oldPathNode.equals(nodeOnPath)) {
break;
}
oldPathIterator.remove();
if (oldPathNode != null) {
Controller.getCurrentModeController().getMapController().fold(oldPathNode);
}
}
this.nodesUnfoldedByDisplay.addAll(nodesUnfoldedByDisplay);
Controller.getCurrentModeController().getMapController().select(node);
}
use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class MMapController method insertSingleNewNode.
private void insertSingleNewNode(final NodeModel newNode, final NodeModel parent, final int index, final boolean newNodeIsLeft) {
final MapModel map = parent.getMap();
newNode.setLeft(newNodeIsLeft);
final IActor actor = new IActor() {
public void act() {
insertNodeIntoWithoutUndo(newNode, parent, index);
}
public String getDescription() {
return "addNewNode";
}
public void undo() {
deleteWithoutUndo(parent, index);
}
};
Controller.getCurrentModeController().execute(actor, map);
}
use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class MMapController method restoreCurrentMap.
/**
*@throws XMLException
* @deprecated -- use MMapIO
*/
@Deprecated
public boolean restoreCurrentMap() throws FileNotFoundException, IOException, URISyntaxException, XMLException {
final Controller controller = Controller.getCurrentController();
final MapModel map = controller.getMap();
final URL url = map.getURL();
if (url == null) {
UITools.errorMessage(TextUtils.getText("map_not_saved"));
return false;
}
if (map.containsExtension(DocuMapAttribute.class)) {
closeWithoutSaving(map);
return newDocumentationMap(url);
}
final URL alternativeURL = MFileManager.getController(getMModeController()).getAlternativeURL(url, AlternativeFileMode.ALL);
if (alternativeURL == null)
return false;
controller.getViewController().setWaitingCursor(true);
try {
final MapModel newModel = new MMapModel();
((MFileManager) MFileManager.getController()).loadAndLock(alternativeURL, newModel);
newModel.setURL(url);
newModel.setSaved(alternativeURL.equals(url));
fireMapCreated(newModel);
closeWithoutSaving(map);
newMapView(newModel);
return true;
} finally {
controller.getViewController().setWaitingCursor(false);
}
}
Aggregations