Search in sources :

Example 1 with MapLinks

use of org.freeplane.features.link.MapLinks 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 2 with MapLinks

use of org.freeplane.features.link.MapLinks 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 3 with MapLinks

use of org.freeplane.features.link.MapLinks in project freeplane by freeplane.

the class ConnectorInListProxy method getConnectorSet.

List<NodeLinkModel> getConnectorSet() {
    final MapLinks allLinks = MapLinks.getLinks(node.getMap());
    final Set<NodeLinkModel> links = allLinks == null ? null : allLinks.get(node.getID());
    return links == null ? Collections.<NodeLinkModel>emptyList() : Collections.unmodifiableList(new ArrayList<NodeLinkModel>(links));
}
Also used : ArrayList(java.util.ArrayList) MapLinks(org.freeplane.features.link.MapLinks) NodeLinkModel(org.freeplane.features.link.NodeLinkModel)

Aggregations

MapLinks (org.freeplane.features.link.MapLinks)3 IActor (org.freeplane.core.undo.IActor)2 MapModel (org.freeplane.features.map.MapModel)2 ArrayList (java.util.ArrayList)1 NodeLinkModel (org.freeplane.features.link.NodeLinkModel)1