Search in sources :

Example 51 with ModeController

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

the class LogicalStyleController method registerChangeListener.

private void registerChangeListener() {
    ModeController modeController = Controller.getCurrentModeController();
    final MapController mapController = modeController.getMapController();
    mapController.addMapChangeListener(new IMapChangeListener() {

        public void onPreNodeMoved(NodeModel oldParent, int oldIndex, NodeModel newParent, NodeModel child, int newIndex) {
            clearCache();
        }

        public void onPreNodeDelete(NodeModel oldParent, NodeModel selectedNode, int index) {
            clearCache();
        }

        public void onNodeMoved(NodeModel oldParent, int oldIndex, NodeModel newParent, NodeModel child, int newIndex) {
            clearCache();
        }

        public void onNodeInserted(NodeModel parent, NodeModel child, int newIndex) {
            clearCache();
        }

        public void onNodeDeleted(NodeModel parent, NodeModel child, int index) {
            clearCache();
        }

        public void mapChanged(MapChangeEvent event) {
            clearCache();
        }
    });
    mapController.addNodeChangeListener(new INodeChangeListener() {

        public void nodeChanged(NodeChangeEvent event) {
            clearCache();
        }
    });
}
Also used : NodeChangeEvent(org.freeplane.features.map.NodeChangeEvent) NodeModel(org.freeplane.features.map.NodeModel) IMapChangeListener(org.freeplane.features.map.IMapChangeListener) INodeChangeListener(org.freeplane.features.map.INodeChangeListener) ModeController(org.freeplane.features.mode.ModeController) MapChangeEvent(org.freeplane.features.map.MapChangeEvent) MapController(org.freeplane.features.map.MapController)

Example 52 with ModeController

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

the class LocationController method install.

public static void install(final LocationController locationController) {
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.addExtension(LocationController.class, locationController);
}
Also used : ModeController(org.freeplane.features.mode.ModeController)

Example 53 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 54 with ModeController

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

the class MNodeStyleController method setFontFamily.

/**
 * @param fontFamily
 */
public void setFontFamily(final NodeModel node, final String fontFamily) {
    final String oldFontFamily = NodeStyleModel.getFontFamilyName(node);
    if (oldFontFamily == fontFamily || oldFontFamily != null && oldFontFamily.equals(fontFamily)) {
        return;
    }
    createOwnStyleModel(node);
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

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

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

        public void undo() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setFontFamilyName(oldFontFamily);
            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 55 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)

Aggregations

ModeController (org.freeplane.features.mode.ModeController)222 NodeModel (org.freeplane.features.map.NodeModel)90 Controller (org.freeplane.features.mode.Controller)56 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)48 MapModel (org.freeplane.features.map.MapModel)37 IActor (org.freeplane.core.undo.IActor)31 MapController (org.freeplane.features.map.MapController)30 ResourceController (org.freeplane.core.resources.ResourceController)29 MMapController (org.freeplane.features.map.mindmapmode.MMapController)20 File (java.io.File)17 TextController (org.freeplane.features.text.TextController)17 Color (java.awt.Color)16 Point (java.awt.Point)16 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)15 MapView (org.freeplane.view.swing.map.MapView)13 NodeView (org.freeplane.view.swing.map.NodeView)13 Component (java.awt.Component)12 URL (java.net.URL)12 LinkController (org.freeplane.features.link.LinkController)12 MenuBuilder (org.freeplane.core.ui.MenuBuilder)11