Search in sources :

Example 16 with MapModel

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);
    }
}
Also used : IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) MapLinks(org.freeplane.features.link.MapLinks)

Example 17 with MapModel

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);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 18 with MapModel

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);
}
Also used : IMapSelectionListener(org.freeplane.features.map.IMapSelectionListener) MapModel(org.freeplane.features.map.MapModel)

Example 19 with MapModel

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;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) MapModel(org.freeplane.features.map.MapModel)

Example 20 with MapModel

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();
            }
        }
    });
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) ViewController(org.freeplane.features.ui.ViewController) WindowEvent(java.awt.event.WindowEvent) WindowConfigurationStorage(org.freeplane.core.resources.WindowConfigurationStorage) WindowAdapter(java.awt.event.WindowAdapter) IUndoHandler(org.freeplane.core.undo.IUndoHandler) ComponentEvent(java.awt.event.ComponentEvent) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) ViewController(org.freeplane.features.ui.ViewController) JDialog(javax.swing.JDialog) ComponentAdapter(java.awt.event.ComponentAdapter)

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