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 SetBooleanMapPropertyAction method actionPerformed.
public void actionPerformed(ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final NodeModel node = controller.getSelection().getSelected();
final ModeController modeController = controller.getModeController();
final MapStyle mapStyleController = MapStyle.getController(modeController);
final MapModel map = node.getMap();
final String value = mapStyleController.getPropertySetDefault(map, propertyName);
boolean set = !Boolean.parseBoolean(value);
mapStyleController.setProperty(map, propertyName, Boolean.toString(set));
setSelected(set);
}
use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class HeadlessMapViewController method changeToMap.
private void changeToMap(final MapModel nextMap, String mapViewDisplayName) {
MapModel oldMap = currentMap;
for (IMapSelectionListener mapSelectionListener : mapSelectionListeners) mapSelectionListener.beforeMapChange(oldMap, nextMap);
currentKey = mapViewDisplayName;
currentMap = nextMap;
for (IMapSelectionListener mapSelectionListener : mapSelectionListeners) mapSelectionListener.afterMapChange(oldMap, nextMap);
}
use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class LastOpenedList method selectLastVisitedNode.
private boolean selectLastVisitedNode(RecentFile recentFile) {
if (recentFile != null && recentFile.lastVisitedNodeId != null) {
final MapModel map = Controller.getCurrentController().getMap();
final NodeModel node = map.getNodeForID(recentFile.lastVisitedNodeId);
if (node != null && node.hasVisibleContent()) {
IMapSelection selection = Controller.getCurrentController().getSelection();
// don't override node selection done by UriManager.loadURI()
if (selection.isSelected(map.getRootNode()))
selection.selectAsTheOnlyOneSelected(node);
return true;
}
}
return false;
}
use of org.freeplane.features.map.MapModel in project freeplane by freeplane.
the class EditStylesAction method init.
private void init() {
this.mainController = Controller.getCurrentController();
if (dialog != null) {
Controller.setCurrentController((Controller) dialog.getRootPane().getClientProperty(Controller.class));
return;
}
dialog = new JDialog(UITools.getCurrentFrame());
final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
windowConfigurationStorage.restoreDialogPositions(dialog);
dialog.setModal(true);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
getModeController().tryToCloseDialog();
}
});
Controller styleDialogController = SModeControllerFactory.getInstance().createController(dialog);
modeController = (SModeController) styleDialogController.getModeController();
final ViewController viewController = styleDialogController.getViewController();
viewController.init(styleDialogController);
dialog.addComponentListener(new ComponentAdapter() {
@Override
public void componentHidden(final ComponentEvent e) {
final WindowConfigurationStorage windowConfigurationStorage = new WindowConfigurationStorage(getKey() + ".dialog");
windowConfigurationStorage.storeDialogPositions(dialog);
final IMapViewManager mapViewManager = modeController.getController().getMapViewManager();
final MapModel map = mapViewManager.getModel();
final IUndoHandler undoHandler = (IUndoHandler) map.getExtension(IUndoHandler.class);
modeController.getMapController().closeWithoutSaving(map);
Controller.setCurrentController(mainController);
super.componentHidden(e);
mainController.getMapViewManager().changeToMapView(currentMapView);
currentMapView = null;
switch(modeController.getStatus()) {
case JOptionPane.OK_OPTION:
if (undoHandler.canUndo()) {
commit();
break;
}
// $FALL-THROUGH$
case JOptionPane.CANCEL_OPTION:
rollback();
}
}
});
}
Aggregations