Search in sources :

Example 16 with Controller

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

the class SetShortenerStateAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    setShortened = !isShortened();
    final Controller controller = Controller.getCurrentController();
    final IMapSelection selection = controller.getSelection();
    final NodeModel node = selection.getSelected();
    controller.getMapViewManager().getComponent(node).requestFocusInWindow();
    selection.keepNodePosition(node, 0.0f, 0.0f);
    super.actionPerformed(e);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) Controller(org.freeplane.features.mode.Controller)

Example 17 with Controller

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

the class EditDetailsAction method actionPerformed.

/*
	 * (non-Javadoc)
	 * @see
	 * freeplane.controller.actions.ActorXml#act(freeplane.controller.actions.
	 * generated.instance.XmlAction)
	 */
public void actionPerformed(final ActionEvent arg0) {
    final Controller controller = Controller.getCurrentController();
    final NodeModel nodeModel = controller.getSelection().getSelected();
    final IMapViewManager viewController = controller.getMapViewManager();
    final Component node = viewController.getComponent(nodeModel);
    node.requestFocus();
    final IMapSelection selection = Controller.getCurrentController().getSelection();
    selection.keepNodePosition(nodeModel, 0.0f, 0.0f);
    final MTextController textController = (MTextController) MTextController.getController();
    textController.editDetails(nodeModel, null, useDialog);
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) Controller(org.freeplane.features.mode.Controller) Component(java.awt.Component)

Example 18 with Controller

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

the class ReminderHook method runScript.

public void runScript(ReminderExtension reminderExtension) {
    final String script = reminderExtension.getScript();
    if (script == null || script.equals(""))
        return;
    final IScriptStarter starter = (IScriptStarter) modeController.getExtension(IScriptStarter.class);
    if (starter == null)
        return;
    final NodeModel node = reminderExtension.getNode();
    final MapModel map = node.getMap();
    final Controller controller = modeController.getController();
    if (!controller.getMapViewManager().getMaps(modeController.getModeName()).containsValue(map))
        return;
    starter.executeScript(node, script);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IScriptStarter(org.freeplane.features.script.IScriptStarter) MapModel(org.freeplane.features.map.MapModel) ResourceController(org.freeplane.core.resources.ResourceController) FilterController(org.freeplane.features.filter.FilterController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) ModeController(org.freeplane.features.mode.ModeController)

Example 19 with Controller

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

the class ViewerController method createURI.

protected URI createURI(final NodeModel node) {
    final Controller controller = Controller.getCurrentController();
    final ViewController viewController = controller.getViewController();
    final MapModel map = node.getMap();
    final File file = map.getFile();
    final boolean useRelativeUri = ResourceController.getResourceController().getProperty("links").equals("relative");
    if (file == null && useRelativeUri) {
        JOptionPane.showMessageDialog(viewController.getCurrentRootComponent(), TextUtils.getText("not_saved_for_image_error"), "Freeplane", JOptionPane.WARNING_MESSAGE);
        return null;
    }
    final UrlManager urlManager = controller.getModeController().getExtension(UrlManager.class);
    final JFileChooser chooser = urlManager.getFileChooser(null, false);
    chooser.setAcceptAllFileFilterUsed(false);
    final FileFilter fileFilter;
    if (factories.size() > 1) {
        fileFilter = getCombiFileFilter();
        chooser.addChoosableFileFilter(fileFilter);
        for (final IViewerFactory factory : factories) {
            chooser.addChoosableFileFilter(new FactoryFileFilter(factory));
        }
    } else {
        fileFilter = new FactoryFileFilter(factories.iterator().next());
    }
    chooser.setFileFilter(fileFilter);
    chooser.putClientProperty(FactoryFileFilter.class, fileFilter);
    chooser.setAccessory(new ImagePreview(chooser));
    final int returnVal = chooser.showOpenDialog(Controller.getCurrentController().getViewController().getCurrentRootComponent());
    if (returnVal != JFileChooser.APPROVE_OPTION) {
        return null;
    }
    final File input = chooser.getSelectedFile();
    if (input == null) {
        return null;
    }
    URI uri = uriOf(input);
    if (uri == null) {
        return null;
    }
    if (useRelativeUri && uri.getScheme().equals("file")) {
        uri = LinkController.toLinkTypeDependantURI(map.getFile(), input);
    }
    return uri;
}
Also used : UrlManager(org.freeplane.features.url.UrlManager) MapModel(org.freeplane.features.map.MapModel) MMapController(org.freeplane.features.map.mindmapmode.MMapController) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) LinkController(org.freeplane.features.link.LinkController) ModeController(org.freeplane.features.mode.ModeController) URI(java.net.URI) Point(java.awt.Point) JFileChooser(javax.swing.JFileChooser) ViewController(org.freeplane.features.ui.ViewController) FileFilter(javax.swing.filechooser.FileFilter) File(java.io.File)

Example 20 with Controller

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

the class NodeHistory method install.

public static void install(final ModeController modeController) {
    final Controller controller = modeController.getController();
    final NodeHistory history = (NodeHistory) controller.getExtension(NodeHistory.class);
    modeController.getMapController().addNodeSelectionListener(history.getMapSelectionListener());
    LinkController.getController(modeController).addNodeSelectionListener(history.getLinkSelectionListener());
    history.backAction = new BackAction(controller, history);
    modeController.addAction(history.backAction);
    history.forwardAction = new ForwardAction(controller, history);
    modeController.addAction(history.forwardAction);
}
Also used : Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) LinkController(org.freeplane.features.link.LinkController)

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