Search in sources :

Example 46 with ModeController

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

the class MapController method createActions.

/**
 * @param modeController
 */
private void createActions() {
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.addAction(new ToggleFoldedAction());
    modeController.addAction(new ToggleChildrenFoldedAction());
    modeController.addAction(new ShowNextChildAction());
    modeController.addAction(new GotoNodeAction());
}
Also used : ModeController(org.freeplane.features.mode.ModeController)

Example 47 with ModeController

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

the class FoldingController method handleMouseWheelEvent.

public boolean handleMouseWheelEvent(final MouseWheelEvent e) {
    if ((e.getModifiers() & InputEvent.ALT_MASK) != 0) {
        Controller controller = Controller.getCurrentController();
        final NodeModel rootNode = controller.getMap().getRootNode();
        if (e.getWheelRotation() > 0) {
            unfoldOneStage(rootNode);
        } else {
            final ModeController modeController = controller.getModeController();
            modeController.getMapController().select(controller.getMap().getRootNode());
            foldOneStage(rootNode);
        }
        return true;
    }
    return false;
}
Also used : ModeController(org.freeplane.features.mode.ModeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 48 with ModeController

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

the class NodeStyleController method install.

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

Example 49 with ModeController

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

the class LoadAcceleratorPresetsAction method install.

public static final void install() {
    final File[] dirs = { LoadAcceleratorPresetsAction.getAcceleratorsUserDirectory(), LoadAcceleratorPresetsAction.getAcceleratorsSysDirectory() };
    final Controller controller = Controller.getCurrentController();
    ModeController modecontroller = controller.getModeController(MModeController.MODENAME);
    final MenuBuilder menuBuilder = modecontroller.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
    // TODO RIBBONS: impl. eventually
    for (final File dir : dirs) {
        final File[] fileList = dir.listFiles();
        if (fileList == null) {
            continue;
        }
        for (final File prop : fileList) {
            final String fileName = prop.getName();
            if (prop.isDirectory()) {
                continue;
            }
            if (!fileName.endsWith(".properties")) {
                continue;
            }
            try {
                final int propNameLength = fileName.lastIndexOf('.');
                final String propName = fileName.substring(0, propNameLength);
                final String key = "LoadAcceleratorPresetsAction." + propName;
                if (controller.getAction(key) == null) {
                    final String title = TextUtils.getText(key + ".text", propName);
                    final LoadAcceleratorPresetsAction loadAcceleratorPresetsAction = new LoadAcceleratorPresetsAction(prop.toURL(), key, title);
                    controller.addAction(loadAcceleratorPresetsAction);
                    menuBuilder.addAction("main_menu_new_load_accelerator_presets", key, loadAcceleratorPresetsAction, MenuBuilder.AS_CHILD);
                }
            } catch (final Exception e) {
                UITools.errorMessage(TextUtils.format("accelerators_loading_error", prop.getPath()));
            }
        }
    }
}
Also used : ModeController(org.freeplane.features.mode.ModeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) ResourceController(org.freeplane.core.resources.ResourceController) File(java.io.File) MenuBuilder(org.freeplane.core.ui.MenuBuilder) IOException(java.io.IOException)

Example 50 with ModeController

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

the class LogicalStyleController method createBuilder.

private void createBuilder() {
    ModeController modeController = Controller.getCurrentModeController();
    final MapController mapController = modeController.getMapController();
    final ReadManager readManager = mapController.getReadManager();
    readManager.addAttributeHandler(NodeBuilder.XML_NODE, "STYLE_REF", new IAttributeHandler() {

        public void setAttribute(final Object node, final String value) {
            final LogicalStyleModel extension = LogicalStyleModel.createExtension((NodeModel) node);
            extension.setStyle(StyleFactory.create(value));
        }
    });
    readManager.addAttributeHandler(NodeBuilder.XML_NODE, "LOCALIZED_STYLE_REF", new IAttributeHandler() {

        public void setAttribute(final Object node, final String value) {
            final LogicalStyleModel extension = LogicalStyleModel.createExtension((NodeModel) node);
            extension.setStyle(StyleFactory.create(NamedObject.format(value)));
        }
    });
    final WriteManager writeManager = mapController.getWriteManager();
    writeManager.addAttributeWriter(NodeBuilder.XML_NODE, new IAttributeWriter() {

        public void writeAttributes(final ITreeWriter writer, final Object node, final String tag) {
            if (!NodeWriter.shouldWriteSharedContent(writer))
                return;
            final LogicalStyleModel extension = LogicalStyleModel.getExtension((NodeModel) node);
            if (extension == null) {
                return;
            }
            final IStyle style = extension.getStyle();
            if (style == null) {
                return;
            }
            final String value = StyleNamedObject.toKeyString(style);
            if (style instanceof StyleNamedObject) {
                writer.addAttribute("LOCALIZED_STYLE_REF", value);
            } else {
                writer.addAttribute("STYLE_REF", value);
            }
        }
    });
}
Also used : IAttributeWriter(org.freeplane.core.io.IAttributeWriter) IAttributeHandler(org.freeplane.core.io.IAttributeHandler) ModeController(org.freeplane.features.mode.ModeController) MapController(org.freeplane.features.map.MapController) NodeModel(org.freeplane.features.map.NodeModel) ReadManager(org.freeplane.core.io.ReadManager) ITreeWriter(org.freeplane.core.io.ITreeWriter) NamedObject(org.freeplane.core.resources.NamedObject) WriteManager(org.freeplane.core.io.WriteManager)

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