Search in sources :

Example 1 with Controller

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

the class ActionAcceleratorManager method loadAcceleratorPreset.

private void loadAcceleratorPreset(final String shortcutKey, final String keystrokeString, Properties allPresets) {
    if (!shortcutKey.startsWith(SHORTCUT_PROPERTY_PREFIX)) {
        LogUtils.warn("wrong property key " + shortcutKey);
        return;
    }
    final int pos = shortcutKey.indexOf("/", SHORTCUT_PROPERTY_PREFIX.length());
    if (pos <= 0) {
        LogUtils.warn("wrong property key " + shortcutKey);
        return;
    }
    final String modeName = shortcutKey.substring(SHORTCUT_PROPERTY_PREFIX.length(), pos);
    final String itemKey = shortcutKey.substring(pos + 1);
    Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController(modeName);
    if (modeController != null) {
        final KeyStroke keyStroke;
        if (!keystrokeString.equals("")) {
            keyStroke = UITools.getKeyStroke(keystrokeString);
            final AFreeplaneAction oldAction = accelerators.get(key(modeController, keyStroke));
            if (!acceleratorIsDefinedByUserProperties(oldAction, modeController, allPresets))
                setAccelerator(modeController, oldAction, null);
        } else {
            keyStroke = null;
        }
        final AFreeplaneAction action = modeController.getAction(itemKey);
        if (action != null) {
            setAccelerator(modeController, action, keyStroke);
        }
    }
    setKeysetProperty(shortcutKey, keystrokeString);
}
Also used : KeyStroke(javax.swing.KeyStroke) ModeController(org.freeplane.features.mode.ModeController) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 2 with Controller

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

the class ColorTracker method showCommonJColorChooserDialog.

public static Color showCommonJColorChooserDialog(final NodeModel nodeModel, final String title, final Color initialColor, Color defaultColor) throws HeadlessException {
    Controller controller = Controller.getCurrentController();
    final Component component = controller.getMapViewManager().getComponent(nodeModel);
    return ColorTracker.showCommonJColorChooserDialog(component, title, initialColor, defaultColor);
}
Also used : Controller(org.freeplane.features.mode.Controller) Component(java.awt.Component)

Example 3 with Controller

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

the class ImportAttributesDialog method createMapSubTrees.

private void createMapSubTrees(final DefaultMutableTreeNode top) {
    top.removeAllChildren();
    final TreeNodeInfo topInfo = (TreeNodeInfo) top.getUserObject();
    topInfo.setSelected(TreeNodeInfo.NOT_SELECTED);
    Controller controller = Controller.getCurrentController();
    final IMapViewManager mapViewManager = controller.getMapViewManager();
    final MapModel currentMap = controller.getMap();
    currentAttributes = AttributeRegistry.getRegistry(currentMap);
    final Iterator<Entry<String, MapModel>> iterator = mapViewManager.getMaps().entrySet().iterator();
    while (iterator.hasNext()) {
        final Entry<String, MapModel> entry = iterator.next();
        final String nextmapName = entry.getKey();
        final MapModel nextMap = entry.getValue();
        if (nextMap == currentMap) {
            continue;
        }
        final TreeNodeInfo treeNodeInfo = new TreeNodeInfo(nextmapName);
        final DefaultMutableTreeNode mapInfo = new DefaultMutableTreeNode(treeNodeInfo);
        createAttributeSubTrees(mapInfo, AttributeRegistry.getRegistry(nextMap));
        if (mapInfo.getChildCount() != 0) {
            top.add(mapInfo);
        }
    }
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) Entry(java.util.Map.Entry) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller)

Example 4 with Controller

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

the class MAttributeController method performReplaceAttributeValue.

@Override
public void performReplaceAttributeValue(final String name, final Object oldValue, final Object newValue) {
    Controller controller = Controller.getCurrentController();
    final MapModel map = controller.getMap();
    ModeController modeController = controller.getModeController();
    final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
    final IActor actor = new ReplaceAttributeValueActor(registry, name, oldValue, newValue);
    Controller.getCurrentModeController().execute(actor, map);
    final IVisitor replacer = new AttributeChanger(name, oldValue, newValue);
    final Iterator iterator = new Iterator(replacer);
    final NodeModel root = modeController.getMapController().getRootNode();
    iterator.iterate(root);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) AttributeRegistry(org.freeplane.features.attribute.AttributeRegistry) IActor(org.freeplane.core.undo.IActor) MapModel(org.freeplane.features.map.MapModel) ModeController(org.freeplane.features.mode.ModeController) AttributeController(org.freeplane.features.attribute.AttributeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 5 with Controller

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

the class CopyAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final ModeController modeController = Controller.getCurrentModeController();
    final IMapSelection selection = controller.getSelection();
    if (selection != null) {
        final ClipboardController clipboardController = (ClipboardController) modeController.getExtension(ClipboardController.class);
        final Transferable copy = clipboardController.copy(selection);
        if (copy != null) {
            clipboardController.setClipboardContents(copy);
        }
    }
}
Also used : IMapSelection(org.freeplane.features.map.IMapSelection) Transferable(java.awt.datatransfer.Transferable) ModeController(org.freeplane.features.mode.ModeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Aggregations

Controller (org.freeplane.features.mode.Controller)135 ModeController (org.freeplane.features.mode.ModeController)78 ResourceController (org.freeplane.core.resources.ResourceController)63 NodeModel (org.freeplane.features.map.NodeModel)44 MapController (org.freeplane.features.map.MapController)37 LinkController (org.freeplane.features.link.LinkController)32 MapModel (org.freeplane.features.map.MapModel)31 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)30 MMapController (org.freeplane.features.map.mindmapmode.MMapController)27 TextController (org.freeplane.features.text.TextController)24 ViewController (org.freeplane.features.ui.ViewController)22 IconController (org.freeplane.features.icon.IconController)20 Component (java.awt.Component)18 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)18 FilterController (org.freeplane.features.filter.FilterController)16 FormatController (org.freeplane.features.format.FormatController)15 ScannerController (org.freeplane.features.format.ScannerController)15 IMapSelection (org.freeplane.features.map.IMapSelection)15 MTextController (org.freeplane.features.text.mindmapmode.MTextController)14 IMapViewManager (org.freeplane.features.ui.IMapViewManager)14