use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class MapBackgroundImageAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final MapController mapController = Controller.getCurrentModeController().getMapController();
final ViewerController vc = controller.getModeController().getExtension(ViewerController.class);
final NodeModel selectedNode = mapController.getSelectedNode();
if (selectedNode == null) {
return;
}
final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class);
final URI uri = vc.createURI(selectedNode);
if (uri == null) {
return;
}
final MapModel model = controller.getMap();
mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, uri.toString());
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class NodeIdHighLighter method handle.
private boolean handle(SyntaxDocument doc, Token token) {
final Matcher matcher = nodeIdPattern.matcher(token.getText(doc));
if (matcher.matches()) {
String id = matcher.group(1);
final NodeModel node = Controller.getCurrentController().getMap().getNodeForID(id);
if (node != null) {
final MapController mapController = Controller.getCurrentModeController().getMapController();
final NodeModel selectedNode = mapController.getSelectedNode();
if (node.equals(selectedNode)) {
return true;
}
NodeModel originallySelectedNode = this.originallySelectedNode;
if (originallySelectedNode == null)
originallySelectedNode = mapController.getSelectedNode();
else {
deHighlight();
}
this.originallySelectedNode = originallySelectedNode;
mapController.displayNode(node, nodesOriginallyFolded);
mapController.select(node);
pane.setToolTipText(node.getText());
return true;
} else {
pane.setToolTipText(//
"<html><body bgcolor='#CC0000'>" + TextUtils.format(getResourceKey("node_is_not_defined"), id) + "</body></html>");
}
} else {
deHighlight();
}
return false;
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class MapIO method install.
public static void install(ModeController modeController) {
UrlManager urlManager = modeController.getExtension(UrlManager.class);
MapController mapController = modeController.getMapController();
final MapIO mapIO = new MapIO(urlManager, mapController);
modeController.addExtension(MapIO.class, mapIO);
}
use of org.freeplane.features.map.MapController 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, false);
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
new MapController(modeController);
IconController.install(new IconController(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());
TextController.install(new TextController(modeController));
LinkController.install(new LinkController());
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.addMenuContributor(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", ViewController.BOTTOM, 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();
new CloneStateIconSupplier().registerStateIconProvider();
return modeController;
}
use of org.freeplane.features.map.MapController in project freeplane by freeplane.
the class ChangeExternalImageAction method actionPerformed.
public void actionPerformed(final ActionEvent arg0) {
final ProgressUtilities progUtil = new ProgressUtilities();
final MapController mapController = Controller.getCurrentModeController().getMapController();
final Collection<NodeModel> nodes = mapController.getSelectedNodes();
final ViewerController vc = (Controller.getCurrentController().getModeController().getExtension(ViewerController.class));
final ExternalResource extRes = (ExternalResource) vc.createExtension(mapController.getSelectedNode());
if (extRes != null) {
URI uri = extRes.getAbsoluteUri(mapController.getSelectedNode().getMap());
for (final NodeModel node : nodes) {
if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
vc.undoableDeactivateHook(node);
vc.paste(uri, node, node.isLeft());
}
}
}
}
Aggregations