Search in sources :

Example 6 with MLinkController

use of org.freeplane.features.link.mindmapmode.MLinkController in project freeplane by freeplane.

the class NodeProxy method addConnectorTo.

// Node: R/W
public Proxy.Connector addConnectorTo(final String targetNodeID) {
    final MLinkController linkController = (MLinkController) LinkController.getController();
    final ConnectorModel connectorModel = linkController.addConnector(getDelegate(), targetNodeID);
    return new ConnectorProxy(connectorModel, getScriptContext());
}
Also used : MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) ConnectorModel(org.freeplane.features.link.ConnectorModel)

Example 7 with MLinkController

use of org.freeplane.features.link.mindmapmode.MLinkController in project freeplane by freeplane.

the class NodeProxy method removeConnector.

// Node: R/W
public void removeConnector(final Proxy.Connector connectorToBeRemoved) {
    final ConnectorProxy connectorProxy = (ConnectorProxy) connectorToBeRemoved;
    final ConnectorModel link = connectorProxy.getConnector();
    final MLinkController linkController = (MLinkController) LinkController.getController();
    linkController.removeArrowLink(link);
}
Also used : MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) ConnectorModel(org.freeplane.features.link.ConnectorModel)

Example 8 with MLinkController

use of org.freeplane.features.link.mindmapmode.MLinkController in project freeplane by freeplane.

the class AttributePopupMenu method getInsertAnchoredLink.

private JMenuItem getInsertAnchoredLink() {
    if (insertAnchoredLink == null) {
        insertAnchoredLink = new JMenuItem(TextUtils.getText("MakeLinkToAnchorAction.text"));
        insertAnchoredLink.addActionListener(new ActionListener() {

            public void actionPerformed(final ActionEvent e) {
                final AttributeTable table = AttributePopupMenu.this.table;
                final Object oldValue = table.getValueAt(row, col);
                final LinkController linkController = LinkController.getController();
                if (linkController instanceof MLinkController) {
                    final MLinkController mLinkController = (MLinkController) linkController;
                    if (mLinkController.isAnchored()) {
                        try {
                            final String anchorIDforNode = mLinkController.getAnchorIDforNode(((IAttributeTableModel) table.getModel()).getNode());
                            if (anchorIDforNode != null) {
                                URI link = LinkController.createURI(anchorIDforNode);
                                if (!oldValue.equals(link))
                                    table.setValueAt(link, row, col);
                            }
                        } catch (URISyntaxException e1) {
                        }
                    }
                }
            }
        });
    }
    return insertAnchoredLink;
}
Also used : MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) LinkController(org.freeplane.features.link.LinkController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) IAttributeTableModel(org.freeplane.features.attribute.IAttributeTableModel) URISyntaxException(java.net.URISyntaxException) JMenuItem(javax.swing.JMenuItem) URI(java.net.URI)

Example 9 with MLinkController

use of org.freeplane.features.link.mindmapmode.MLinkController in project freeplane by freeplane.

the class ImportExplorerFavoritesAction method importExplorerFavorites.

public boolean importExplorerFavorites(final File folder, final NodeModel target, final boolean redisplay) {
    boolean favoritesFound = false;
    final File[] list = folder.listFiles();
    if (list != null) {
        for (int i = 0; i < list.length; i++) {
            if (list[i].isDirectory()) {
                final String nodeContent = list[i].getName();
                final NodeModel node = addNode(target, nodeContent);
                final boolean favoritesFoundInSubfolder = importExplorerFavorites(list[i], node, false);
                if (favoritesFoundInSubfolder) {
                    favoritesFound = true;
                } else {
                    ((MMapController) Controller.getCurrentModeController().getMapController()).deleteNode(node);
                }
            }
        }
        for (int i = 0; i < list.length; i++) {
            if (!list[i].isDirectory() && FileUtils.getExtension(list[i]).equals("url")) {
                favoritesFound = true;
                BufferedReader in = null;
                try {
                    final NodeModel node = addNode(target, FileUtils.removeExtension(list[i].getName()));
                    in = new BufferedReader(new FileReader(list[i]));
                    String line = null;
                    while ((line = in.readLine()) != null) {
                        if (line.startsWith("URL=")) {
                            final String link = line.substring(4);
                            ((MLinkController) LinkController.getController()).setLink(node, LinkController.createURI(link), LinkController.LINK_ABSOLUTE);
                            break;
                        }
                    }
                } catch (final Exception e) {
                    LogUtils.severe(e);
                } finally {
                    try {
                        if (in != null) {
                            in.close();
                        }
                    } catch (final IOException e) {
                        LogUtils.warn(e);
                    }
                }
            }
        }
    }
    if (redisplay) {
        Controller.getCurrentModeController().getMapController().nodeChanged(target);
    }
    return favoritesFound;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) IOException(java.io.IOException) File(java.io.File) IOException(java.io.IOException)

Example 10 with MLinkController

use of org.freeplane.features.link.mindmapmode.MLinkController in project freeplane by freeplane.

the class ImportFolderStructureAction method addNode.

/**
 */
private NodeModel addNode(final NodeModel target, final String nodeContent, final String link) {
    final NodeModel node = ((MMapController) Controller.getCurrentModeController().getMapController()).addNewNode(target, target.getChildCount(), target.isNewChildLeft());
    ((MTextController) TextController.getController()).setNodeText(node, nodeContent);
    ((MLinkController) LinkController.getController()).setLink(node, link, LinkController.LINK_ABSOLUTE);
    return node;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MTextController(org.freeplane.features.text.mindmapmode.MTextController)

Aggregations

MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)16 MMapController (org.freeplane.features.map.mindmapmode.MMapController)10 LinkController (org.freeplane.features.link.LinkController)8 NodeModel (org.freeplane.features.map.NodeModel)7 Controller (org.freeplane.features.mode.Controller)6 File (java.io.File)5 URI (java.net.URI)5 ModeController (org.freeplane.features.mode.ModeController)5 MTextController (org.freeplane.features.text.mindmapmode.MTextController)5 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)4 MapModel (org.freeplane.features.map.MapModel)4 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)4 ResourceController (org.freeplane.core.resources.ResourceController)3 AttributeController (org.freeplane.features.attribute.AttributeController)3 MAttributeController (org.freeplane.features.attribute.mindmapmode.MAttributeController)3 ClipboardController (org.freeplane.features.clipboard.ClipboardController)3 MClipboardController (org.freeplane.features.clipboard.mindmapmode.MClipboardController)3 CloudController (org.freeplane.features.cloud.CloudController)3 MCloudController (org.freeplane.features.cloud.mindmapmode.MCloudController)3 EdgeController (org.freeplane.features.edge.EdgeController)3