Search in sources :

Example 1 with ClipboardController

use of org.freeplane.features.clipboard.ClipboardController in project freeplane by freeplane.

the class MMapController method convertCloneToNode.

private void convertCloneToNode(final NodeModel node) {
    final MModeController mModeController = getMModeController();
    final ClipboardController clipboardController = mModeController.getExtension(ClipboardController.class);
    final NodeModel duplicate = clipboardController.duplicate(node, false);
    IActor converter = new IActor() {

        @Override
        public void act() {
            node.swapData(duplicate);
            nodeChanged(node);
        }

        @Override
        public void undo() {
            node.swapData(duplicate);
            nodeChanged(node);
        }

        @Override
        public String getDescription() {
            return "convertClonesToIndependentNodes";
        }
    };
    final boolean shouldConvertChildNodes = node.subtreeClones().size() > 1;
    mModeController.execute(converter, node.getMap());
    if (shouldConvertChildNodes)
        for (NodeModel child : node.getChildren()) convertCloneToNode(child);
}
Also used : ClipboardController(org.freeplane.features.clipboard.ClipboardController) NodeModel(org.freeplane.features.map.NodeModel) IActor(org.freeplane.core.undo.IActor) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 2 with ClipboardController

use of org.freeplane.features.clipboard.ClipboardController in project freeplane by freeplane.

the class FModeControllerFactory method createModeController.

public static FModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new FModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new FMapController(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    new IconController(modeController).install(modeController);
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    new TextController(modeController).install(modeController);
    LinkController.install(new LinkController(modeController));
    CloudController.install(new CloudController(modeController));
    ClipboardController.install(new ClipboardController());
    LocationController.install(new LocationController());
    LogicalStyleController.install(new LogicalStyleController(modeController));
    MapStyle.install(true);
    NodeStyleController.getController().addShapeGetter(new Integer(0), new IPropertyHandler<ShapeConfigurationModel, NodeModel>() {

        public ShapeConfigurationModel getProperty(final NodeModel node, final ShapeConfigurationModel currentValue) {
            return ShapeConfigurationModel.FORK;
        }
    });
    modeController.addAction(new CenterAction());
    modeController.addAction(new OpenPathAction());
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    NodeHistory.install(modeController);
    return modeController;
}
Also used : OpenPathAction(org.freeplane.features.map.filemode.OpenPathAction) ShapeConfigurationModel(org.freeplane.features.nodestyle.ShapeConfigurationModel) UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) EdgeController(org.freeplane.features.edge.EdgeController) TextController(org.freeplane.features.text.TextController) LinkController(org.freeplane.features.link.LinkController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) LocationController(org.freeplane.features.nodelocation.LocationController) FMapController(org.freeplane.features.map.filemode.FMapController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) FModeController(org.freeplane.features.mode.filemode.FModeController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) LocationController(org.freeplane.features.nodelocation.LocationController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FMapController(org.freeplane.features.map.filemode.FMapController) JPopupMenu(javax.swing.JPopupMenu) IconController(org.freeplane.features.icon.IconController) CenterAction(org.freeplane.features.map.filemode.CenterAction) NodeModel(org.freeplane.features.map.NodeModel) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FModeController(org.freeplane.features.mode.filemode.FModeController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) FrameController(org.freeplane.features.ui.FrameController)

Example 3 with ClipboardController

use of org.freeplane.features.clipboard.ClipboardController in project freeplane by freeplane.

the class SetLinkByTextFieldAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final ModeController modeController = Controller.getCurrentModeController();
    final NodeModel selectedNode = modeController.getMapController().getSelectedNode();
    String linkAsString = NodeLinks.getLinkAsString(selectedNode);
    if (Compat.isWindowsOS() && linkAsString != null && linkAsString.startsWith("smb:")) {
        final URI link = NodeLinks.getValidLink(selectedNode);
        linkAsString = Compat.smbUri2unc(link);
    }
    if (linkAsString == null || "".equals(linkAsString)) {
        linkAsString = "http://";
        // if clipboard contains a valid uri use it
        ClipboardController clipboardController = modeController.getExtension(ClipboardController.class);
        Transferable t = clipboardController.getClipboardContents();
        if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
            try {
                final String plainTextFromClipboard = t.getTransferData(DataFlavor.stringFlavor).toString().trim();
                new URI(plainTextFromClipboard);
                linkAsString = plainTextFromClipboard;
            } catch (final Exception ex) {
            }
        }
    }
    final String inputValue = UITools.showInputDialog(Controller.getCurrentController().getSelection().getSelected(), TextUtils.getText("edit_link_manually"), linkAsString);
    if (inputValue != null && !inputValue.matches("\\w+://")) {
        final MLinkController linkController = (MLinkController) MLinkController.getController();
        if (inputValue.equals("")) {
            linkController.setLink(selectedNode, (URI) null, LinkController.LINK_ABSOLUTE);
            return;
        }
        try {
            final URI link = LinkController.createURI(inputValue.trim());
            linkController.setLink(selectedNode, link, LinkController.LINK_ABSOLUTE);
        } catch (final URISyntaxException e1) {
            LogUtils.warn(e1);
            UITools.errorMessage(TextUtils.format("invalid_uri", inputValue));
            return;
        }
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ClipboardController(org.freeplane.features.clipboard.ClipboardController) Transferable(java.awt.datatransfer.Transferable) ModeController(org.freeplane.features.mode.ModeController) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) URISyntaxException(java.net.URISyntaxException)

Example 4 with ClipboardController

