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());
}
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);
}
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;
}
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;
}
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;
}
Aggregations