Search in sources :

Example 21 with MapModel

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

the class ControllerProxy method getOpenMaps.

public List<Map> getOpenMaps() {
    Collection<MapModel> mapModels = getMapViewManager().getMaps().values();
    ArrayList<Map> mapProxies = new ArrayList<Map>(mapModels.size());
    for (MapModel mapModel : mapModels) {
        mapProxies.add(new MapProxy(mapModel, scriptContext));
    }
    return mapProxies;
}
Also used : ArrayList(java.util.ArrayList) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel) Map(org.freeplane.plugin.script.proxy.Proxy.Map)

Example 22 with MapModel

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

the class ControllerProxy method newMapFromTemplate.

public Map newMapFromTemplate(File templateFile) {
    final MapModel oldMap = Controller.getCurrentController().getMap();
    final MMapIO mapIO = (MMapIO) Controller.getCurrentModeController().getExtension(MapIO.class);
    final MapModel newMap = mapIO.newMapFromTemplate(templateFile);
    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 23 with MapModel

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

the class ImportAttributesDialog method createMapSubTrees.

private void createMapSubTrees(final DefaultMutableTreeNode top) {
    top.removeAllChildren();
    final TreeNodeInfo topInfo = (TreeNodeInfo) top.getUserObject();
    topInfo.setSelected(TreeNodeInfo.NOT_SELECTED);
    Controller controller = Controller.getCurrentController();
    final IMapViewManager mapViewManager = controller.getMapViewManager();
    final MapModel currentMap = controller.getMap();
    currentAttributes = AttributeRegistry.getRegistry(currentMap);
    final Iterator<Entry<String, MapModel>> iterator = mapViewManager.getMaps().entrySet().iterator();
    while (iterator.hasNext()) {
        final Entry<String, MapModel> entry = iterator.next();
        final String nextmapName = entry.getKey();
        final MapModel nextMap = entry.getValue();
        if (nextMap == currentMap) {
            continue;
        }
        final TreeNodeInfo treeNodeInfo = new TreeNodeInfo(nextmapName);
        final DefaultMutableTreeNode mapInfo = new DefaultMutableTreeNode(treeNodeInfo);
        createAttributeSubTrees(mapInfo, AttributeRegistry.getRegistry(nextMap));
        if (mapInfo.getChildCount() != 0) {
            top.add(mapInfo);
        }
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) Entry(java.util.Map.Entry) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller)

Example 24 with MapModel

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

the class MAttributeController method performSetVisibility.

@Override
public void performSetVisibility(final int index, final boolean isVisible) {
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    if (attributeRegistry.getElement(index).isVisible() == isVisible) {
        return;
    }
    final IActor actor = new SetAttributeVisibleActor(attributeRegistry, index, isVisible);
    Controller.getCurrentModeController().execute(actor, map);
}
Also used : AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel)

Example 25 with MapModel

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

the class MAttributeController method performRemoveAttribute.

@Override
public void performRemoveAttribute(final String name) {
    final IVisitor remover = new AttributeRemover(name);
    final Iterator iterator = new Iterator(remover);
    ModeController modeController = Controller.getCurrentModeController();
    final NodeModel root = modeController.getMapController().getRootNode();
    iterator.iterate(root);
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    final IActor actor = new UnregistryAttributeActor(name, attributeRegistry, map);
    Controller.getCurrentModeController().execute(actor, map);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel)

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