use of org.freeplane.features.link.LinkController 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.LinkController in project freeplane by freeplane.
the class FreeplaneGUIStarter method loadMaps.
private void loadMaps(final Controller controller, final String[] args) {
controller.selectMode(MModeController.MODENAME);
for (int i = 0; i < args.length; i++) {
String fileArgument = args[i];
try {
final LinkController linkController = LinkController.getController();
linkController.loadMap(fileArgument);
} catch (final Exception ex) {
System.err.println("File " + fileArgument + " not loaded");
}
}
}
use of org.freeplane.features.link.LinkController 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;
}
Aggregations