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);
}
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);
}
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);
}
}
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);
}
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);
}
}
Aggregations