Search in sources :

Example 41 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class ExportAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    if (exp == null) {
        exp = new ExportDialog();
    }
    final MapModel model = Controller.getCurrentController().getMap();
    if (model == null) {
        return;
    }
    export(model);
}
Also used : MapModel(org.freeplane.features.map.MapModel)

Example 42 with MapModel

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();
    }
}
Also used : MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller)

Example 43 with MapModel

use of org.freeplane.features.map.MapModel in project freeplane by freeplane.

the class MMapController method deleteWithoutUndo.

private void deleteWithoutUndo(final NodeModel parent, final int index) {
    final NodeModel child = parent.getChildAt(index);
    firePreNodeDelete(parent, child, index);
    final MapModel map = parent.getMap();
    setSaved(map, false);
    parent.remove(index);
    fireNodeDeleted(parent, child, index);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapModel(org.freeplane.features.map.MapModel)

Example 44 with MapModel

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);
}
Also used : IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel)

Example 45 with MapModel

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)) {
        controller.close(true);
        return newDocumentationMap(url);
    }
    final URL alternativeURL = MFileManager.getController(getMModeController()).getAlternativeURL(url, AlternativeFileMode.ALL);
    if (alternativeURL == null)
        return false;
    Controller.getCurrentController().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);
        controller.close(true);
        newMapView(newModel);
        return true;
    } finally {
        Controller.getCurrentController().getViewController().setWaitingCursor(false);
    }
}
Also used : MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) MapModel(org.freeplane.features.map.MapModel) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) ModeController(org.freeplane.features.mode.ModeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) URL(java.net.URL)

Aggregations

MapModel (org.freeplane.features.map.MapModel)161 NodeModel (org.freeplane.features.map.NodeModel)53 ModeController (org.freeplane.features.mode.ModeController)42 Controller (org.freeplane.features.mode.Controller)34 IActor (org.freeplane.core.undo.IActor)31 File (java.io.File)18 AttributeRegistry (org.freeplane.features.attribute.AttributeRegistry)17 MMapModel (org.freeplane.features.map.mindmapmode.MMapModel)17 IUndoHandler (org.freeplane.core.undo.IUndoHandler)16 URL (java.net.URL)14 MMapController (org.freeplane.features.map.mindmapmode.MMapController)14 IStyle (org.freeplane.features.styles.IStyle)14 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)14 MapController (org.freeplane.features.map.MapController)12 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)12 IMapViewManager (org.freeplane.features.ui.IMapViewManager)12 MapStyleModel (org.freeplane.features.styles.MapStyleModel)10 IOException (java.io.IOException)9 MalformedURLException (java.net.MalformedURLException)9 URI (java.net.URI)9