Search in sources :

Example 21 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class RemoveNoteAction method doesNoteExist.

private boolean doesNoteExist() {
    boolean foundNote = false;
    final ModeController modeController = Controller.getCurrentModeController();
    if (modeController == null) {
        foundNote = false;
    } else {
        for (final NodeModel node : modeController.getMapController().getSelectedNodes()) {
            if (NoteModel.getNoteText(node) != null) {
                foundNote = true;
                break;
            }
        }
    }
    return foundNote;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ModeController(org.freeplane.features.mode.ModeController)

Example 22 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class RemoveNoteAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final int showResult = OptionalDontShowMeAgainDialog.show("really_remove_notes", "confirmation", MNoteController.RESOURCES_REMOVE_NOTES_WITHOUT_QUESTION, OptionalDontShowMeAgainDialog.ONLY_OK_SELECTION_IS_STORED);
    if (showResult != JOptionPane.OK_OPTION) {
        return;
    }
    final ModeController modeController = Controller.getCurrentModeController();
    for (final Iterator<NodeModel> iterator = modeController.getMapController().getSelectedNodes().iterator(); iterator.hasNext(); ) {
        final NodeModel node = iterator.next();
        if (NoteModel.getNoteText(node) != null) {
            removeNote(node);
        }
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ModeController(org.freeplane.features.mode.ModeController)

Example 23 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class MNodeStyleController method createOwnSizeModel.

private NodeSizeModel createOwnSizeModel(final NodeModel node) {
    {
        final NodeSizeModel sizeModel = NodeSizeModel.getModel(node);
        if (sizeModel != null) {
            return sizeModel;
        }
    }
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            node.addExtension(new NodeSizeModel());
        }

        public String getDescription() {
            return null;
        }

        public void undo() {
            node.removeExtension(NodeSizeModel.class);
        }
    };
    modeController.execute(actor, node.getMap());
    return NodeSizeModel.getModel(node);
}
Also used : NodeSizeModel(org.freeplane.features.nodestyle.NodeSizeModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Example 24 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class MNodeStyleController method setItalic.

/**
 * @param italic
 */
public void setItalic(final NodeModel node, final Boolean italic) {
    final Boolean oldItalic = NodeStyleModel.isItalic(node);
    if (oldItalic == italic || oldItalic != null && oldItalic.equals(italic)) {
        return;
    }
    createOwnStyleModel(node);
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setItalic(italic);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }

        public String getDescription() {
            return "setItalic";
        }

        public void undo() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setItalic(oldItalic);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : NodeStyleModel(org.freeplane.features.nodestyle.NodeStyleModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Example 25 with ModeController

use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.

the class MNodeStyleController method setNodeFormat.

public void setNodeFormat(final NodeModel node, final String format) {
    final ModeController modeController = Controller.getCurrentModeController();
    final String oldFormat = NodeStyleModel.getNodeFormat(node);
    final IActor actor = new IActor() {

        public void act() {
            NodeStyleModel.setNodeFormat(node, format);
            modeController.getMapController().nodeChanged(node);
        }

        public String getDescription() {
            return "setNodeFormat";
        }

        public void undo() {
            NodeStyleModel.setNodeFormat(node, oldFormat);
            modeController.getMapController().nodeChanged(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Aggregations

ModeController (org.freeplane.features.mode.ModeController)185 NodeModel (org.freeplane.features.map.NodeModel)80 Controller (org.freeplane.features.mode.Controller)43 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)36 MapController (org.freeplane.features.map.MapController)31 MapModel (org.freeplane.features.map.MapModel)30 IActor (org.freeplane.core.undo.IActor)28 ResourceController (org.freeplane.core.resources.ResourceController)21 MMapController (org.freeplane.features.map.mindmapmode.MMapController)21 Point (java.awt.Point)16 TextController (org.freeplane.features.text.TextController)16 Component (java.awt.Component)13 MapView (org.freeplane.view.swing.map.MapView)13 LinkController (org.freeplane.features.link.LinkController)12 NodeView (org.freeplane.view.swing.map.NodeView)12 Color (java.awt.Color)11 File (java.io.File)11 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)11 IMapSelection (org.freeplane.features.map.IMapSelection)10 ViewController (org.freeplane.features.ui.ViewController)10