Search in sources :

Example 51 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);
    final NodeDeletionEvent nodeDeletionEvent = new NodeDeletionEvent(parent, child, index);
    firePreNodeDelete(nodeDeletionEvent);
    final MapModel map = parent.getMap();
    setSaved(map, false);
    parent.remove(index);
    fireNodeDeleted(nodeDeletionEvent);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) NodeDeletionEvent(org.freeplane.features.map.NodeDeletionEvent) MapModel(org.freeplane.features.map.MapModel)

Example 52 with MapModel

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

the class NewMapViewAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final MapModel map = Controller.getCurrentController().getMap();
    Controller.getCurrentModeController().getMapController().newMapView(map);
}
Also used : MapModel(org.freeplane.features.map.MapModel)

Example 53 with MapModel

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

the class MLinkController method insertMapLinksForClone.

public void insertMapLinksForClone(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.deleteMapLinks(mapLinks, model, model);
            }

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

            @Override
            public void act() {
                mapLinkChanger.insertMapLinks(mapLinks, 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 54 with MapModel

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

the class MapStyle method copyStyle.

public void copyStyle(final URL source, final MapModel targetMap, boolean undoable) {
    final MapModel styleMapContainer = new MapModel();
    final IExtension oldStyleModel = targetMap.getRootNode().removeExtension(MapStyleModel.class);
    final ModeController modeController = Controller.getCurrentModeController();
    final UrlManager urlManager = modeController.getExtension(UrlManager.class);
    if (!urlManager.loadCatchExceptions(source, styleMapContainer))
        return;
    onCreate(styleMapContainer);
    moveStyle(styleMapContainer, targetMap, true);
    modeController.getExtension(AutomaticLayoutController.class).moveExtension(modeController, styleMapContainer, targetMap);
    modeController.getExtension(AutomaticEdgeColorHook.class).moveExtension(modeController, styleMapContainer, targetMap);
    LogicalStyleController.getController().refreshMap(targetMap);
    if (!undoable) {
        return;
    }
    final IExtension newStyleModel = targetMap.getRootNode().getExtension(MapStyleModel.class);
    IActor actor = new IActor() {

        public void undo() {
            targetMap.getRootNode().putExtension(oldStyleModel);
        }

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

        public void act() {
            targetMap.getRootNode().putExtension(newStyleModel);
        }
    };
    Controller.getCurrentModeController().execute(actor, targetMap);
}
Also used : UrlManager(org.freeplane.features.url.UrlManager) AutomaticEdgeColorHook(org.freeplane.features.edge.AutomaticEdgeColorHook) IExtension(org.freeplane.core.extension.IExtension) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) ModeController(org.freeplane.features.mode.ModeController)

Example 55 with MapModel

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

the class MapStyle method createDefaultStyleMap.

private void createDefaultStyleMap(final MapModel map) {
    UrlManager loader = UrlManager.getController();
    final File file = loader.defaultTemplateFile();
    if (file != null) {
        try {
            MapModel styleMapContainer = new MapModel();
            loader.load(Compat.fileToUrl(file), styleMapContainer);
            if (null != MapStyleModel.getExtension(styleMapContainer)) {
                moveStyle(styleMapContainer, map, false);
                return;
            }
        } catch (Exception e) {
            LogUtils.warn(e);
            UITools.errorMessage(TextUtils.format("error_in_template", file));
        }
    }
    ;
    MapModel styleMapContainer = new MapModel();
    try {
        loader.load(ResourceController.getResourceController().getResource("/styles/viewer_standard.mm"), styleMapContainer);
        moveStyle(styleMapContainer, map, false);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : UrlManager(org.freeplane.features.url.UrlManager) MapModel(org.freeplane.features.map.MapModel) File(java.io.File) IOException(java.io.IOException)

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