Search in sources :

Example 1 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 2 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)

Example 3 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 4 with MapModel

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

the class MAttributeController method performRegistryAttributeValue.

@Override
public void performRegistryAttributeValue(final String name, final String value, boolean manual) {
    if (name.equals("")) {
        return;
    }
    final MapModel map = Controller.getCurrentModeController().getController().getMap();
    final AttributeRegistry attributeRegistry = AttributeRegistry.getRegistry(map);
    try {
        final AttributeRegistryElement element = attributeRegistry.getElement(name);
        if (element.getValues().contains(value)) {
            return;
        }
        final IActor actor = new RegistryAttributeValueActor(element, value, manual);
        Controller.getCurrentModeController().execute(actor, map);
        return;
    } catch (final NoSuchElementException ex) {
        final IActor nameActor = new RegistryAttributeActor(name, true, false, attributeRegistry, map);
        Controller.getCurrentModeController().execute(nameActor, map);
        final AttributeRegistryElement element = attributeRegistry.getElement(name);
        final IActor valueActor = new RegistryAttributeValueActor(element, value, false);
        Controller.getCurrentModeController().execute(valueActor, map);
    }
}
Also used : AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) AttributeRegistryElement(org.freeplane.features.attribute.AttributeRegistryElement) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) NoSuchElementException(java.util.NoSuchElementException)

Example 5 with MapModel

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

the class MAttributeController method performReplaceAttributeValue.

@Override
public void performReplaceAttributeValue(final String name, final Object oldValue, final Object newValue) {
    Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    ModeController modeController = controller.getModeController();
    final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
    final IActor actor = new ReplaceAttributeValueActor(registry, name, oldValue, newValue);
    Controller.getCurrentModeController().execute(actor, map);
    final IVisitor replacer = new AttributeChanger(name, oldValue, newValue);
    final Iterator iterator = new Iterator(replacer);
    final NodeModel root = modeController.getMapController().getRootNode();
    iterator.iterate(root);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) ModeController(org.freeplane.features.mode.ModeController) AttributeController(org.freeplane.features.attribute.AttributeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

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