Search in sources :

Example 71 with MapModel

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

the class ControllerProxy method newMap.

public Map newMap() {
    final MapModel oldMap = Controller.getCurrentController().getMap();
    final MMapIO mapIO = (MMapIO) Controller.getCurrentModeController().getExtension(MapIO.class);
    final MapModel newMap = mapIO.newMapFromDefaultTemplate();
    restartTransaction(oldMap, newMap);
    return new MapProxy(newMap, scriptContext);
}
Also used : MMapIO(org.freeplane.features.mapio.mindmapmode.MMapIO) MapIO(org.freeplane.features.mapio.MapIO) MMapIO(org.freeplane.features.mapio.mindmapmode.MMapIO) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel)

Example 72 with MapModel

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

the class ControllerProxy method deactivateUndo.

public void deactivateUndo() {
    final MapModel map = Controller.getCurrentController().getMap();
    if (map instanceof MapModel) {
        MModeController modeController = ((MModeController) Controller.getCurrentModeController());
        modeController.deactivateUndo((MMapModel) map);
    }
}
Also used : MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 73 with MapModel

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

the class ControllerProxy method newMap.

public Map newMap(URL url) {
    try {
        final MapModel oldMap = Controller.getCurrentController().getMap();
        Controller.getCurrentModeController().getMapController().newMap(url);
        final IMapViewManager mapViewManager = Controller.getCurrentController().getMapViewManager();
        final String key = mapViewManager.checkIfFileIsAlreadyOpened(url);
        // make the map the current map even if it was already opened
        if (key == null || !mapViewManager.tryToChangeToMapView(key))
            throw new RuntimeException("map " + url + " does not seem to be opened");
        final MapModel newMap = mapViewManager.getModel();
        restartTransaction(oldMap, newMap);
        return new MapProxy(newMap, scriptContext);
    } catch (Exception e) {
        throw new RuntimeException("error on newMap", e);
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel)

Example 74 with MapModel

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

the class MLinkController method deleteMapLinksForClone.

public void deleteMapLinksForClone(final NodeModel model) {
    final MapModel map = model.getMap();
    final MapLinks mapLinks = map.getExtension(MapLinks.class);
    if (mapLinks != null) {
        IActor actor = new IActor() {

            @Override
            public void undo() {
                mapLinkChanger.insertMapLinks(mapLinks, model);
            }

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

            @Override
            public void act() {
                mapLinkChanger.deleteMapLinks(mapLinks, model, model);
            }
        };
        modeController.execute(actor, map);
    }
}
Also used : IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) MapLinks(org.freeplane.features.link.MapLinks)

Example 75 with MapModel

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

the class NodeLinks method addArrowlink.

public void addArrowlink(final NodeLinkModel newLink) {
    links.add(newLink);
    final MapModel map = newLink.getSource().getMap();
    addLinkToMap(map, newLink);
}
Also used : MapModel(org.freeplane.features.map.MapModel)

Aggregations

MapModel (org.freeplane.features.map.MapModel)143 NodeModel (org.freeplane.features.map.NodeModel)47 ModeController (org.freeplane.features.mode.ModeController)35 Controller (org.freeplane.features.mode.Controller)31 IActor (org.freeplane.core.undo.IActor)27 MMapModel (org.freeplane.features.map.mindmapmode.MMapModel)16 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)16 IUndoHandler (org.freeplane.core.undo.IUndoHandler)15 AttributeRegistry (org.freeplane.features.attribute.AttributeRegistry)14 IStyle (org.freeplane.features.styles.IStyle)14 File (java.io.File)13 MMapController (org.freeplane.features.map.mindmapmode.MMapController)13 URL (java.net.URL)12 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)11 MapStyleModel (org.freeplane.features.styles.MapStyleModel)10 IMapViewManager (org.freeplane.features.ui.IMapViewManager)10 MapController (org.freeplane.features.map.MapController)9 URI (java.net.URI)8 ResourceController (org.freeplane.core.resources.ResourceController)8 IOException (java.io.IOException)7