use of org.freeplane.features.clipboard.ClipboardController in project freeplane by freeplane.

the class CutAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final ModeController mMindMapController = Controller.getCurrentModeController();
    final Controller controller = Controller.getCurrentController();
    final NodeModel root = controller.getMap().getRootNode();
    if (controller.getSelection().isSelected(root)) {
        UITools.errorMessage(TextUtils.getText("cannot_delete_root"));
        return;
    }
    final int showResult = OptionalDontShowMeAgainDialog.show("really_cut_node", "confirmation", MClipboardController.RESOURCES_CUT_NODES_WITHOUT_QUESTION, OptionalDontShowMeAgainDialog.ONLY_OK_SELECTION_IS_STORED);
    if (showResult != JOptionPane.OK_OPTION) {
        return;
    }
    final MClipboardController clipboardController = (MClipboardController) mMindMapController.getExtension(ClipboardController.class);
    clipboardController.cut(controller.getSelection().getSortedSelection(true));
    controller.getMapViewManager().obtainFocusForSelected();
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ClipboardController(org.freeplane.features.clipboard.ClipboardController) ModeController(org.freeplane.features.mode.ModeController) Controller(org.freeplane.features.mode.Controller) ClipboardController(org.freeplane.features.clipboard.ClipboardController) ModeController(org.freeplane.features.mode.ModeController)

Example 5 with ClipboardController

use of org.freeplane.features.clipboard.ClipboardController in project freeplane by freeplane.

the class BModeControllerFactory method createModeController.

public static BModeController createModeController() {
    final Controller controller = Controller.getCurrentController();
    modeController = new BModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MapController(modeController);
    new IconController(modeController).install(modeController);
    UrlManager.install(new UrlManager());
    MapIO.install(modeController);
    AttributeController.install(new AttributeController(modeController));
    NodeStyleController.install(new NodeStyleController(modeController));
    EdgeController.install(new EdgeController(modeController));
    CloudController.install(new CloudController(modeController));
    NoteController.install(new NoteController());
    new TextController(modeController).install(modeController);
    LinkController.install(new LinkController(modeController));
    LogicalStyleController.install(new LogicalStyleController(modeController));
    try {
        ClipboardController.install(new ClipboardController());
    } catch (final AccessControlException e) {
        LogUtils.warn("can not access system clipboard, clipboard controller disabled");
    }
    LocationController.install(new LocationController());
    SummaryNode.install();
    FreeNode.install();
    MapStyle.install(true);
    final BToolbarContributor toolbarContributor = new BToolbarContributor();
    modeController.addUiBuilder(Phase.ACTIONS, "main_toolbar_url", toolbarContributor);
    controller.getMapViewManager().addMapViewChangeListener(toolbarContributor);
    userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
    final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
    userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
    userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getController(controller).getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
    FoldingController.install(new FoldingController());
    new ViewerController();
    EncryptionController.install(new EncryptionController(modeController));
    new AutomaticLayoutController();
    return modeController;
}
Also used : UrlManager(org.freeplane.features.url.UrlManager) ClipboardController(org.freeplane.features.clipboard.ClipboardController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) LinkController(org.freeplane.features.link.LinkController) LocationController(org.freeplane.features.nodelocation.LocationController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) IconController(org.freeplane.features.icon.IconController) FoldingController(org.freeplane.features.map.FoldingController) FrameController(org.freeplane.features.ui.FrameController) NoteController(org.freeplane.features.note.NoteController) EdgeController(org.freeplane.features.edge.EdgeController) AttributeController(org.freeplane.features.attribute.AttributeController) TextController(org.freeplane.features.text.TextController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) AccessControlException(java.security.AccessControlException) AttributeController(org.freeplane.features.attribute.AttributeController) EncryptionController(org.freeplane.features.encrypt.EncryptionController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) NoteController(org.freeplane.features.note.NoteController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) FilterController(org.freeplane.features.filter.FilterController) MapController(org.freeplane.features.map.MapController) LocationController(org.freeplane.features.nodelocation.LocationController) FoldingController(org.freeplane.features.map.FoldingController) FrameController(org.freeplane.features.ui.FrameController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) JPopupMenu(javax.swing.JPopupMenu) MapController(org.freeplane.features.map.MapController) EncryptionController(org.freeplane.features.encrypt.EncryptionController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) CloudController(org.freeplane.features.cloud.CloudController) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar)

Aggregations

ClipboardController (org.freeplane.features.clipboard.ClipboardController)5 NodeModel (org.freeplane.features.map.NodeModel)4 Controller (org.freeplane.features.mode.Controller)3 JPopupMenu (javax.swing.JPopupMenu)2 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)2 CloudController (org.freeplane.features.cloud.CloudController)2 EdgeController (org.freeplane.features.edge.EdgeController)2 FilterController (org.freeplane.features.filter.FilterController)2 IconController (org.freeplane.features.icon.IconController)2 LinkController (org.freeplane.features.link.LinkController)2 ModeController (org.freeplane.features.mode.ModeController)2 LocationController (org.freeplane.features.nodelocation.LocationController)2 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)2 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)2 TextController (org.freeplane.features.text.TextController)2 FrameController (org.freeplane.features.ui.FrameController)2 ViewController (org.freeplane.features.ui.ViewController)2 UrlManager (org.freeplane.features.url.UrlManager)2 UserInputListenerFactory (org.freeplane.view.swing.ui.UserInputListenerFactory)2 Transferable (java.awt.datatransfer.Transferable)1