Search in sources :

Example 6 with MapStyle

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

the class MapProxy method getBackgroundColor.

// MapRO: R
public Color getBackgroundColor() {
    // see MapBackgroundColorAction
    final MapStyle mapStyle = (MapStyle) Controller.getCurrentModeController().getExtension(MapStyle.class);
    final MapStyleModel model = (MapStyleModel) mapStyle.getMapHook();
    if (model != null) {
        return model.getBackgroundColor();
    } else {
        final String colorPropertyString = ResourceController.getResourceController().getProperty(MapStyle.RESOURCES_BACKGROUND_COLOR);
        final Color defaultBgColor = ColorUtils.stringToColor(colorPropertyString);
        return defaultBgColor;
    }
}
Also used : MapStyleModel(org.freeplane.features.styles.MapStyleModel) Color(java.awt.Color) MapStyle(org.freeplane.features.styles.MapStyle)

Example 7 with MapStyle

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

the class SetBooleanMapPropertyAction method actionPerformed.

public void actionPerformed(ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final NodeModel node = controller.getSelection().getSelected();
    final ModeController modeController = controller.getModeController();
    final MapStyle mapStyleController = MapStyle.getController(modeController);
    final MapModel map = node.getMap();
    final String value = mapStyleController.getPropertySetDefault(map, propertyName);
    boolean set = !Boolean.parseBoolean(value);
    mapStyleController.setProperty(map, propertyName, Boolean.toString(set));
    setSelected(set);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) MapStyle(org.freeplane.features.styles.MapStyle) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 8 with MapStyle

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

the class MapBackgroundColorAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    MapStyle mapStyle = (MapStyle) controller.getModeController().getExtension(MapStyle.class);
    final MapStyleModel model = (MapStyleModel) mapStyle.getMapHook();
    final Color oldBackgroundColor;
    final String colorPropertyString = ResourceController.getResourceController().getProperty(MapStyle.RESOURCES_BACKGROUND_COLOR);
    final Color defaultBgColor = ColorUtils.stringToColor(colorPropertyString);
    if (model != null) {
        oldBackgroundColor = model.getBackgroundColor();
    } else {
        oldBackgroundColor = defaultBgColor;
    }
    final Color actionColor = ColorTracker.showCommonJColorChooserDialog(controller.getSelection().getSelected(), TextUtils.getText("choose_map_background_color"), oldBackgroundColor, defaultBgColor);
    mapStyle.setBackgroundColor(model, actionColor);
}
Also used : MapStyleModel(org.freeplane.features.styles.MapStyleModel) Color(java.awt.Color) MapStyle(org.freeplane.features.styles.MapStyle) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller)

Example 9 with MapStyle

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

the class MapBackgroundClearAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class);
    final MapModel model = controller.getMap();
    mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, null);
}
Also used : MapStyle(org.freeplane.features.styles.MapStyle) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller)

Example 10 with MapStyle

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

the class CopyMapStylesAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    final MFileManager fileManager = MFileManager.getController(modeController);
    final JFileChooser fileChooser = fileManager.getFileChooser(true);
    fileChooser.setMultiSelectionEnabled(false);
    final int returnVal = fileChooser.showOpenDialog(controller.getMapViewManager().getMapViewComponent());
    if (returnVal != JFileChooser.APPROVE_OPTION) {
        return;
    }
    File file = fileChooser.getSelectedFile();
    if (!file.exists()) {
        return;
    }
    try {
        final URL url = Compat.fileToUrl(file);
        final MapModel map = controller.getMap();
        MapStyle mapStyleController = MapStyle.getController(modeController);
        mapStyleController.copyStyle(url, map, true);
    } catch (MalformedURLException e1) {
        e1.printStackTrace();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) JFileChooser(javax.swing.JFileChooser) MapStyle(org.freeplane.features.styles.MapStyle) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) ModeController(org.freeplane.features.mode.ModeController) MapModel(org.freeplane.features.map.MapModel) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) File(java.io.File) URL(java.net.URL)

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