Search in sources :

Example 11 with MapStyle

use of org.freeplane.features.styles.MapStyle 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());
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapStyle(org.freeplane.features.styles.MapStyle) MapModel(org.freeplane.features.map.MapModel) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) URI(java.net.URI) MapController(org.freeplane.features.map.MapController)

Example 12 with MapStyle

use of org.freeplane.features.styles.MapStyle in project freeplane by freeplane.

the class ViewLayoutTypeAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final MapView map = (MapView) Controller.getCurrentController().getMapViewManager().getMapViewComponent();
    if (isSelected()) {
        map.setLayoutType(MapViewLayout.MAP);
        setSelected(false);
    } else {
        map.setLayoutType(layoutType);
        setSelected(true);
    }
    final MapStyle mapStyle = (MapStyle) map.getModeController().getExtension(MapStyle.class);
    mapStyle.setMapViewLayout(map.getModel(), map.getLayoutType());
    map.anchorToSelected(map.getSelected(), 0.5f, 0.5f);
    final NodeView root = map.getRoot();
    invalidate(root);
    root.revalidate();
}
Also used : MapStyle(org.freeplane.features.styles.MapStyle)

Aggregations

MapStyle (org.freeplane.features.styles.MapStyle)12 Controller (org.freeplane.features.mode.Controller)6 MapModel (org.freeplane.features.map.MapModel)5 Color (java.awt.Color)3 NodeModel (org.freeplane.features.map.NodeModel)3 ModeController (org.freeplane.features.mode.ModeController)3 MapStyleModel (org.freeplane.features.styles.MapStyleModel)3 URI (java.net.URI)2 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 JFileChooser (javax.swing.JFileChooser)1 ResourceController (org.freeplane.core.resources.ResourceController)1 MapController (org.freeplane.features.map.MapController)1 MFileManager (org.freeplane.features.url.mindmapmode.MFileManager)1 IViewerFactory (org.freeplane.view.swing.features.filepreview.IViewerFactory)1 ViewerController (org.freeplane.view.swing.features.filepreview.ViewerController)1